dify 在工作流发布为工具后,需要传递的参数不支持快速插入,

gj3fmq9x  于 4个月前  发布在  其他
关注(0)|答案(4)|浏览(70)

自检

  • 这仅用于提交错误报告,如果您想提问,请访问 Discussions
  • 我已搜索现有问题 search for existing issues ,包括已关闭的问题。
  • 我确认我使用英语提交此报告(我已阅读并同意 Language Policy )。
  • 请不要修改此模板 :) 并填写所有必填字段。

Dify版本

0.6.10

云或自托管

自托管(Docker)

重现步骤

在将工作流发布为工具后,需要传递的参数不支持快速插入。

✔️ 预期行为

  • 无响应*

❌ 实际行为

  • 无响应*
i86rm4rw

i86rm4rw1#

为了在Dify版本0.6.10(通过Docker自托管)中作为工具发布工作流后快速插入参数,您需要在工具的YAML配置文件中定义参数。以下是如何为工具定义参数的示例:

identity: # Basic information of the tool
  name: google_search # Tool name, unique, no duplication with other tools
  author: Dify # Author
  label: # Label for frontend display
    en_US: GoogleSearch # English label
    zh_Hans: 谷歌搜索 # Chinese label
description: # Description for frontend display
  human: # Introduction for frontend display, supports multiple languages
    en_US: A tool for performing a Google SERP search and extracting snippets and webpages. Input should be a search query.
    zh_Hans: 一个用于执行 Google SERP 搜索并提取片段和网页的工具。输入应该是一个搜索查询。
  llm: A tool for performing a Google SERP search and extracting snippets and webpages. Input should be a search query. # Introduction passed to LLM, in order to make LLM better understand this tool, we suggest to write as detailed information about this tool as possible here, so that LLM can understand and use this tool
parameters: # Parameter list
  - name: query # Parameter name
    type: string # Parameter type
    required: true # Required or not
    label: # Parameter label
      en_US: Query string # English label
      zh_Hans: 查询语句 # Chinese label
    human_description: # Introduction for frontend display, supports multiple languages
      en_US: used for searching
      zh_Hans: 用于搜索网页内容
    llm_description: key words for searching # Introduction passed to LLM, similarly, in order to make LLM better understand this parameter, we suggest to write as detailed information about this parameter as possible here, so that LLM can understand this parameter
    form: llm # Form type, llm means this parameter needs to be inferred by Agent, the frontend will not display this parameter
  - name: result_type
    type: select # Parameter type
    required: true
    options: # Drop-down box options
      - value: text
        label:
          en_US: text
          zh_Hans: 文本
      - value: link
        label:
          en_US: link
          zh_Hans: 链接
    default: link
    label:
      en_US: Result type
      zh_Hans: 结果类型
    human_description:
      en_US: used for selecting the result type, text or link
      zh_Hans: 用于选择结果类型,使用文本还是链接进行展示
    form: form # Form type, form means this parameter needs to be filled in by the user on the frontend before the conversation starts

此外,您还可以使用 WorkflowToolConfigureButton 组件动态管理工具配置和参数。该组件提供的功能包括获取工具数据、设置输入变量以及处理工具参数的表单模式。以下是如何使用它的简要概述:

import WorkflowToolConfigureButton from '@/app/components/tools/workflow-tool/configure-button';

const MyComponent = () => {
  const handlePublish = () => {
    // Your publish logic here
  };

  const onRefreshData = () => {
    // Your refresh data logic here
  };

  return (
    <WorkflowToolConfigureButton
      disabled={false}
      published={true}
      detailNeedUpdate={false}
      workflowAppId="your-workflow-app-id"
      icon="🔍"
      name="Google Search"
      description="A tool for performing a Google SERP search and extracting snippets and webpages."
      inputs={[
        { variable: 'query', required: true, type: 'string' },
        { variable: 'result_type', required: true, type: 'select' },
      ]}
      handlePublish={handlePublish}
      onRefreshData={onRefreshData}
    />
  );
};

export default MyComponent;

通过在工具的YAML文件的 parameters 部分定义它们并在您的应用程序 1(https://github.com/langgenius/dify-docs/blob/main/en/tutorials/quick-tool-integration.md)2(https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/tool/use-config.ts)3(https://github.com/langgenius/dify/blob/main/web/app/components/tools/workflow-tool/configure-button.tsx) 中动态处理它们,这种配置和组件使用允许快速插入和管理参数。

  • 要继续与 Dosu 交谈,请提及 @dosu。*
lndjwyie

lndjwyie2#

要将参数快速插入到Dify 0.6.10版本(通过Docker自托管)发布的工作流作为工具中,您需要在工具的YAML配置文件中定义参数。以下是如何为工具定义参数的示例:

identity: # Basic information of the tool
  name: google_search # Tool name, unique, no duplication with other tools
  author: Dify # Author
  label: # Label for frontend display
    en_US: GoogleSearch # English label
    zh_Hans: 谷歌搜索 # Chinese label
description: # Description for frontend display
  human: # Introduction for frontend display, supports multiple languages
    en_US: A tool for performing a Google SERP search and extracting snippets and webpages. Input should be a search query.
    zh_Hans: 一个用于执行 Google SERP 搜索并提取片段和网页的工具。输入应该是一个搜索查询。
  llm: A tool for performing a Google SERP search and extracting snippets and webpages. Input should be a search query. # Introduction passed to LLM, in order to make LLM better understand this tool, we suggest to write as detailed information about this tool as possible here, so that LLM can understand and use this tool
parameters: # Parameter list
  - name: query # Parameter name
    type: string # Parameter type
    required: true # Required or not
    label: # Parameter label
      en_US: Query string # English label
      zh_Hans: 查询语句 # Chinese label
    human_description: # Introduction for frontend display, supports multiple languages
      en_US: used for searching
      zh_Hans: 用于搜索网页内容
    llm_description: key words for searching # Introduction passed to LLM, similarly, in order to make LLM better understand this parameter, we suggest to write as detailed information about this parameter as possible here, so that LLM can understand this parameter
    form: llm # Form type, llm means this parameter needs to be inferred by Agent, the frontend will not display this parameter
  - name: result_type
    type: select # Parameter type
    required: true
    options: # Drop-down box options
      - value: text
        label:
          en_US: text
          zh_Hans: 文本
      - value: link
        label:
          en_US: link
          zh_Hans: 链接
    default: link
    label:
      en_US: Result type
      zh_Hans: 结果类型
    human_description:
      en_US: used for selecting the result type, text or link
      zh_Hans: 用于选择结果类型,使用文本还是链接进行展示
    form: form # Form type, form means this parameter needs to be filled in by the user on the frontend before the conversation starts

此外,您还可以使用 WorkflowToolConfigureButton 组件动态管理工具配置和参数。该组件提供的功能包括获取工具数据、设置输入变量以及处理工具参数的表单模式。以下是如何使用它的简要概述:

import WorkflowToolConfigureButton from '@/app/components/tools/workflow-tool/configure-button';

const MyComponent = () => {
  const handlePublish = () => {
    // Your publish logic here
  };

  const onRefreshData = () => {
    // Your refresh data logic here
  };

  return (
    <WorkflowToolConfigureButton
      disabled={false}
      published={true}
      detailNeedUpdate={false}
      workflowAppId="your-workflow-app-id"
      icon="🔍"
      name="Google Search"
      description="A tool for performing a Google SERP search and extracting snippets and webpages."
      inputs={[
        { variable: 'query', required: true, type: 'string' },
        { variable: 'result_type', required: true, type: 'select' },
      ]}
      handlePublish={handlePublish}
      onRefreshData={onRefreshData}
    />
  );
};

export default MyComponent;

通过在工具的YAML文件的 parameters 部分定义它们并在您的应用程序 1(https://github.com/langgenius/dify-docs/blob/main/en/tutorials/quick-tool-integration.md) 2(https://github.com/langgenius/dify/blob/main/web/app/components/workflow/nodes/tool/use-config.ts) 3(https://github.com/langgenius/dify/blob/main/web/app/components/tools/workflow-tool/configure-button.tsx) 中动态处理它们,这种配置和组件使用允许快速插入和管理参数。

  • 要继续与 Dosu 交谈,请提及 @dosu。*

当我将工作流转换为工具时,它会包含相关参数的描述。我还需要准备一个额外的YAML配置文件吗?

q1qsirdb

q1qsirdb3#

是的,在Dify版本0.6.10(通过Docker自托管)中,即使包含相关参数的描述,您仍然需要准备一个额外的YAML配置文件来定义转换为工具时的参数。

文档中的支持证据:

### 3. Prepare Tool yaml

A provider can have multiple tools, each tool needs a yaml file to describe, this file contains the basic information, parameters, output, etc. of the tool.

1(https://github.com/langgenius/dify-docs/blob/main/en/guides/tools/quick-tool-integration.md)

  • 要继续与Dosu交流,请提及@dosu。*
ohfgkhjo

ohfgkhjo4#

用户在工具配置中填写的工具参数不支持插入变量。

相关问题