zenaight commited on
Commit ·
3de6228
1
Parent(s): 45c2c48
debuggig
Browse files- ai_chat.py +6 -0
ai_chat.py
CHANGED
|
@@ -164,17 +164,23 @@ async def extract_and_update_intent(state):
|
|
| 164 |
try:
|
| 165 |
# Clean up the response content (remove markdown formatting if present)
|
| 166 |
content = response.content.strip()
|
|
|
|
|
|
|
| 167 |
if content.startswith('```json'):
|
| 168 |
content = content[7:] # Remove ```json
|
|
|
|
| 169 |
if content.endswith('```'):
|
| 170 |
content = content[:-3] # Remove ```
|
|
|
|
| 171 |
content = content.strip()
|
|
|
|
| 172 |
|
| 173 |
extracted = json.loads(content)
|
| 174 |
print(f"Successfully parsed intent JSON: {extracted}")
|
| 175 |
except Exception as e:
|
| 176 |
print("Failed to parse intent JSON:", response.content)
|
| 177 |
print("Error:", e)
|
|
|
|
| 178 |
extracted = {}
|
| 179 |
|
| 180 |
print(f"Starting field update loop. Extracted: {extracted}")
|
|
|
|
| 164 |
try:
|
| 165 |
# Clean up the response content (remove markdown formatting if present)
|
| 166 |
content = response.content.strip()
|
| 167 |
+
print(f"Original content: {repr(content)}")
|
| 168 |
+
|
| 169 |
if content.startswith('```json'):
|
| 170 |
content = content[7:] # Remove ```json
|
| 171 |
+
print(f"After removing ```json: {repr(content)}")
|
| 172 |
if content.endswith('```'):
|
| 173 |
content = content[:-3] # Remove ```
|
| 174 |
+
print(f"After removing ```: {repr(content)}")
|
| 175 |
content = content.strip()
|
| 176 |
+
print(f"Final cleaned content: {repr(content)}")
|
| 177 |
|
| 178 |
extracted = json.loads(content)
|
| 179 |
print(f"Successfully parsed intent JSON: {extracted}")
|
| 180 |
except Exception as e:
|
| 181 |
print("Failed to parse intent JSON:", response.content)
|
| 182 |
print("Error:", e)
|
| 183 |
+
print(f"Content that failed to parse: {repr(content)}")
|
| 184 |
extracted = {}
|
| 185 |
|
| 186 |
print(f"Starting field update loop. Extracted: {extracted}")
|