Tuchuanhuhuhu commited on
Commit
71ef544
·
1 Parent(s): a3c7463

加入川虎助理的错误处理

Browse files
Files changed (1) hide show
  1. modules/models/ChuanhuAgent.py +4 -1
modules/models/ChuanhuAgent.py CHANGED
@@ -171,7 +171,10 @@ class ChuanhuAgent_Client(BaseLLMModel):
171
  )
172
  )
173
  agent = initialize_agent(self.tools, self.llm, agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION, verbose=True, callback_manager=manager)
174
- reply = agent.run(input=f"{question} Reply in 简体中文")
 
 
 
175
  it.callback(reply)
176
  it.finish()
177
  t = Thread(target=thread_func)
 
171
  )
172
  )
173
  agent = initialize_agent(self.tools, self.llm, agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION, verbose=True, callback_manager=manager)
174
+ try:
175
+ reply = agent.run(input=f"{question} Reply in 简体中文")
176
+ except Exception as e:
177
+ reply = str(e)
178
  it.callback(reply)
179
  it.finish()
180
  t = Thread(target=thread_func)