Spaces:
Running
Running
Update apps/agents/agents.py
Browse files- apps/agents/agents.py +14 -5
apps/agents/agents.py
CHANGED
@@ -399,14 +399,16 @@ def construct_ui(blocks, api_key: Optional[str] = None) -> None:
|
|
399 |
assistant_dd = gr.Dropdown(default_society['assistant_roles'],
|
400 |
label="Example assistant roles",
|
401 |
value=default_society['assistant_role'],
|
402 |
-
interactive=True
|
|
|
403 |
assistant_ta = gr.TextArea(label="Assistant role (EDIT ME)",
|
404 |
lines=1, interactive=True)
|
405 |
with gr.Column(scale=2):
|
406 |
user_dd = gr.Dropdown(default_society['user_roles'],
|
407 |
label="Example user roles",
|
408 |
value=default_society['user_role'],
|
409 |
-
interactive=True
|
|
|
410 |
user_ta = gr.TextArea(label="User role (EDIT ME)", lines=1,
|
411 |
interactive=True)
|
412 |
with gr.Column(scale=2):
|
@@ -486,9 +488,16 @@ def construct_ui(blocks, api_key: Optional[str] = None) -> None:
|
|
486 |
.then(role_playing_chat_init, session_state,
|
487 |
[session_state, chatbot, progress_sl], queue=False)
|
488 |
|
489 |
-
|
490 |
-
|
491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
492 |
|
493 |
clear_bn.click(stop_session, session_state,
|
494 |
[session_state, progress_sl, start_bn])
|
|
|
399 |
assistant_dd = gr.Dropdown(default_society['assistant_roles'],
|
400 |
label="Example assistant roles",
|
401 |
value=default_society['assistant_role'],
|
402 |
+
interactive=True,
|
403 |
+
allow_custom_value=True)
|
404 |
assistant_ta = gr.TextArea(label="Assistant role (EDIT ME)",
|
405 |
lines=1, interactive=True)
|
406 |
with gr.Column(scale=2):
|
407 |
user_dd = gr.Dropdown(default_society['user_roles'],
|
408 |
label="Example user roles",
|
409 |
value=default_society['user_role'],
|
410 |
+
interactive=True,
|
411 |
+
allow_custom_value=True)
|
412 |
user_ta = gr.TextArea(label="User role (EDIT ME)", lines=1,
|
413 |
interactive=True)
|
414 |
with gr.Column(scale=2):
|
|
|
488 |
.then(role_playing_chat_init, session_state,
|
489 |
[session_state, chatbot, progress_sl], queue=False)
|
490 |
|
491 |
+
chat_bot = gr.Button("Continue Chat", visible=False)
|
492 |
+
chat_bot.click(
|
493 |
+
role_playing_chat_cont,
|
494 |
+
inputs=[session_state],
|
495 |
+
outputs=[session_state, chatbot, progress_sl, start_bn]
|
496 |
+
).then(
|
497 |
+
lambda: gr.update(visible=False, value=None) # Hide the button
|
498 |
+
).then(
|
499 |
+
lambda: gr.update(visible=True) # Show the button again after a delay
|
500 |
+
)
|
501 |
|
502 |
clear_bn.click(stop_session, session_state,
|
503 |
[session_state, progress_sl, start_bn])
|