Skip to content

Commit

Permalink
Fix mismatched output in web server (lm-sys#3097)
Browse files Browse the repository at this point in the history
  • Loading branch information
sthemeow authored Feb 27, 2024
1 parent 4edbd9d commit d04ce64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fastchat/serve/gradio_web_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def add_text(state, model_selector, text, image, request: gr.Request):

if len(text) <= 0:
state.skip_next = True
return (state, state.to_gradio_chatbot(), "") + (no_change_btn,) * 5
return (state, state.to_gradio_chatbot(), "", None) + (no_change_btn,) * 5

flagged = moderation_filter(text, [state.model_name])
if flagged:
Expand All @@ -290,7 +290,7 @@ def add_text(state, model_selector, text, image, request: gr.Request):
if (len(state.conv.messages) - state.conv.offset) // 2 >= CONVERSATION_TURN_LIMIT:
logger.info(f"conversation turn limit. ip: {ip}. text: {text}")
state.skip_next = True
return (state, state.to_gradio_chatbot(), CONVERSATION_LIMIT_MSG) + (
return (state, state.to_gradio_chatbot(), CONVERSATION_LIMIT_MSG, None) + (
no_change_btn,
) * 5

Expand Down

0 comments on commit d04ce64

Please sign in to comment.