cstr commited on
Commit
5af2fbd
1 Parent(s): 3a2a0c1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -2
app.py CHANGED
@@ -628,11 +628,20 @@ def send_to_qwq(prompt: str):
628
 
629
  # Call the agent_run endpoint
630
  response = client.predict(
631
- _chatbot=result[1],
632
  api_name="/agent_run"
633
  )
 
 
 
 
 
 
 
 
 
634
 
635
- return response[0].get('text', 'No response from QwQ')
636
 
637
  except Exception as e:
638
  logging.error(f"QwQ API error: {e}")
 
628
 
629
  # Call the agent_run endpoint
630
  response = client.predict(
631
+ _chatbot=result[1], # This is correct
632
  api_name="/agent_run"
633
  )
634
+
635
+ if isinstance(response, list) and len(response) > 0:
636
+ # Extract text from first message in chat history
637
+ if isinstance(response[0], list) and len(response[0]) > 0:
638
+ if isinstance(response[0][1], dict):
639
+ return response[0][1].get('text', 'No response text from QwQ')
640
+ elif isinstance(response[0][1], str):
641
+ return response[0][1]
642
+ return 'No valid response from QwQ'
643
 
644
+ return 'No response from QwQ'
645
 
646
  except Exception as e:
647
  logging.error(f"QwQ API error: {e}")