新建的AI工作流系统中,支持我们自建的谷歌搜索api,由于接口需要改动,我将其改为插件形式,可以生成插件,并且导入配置即可。
需要输入的字段及说明:
1,chatapi-token:需要填入你在chatapi中申请的令牌
2,text:即在谷歌内搜索的关键词,请不要输入过长,可以在工作流中灵活使用,例如AI来筛选
3,地区:搜索谷歌所属地区,例如
中国 – 中文
英国-英语
美国英语
美国的欧盟 (es)
4,max_results:最大搜索结果,如果需要速度推荐写10,最大为30。
新建插件,导入以下配置,并且在工作流中使用
{
“nodes”: [
{
“nodeId”: “pluginInput”,
“name”: “自定义插件输入”,
“intro”: “可以配置插件需要哪些输入,利用这些输入来运行插件”,
“avatar”: “core/workflow/template/workflowStart”,
“flowNodeType”: “pluginInput”,
“showStatus”: false,
“position”: {
“x”: 284.44410988533355,
“y”: -322.6782789366677
},
“version”: “481”,
“inputs”: [
{
“renderTypeList”: [
“reference”
],
“selectedTypeIndex”: 0,
“valueType”: “string”,
“canEdit”: true,
“key”: “chatapi-token”,
“label”: “chatapi-token”,
“description”: “获取chatapi中的令牌写入”,
“required”: true
},
{
“renderTypeList”: [
“reference”
],
“selectedTypeIndex”: 0,
“valueType”: “string”,
“canEdit”: true,
“key”: “text”,
“label”: “text”,
“description”: “搜索关键词”,
“required”: true
},
{
“renderTypeList”: [
“reference”
],
“selectedTypeIndex”: 0,
“valueType”: “string”,
“canEdit”: true,
“key”: “region”,
“label”: “region”,
“description”: “选择国家,例如\ncn-zh for China\nuk-en for United Kingdom\nus-en for United States\nue-es for United States (es)”,
“required”: false
},
{
“renderTypeList”: [
“reference”
],
“selectedTypeIndex”: 0,
“valueType”: “string”,
“canEdit”: true,
“key”: “max_results”,
“label”: “max_results”,
“description”: “允许最大的结果数量,默认为10,可选30.”,
“required”: false
}
],
“outputs”: [
{
“id”: “chatapi-token”,
“valueType”: “string”,
“key”: “chatapi-token”,
“label”: “chatapi-token”,
“type”: “hidden”
},
{
“id”: “text”,
“valueType”: “string”,
“key”: “text”,
“label”: “text”,
“type”: “hidden”
},
{
“id”: “region”,
“valueType”: “string”,
“key”: “region”,
“label”: “region”,
“type”: “hidden”
},
{
“id”: “max_results”,
“valueType”: “string”,
“key”: “max_results”,
“label”: “max_results”,
“type”: “hidden”
}
]
},
{
“nodeId”: “pluginOutput”,
“name”: “自定义插件输出”,
“intro”: “自定义配置外部输出,使用插件时,仅暴露自定义配置的输出”,
“avatar”: “core/workflow/template/pluginOutput”,
“flowNodeType”: “pluginOutput”,
“showStatus”: false,
“position”: {
“x”: 1730.6356700358813,
“y”: -192.42221566861426
},
“version”: “481”,
“inputs”: [
{
“renderTypeList”: [
“reference”
],
“valueType”: “string”,
“canEdit”: true,
“key”: “result”,
“label”: “result”,
“description”: “”,
“value”: [
“fxeuqI9GnWvO”,
“qLUQfhG0ILRX”
]
}
],
“outputs”: []
},
{
“nodeId”: “bqKyItJbuSk0”,
“name”: “HTTP 请求”,
“intro”: “可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)”,
“avatar”: “core/workflow/template/httpRequest”,
“flowNodeType”: “httpRequest468”,
“showStatus”: true,
“position”: {
“x”: 745.340720541016,
“y”: -542.6099795460601
},
“version”: “481”,
“inputs”: [
{
“key”: “system_addInputParam”,
“renderTypeList”: [
“addInputParam”
],
“valueType”: “dynamic”,
“label”: “”,
“required”: false,
“description”: “core.module.input.description.HTTP Dynamic Input”,
“customInputConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: true
}
},
{
“key”: “system_httpMethod”,
“renderTypeList”: [
“custom”
],
“valueType”: “string”,
“label”: “”,
“value”: “POST”,
“required”: true
},
{
“key”: “system_httpReqUrl”,
“renderTypeList”: [
“hidden”
],
“valueType”: “string”,
“label”: “”,
“description”: “core.module.input.description.Http Request Url”,
“placeholder”: “https://api.ai.com/getInventory”,
“required”: false,
“value”: “https://chatapi.aisws.com/v1/chat/completions”
},
{
“key”: “system_httpHeader”,
“renderTypeList”: [
“custom”
],
“valueType”: “any”,
“value”: [
{
“key”: “content-type”,
“type”: “string”,
“value”: “application/json”
},
{
“key”: “Authorization”,
“type”: “string”,
“value”: “{{chatapi-token}}”
}
],
“label”: “”,
“description”: “core.module.input.description.Http Request Header”,
“placeholder”: “core.module.input.description.Http Request Header”,
“required”: false
},
{
“key”: “system_httpParams”,
“renderTypeList”: [
“hidden”
],
“valueType”: “any”,
“value”: [],
“label”: “”,
“required”: false
},
{
“key”: “system_httpJsonBody”,
“renderTypeList”: [
“hidden”
],
“valueType”: “any”,
“value”: “{\r\n \”model\”: \”google-websearch\”,\r\n \”stream\”: false,\r\n \”messages\”: [\r\n {\r\n \”role\”: \”user\”,\r\n \”content\”: {\r\n \”text\”: \”{{text}}\”, \r\n \”safesearch\”: \”off\”,\r\n \”timelimit\”: \”\”,\r\n \”region\”: \”{{region}}\”,\r\n \”max_results\”: {{max_results}}\r\n }\r\n }\r\n ]\r\n}”,
“label”: “”,
“required”: false
},
{
“renderTypeList”: [
“reference”
],
“valueType”: “string”,
“canEdit”: true,
“key”: “chatapi-token”,
“label”: “chatapi-token”,
“customInputConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: true
},
“required”: true,
“value”: [
“pluginInput”,
“chatapi-token”
]
},
{
“renderTypeList”: [
“reference”
],
“valueType”: “string”,
“canEdit”: true,
“key”: “text”,
“label”: “text”,
“customInputConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: true
},
“required”: true,
“value”: [
“pluginInput”,
“text”
]
},
{
“renderTypeList”: [
“reference”
],
“valueType”: “string”,
“canEdit”: true,
“key”: “region”,
“label”: “region”,
“customInputConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: true
},
“required”: true,
“value”: [
“pluginInput”,
“region”
]
},
{
“renderTypeList”: [
“reference”
],
“valueType”: “string”,
“canEdit”: true,
“key”: “max_results”,
“label”: “max_results”,
“customInputConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: true
},
“required”: true,
“value”: [
“pluginInput”,
“max_results”
]
}
],
“outputs”: [
{
“id”: “system_addOutputParam”,
“key”: “system_addOutputParam”,
“type”: “dynamic”,
“valueType”: “dynamic”,
“label”: “”,
“customFieldConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: false
}
},
{
“id”: “error”,
“key”: “error”,
“label”: “请求错误”,
“description”: “HTTP请求错误信息,成功时返回空”,
“valueType”: “object”,
“type”: “static”
},
{
“id”: “httpRawResponse”,
“key”: “httpRawResponse”,
“label”: “原始响应”,
“required”: true,
“description”: “HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。”,
“valueType”: “any”,
“type”: “static”
},
{
“id”: “oUUcZSdecHln”,
“valueType”: “string”,
“type”: “dynamic”,
“key”: “choices”,
“label”: “choices”
}
]
},
{
“nodeId”: “fxeuqI9GnWvO”,
“name”: “代码运行”,
“intro”: “执行一段简单的脚本代码,通常用于进行复杂的数据处理。”,
“avatar”: “core/workflow/template/codeRun”,
“flowNodeType”: “code”,
“showStatus”: true,
“position”: {
“x”: 1263.2102927162487,
“y”: -426.0987660008127
},
“version”: “482”,
“inputs”: [
{
“key”: “system_addInputParam”,
“renderTypeList”: [
“addInputParam”
],
“valueType”: “dynamic”,
“label”: “”,
“required”: false,
“description”: “这些变量会作为代码的运行的输入参数”,
“customInputConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: true
}
},
{
“renderTypeList”: [
“reference”
],
“valueType”: “string”,
“canEdit”: true,
“key”: “choices”,
“label”: “choices”,
“customInputConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: true
},
“required”: true,
“value”: [
“bqKyItJbuSk0”,
“oUUcZSdecHln”
]
},
{
“key”: “codeType”,
“renderTypeList”: [
“hidden”
],
“label”: “”,
“value”: “js”
},
{
“key”: “code”,
“renderTypeList”: [
“custom”
],
“label”: “”,
“value”: “function main({ choices }) {\n // 解析 choices 字段本身为一个数组\n const parsedChoices = JSON.parse(choices);\n\n // 获取 content 字段\n const rawContent = parsedChoices[0].message.content;\n\n // 去掉字符串的转义字符并解析为 JSON 对象\n const cleanedContent = JSON.parse(rawContent);\n\n // 提取 content 中的数据\n const result = cleanedContent.map(item => ({\n title: item.title,\n href: item.href,\n body: item.body\n }));\n\n return {\n result\n };\n}\n”
}
],
“outputs”: [
{
“id”: “system_addOutputParam”,
“key”: “system_addOutputParam”,
“type”: “dynamic”,
“valueType”: “dynamic”,
“label”: “”,
“customFieldConfig”: {
“selectValueTypeList”: [
“string”,
“number”,
“boolean”,
“object”,
“arrayString”,
“arrayNumber”,
“arrayBoolean”,
“arrayObject”,
“any”,
“chatHistory”,
“datasetQuote”,
“dynamic”,
“selectApp”,
“selectDataset”
],
“showDescription”: false,
“showDefaultValue”: false
},
“description”: “将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key”
},
{
“id”: “system_rawResponse”,
“key”: “system_rawResponse”,
“label”: “完整响应数据”,
“valueType”: “object”,
“type”: “static”
},
{
“id”: “error”,
“key”: “error”,
“label”: “运行错误”,
“description”: “代码运行错误信息,成功时返回空”,
“valueType”: “object”,
“type”: “static”
},
{
“id”: “qLUQfhG0ILRX”,
“type”: “dynamic”,
“key”: “result”,
“valueType”: “string”,
“label”: “result”
}
]
}
],
“edges”: [
{
“source”: “pluginInput”,
“target”: “bqKyItJbuSk0”,
“sourceHandle”: “pluginInput-source-right”,
“targetHandle”: “bqKyItJbuSk0-target-left”
},
{
“source”: “bqKyItJbuSk0”,
“target”: “fxeuqI9GnWvO”,
“sourceHandle”: “bqKyItJbuSk0-source-right”,
“targetHandle”: “fxeuqI9GnWvO-target-left”
},
{
“source”: “fxeuqI9GnWvO”,
“target”: “pluginOutput”,
“sourceHandle”: “fxeuqI9GnWvO-source-right”,
“targetHandle”: “pluginOutput-target-left”
}
]
}
没有回复内容