Skip to content

Commit

Permalink
fix color list overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
binary-husky committed Mar 31, 2024
1 parent 8af6c0c commit 216d437
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions request_llms/bridge_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,8 @@ def mutex_manager(window_mutex, observe_window):
# 观察窗(window)
chat_string = []
for i in range(n_model):
chat_string.append( f"【{str(models[i])} 说】: <font color=\"{colors[i]}\"> {window_mutex[i][0]} </font>" )
color = colors[i%len(colors)]
chat_string.append( f"【{str(models[i])} 说】: <font color=\"{color}\"> {window_mutex[i][0]} </font>" )
res = '<br/><br/>\n\n---\n\n'.join(chat_string)
# # # # # # # # # # #
observe_window[0] = res
Expand All @@ -871,7 +872,8 @@ def mutex_manager(window_mutex, observe_window):
time.sleep(1)

for i, future in enumerate(futures): # wait and get
return_string_collect.append( f"【{str(models[i])} 说】: <font color=\"{colors[i]}\"> {future.result()} </font>" )
color = colors[i%len(colors)]
return_string_collect.append( f"【{str(models[i])} 说】: <font color=\"{color}\"> {future.result()} </font>" )

window_mutex[-1] = False # stop mutex thread
res = '<br/><br/>\n\n---\n\n'.join(return_string_collect)
Expand Down

0 comments on commit 216d437

Please sign in to comment.