diff --git a/astrbot/core/config/default.py b/astrbot/core/config/default.py index 2f055f05f..17ee27949 100644 --- a/astrbot/core/config/default.py +++ b/astrbot/core/config/default.py @@ -496,6 +496,7 @@ CONFIG_METADATA_2 = { "dify_api_key": "", "dify_api_base": "https://api.dify.ai/v1", "dify_workflow_output_key": "", + "dify_query_input_key": "astrbot_text_query", "timeout": 60, }, "whisper(API)": { @@ -647,6 +648,12 @@ CONFIG_METADATA_2 = { "type": "string", "hint": "Dify Workflow 输出变量名。当应用类型为 workflow 时才使用。默认为 astrbot_wf_output。", }, + "dify_query_input_key": { + "description": "Prompt 输入变量名", + "type": "string", + "hint": "发送的消息文本内容对应的输入变量名。默认为 astrbot_text_query。", + "obvious": True, + } }, }, "provider_settings": { diff --git a/astrbot/core/provider/sources/dify_source.py b/astrbot/core/provider/sources/dify_source.py index 4e8e3e851..33c53e218 100644 --- a/astrbot/core/provider/sources/dify_source.py +++ b/astrbot/core/provider/sources/dify_source.py @@ -31,6 +31,9 @@ class ProviderDify(Provider): raise Exception("Dify API 类型不能为空。") self.model_name = "dify" self.workflow_output_key = provider_config.get("dify_workflow_output_key", "astrbot_wf_output") + self.dify_query_input_key = provider_config.get("dify_query_input_key", "astrbot_text_query") + if not self.dify_query_input_key: + self.dify_query_input_key = "astrbot_text_query" self.timeout = provider_config.get("timeout", 120) if isinstance(self.timeout, str): self.timeout = int(self.timeout) @@ -95,7 +98,7 @@ class ProviderDify(Provider): case "workflow": async for chunk in self.api_client.workflow_run( inputs={ - "astrbot_text_query": prompt, + self.dify_query_input_key: prompt, "astrbot_session_id": session_id, **session_var },