Update app.py
Browse files
app.py
CHANGED
|
@@ -27,10 +27,8 @@ class BasicAgent:
|
|
| 27 |
response = state_dict["messages"][-1]
|
| 28 |
try:
|
| 29 |
response = response.content
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
response = response.strip()
|
| 33 |
-
return response
|
| 34 |
except:
|
| 35 |
return "Sorry, I can't answer to this question."
|
| 36 |
|
|
|
|
| 27 |
response = state_dict["messages"][-1]
|
| 28 |
try:
|
| 29 |
response = response.content
|
| 30 |
+
matches = re.findall(r"Final Answer:\s*(.*)", response)
|
| 31 |
+
return matches[-1].strip() if matches else response.strip()
|
|
|
|
|
|
|
| 32 |
except:
|
| 33 |
return "Sorry, I can't answer to this question."
|
| 34 |
|