Closed yuhp-zts closed 2 months ago
To enable quick insertion of parameters after publishing a workflow as a tool in Dify version 0.6.10 (Self Hosted via Docker), you need to define the parameters in the tool's YAML configuration file. Here is an example of how to define parameters for a tool:
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
Additionally, you can use the WorkflowToolConfigureButton
component to manage tool configurations and parameters dynamically. This component provides functionalities such as fetching tool data, setting input variables, and handling form schemas for tool parameters. Here is a brief overview of how you can use it:
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;
This configuration and component usage allow the quick insertion and management of parameters by defining them in the parameters
section of the tool's YAML file and dynamically handling them in your application [1][2][3].
To continue talking to Dosu, mention @dosu.
To enable quick insertion of parameters after publishing a workflow as a tool in Dify version 0.6.10 (Self Hosted via Docker), you need to define the parameters in the tool's YAML configuration file. Here is an example of how to define parameters for a tool:
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
Additionally, you can use the
WorkflowToolConfigureButton
component to manage tool configurations and parameters dynamically. This component provides functionalities such as fetching tool data, setting input variables, and handling form schemas for tool parameters. Here is a brief overview of how you can use it: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;
This configuration and component usage allow the quick insertion and management of parameters by defining them in the
parameters
section of the tool's YAML file and dynamically handling them in your application [1][2][3].To continue talking to Dosu, mention @dosu.
When I convert the workflow into a tool, it includes descriptions of the relevant parameters. Do I still need to prepare an additional YAML configuration file?
Yes, you still need to prepare an additional YAML configuration file for defining the parameters when converting the workflow into a tool in Dify version 0.6.10 (Self Hosted via Docker), even if it includes descriptions of the relevant parameters.
Supporting evidence from the document:
### 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.
To continue talking to Dosu, mention @dosu.
Tool param that user fills in the tool configuration is not support insert variable now.
Self Checks
Dify version
0.6.10
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
After the workflow is published as a tool, the parameters that need to be passed do not support quick insertion.
✔️ Expected Behavior
No response
❌ Actual Behavior
No response