gpaasch commited on
Commit
448a2cd
·
1 Parent(s): 28aec0b

needs dict, not string

Browse files
Files changed (1) hide show
  1. app.py +6 -0
app.py CHANGED
@@ -7,6 +7,7 @@ from services.indexing import create_symptom_index
7
  import torchaudio.transforms as T
8
  import re
9
  import logging, sys
 
10
 
11
 
12
  logging.basicConfig(stream=sys.stdout, level=logging.INFO, force=True)
@@ -116,6 +117,11 @@ def on_submit(symptoms_text, history):
116
  yield history, None, "\n".join(log)
117
 
118
  # Final assistant message
 
 
 
 
 
119
  assistant_msg = format_response_for_user(raw)
120
  history = history + [{"role": "assistant", "content": assistant_msg}]
121
  msg = "✅ Final response appended"
 
7
  import torchaudio.transforms as T
8
  import re
9
  import logging, sys
10
+ import json
11
 
12
 
13
  logging.basicConfig(stream=sys.stdout, level=logging.INFO, force=True)
 
117
  yield history, None, "\n".join(log)
118
 
119
  # Final assistant message
120
+ if isinstance(raw, str):
121
+ try:
122
+ raw = json.loads(raw)
123
+ except Exception:
124
+ pass # Optionally handle or log the error
125
  assistant_msg = format_response_for_user(raw)
126
  history = history + [{"role": "assistant", "content": assistant_msg}]
127
  msg = "✅ Final response appended"