rwayz commited on
Commit
555da97
·
verified ·
1 Parent(s): 6741f25

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -38,7 +38,7 @@ def chatbot_response(user_input, model_name):
38
  completion = client.chat.completions.create(
39
  model=model_id,
40
  messages=messages,
41
- max_tokens=8192 if "Qwen" in model_id else 900,
42
  )
43
  response = completion.choices[0].message['content']
44
  except Exception as e:
@@ -80,8 +80,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
80
  def respond(message, chat_history, model_name):
81
  response = chatbot_response(message, model_name)
82
  response = clean_response(response)
83
- chat_history.append({"role": "user", "content": message})
84
- chat_history.append({"role": "assistant", "content": response})
85
  return "", chat_history
86
 
87
  btn.click(respond, [msg, chatbot, model_selector], [msg, chatbot])
 
38
  completion = client.chat.completions.create(
39
  model=model_id,
40
  messages=messages,
41
+ max_tokens=8192 if "Qwen" in model_id else 900
42
  )
43
  response = completion.choices[0].message['content']
44
  except Exception as e:
 
80
  def respond(message, chat_history, model_name):
81
  response = chatbot_response(message, model_name)
82
  response = clean_response(response)
83
+ chat_history.append((message, response))
 
84
  return "", chat_history
85
 
86
  btn.click(respond, [msg, chatbot, model_selector], [msg, chatbot])