Spaces:
Sleeping
Sleeping
Update third.py
Browse files
third.py
CHANGED
|
@@ -64,15 +64,25 @@ async def main(editable_output2, keyword_id):
|
|
| 64 |
raw_output = agent.run(instruction)
|
| 65 |
executed_instructions.append(instruction)
|
| 66 |
|
| 67 |
-
#
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
else:
|
| 74 |
response_content = "This instruction has already been executed."
|
| 75 |
-
|
| 76 |
# Prepare the system message
|
| 77 |
system_message = {
|
| 78 |
"role": "system",
|
|
|
|
| 64 |
raw_output = agent.run(instruction)
|
| 65 |
executed_instructions.append(instruction)
|
| 66 |
|
| 67 |
+
# raw_outputの内容を確認
|
| 68 |
+
print(f"Raw Output: {raw_output}")
|
| 69 |
+
|
| 70 |
+
try:
|
| 71 |
+
# エージェントの出力をJSONとして解析
|
| 72 |
+
agent_output = json.loads(raw_output)
|
| 73 |
+
|
| 74 |
+
# 'action_input'を取得
|
| 75 |
+
response_content = agent_output['action']['action_input']
|
| 76 |
+
research_results.append(response_content)
|
| 77 |
+
except json.JSONDecodeError:
|
| 78 |
+
print("Error: Could not decode the agent's output as JSON.")
|
| 79 |
+
return
|
| 80 |
+
except Exception as e:
|
| 81 |
+
print(f"Error: {e}")
|
| 82 |
+
return
|
| 83 |
else:
|
| 84 |
response_content = "This instruction has already been executed."
|
| 85 |
+
|
| 86 |
# Prepare the system message
|
| 87 |
system_message = {
|
| 88 |
"role": "system",
|