thinkall commited on
Commit
d29d4dc
1 Parent(s): ccbd989

Fix error message when click - after no agent left; Update code when run code value changes

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -171,7 +171,8 @@ def add_agent(event):
171
 
172
 
173
  def remove_agent(event):
174
- column_agents.pop(-1)
 
175
 
176
 
177
  btn_add.on_click(add_agent)
@@ -292,7 +293,7 @@ async def reply_chat(contents, user, instance):
292
  collection_name = f"{int(time.time())}_{random.randint(0, 100000)}"
293
  instance.collection_name = collection_name
294
 
295
- column_agents_list = [[a.value for a in agent[0]] for agent in column_agents]
296
  if (
297
  not hasattr(instance, "agent_list")
298
  or instance.agents_list != column_agents_list
 
171
 
172
 
173
  def remove_agent(event):
174
+ if len(column_agents) > 0:
175
+ column_agents.pop(-1)
176
 
177
 
178
  btn_add.on_click(add_agent)
 
293
  collection_name = f"{int(time.time())}_{random.randint(0, 100000)}"
294
  instance.collection_name = collection_name
295
 
296
+ column_agents_list = [[a.value for a in agent[0]] for agent in column_agents]+[switch_code.value]
297
  if (
298
  not hasattr(instance, "agent_list")
299
  or instance.agents_list != column_agents_list