yuxwu commited on
Commit
19091fb
·
1 Parent(s): e8c529b
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -8,7 +8,7 @@ from chatarena.arena import Arena, TooManyInvalidActions
8
  from chatarena.backends import BACKEND_REGISTRY
9
  from chatarena.backends.human import HumanBackendError
10
  from chatarena.config import ArenaConfig
11
- from chatarena.environments import ENV_REGISTRY, TimeStep
12
  from chatarena.database import log_arena, log_messages, SupabaseDB, supabase_available
13
  from chatarena.message import Message
14
 
@@ -24,9 +24,10 @@ css = """#col-container {max-width: 90%; margin-left: auto; margin-right: auto;
24
  # .wrap {min-width: min(640px, 100vh)}
25
  # #env-desc {max-height: 100px; overflow-y: auto;}
26
  # .textarea {height: 100px; max-height: 100px;}
27
- #chatbot-tab-all {height: 750px; max-height: min(750px, 100%);}
28
- #chatbox {height: min(750px, 100%); max-height: min(750px, 100%);}
29
- #chatbox.block {height: 730px}
 
30
 
31
  DEBUG = False
32
 
@@ -57,7 +58,7 @@ def get_moderator_components(visible=True):
57
  with gr.Row():
58
  with gr.Column():
59
  role_desc = gr.Textbox(label="Moderator role", lines=1, visible=visible, interactive=True,
60
- placeholder=f"Enter the role description for {name}").style(resize="both", max_height="85px")
61
  terminal_condition = gr.Textbox(show_label=False, lines=1, visible=visible, interactive=True,
62
  placeholder="Enter the end criteria for the conversation")
63
  with gr.Column():
@@ -105,7 +106,7 @@ Prompting multiple AI agents to play games in a language-driven environment.
105
 
106
  with gr.Row():
107
  env_selector = gr.Dropdown(choices=list(ENV_REGISTRY.keys()), value=DEFAULT_ENV, interactive=True,
108
- label="Environment Type", show_label=True, elem_id="env-desc")
109
  example_selector = gr.Dropdown(choices=list(EXAMPLE_REGISTRY.keys()), interactive=True,
110
  label="Select Example", show_label=True)
111
 
@@ -117,13 +118,13 @@ Prompting multiple AI agents to play games in a language-driven environment.
117
 
118
  with gr.Row():
119
  with gr.Column(elem_id="col-chatbox"):
120
- with gr.Tab("All", elem_id='chatbot-tab-all', visible=True):
121
  chatbot = gr.Chatbot(elem_id="chatbox", visible=True, show_label=False)
122
 
123
  player_chatbots = []
124
  for i in range(MAX_NUM_PLAYERS):
125
  player_name = f"Player {i + 1}"
126
- with gr.Tab(player_name, elem_id=f'chatbot-tab-{i}', visible=(i < DEFAULT_NUM_PLAYERS)):
127
  player_chatbot = gr.Chatbot(elem_id=f"chatbox-{i}", visible=i < DEFAULT_NUM_PLAYERS,
128
  label=player_name, show_label=False)
129
  player_chatbots.append(player_chatbot)
 
8
  from chatarena.backends import BACKEND_REGISTRY
9
  from chatarena.backends.human import HumanBackendError
10
  from chatarena.config import ArenaConfig
11
+ from chatarena.environments import ENV_REGISTRY
12
  from chatarena.database import log_arena, log_messages, SupabaseDB, supabase_available
13
  from chatarena.message import Message
14
 
 
24
  # .wrap {min-width: min(640px, 100vh)}
25
  # #env-desc {max-height: 100px; overflow-y: auto;}
26
  # .textarea {height: 100px; max-height: 100px;}
27
+ # #chatbot-tab-all {height: 750px; max-height: min(750px, 100%);}
28
+ # #chatbox {height: min(750px, 100%); max-height: min(750px, 100%);}
29
+ # #chatbox.block {height: 730px}
30
+
31
 
32
  DEBUG = False
33
 
 
58
  with gr.Row():
59
  with gr.Column():
60
  role_desc = gr.Textbox(label="Moderator role", lines=1, visible=visible, interactive=True,
61
+ placeholder=f"Enter the role description for {name}")
62
  terminal_condition = gr.Textbox(show_label=False, lines=1, visible=visible, interactive=True,
63
  placeholder="Enter the end criteria for the conversation")
64
  with gr.Column():
 
106
 
107
  with gr.Row():
108
  env_selector = gr.Dropdown(choices=list(ENV_REGISTRY.keys()), value=DEFAULT_ENV, interactive=True,
109
+ label="Environment Type", show_label=True)
110
  example_selector = gr.Dropdown(choices=list(EXAMPLE_REGISTRY.keys()), interactive=True,
111
  label="Select Example", show_label=True)
112
 
 
118
 
119
  with gr.Row():
120
  with gr.Column(elem_id="col-chatbox"):
121
+ with gr.Tab("All", visible=True):
122
  chatbot = gr.Chatbot(elem_id="chatbox", visible=True, show_label=False)
123
 
124
  player_chatbots = []
125
  for i in range(MAX_NUM_PLAYERS):
126
  player_name = f"Player {i + 1}"
127
+ with gr.Tab(player_name, visible=(i < DEFAULT_NUM_PLAYERS)):
128
  player_chatbot = gr.Chatbot(elem_id=f"chatbox-{i}", visible=i < DEFAULT_NUM_PLAYERS,
129
  label=player_name, show_label=False)
130
  player_chatbots.append(player_chatbot)