Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -101,7 +101,8 @@ class PromptRefiner:
|
|
| 101 |
# Clean up JSON values
|
| 102 |
return {
|
| 103 |
key: value.replace('\\"', '"') if isinstance(value, str) else value
|
| 104 |
-
for key, value in json_output.items()
|
|
|
|
| 105 |
}
|
| 106 |
|
| 107 |
# Fallback to regex parsing if no JSON found
|
|
@@ -110,7 +111,7 @@ class PromptRefiner:
|
|
| 110 |
pattern = rf'"{key}":\s*"(.*?)"(?:,|\}})'
|
| 111 |
match = re.search(pattern, response_content, re.DOTALL)
|
| 112 |
output[key] = match.group(1).replace('\\n', '\n').replace('\\"', '"') if match else ""
|
| 113 |
-
|
| 114 |
return output
|
| 115 |
|
| 116 |
except (json.JSONDecodeError, ValueError) as e:
|
|
|
|
| 101 |
# Clean up JSON values
|
| 102 |
return {
|
| 103 |
key: value.replace('\\"', '"') if isinstance(value, str) else value
|
| 104 |
+
for key, value in json_output.items(),
|
| 105 |
+
'response_content':json_output
|
| 106 |
}
|
| 107 |
|
| 108 |
# Fallback to regex parsing if no JSON found
|
|
|
|
| 111 |
pattern = rf'"{key}":\s*"(.*?)"(?:,|\}})'
|
| 112 |
match = re.search(pattern, response_content, re.DOTALL)
|
| 113 |
output[key] = match.group(1).replace('\\n', '\n').replace('\\"', '"') if match else ""
|
| 114 |
+
output['response_content']=response_content
|
| 115 |
return output
|
| 116 |
|
| 117 |
except (json.JSONDecodeError, ValueError) as e:
|