Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,6 @@ def respond(
|
|
26 |
if val[1]:
|
27 |
messages.append({"role": "assistant", "content": val[1]})
|
28 |
|
29 |
-
messages.append({"role": "user", "content": message})
|
30 |
|
31 |
data = {
|
32 |
"preferences": {
|
@@ -37,13 +36,14 @@ def respond(
|
|
37 |
"conversation_history": messages,
|
38 |
"input": message
|
39 |
}
|
|
|
40 |
|
41 |
response = requests.post(API_URL, headers=headers, data=json.dumps(data))
|
42 |
response_json = response.json()
|
43 |
|
44 |
if response.status_code == 200:
|
45 |
-
|
46 |
-
yield
|
47 |
else:
|
48 |
yield "Error: " + response_json.get("error", "Unknown error occurred.")
|
49 |
|
|
|
26 |
if val[1]:
|
27 |
messages.append({"role": "assistant", "content": val[1]})
|
28 |
|
|
|
29 |
|
30 |
data = {
|
31 |
"preferences": {
|
|
|
36 |
"conversation_history": messages,
|
37 |
"input": message
|
38 |
}
|
39 |
+
messages.append({"role": "user", "content": message})
|
40 |
|
41 |
response = requests.post(API_URL, headers=headers, data=json.dumps(data))
|
42 |
response_json = response.json()
|
43 |
|
44 |
if response.status_code == 200:
|
45 |
+
respond = response_json.msq.message[0]
|
46 |
+
yield respond
|
47 |
else:
|
48 |
yield "Error: " + response_json.get("error", "Unknown error occurred.")
|
49 |
|