Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -44,8 +44,6 @@ def respond(message, history):
|
|
| 44 |
else:
|
| 45 |
# Process the query through the model
|
| 46 |
messages = [{"role": "user", "content": message}]
|
| 47 |
-
for h in history:
|
| 48 |
-
messages.append(h)
|
| 49 |
generated_response = client.chat_completion(
|
| 50 |
messages=messages,
|
| 51 |
max_tokens=512,
|
|
@@ -54,7 +52,7 @@ def respond(message, history):
|
|
| 54 |
)
|
| 55 |
response = generated_response["choices"][0]["message"]["content"]
|
| 56 |
|
| 57 |
-
#
|
| 58 |
history.append({"role": "user", "content": message})
|
| 59 |
history.append({"role": "assistant", "content": response})
|
| 60 |
return response, history
|
|
|
|
| 44 |
else:
|
| 45 |
# Process the query through the model
|
| 46 |
messages = [{"role": "user", "content": message}]
|
|
|
|
|
|
|
| 47 |
generated_response = client.chat_completion(
|
| 48 |
messages=messages,
|
| 49 |
max_tokens=512,
|
|
|
|
| 52 |
)
|
| 53 |
response = generated_response["choices"][0]["message"]["content"]
|
| 54 |
|
| 55 |
+
# Append to history in the required format
|
| 56 |
history.append({"role": "user", "content": message})
|
| 57 |
history.append({"role": "assistant", "content": response})
|
| 58 |
return response, history
|