G-T commited on
Commit
21d991f
1 Parent(s): c9fb5b3

Update app.py

Browse files

Rework Chatbot

Files changed (1) hide show
  1. app.py +10 -14
app.py CHANGED
@@ -72,22 +72,18 @@ with gr.Blocks() as demo:
72
 
73
  def respond(message, chat_history):
74
  messages = [ChatMessage(role="user", content=message)]
75
- # response = client.chat(
76
- # model=MODEL,
77
- # messages=messages)
78
-
79
  response = forecast(messages)
80
 
81
- # prompt = f"Reformule le résultat suivant {response}"
82
- # prompt = [ChatMessage(role="user", content=prompt)]
83
- # chat_history.append((message, str(response)))
84
- final_response = CLIENT.chat(
85
- model=MODEL,
86
- messages=response
87
- ).choices[0].message.content
88
- return "", [[None, None],
89
- [None, str(final_response)]
90
- ]
91
 
92
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
93
 
 
72
 
73
  def respond(message, chat_history):
74
  messages = [ChatMessage(role="user", content=message)]
75
+
 
 
 
76
  response = forecast(messages)
77
 
78
+ chat_history.append((message, str(response)))
79
+ # final_response = CLIENT.chat(
80
+ # model=MODEL,
81
+ # messages=prompt
82
+ # ).choices[0].message.content
83
+ # return [[message, None],
84
+ # [None, str(response)]
85
+ # ]
86
+ return "", chat_history
 
87
 
88
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
89