mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 05:36:02 +08:00
fix: dataset query truncated (#1026)
This commit is contained in:
parent
4b168f4838
commit
6c148b223d
@ -60,7 +60,13 @@ class MultiDatasetRouterAgent(OpenAIFunctionsAgent):
|
|||||||
return AgentFinish(return_values={"output": observation}, log=observation)
|
return AgentFinish(return_values={"output": observation}, log=observation)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return super().plan(intermediate_steps, callbacks, **kwargs)
|
agent_decision = super().plan(intermediate_steps, callbacks, **kwargs)
|
||||||
|
if isinstance(agent_decision, AgentAction):
|
||||||
|
tool_inputs = agent_decision.tool_input
|
||||||
|
if isinstance(tool_inputs, dict) and 'query' in tool_inputs:
|
||||||
|
tool_inputs['query'] = kwargs['input']
|
||||||
|
agent_decision.tool_input = tool_inputs
|
||||||
|
return agent_decision
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
new_exception = self.model_instance.handle_exceptions(e)
|
new_exception = self.model_instance.handle_exceptions(e)
|
||||||
raise new_exception
|
raise new_exception
|
||||||
|
@ -97,6 +97,13 @@ class AutoSummarizingOpenAIFunctionCallAgent(OpenAIFunctionsAgent, OpenAIFunctio
|
|||||||
messages, functions=self.functions, callbacks=callbacks
|
messages, functions=self.functions, callbacks=callbacks
|
||||||
)
|
)
|
||||||
agent_decision = _parse_ai_message(predicted_message)
|
agent_decision = _parse_ai_message(predicted_message)
|
||||||
|
|
||||||
|
if isinstance(agent_decision, AgentAction) and agent_decision.tool == 'dataset':
|
||||||
|
tool_inputs = agent_decision.tool_input
|
||||||
|
if isinstance(tool_inputs, dict) and 'query' in tool_inputs:
|
||||||
|
tool_inputs['query'] = kwargs['input']
|
||||||
|
agent_decision.tool_input = tool_inputs
|
||||||
|
|
||||||
return agent_decision
|
return agent_decision
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -102,7 +102,13 @@ class StructuredMultiDatasetRouterAgent(StructuredChatAgent):
|
|||||||
raise new_exception
|
raise new_exception
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return self.output_parser.parse(full_output)
|
agent_decision = self.output_parser.parse(full_output)
|
||||||
|
if isinstance(agent_decision, AgentAction):
|
||||||
|
tool_inputs = agent_decision.tool_input
|
||||||
|
if isinstance(tool_inputs, dict) and 'query' in tool_inputs:
|
||||||
|
tool_inputs['query'] = kwargs['input']
|
||||||
|
agent_decision.tool_input = tool_inputs
|
||||||
|
return agent_decision
|
||||||
except OutputParserException:
|
except OutputParserException:
|
||||||
return AgentFinish({"output": "I'm sorry, the answer of model is invalid, "
|
return AgentFinish({"output": "I'm sorry, the answer of model is invalid, "
|
||||||
"I don't know how to respond to that."}, "")
|
"I don't know how to respond to that."}, "")
|
||||||
|
@ -106,7 +106,13 @@ class AutoSummarizingStructuredChatAgent(StructuredChatAgent, CalcTokenMixin):
|
|||||||
raise new_exception
|
raise new_exception
|
||||||
|
|
||||||
try:
|
try:
|
||||||
return self.output_parser.parse(full_output)
|
agent_decision = self.output_parser.parse(full_output)
|
||||||
|
if isinstance(agent_decision, AgentAction) and agent_decision.tool == 'dataset':
|
||||||
|
tool_inputs = agent_decision.tool_input
|
||||||
|
if isinstance(tool_inputs, dict) and 'query' in tool_inputs:
|
||||||
|
tool_inputs['query'] = kwargs['input']
|
||||||
|
agent_decision.tool_input = tool_inputs
|
||||||
|
return agent_decision
|
||||||
except OutputParserException:
|
except OutputParserException:
|
||||||
return AgentFinish({"output": "I'm sorry, the answer of model is invalid, "
|
return AgentFinish({"output": "I'm sorry, the answer of model is invalid, "
|
||||||
"I don't know how to respond to that."}, "")
|
"I don't know how to respond to that."}, "")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user