Spaces:
Sleeping
Sleeping
BolyosCsaba commited on
Commit 路
4c98975
1
Parent(s): e7d1cc3
used newer gradio syntax
Browse files- test_app.py +8 -15
test_app.py
CHANGED
|
@@ -93,21 +93,15 @@ class MockFloorSession:
|
|
| 93 |
return "鈴革笍 No active speaker"
|
| 94 |
|
| 95 |
def format_chat_history(self):
|
| 96 |
-
"""Format messages for Gradio Chatbot
|
| 97 |
formatted = []
|
| 98 |
for msg in self.messages:
|
| 99 |
if msg["role"] == "system":
|
| 100 |
-
# System messages as
|
| 101 |
-
formatted.append({
|
| 102 |
-
"role": "assistant",
|
| 103 |
-
"content": f"_{msg['content']}_"
|
| 104 |
-
})
|
| 105 |
else:
|
| 106 |
-
# Agent messages as
|
| 107 |
-
formatted.append({
|
| 108 |
-
"role": "user",
|
| 109 |
-
"content": f"**{msg['role']}** [{msg['timestamp']}]: {msg['content']}"
|
| 110 |
-
})
|
| 111 |
return formatted
|
| 112 |
|
| 113 |
|
|
@@ -218,7 +212,7 @@ def get_agent_dropdown_choices():
|
|
| 218 |
|
| 219 |
|
| 220 |
# Create Gradio interface
|
| 221 |
-
with gr.Blocks(title="OFP Floor Manager Test"
|
| 222 |
gr.Markdown("# 馃帳 OpenFloor Protocol - Floor Manager Test")
|
| 223 |
gr.Markdown("Test interface for managing multi-agent floor conversations")
|
| 224 |
|
|
@@ -285,8 +279,7 @@ with gr.Blocks(title="OFP Floor Manager Test", theme=gr.themes.Soft()) as demo:
|
|
| 285 |
|
| 286 |
chatbot = gr.Chatbot(
|
| 287 |
label="Conversation",
|
| 288 |
-
height=400
|
| 289 |
-
type="messages"
|
| 290 |
)
|
| 291 |
|
| 292 |
gr.Markdown("### Send Message")
|
|
@@ -343,4 +336,4 @@ if __name__ == "__main__":
|
|
| 343 |
print("馃殌 Starting OFP Floor Manager Test Interface...")
|
| 344 |
print("馃摫 Open your browser to test the interface")
|
| 345 |
print("=" * 50)
|
| 346 |
-
demo.launch(server_name="0.0.0.0", server_port=7860, share=False)
|
|
|
|
| 93 |
return "鈴革笍 No active speaker"
|
| 94 |
|
| 95 |
def format_chat_history(self):
|
| 96 |
+
"""Format messages for Gradio Chatbot as tuples (user, assistant)"""
|
| 97 |
formatted = []
|
| 98 |
for msg in self.messages:
|
| 99 |
if msg["role"] == "system":
|
| 100 |
+
# System messages as (None, message)
|
| 101 |
+
formatted.append((None, f"_{msg['content']}_"))
|
|
|
|
|
|
|
|
|
|
| 102 |
else:
|
| 103 |
+
# Agent messages as (message, None)
|
| 104 |
+
formatted.append((f"**{msg['role']}** [{msg['timestamp']}]: {msg['content']}", None))
|
|
|
|
|
|
|
|
|
|
| 105 |
return formatted
|
| 106 |
|
| 107 |
|
|
|
|
| 212 |
|
| 213 |
|
| 214 |
# Create Gradio interface
|
| 215 |
+
with gr.Blocks(title="OFP Floor Manager Test") as demo:
|
| 216 |
gr.Markdown("# 馃帳 OpenFloor Protocol - Floor Manager Test")
|
| 217 |
gr.Markdown("Test interface for managing multi-agent floor conversations")
|
| 218 |
|
|
|
|
| 279 |
|
| 280 |
chatbot = gr.Chatbot(
|
| 281 |
label="Conversation",
|
| 282 |
+
height=400
|
|
|
|
| 283 |
)
|
| 284 |
|
| 285 |
gr.Markdown("### Send Message")
|
|
|
|
| 336 |
print("馃殌 Starting OFP Floor Manager Test Interface...")
|
| 337 |
print("馃摫 Open your browser to test the interface")
|
| 338 |
print("=" * 50)
|
| 339 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, share=False, theme=gr.themes.Soft())
|