放一个fastgpt调用CF的SD模型并结合gpt的简单绘图工作流,让大佬们看看哪里可以进行优化

fastgpt部署参考:

CloudFlare ai 模型调用参考:

之前闲着连了一个fastgpt调用CF的SD模型并结合gpt的简单绘图工作流,让大佬们看看哪里可以进行优化,顺便水个经验
绘图工作流实际使用效果如图:


不使用gpt优化提示词

使用gpt优化提示词

工作流预览:





网络请求插件的接口需要自己写,毕竟需要把二进制保存后搞成image url,相关的flask应用代码如下:

import requests
from flask import Flask, request, jsonify
import logging
import os
import time

app = Flask(__name__)
app.static_folder = 'static'
logging.basicConfig(level=logging.DEBUG)

@app.route('/v1/images/generations', methods=['POST'])
def generate_image():
    # 获取前端请求中的数据
    data = request.json
    logging.debug(f"Received request data: {data}")

    # 提取 Cloudflare 账户 ID 和 API 令牌
    cloudflare_account_id = data.get('CLOUDFLARE_ACCOUNT_ID')
    cloudflare_api_token = data.get('cloudflare_api_token')
    prompt = data.get('prompt')

    if not cloudflare_account_id or not cloudflare_api_token or not prompt:
        return jsonify({'error': 'Missing required parameters'}), 400

    # 构造 Cloudflare API 请求
    url = f"https://api.cloudflare.com/client/v4/accounts/{cloudflare_account_id}/ai/run/@cf/stabilityai/stable-diffusion-xl-base-1.0"
    headers = {"Authorization": f"Bearer {cloudflare_api_token}"}
    payload = {"prompt": prompt}

    # 发送请求到 Cloudflare API
    response = requests.post(url, headers=headers, json=payload)
    logging.debug(f"Response status code: {response.status_code}")

    # 检查响应状态码
    if response.status_code != 200:
        return jsonify({'error': 'Failed to generate image'}), response.status_code

    # 获取完整的响应内容
    response_data = response.content
    logging.debug(f"Response content: {response_data}")

    # 生成图像文件名
    img_filename = f'image_{int(time.time())}.png'
    save_path = os.path.join(app.static_folder, img_filename)

    # 将图像保存到 'static' 目录
    with open(save_path, 'wb') as f:
        f.write(response_data)

    # 构造返回给前端的数据
    img_url = f'https://localhost:7860/static/{img_filename}'
    result = {
        "created": int(time.time()),
        "data": [
            {"url": img_url}
        ]
    }
    return jsonify(result)

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=7860)

工作流参考:

{
  "nodes": [
    {
      "nodeId": "userGuide",
      "name": "core.module.template.User guide",
      "intro": "core.app.tip.userGuideTip",
      "avatar": "/imgs/workflow/userGuide.png",
      "flowNodeType": "userGuide",
      "position": {
        "x": 105.752089632945,
        "y": 693.2377317986357
      },
      "inputs": [
        {
          "key": "welcomeText",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "string",
          "label": "core.app.Welcome Text",
          "type": "hidden",
          "showTargetInApp": false,
          "showTargetInPlugin": false,
          "value": "您好,我是stable-diffusion文生图像绘制助手,您可以按照下面这个格式进行提问:\n[一只赛博朋克猫咪]\n[一只黑白相间的狗在追蝴蝶]",
          "connected": false,
          "selectedTypeIndex": 0
        },
        {
          "key": "variables",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "core.module.Variable",
          "value": [
            {
              "id": "6agumx",
              "key": "AI优化",
              "label": "是否需要使用AI优化提示词?(默认不需要)",
              "type": "select",
              "required": false,
              "maxLen": 50,
              "enums": [
                {
                  "value": "true"
                },
                {
                  "value": "false"
                }
              ],
              "icon": "core/app/variable/select"
            }
          ],
          "type": "hidden",
          "showTargetInApp": false,
          "showTargetInPlugin": false,
          "connected": false,
          "selectedTypeIndex": 0
        },
        {
          "key": "questionGuide",
          "valueType": "boolean",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "type": "switch",
          "showTargetInApp": false,
          "showTargetInPlugin": false,
          "connected": false,
          "selectedTypeIndex": 0
        },
        {
          "key": "tts",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "type": "hidden",
          "showTargetInApp": false,
          "showTargetInPlugin": false,
          "connected": false,
          "selectedTypeIndex": 0
        },
        {
          "key": "whisper",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "type": "hidden",
          "showTargetInApp": false,
          "showTargetInPlugin": false,
          "connected": false,
          "selectedTypeIndex": 0
        },
        {
          "key": "scheduleTrigger",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": null
        }
      ],
      "outputs": []
    },
    {
      "nodeId": "userChatInput",
      "name": "流程开始",
      "intro": "当用户发送一个内容后,流程将会从这个模块开始执行。",
      "avatar": "/imgs/workflow/userChatInput.svg",
      "flowNodeType": "workflowStart",
      "position": {
        "x": -82.2396495525715,
        "y": 1337.1175920296187
      },
      "inputs": [
        {
          "key": "userChatInput",
          "renderTypeList": [
            "reference",
            "textarea"
          ],
          "valueType": "string",
          "label": "问题输入",
          "required": true,
          "toolDescription": "用户问题",
          "type": "systemInput",
          "showTargetInApp": false,
          "showTargetInPlugin": false,
          "connected": false,
          "selectedTypeIndex": 0,
          "value": [
            "userChatInput",
            "userChatInput"
          ]
        }
      ],
      "outputs": [
        {
          "id": "userChatInput",
          "type": "static",
          "key": "userChatInput",
          "valueType": "string",
          "label": "core.module.input.label.user question"
        }
      ]
    },
    {
      "nodeId": "yYt8CGHxlB6x",
      "name": "提示词整理",
      "intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
      "avatar": "/imgs/workflow/http.png",
      "flowNodeType": "httpRequest468",
      "showStatus": true,
      "position": {
        "x": 2125.507213046014,
        "y": 950.3076161071813
      },
      "inputs": [
        {
          "key": "system_addInputParam",
          "renderTypeList": [
            "addInputParam"
          ],
          "valueType": "dynamic",
          "label": "",
          "required": false,
          "description": "core.module.input.description.HTTP Dynamic Input",
          "editField": {
            "key": true,
            "valueType": true
          }
        },
        {
          "key": "prompt",
          "valueType": "string",
          "label": "prompt",
          "renderTypeList": [
            "reference"
          ],
          "description": "",
          "canEdit": true,
          "editField": {
            "key": true,
            "valueType": true
          },
          "value": [
            "userChatInput",
            "userChatInput"
          ]
        },
        {
          "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://api.deeplx.org/translate"
        },
        {
          "key": "system_httpHeader",
          "renderTypeList": [
            "custom"
          ],
          "valueType": "any",
          "value": [
            {
              "key": "Content-Type",
              "type": "string",
              "value": "application/json"
            }
          ],
          "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  \"text\":\" {{prompt}}\",\r\n  \"source_lang\": \"ZH\",\r\n  \"target_lang\": \"EN\"\r\n}",
          "label": "",
          "required": false
        }
      ],
      "outputs": [
        {
          "id": "system_addOutputParam",
          "key": "system_addOutputParam",
          "type": "dynamic",
          "valueType": "dynamic",
          "label": "",
          "editField": {
            "key": true,
            "valueType": true
          }
        },
        {
          "id": "httpRawResponse",
          "key": "httpRawResponse",
          "label": "原始响应",
          "description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
          "valueType": "any",
          "type": "static"
        },
        {
          "id": "z5IjkYsqwogH",
          "type": "dynamic",
          "key": "data",
          "valueType": "string",
          "label": "data"
        }
      ]
    },
    {
      "nodeId": "iQu8fF307nzZ",
      "name": "stable-diffusion绘图",
      "intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
      "avatar": "/imgs/workflow/http.png",
      "flowNodeType": "httpRequest468",
      "showStatus": true,
      "position": {
        "x": 2679.930907376918,
        "y": 864.5386525950726
      },
      "inputs": [
        {
          "key": "system_addInputParam",
          "renderTypeList": [
            "addInputParam"
          ],
          "valueType": "dynamic",
          "label": "",
          "required": false,
          "description": "core.module.input.description.HTTP Dynamic Input",
          "editField": {
            "key": true,
            "valueType": true
          }
        },
        {
          "key": "prompt",
          "valueType": "string",
          "label": "prompt",
          "renderTypeList": [
            "reference"
          ],
          "description": "",
          "canEdit": true,
          "editField": {
            "key": true,
            "valueType": true
          },
          "value": [
            "yYt8CGHxlB6x",
            "z5IjkYsqwogH"
          ]
        },
        {
          "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://localhost:7860/v1/images/generations"
        },
        {
          "key": "system_httpHeader",
          "renderTypeList": [
            "custom"
          ],
          "valueType": "any",
          "value": [
            {
              "key": "Content-Type",
              "type": "string",
              "value": "application/json"
            }
          ],
          "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  \"prompt\": \"{{prompt}}\",\r\n  \"CLOUDFLARE_ACCOUNT_ID\": \"\",\r\n  \"cloudflare_api_token\": \"\"\r\n}",
          "label": "",
          "required": false
        }
      ],
      "outputs": [
        {
          "id": "system_addOutputParam",
          "key": "system_addOutputParam",
          "type": "dynamic",
          "valueType": "dynamic",
          "label": "",
          "editField": {
            "key": true,
            "valueType": true
          }
        },
        {
          "id": "httpRawResponse",
          "key": "httpRawResponse",
          "label": "原始响应",
          "description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
          "valueType": "any",
          "type": "static"
        },
        {
          "id": "q2mkKEFTiGJV",
          "type": "dynamic",
          "key": "data[0].url",
          "valueType": "string",
          "label": "data[0].url"
        }
      ]
    },
    {
      "nodeId": "kom4HKYdbqn1",
      "name": "文本加工",
      "intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。",
      "avatar": "/imgs/workflow/textEditor.svg",
      "flowNodeType": "pluginModule",
      "showStatus": false,
      "position": {
        "x": 3183.196677040183,
        "y": 1195.354830117139
      },
      "inputs": [
        {
          "key": "system_addInputParam",
          "valueType": "dynamic",
          "label": "动态外部数据",
          "renderTypeList": [
            "addInputParam"
          ],
          "required": false,
          "description": "",
          "canEdit": false,
          "value": "",
          "editField": {
            "key": true
          },
          "dynamicParamDefaultValue": {
            "inputType": "reference",
            "valueType": "string",
            "required": true
          }
        },
        {
          "key": "url",
          "valueType": "string",
          "label": "url",
          "renderTypeList": [
            "reference"
          ],
          "description": "",
          "canEdit": true,
          "editField": {
            "key": true
          },
          "value": [
            "iQu8fF307nzZ",
            "q2mkKEFTiGJV"
          ]
        },
        {
          "key": "文本",
          "valueType": "string",
          "label": "文本",
          "renderTypeList": [
            "textarea"
          ],
          "required": true,
          "description": "",
          "canEdit": false,
          "value": "![]({{url}})",
          "editField": {
            "key": true
          },
          "maxLength": "",
          "dynamicParamDefaultValue": {
            "inputType": "reference",
            "valueType": "string",
            "required": true
          }
        }
      ],
      "outputs": [
        {
          "id": "text",
          "type": "static",
          "key": "text",
          "valueType": "string",
          "label": "text",
          "description": ""
        }
      ],
      "pluginId": "community-textEditor"
    },
    {
      "nodeId": "w9LzDqXjCQ9p",
      "name": "指定回复",
      "intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
      "avatar": "/imgs/workflow/reply.png",
      "flowNodeType": "answerNode",
      "position": {
        "x": 3767.6127010920927,
        "y": 1241.225442127843
      },
      "inputs": [
        {
          "key": "text",
          "renderTypeList": [
            "textarea",
            "reference"
          ],
          "valueType": "any",
          "label": "core.module.input.label.Response content",
          "description": "core.module.input.description.Response content",
          "placeholder": "core.module.input.description.Response content",
          "selectedTypeIndex": 1,
          "value": [
            "kom4HKYdbqn1",
            "text"
          ]
        }
      ],
      "outputs": []
    },
    {
      "nodeId": "zhiWJhPk8mw0",
      "name": "判断器",
      "intro": "根据一定的条件,执行不同的分支。",
      "avatar": "/imgs/workflow/ifElse.svg",
      "flowNodeType": "ifElseNode",
      "showStatus": true,
      "position": {
        "x": 402.70354675480627,
        "y": 1565.371297801241
      },
      "inputs": [
        {
          "key": "ifElseList",
          "renderTypeList": [
            "hidden"
          ],
          "valueType": "any",
          "label": "",
          "value": [
            {
              "condition": "AND",
              "list": [
                {
                  "variable": [
                    "VARIABLE_NODE_ID",
                    "AI优化"
                  ],
                  "condition": "equalTo",
                  "value": "false"
                }
              ]
            },
            {
              "condition": "AND",
              "list": [
                {
                  "variable": [
                    "VARIABLE_NODE_ID",
                    "AI优化"
                  ],
                  "condition": "equalTo",
                  "value": "true"
                }
              ]
            },
            {
              "condition": "AND",
              "list": [
                {
                  "variable": [
                    "VARIABLE_NODE_ID",
                    "AI优化"
                  ],
                  "condition": "isEmpty"
                }
              ]
            }
          ]
        }
      ],
      "outputs": [
        {
          "id": "ifElseResult",
          "key": "ifElseResult",
          "label": "判断结果",
          "valueType": "string",
          "type": "static"
        }
      ]
    },
    {
      "nodeId": "tNbjIPgU4HWr",
      "name": "AI 对话",
      "intro": "AI 大模型对话",
      "avatar": "/imgs/workflow/AI.png",
      "flowNodeType": "chatNode",
      "showStatus": true,
      "position": {
        "x": 1473.4417640811891,
        "y": 1947.5533282409522
      },
      "inputs": [
        {
          "key": "model",
          "renderTypeList": [
            "settingLLMModel",
            "reference"
          ],
          "label": "core.module.input.label.aiModel",
          "valueType": "string",
          "value": "gpt-3.5-turbo-0125"
        },
        {
          "key": "temperature",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": 0,
          "valueType": "number",
          "min": 0,
          "max": 10,
          "step": 1
        },
        {
          "key": "maxToken",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": 2000,
          "valueType": "number",
          "min": 100,
          "max": 4000,
          "step": 50
        },
        {
          "key": "isResponseAnswerText",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "value": true,
          "valueType": "boolean"
        },
        {
          "key": "quoteTemplate",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "valueType": "string"
        },
        {
          "key": "quotePrompt",
          "renderTypeList": [
            "hidden"
          ],
          "label": "",
          "valueType": "string"
        },
        {
          "key": "systemPrompt",
          "renderTypeList": [
            "textarea",
            "reference"
          ],
          "max": 3000,
          "valueType": "string",
          "label": "core.ai.Prompt",
          "description": "core.app.tip.chatNodeSystemPromptTip",
          "placeholder": "core.app.tip.chatNodeSystemPromptTip",
          "value": "作为 Stable Diffusion Prompt 提示词专家,您将从关键词中创建提示,通常来自 Danbooru 等数据库。\n\n提示通常描述图像,使用常见词汇,按重要性排列,并用逗号分隔。避免使用\"-\"或\".\",但可以接受空格和自然语言。避免词汇重复。\n\n为了强调关键词,请将其放在括号中以增加其权重。例如,\"(flowers)\"将'flowers'的权重增加1.1倍,而\"(((flowers)))\"将其增加1.331倍。使用\"(flowers:1.5)\"将'flowers'的权重增加1.5倍。只为重要的标签增加权重。\n\n提示包括三个部分:**前缀**(质量标签+风格词+效果器)+ **主题**(图像的主要焦点)+ **场景**(背景、环境)。\n\n*   前缀影响图像质量。像\"masterpiece\"、\"best quality\"、\"4k\"这样的标签可以提高图像的细节。像\"illustration\"、\"lensflare\"这样的风格词定义图像的风格。像\"bestlighting\"、\"lensflare\"、\"depthoffield\"这样的效果器会影响光照和深度。\n\n*   主题是图像的主要焦点,如角色或场景。对主题进行详细描述可以确保图像丰富而详细。增加主题的权重以增强其清晰度。对于角色,描述面部、头发、身体、服装、姿势等特征。\n\n*   场景描述环境。没有场景,图像的背景是平淡的,主题显得过大。某些主题本身包含场景(例如建筑物、风景)。像\"花草草地\"、\"阳光\"、\"河流\"这样的环境词可以丰富场景。你的任务是设计图像生成的提示。请按照以下步骤进行操作:\n\n1.  我会发送给您一个图像场景。需要你生成详细的图像描述\n2.  图像描述必须是英文,输出为Positive Prompt。\n3.  设计 Negetive Prompt,即图像中要避免的元素,创建标准的稳定扩散提示(英文),输出为 Negetive Prompt。\n\n示例:\n\n我发送:二战时期的护士。\n您回复只回复:\nPositive Prompt\n\nA WWII-era nurse in a German uniform, holding a wine bottle and stethoscope, sitting at a table in white attire, with a table in the background, masterpiece, best quality, 4k, illustration style, best lighting, depth of field, detailed character, detailed environment.\n\nNegetive Prompt\n\nCartoon, 3D, disfigured, bad art, deformed, extra limbs, close-up, black and white, weird colors, blurry, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, ugly, blurry, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, out of frame, ugly, extra limbs, bad anatomy, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, mutated hands, fused fingers, too many fingers, long neck, Photoshop, video game, ugly, tiling, poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, mutation, mutated, extra limbs, extra legs, extra arms, disfigured, deformed, cross-eyed, body out of frame, blurry, bad art, bad anatomy, 3D render\n"
        },
        {
          "key": "history",
          "renderTypeList": [
            "numberInput",
            "reference"
          ],
          "valueType": "chatHistory",
          "label": "core.module.input.label.chat history",
          "description": "最多携带多少轮对话记录",
          "required": true,
          "min": 0,
          "max": 50,
          "value": 0
        },
        {
          "key": "userChatInput",
          "renderTypeList": [
            "reference",
            "textarea"
          ],
          "valueType": "string",
          "label": "用户问题",
          "required": true,
          "toolDescription": "用户问题",
          "value": [
            "userChatInput",
            "userChatInput"
          ]
        },
        {
          "key": "quoteQA",
          "renderTypeList": [
            "settingDatasetQuotePrompt"
          ],
          "label": "",
          "debugLabel": "知识库引用",
          "description": "",
          "valueType": "datasetQuote"
        }
      ],
      "outputs": [
        {
          "id": "history",
          "key": "history",
          "label": "core.module.output.label.New context",
          "description": "core.module.output.description.New context",
          "valueType": "chatHistory",
          "type": "static"
        },
        {
          "id": "answerText",
          "key": "answerText",
          "label": "core.module.output.label.Ai response content",
          "description": "core.module.output.description.Ai response content",
          "valueType": "string",
          "type": "static"
        }
      ]
    },
    {
      "nodeId": "szqvHMArA7rG",
      "name": "stable-diffusion(AI)",
      "intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
      "avatar": "/imgs/workflow/http.png",
      "flowNodeType": "httpRequest468",
      "showStatus": true,
      "position": {
        "x": 2251.7681229304485,
        "y": 1941.8109977679328
      },
      "inputs": [
        {
          "key": "system_addInputParam",
          "renderTypeList": [
            "addInputParam"
          ],
          "valueType": "dynamic",
          "label": "",
          "required": false,
          "description": "core.module.input.description.HTTP Dynamic Input",
          "editField": {
            "key": true,
            "valueType": true
          }
        },
        {
          "key": "prompt",
          "valueType": "string",
          "label": "prompt",
          "renderTypeList": [
            "reference"
          ],
          "description": "",
          "canEdit": true,
          "editField": {
            "key": true,
            "valueType": true
          },
          "value": [
            "tNbjIPgU4HWr",
            "answerText"
          ]
        },
        {
          "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://localhost:7860/v1/images/generations"
        },
        {
          "key": "system_httpHeader",
          "renderTypeList": [
            "custom"
          ],
          "valueType": "any",
          "value": [
            {
              "key": "Content-Type",
              "type": "string",
              "value": "application/json"
            }
          ],
          "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  \"prompt\": \"{{prompt}}\",\r\n  \"CLOUDFLARE_ACCOUNT_ID\": \"\",\r\n  \"cloudflare_api_token\": \"\"\r\n}",
          "label": "",
          "required": false
        }
      ],
      "outputs": [
        {
          "id": "system_addOutputParam",
          "key": "system_addOutputParam",
          "type": "dynamic",
          "valueType": "dynamic",
          "label": "",
          "editField": {
            "key": true,
            "valueType": true
          }
        },
        {
          "id": "httpRawResponse",
          "key": "httpRawResponse",
          "label": "原始响应",
          "description": "HTTP请求的原始响应。只能接受字符串或JSON类型响应数据。",
          "valueType": "any",
          "type": "static"
        },
        {
          "id": "q2mkKEFTiGJV",
          "type": "dynamic",
          "key": "data[0].url",
          "valueType": "string",
          "label": "data[0].url"
        }
      ]
    },
    {
      "nodeId": "tWZNHoEq1KlA",
      "name": "文本加工AI",
      "intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。",
      "avatar": "/imgs/workflow/textEditor.svg",
      "flowNodeType": "pluginModule",
      "showStatus": false,
      "position": {
        "x": 2752.644944839753,
        "y": 1970.0110276298715
      },
      "inputs": [
        {
          "key": "system_addInputParam",
          "valueType": "dynamic",
          "label": "动态外部数据",
          "renderTypeList": [
            "addInputParam"
          ],
          "required": false,
          "description": "",
          "canEdit": false,
          "value": "",
          "editField": {
            "key": true
          },
          "dynamicParamDefaultValue": {
            "inputType": "reference",
            "valueType": "string",
            "required": true
          }
        },
        {
          "key": "url",
          "valueType": "string",
          "label": "url",
          "renderTypeList": [
            "reference"
          ],
          "description": "",
          "canEdit": true,
          "editField": {
            "key": true
          },
          "value": [
            "szqvHMArA7rG",
            "q2mkKEFTiGJV"
          ]
        },
        {
          "key": "文本",
          "valueType": "string",
          "label": "文本",
          "renderTypeList": [
            "textarea"
          ],
          "required": true,
          "description": "",
          "canEdit": false,
          "value": "![]({{url}})",
          "editField": {
            "key": true
          },
          "maxLength": "",
          "dynamicParamDefaultValue": {
            "inputType": "reference",
            "valueType": "string",
            "required": true
          }
        }
      ],
      "outputs": [
        {
          "id": "text",
          "type": "static",
          "key": "text",
          "valueType": "string",
          "label": "text",
          "description": ""
        }
      ],
      "pluginId": "community-textEditor"
    },
    {
      "nodeId": "yAKGUGkorRxj",
      "name": "指定回复",
      "intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
      "avatar": "/imgs/workflow/reply.png",
      "flowNodeType": "answerNode",
      "position": {
        "x": 3298.23037529255,
        "y": 2080.7181833029563
      },
      "inputs": [
        {
          "key": "text",
          "renderTypeList": [
            "textarea",
            "reference"
          ],
          "valueType": "any",
          "label": "core.module.input.label.Response content",
          "description": "core.module.input.description.Response content",
          "placeholder": "core.module.input.description.Response content",
          "selectedTypeIndex": 1,
          "value": [
            "tWZNHoEq1KlA",
            "text"
          ]
        }
      ],
      "outputs": []
    }
  ],
  "edges": [
    {
      "source": "yYt8CGHxlB6x",
      "target": "iQu8fF307nzZ",
      "sourceHandle": "yYt8CGHxlB6x-source-right",
      "targetHandle": "iQu8fF307nzZ-target-left"
    },
    {
      "source": "iQu8fF307nzZ",
      "target": "kom4HKYdbqn1",
      "sourceHandle": "iQu8fF307nzZ-source-right",
      "targetHandle": "kom4HKYdbqn1-target-left"
    },
    {
      "source": "kom4HKYdbqn1",
      "target": "w9LzDqXjCQ9p",
      "sourceHandle": "kom4HKYdbqn1-source-right",
      "targetHandle": "w9LzDqXjCQ9p-target-left"
    },
    {
      "source": "userChatInput",
      "target": "zhiWJhPk8mw0",
      "sourceHandle": "userChatInput-source-right",
      "targetHandle": "zhiWJhPk8mw0-target-left"
    },
    {
      "source": "zhiWJhPk8mw0",
      "target": "yYt8CGHxlB6x",
      "sourceHandle": "zhiWJhPk8mw0-source-IF",
      "targetHandle": "yYt8CGHxlB6x-target-left"
    },
    {
      "source": "zhiWJhPk8mw0",
      "target": "tNbjIPgU4HWr",
      "sourceHandle": "zhiWJhPk8mw0-source-ELSE IF 1",
      "targetHandle": "tNbjIPgU4HWr-target-left"
    },
    {
      "source": "tWZNHoEq1KlA",
      "target": "yAKGUGkorRxj",
      "sourceHandle": "tWZNHoEq1KlA-source-right",
      "targetHandle": "yAKGUGkorRxj-target-left"
    },
    {
      "source": "szqvHMArA7rG",
      "target": "tWZNHoEq1KlA",
      "sourceHandle": "szqvHMArA7rG-source-right",
      "targetHandle": "tWZNHoEq1KlA-target-left"
    },
    {
      "source": "tNbjIPgU4HWr",
      "target": "szqvHMArA7rG",
      "sourceHandle": "tNbjIPgU4HWr-source-right",
      "targetHandle": "szqvHMArA7rG-target-left"
    },
    {
      "source": "zhiWJhPk8mw0",
      "target": "tNbjIPgU4HWr",
      "sourceHandle": "zhiWJhPk8mw0-source-ELSE IF 2",
      "targetHandle": "tNbjIPgU4HWr-target-left"
    }
  ]
}

一堆缺点肯定挺明显的,不过玩玩足够了

鸣谢

鸣谢2

  • CF大善人
9 个赞

没看懂

5 个赞

大佬牛,我学习

2 个赞

就是fastgpt上面的一个简单的工作流,可以在这上面调用CF的SD模型,只不过生成的图片需要一个flask应用进行转换托管,然后url访问,也可以把gpt的提示词优化也加进去,废大劲,最后只实现一个文生图的应用 :joy:

2 个赞

自动优化提示词后再生成图片?

3 个赞

对啊,贼简单的逻辑,虽然我暂时没发现区别,

2 个赞

这个会很慢吧

3 个赞

对啊,所以废大劲只不过可以给fastgpt多一个应用

2 个赞

10秒一张图吧,也还好

2 个赞

666

2 个赞

太强啦!

2 个赞

都是干货啊

2 个赞

mark

2 个赞

感谢分享

1 个赞

这就触及到我知识盲区了 :rofl:

1 个赞

这个正常,所以就只放了个文生图的

1 个赞