Update app.py
Browse files
app.py
CHANGED
|
@@ -30,7 +30,15 @@ def api_call(prompt, thread_id, model_name, chat_history):
|
|
| 30 |
"chat_history": chat_history # Include chat history
|
| 31 |
}
|
| 32 |
response = requests.post(url, headers=headers, json=data)
|
| 33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
# Gradio interface
|
| 36 |
with gr.Blocks() as demo:
|
|
|
|
| 30 |
"chat_history": chat_history # Include chat history
|
| 31 |
}
|
| 32 |
response = requests.post(url, headers=headers, json=data)
|
| 33 |
+
|
| 34 |
+
# Log the full response for debugging
|
| 35 |
+
print("API Response:", response.json())
|
| 36 |
+
|
| 37 |
+
try:
|
| 38 |
+
return response.json()["message"]
|
| 39 |
+
except KeyError:
|
| 40 |
+
print("Key 'message' not found in the response")
|
| 41 |
+
return "Error: Unable to retrieve the message"
|
| 42 |
|
| 43 |
# Gradio interface
|
| 44 |
with gr.Blocks() as demo:
|