Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,24 +19,20 @@ class BasicAgent:
|
|
| 19 |
self.graph = build_graph()
|
| 20 |
|
| 21 |
def __call__(self, question: str) -> str:
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
answer = answer_full
|
| 37 |
-
print(f"Warning: 'FINAL ANSWER:' prefix not found. Returning full response: {answer_full[:100]}...")
|
| 38 |
-
|
| 39 |
-
return answer
|
| 40 |
|
| 41 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 42 |
"""
|
|
|
|
| 19 |
self.graph = build_graph()
|
| 20 |
|
| 21 |
def __call__(self, question: str) -> str:
|
| 22 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 23 |
+
messages = [HumanMessage(content=question)]
|
| 24 |
+
messages = self.graph.invoke({"messages": messages})
|
| 25 |
+
answer_full = messages['messages'][-1].content
|
| 26 |
+
|
| 27 |
+
# "FINAL ANSWER: " 접두사 제거
|
| 28 |
+
if "FINAL ANSWER: " in answer_full:
|
| 29 |
+
answer = answer_full.split("FINAL ANSWER: ", 1)[1].strip()
|
| 30 |
+
else:
|
| 31 |
+
# 접두사가 없는 경우 전체 응답 반환
|
| 32 |
+
answer = answer_full.strip()
|
| 33 |
+
print(f"Warning: 'FINAL ANSWER:' prefix not found. Returning full response: {answer[:100]}...")
|
| 34 |
+
|
| 35 |
+
return answer
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
| 38 |
"""
|