无Laf云函数,直接使用FastGPT集成Google搜索

背景介绍

在Fastgpt中虽然有Google集成搜索,但是需要使用laf云函数。这里给出一个配置文件,可以直接导入到fastgpt的workflow,只需要修性Google的cx和API的值,其他的值你自己自定义即可。

  • FastGPT社区版本:V4.8.16
  • 具体的操作可以观看B站视频:视频链接

配置文件

{
  "nodes": [
    {
      "nodeId": "userGuide",
      "name": "common:core.module.template.system_config",
      "intro": "common:core.module.template.system_config_info",
      "avatar": "core/workflow/template/systemConfig",
      "flowNodeType": "userGuide",
      "position": {
        "x": 262.2732338817093,
        "y": -476.00241136598146
      },
      "version": "481",
      "inputs": [
        {
          "key": "welcomeText",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "string",
          "label": "core.app.Welcome Text",
          "value": ""
        },
        {
          "key": "variables",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "core.app.Chat Variable",
          "value": []
        },
        {
          "key": "questionGuide",
          "valueType": "any",
          "renderTypeList": [
            "hidden"
          ],
          "label": "core.app.Question Guide",
          "value": {
            "open": false
          }
        },
        {
          "key": "tts",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": {
            "type": "web"
          }
        },
        {
          "key": "whisper",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": {
            "open": false,
            "autoSend": false,
            "autoTTSResponse": false
          }
        },
        {
          "key": "scheduleTrigger",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": null
        }
      ],
      "outputs": []
    },
    {
      "nodeId": "448745",
      "name": "common:core.module.template.work_start",
      "intro": "",
      "avatar": "core/workflow/template/workflowStart",
      "flowNodeType": "workflowStart",
      "position": {
        "x": 754.4072203387426,
        "y": -406.7954791699196
      },
      "version": "481",
      "inputs": [
        {
          "key": "userChatInput",
          "renderTypeList": [
            "reference",
            "textarea"
          ],
          "valueType": "string",
          "label": "common:core.module.input.label.user question",
          "required": true,
          "toolDescription": "用户问题",
          "debugLabel": ""
        }
      ],
      "outputs": [
        {
          "id": "userChatInput",
          "key": "userChatInput",
          "label": "common:core.module.input.label.user question",
          "type": "static",
          "valueType": "string",
          "description": ""
        }
      ]
    },
    {
      "nodeId": "h4JD8xaVEpxK",
      "name": "HTTP 请求",
      "intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
      "avatar": "core/workflow/template/httpRequest",
      "flowNodeType": "httpRequest468",
      "showStatus": true,
      "position": {
        "x": 1194.8632898061628,
        "y": -572.7954791699196
      },
      "version": "481",
      "inputs": [
        {
          "key": "system_addInputParam",
          "renderTypeList": [
            "addInputParam"
          ],
          "valueType": "dynamic",
          "label": "",
          "required": false,
          "description": "common:core.module.input.description.HTTP Dynamic Input",
          "customInputConfig": {
            "selectValueTypeList": [
              "string",
              "number",
              "boolean",
              "object",
              "arrayString",
              "arrayNumber",
              "arrayBoolean",
              "arrayObject",
              "arrayAny",
              "any",
              "chatHistory",
              "datasetQuote",
              "dynamic",
              "selectApp",
              "selectDataset"
            ],
            "showDescription": false,
            "showDefaultValue": true
          },
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpMethod",
          "renderTypeList": [
            "custom"
          ],
          "valueType": "string",
          "label": "",
          "value": "GET",
          "required": true,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpTimeout",
          "renderTypeList": [
            "custom"
          ],
          "valueType": "number",
          "label": "",
          "value": 30,
          "min": 5,
          "max": 600,
          "required": true,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpReqUrl",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "string",
          "label": "",
          "description": "common:core.module.input.description.Http Request Url",
          "placeholder": "https://api.ai.com/getInventory",
          "required": false,
          "value": "https://www.googleapis.com/customsearch/v1",
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpHeader",
          "renderTypeList": [
            "custom"
          ],
          "valueType": "any",
          "value": [],
          "label": "",
          "description": "common:core.module.input.description.Http Request Header",
          "placeholder": "common:core.module.input.description.Http Request Header",
          "required": false,
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpParams",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "value": [
            {
              "key": "q",
              "type": "string",
              "value": "{{query}}"
            },
            {
              "key": "cx",
              "type": "string",
              "value": "yourself_cx"
            },
            {
              "key": "key",
              "type": "string",
              "value": "yourself_api_key"
            },
            {
              "key": "c2coff",
              "type": "string",
              "value": "1"
            },
            {
              "key": "start",
              "type": "string",
              "value": "1"
            },
            {
              "key": "end",
              "type": "string",
              "value": "20"
            }
          ],
          "label": "",
          "required": false,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpJsonBody",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "value": "",
          "label": "",
          "required": false,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpFormBody",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "value": [],
          "label": "",
          "required": false,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "system_httpContentType",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "string",
          "value": "json",
          "label": "",
          "required": false,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "renderTypeList": [
            "reference"
          ],
          "valueType": "string",
          "canEdit": true,
          "key": "query",
          "label": "query",
          "customInputConfig": {
            "selectValueTypeList": [
              "string",
              "number",
              "boolean",
              "object",
              "arrayString",
              "arrayNumber",
              "arrayBoolean",
              "arrayObject",
              "arrayAny",
              "any",
              "chatHistory",
              "datasetQuote",
              "dynamic",
              "selectApp",
              "selectDataset"
            ],
            "showDescription": false,
            "showDefaultValue": true
          },
          "required": true,
          "value": [
            "448745",
            "userChatInput"
          ]
        }
      ],
      "outputs": [
        {
          "id": "error",
          "key": "error",
          "label": "workflow:request_error",
          "description": "HTTP请求错误信息,成功时返回空",
          "valueType": "object",
          "type": "static"
        },
        {
          "id": "httpRawResponse",
          "key": "httpRawResponse",
          "required": true,
          "label": "workflow:raw_response",
          "description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
          "valueType": "any",
          "type": "static"
        },
        {
          "id": "system_addOutputParam",
          "key": "system_addOutputParam",
          "type": "dynamic",
          "valueType": "dynamic",
          "label": "输出字段提取",
          "customFieldConfig": {
            "selectValueTypeList": [
              "string",
              "number",
              "boolean",
              "object",
              "arrayString",
              "arrayNumber",
              "arrayBoolean",
              "arrayObject",
              "arrayAny",
              "any",
              "chatHistory",
              "datasetQuote",
              "dynamic",
              "selectApp",
              "selectDataset"
            ],
            "showDescription": false,
            "showDefaultValue": false
          },
          "description": "可以通过 JSONPath 语法来提取响应值中的指定字段",
          "valueDesc": ""
        }
      ]
    },
    {
      "nodeId": "jvTUBFkJ47cy",
      "name": "代码运行",
      "intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
      "avatar": "core/workflow/template/codeRun",
      "flowNodeType": "code",
      "showStatus": true,
      "position": {
        "x": 1977.6571839512153,
        "y": -406.7954791699196
      },
      "version": "482",
      "inputs": [
        {
          "key": "system_addInputParam",
          "renderTypeList": [
            "addInputParam"
          ],
          "valueType": "dynamic",
          "label": "",
          "required": false,
          "description": "workflow:these_variables_will_be_input_parameters_for_code_execution",
          "customInputConfig": {
            "selectValueTypeList": [
              "string",
              "number",
              "boolean",
              "object",
              "arrayString",
              "arrayNumber",
              "arrayBoolean",
              "arrayObject",
              "arrayAny",
              "any",
              "chatHistory",
              "datasetQuote",
              "dynamic",
              "selectApp",
              "selectDataset"
            ],
            "showDescription": false,
            "showDefaultValue": true
          },
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "codeType",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": "js",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "code",
          "renderTypeList": [
            "custom"
          ],
          "label": "",
          "value": "function main({searchresult}){\n    const data = JSON.parse(searchresult);\n    // 提取标题和链接\n    const output = data.items.map((item) => {\n  return `${item.title}\\n${item.snippet}`;\n}).join('\\n');\nreturn {\"output\":output};\n\n}",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "renderTypeList": [
            "reference"
          ],
          "valueType": "string",
          "canEdit": true,
          "key": "searchresult",
          "label": "searchresult",
          "customInputConfig": {
            "selectValueTypeList": [
              "string",
              "number",
              "boolean",
              "object",
              "arrayString",
              "arrayNumber",
              "arrayBoolean",
              "arrayObject",
              "arrayAny",
              "any",
              "chatHistory",
              "datasetQuote",
              "dynamic",
              "selectApp",
              "selectDataset"
            ],
            "showDescription": false,
            "showDefaultValue": true
          },
          "required": true,
          "value": [
            "h4JD8xaVEpxK",
            "httpRawResponse"
          ],
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        }
      ],
      "outputs": [
        {
          "id": "system_rawResponse",
          "key": "system_rawResponse",
          "label": "workflow:full_response_data",
          "valueType": "object",
          "type": "static",
          "description": ""
        },
        {
          "id": "error",
          "key": "error",
          "label": "workflow:execution_error",
          "description": "代码运行错误信息,成功时返回空",
          "valueType": "object",
          "type": "static"
        },
        {
          "id": "system_addOutputParam",
          "key": "system_addOutputParam",
          "type": "dynamic",
          "valueType": "dynamic",
          "label": "",
          "customFieldConfig": {
            "selectValueTypeList": [
              "string",
              "number",
              "boolean",
              "object",
              "arrayString",
              "arrayNumber",
              "arrayBoolean",
              "arrayObject",
              "arrayAny",
              "any",
              "chatHistory",
              "datasetQuote",
              "dynamic",
              "selectApp",
              "selectDataset"
            ],
            "showDescription": false,
            "showDefaultValue": false
          },
          "description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key",
          "valueDesc": ""
        },
        {
          "id": "qLUQfhG0ILRX",
          "type": "dynamic",
          "key": "output",
          "valueType": "string",
          "label": "output",
          "valueDesc": "",
          "description": ""
        }
      ]
    },
    {
      "nodeId": "jq5VisZl4Ctw",
      "name": "AI 对话",
      "intro": "AI 大模型对话",
      "avatar": "core/workflow/template/aiChat",
      "flowNodeType": "chatNode",
      "showStatus": true,
      "position": {
        "x": 2514.6177029774717,
        "y": -448.79547916991964
      },
      "version": "4813",
      "inputs": [
        {
          "key": "model",
          "renderTypeList": [
            "settingLLMModel",
            "reference"
          ],
          "label": "AI 模型",
          "valueType": "string",
          "value": "qwen2.5-14b-instruct",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "temperature",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": 0,
          "valueType": "number",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "maxToken",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": 2000,
          "valueType": "number",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "isResponseAnswerText",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": true,
          "valueType": "boolean",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "aiChatQuoteRole",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "valueType": "string",
          "value": "system",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "quoteTemplate",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "valueType": "string",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "quotePrompt",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "valueType": "string",
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "aiChatVision",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "valueType": "boolean",
          "value": true,
          "valueDesc": "",
          "description": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "systemPrompt",
          "renderTypeList": [
            "textarea",
            "reference"
          ],
          "max": 3000,
          "valueType": "string",
          "label": "提示词",
          "description": "core.app.tip.systemPromptTip",
          "placeholder": "core.app.tip.chatNodeSystemPromptTip",
          "value": "下文是谷歌搜索的结果,你可以提供实时信息,根据搜索结果回答问题。搜索词: {{$448745.userChatInput$}}\ngoogle 搜索结果:`\n{{$jvTUBFkJ47cy.qLUQfhG0ILRX$}}`\n请尽可能利用搜索结果回答用户问题",
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "history",
          "renderTypeList": [
            "numberInput",
            "reference"
          ],
          "valueType": "chatHistory",
          "label": "聊天记录",
          "description": "workflow:max_dialog_rounds",
          "required": true,
          "min": 0,
          "max": 50,
          "value": 6,
          "valueDesc": "",
          "debugLabel": "",
          "toolDescription": ""
        },
        {
          "key": "quoteQA",
          "renderTypeList": [
            "settingDatasetQuotePrompt"
          ],
          "label": "",
          "debugLabel": "知识库引用",
          "description": "",
          "valueType": "datasetQuote",
          "valueDesc": "",
          "toolDescription": ""
        },
        {
          "key": "fileUrlList",
          "renderTypeList": [
            "reference",
            "input"
          ],
          "label": "文件链接",
          "debugLabel": "文件链接",
          "valueType": "arrayString",
          "value": [],
          "valueDesc": "",
          "description": "",
          "toolDescription": ""
        },
        {
          "key": "userChatInput",
          "renderTypeList": [
            "reference",
            "textarea"
          ],
          "valueType": "string",
          "label": "用户问题",
          "toolDescription": "用户问题",
          "required": true,
          "value": [
            "448745",
            "userChatInput"
          ],
          "valueDesc": "",
          "description": "",
          "debugLabel": ""
        }
      ],
      "outputs": [
        {
          "id": "history",
          "key": "history",
          "required": true,
          "label": "common:core.module.output.label.New context",
          "description": "将本次回复内容拼接上历史记录,作为新的上下文返回",
          "valueType": "chatHistory",
          "valueDesc": "{\n  obj: System | Human | AI;\n  value: string;\n}[]",
          "type": "static"
        },
        {
          "id": "answerText",
          "key": "answerText",
          "required": true,
          "label": "common:core.module.output.label.Ai response content",
          "description": "将在 stream 回复完毕后触发",
          "valueType": "string",
          "type": "static"
        }
      ]
    }
  ],
  "edges": [
    {
      "source": "448745",
      "target": "h4JD8xaVEpxK",
      "sourceHandle": "448745-source-right",
      "targetHandle": "h4JD8xaVEpxK-target-left"
    },
    {
      "source": "h4JD8xaVEpxK",
      "target": "jvTUBFkJ47cy",
      "sourceHandle": "h4JD8xaVEpxK-source-right",
      "targetHandle": "jvTUBFkJ47cy-target-left"
    },
    {
      "source": "jvTUBFkJ47cy",
      "target": "jq5VisZl4Ctw",
      "sourceHandle": "jvTUBFkJ47cy-source-right",
      "targetHandle": "jq5VisZl4Ctw-target-left"
    }
  ],
  "chatConfig": {
    "welcomeText": "我是你的google搜索AI小助手,你有什么问题想问我的?",
    "variables": [],
    "scheduledTriggerConfig": {
      "cronString": "",
      "timezone": "Asia/Shanghai",
      "defaultPrompt": ""
    },
    "_id": "6776ca6bef991bbbfe693871"
  }
}
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇