Spaces:
Sleeping
Sleeping
韩宇
commited on
Commit
·
51e209e
1
Parent(s):
fc670c2
init req
Browse files- webpage.py +15 -15
webpage.py
CHANGED
@@ -185,7 +185,7 @@ class WebpageClient:
|
|
185 |
|
186 |
chat_msg = chat_input.submit(
|
187 |
self.add_message,
|
188 |
-
[chatbot, chat_input, state
|
189 |
[chatbot, chat_input]
|
190 |
)
|
191 |
bot_msg = chat_msg.then(
|
@@ -262,20 +262,20 @@ class WebpageClient:
|
|
262 |
self._task_handler_processor.stop_processes()
|
263 |
|
264 |
def add_message(self, history, message, state):
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
if self._workflow_instance_id is None:
|
280 |
workflow_input = {
|
281 |
'question': message,
|
|
|
185 |
|
186 |
chat_msg = chat_input.submit(
|
187 |
self.add_message,
|
188 |
+
[chatbot, chat_input, state],
|
189 |
[chatbot, chat_input]
|
190 |
)
|
191 |
bot_msg = chat_msg.then(
|
|
|
262 |
self._task_handler_processor.stop_processes()
|
263 |
|
264 |
def add_message(self, history, message, state):
|
265 |
+
if isinstance(state, gr.State):
|
266 |
+
if state.value.get('current_video') is None:
|
267 |
+
history.append({"role": "user", "content": message})
|
268 |
+
history.append({"role": "assistant", "content": 'Please select a video'})
|
269 |
+
return history, gr.Textbox(value=None, interactive=False)
|
270 |
+
else:
|
271 |
+
if not state:
|
272 |
+
history.append({"role": "user", "content": message})
|
273 |
+
history.append({"role": "assistant", "content": 'Please reselect the video'})
|
274 |
+
return history, gr.Textbox(value=None, interactive=False)
|
275 |
+
if state.get('current_video') is None:
|
276 |
+
history.append({"role": "user", "content": message})
|
277 |
+
history.append({"role": "assistant", "content": 'Please select a video'})
|
278 |
+
return history, gr.Textbox(value=None, interactive=False)
|
279 |
if self._workflow_instance_id is None:
|
280 |
workflow_input = {
|
281 |
'question': message,
|