Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -149,7 +149,7 @@ async def chat(input_data: ChatInput):
|
|
| 149 |
|
| 150 |
elif kind == "on_tool_end":
|
| 151 |
tool_output = event['data'].get('output', '').content
|
| 152 |
-
|
| 153 |
#print(dir(tool_output))
|
| 154 |
#print the keys
|
| 155 |
pattern = r'data: (.*?)\ndata:'
|
|
@@ -163,8 +163,8 @@ async def chat(input_data: ChatInput):
|
|
| 163 |
if "artifacts" in tool_output:
|
| 164 |
for artifact in tool_output["artifacts"]:
|
| 165 |
artifact_content = requests.get(f"{API_URL}/artifact/{artifact['artifact_id']}").content
|
| 166 |
-
print(artifact_content)
|
| 167 |
-
tool_output["artifacts"][artifact["artifact_id"]] = artifact_content
|
| 168 |
except Exception as e:
|
| 169 |
print(e)
|
| 170 |
print("Error parsing tool output as json: ", tool_output)
|
|
|
|
| 149 |
|
| 150 |
elif kind == "on_tool_end":
|
| 151 |
tool_output = event['data'].get('output', '').content
|
| 152 |
+
print(type(tool_output))
|
| 153 |
#print(dir(tool_output))
|
| 154 |
#print the keys
|
| 155 |
pattern = r'data: (.*?)\ndata:'
|
|
|
|
| 163 |
if "artifacts" in tool_output:
|
| 164 |
for artifact in tool_output["artifacts"]:
|
| 165 |
artifact_content = requests.get(f"{API_URL}/artifact/{artifact['artifact_id']}").content
|
| 166 |
+
#print(artifact_content)
|
| 167 |
+
#tool_output["artifacts"][artifact["artifact_id"]] = artifact_content
|
| 168 |
except Exception as e:
|
| 169 |
print(e)
|
| 170 |
print("Error parsing tool output as json: ", tool_output)
|