Commit 21969300 by Archer Committed by GitHub

App template market (#2337)

* feat: add app template market (#2012)

* feat: add app template market

* fix

* fix

* i18n

* fix

* perf: template market ux

* perf: simple mode app ui

* perf: tempalte modal ui

* perf: tempalte market ui

* perf: template position

* feat: create app modal

* regiter default app

* perf: icon

* change templates position (#2331)

* change templates position

* fix

* perf: template market ux

---------

Co-authored-by: heheer <heheer@sealos.io>
parent 231afc4a
...@@ -37,6 +37,7 @@ export type FastGPTFeConfigsType = { ...@@ -37,6 +37,7 @@ export type FastGPTFeConfigsType = {
chatbotUrl?: string; chatbotUrl?: string;
openAPIDocUrl?: string; openAPIDocUrl?: string;
systemPluginCourseUrl?: string; systemPluginCourseUrl?: string;
appTemplateCourse?: string;
systemTitle?: string; systemTitle?: string;
systemDescription?: string; systemDescription?: string;
......
...@@ -29,3 +29,12 @@ export const defaultAppSelectFileConfig: AppFileSelectConfigType = { ...@@ -29,3 +29,12 @@ export const defaultAppSelectFileConfig: AppFileSelectConfigType = {
canSelectImg: false, canSelectImg: false,
maxFiles: 10 maxFiles: 10
}; };
export enum AppTemplateTypeEnum {
recommendation = 'recommendation',
writing = 'writing',
imageGeneration = 'image-generation',
webSearch = 'web-search',
roleplay = 'roleplay',
officeServices = 'office-services'
}
...@@ -24,7 +24,7 @@ import { FlowNodeTemplateType, StoreNodeItemType } from './node'; ...@@ -24,7 +24,7 @@ import { FlowNodeTemplateType, StoreNodeItemType } from './node';
export type WorkflowTemplateBasicType = { export type WorkflowTemplateBasicType = {
nodes: StoreNodeItemType[]; nodes: StoreNodeItemType[];
edges: StoreEdgeItemType[]; edges: StoreEdgeItemType[];
chatConfigs?: AppChatConfigType; chatConfig?: AppChatConfigType;
}; };
export type WorkflowTemplateType = { export type WorkflowTemplateType = {
id: string; id: string;
...@@ -46,7 +46,18 @@ export type WorkflowTemplateType = { ...@@ -46,7 +46,18 @@ export type WorkflowTemplateType = {
// template market // template market
export type TemplateMarketItemType = WorkflowTemplateType & { export type TemplateMarketItemType = WorkflowTemplateType & {
tags?: { id: string; label: string }[]; tags: string[];
type: AppTypeEnum.simple | AppTypeEnum.workflow | AppTypeEnum.plugin;
};
// template market list
export type TemplateMarketListItemType = {
id: string;
name: string;
intro?: string;
author?: string;
tags: string[];
type: AppTypeEnum.simple | AppTypeEnum.workflow | AppTypeEnum.plugin;
avatar: string;
}; };
// system plugin // system plugin
......
...@@ -9,6 +9,7 @@ import { ...@@ -9,6 +9,7 @@ import {
import { SubPlanType } from '@fastgpt/global/support/wallet/sub/type'; import { SubPlanType } from '@fastgpt/global/support/wallet/sub/type';
import { WorkerNameEnum, WorkerPool } from './worker/utils'; import { WorkerNameEnum, WorkerPool } from './worker/utils';
import { Worker } from 'worker_threads'; import { Worker } from 'worker_threads';
import { TemplateMarketItemType } from '@fastgpt/global/core/workflow/type';
declare global { declare global {
var feConfigs: FastGPTFeConfigsType; var feConfigs: FastGPTFeConfigsType;
...@@ -25,4 +26,5 @@ declare global { ...@@ -25,4 +26,5 @@ declare global {
var systemLoadedGlobalConfig: boolean; var systemLoadedGlobalConfig: boolean;
var workerPoll: Record<WorkerNameEnum, WorkerPool>; var workerPoll: Record<WorkerNameEnum, WorkerPool>;
var appMarketTemplates: TemplateMarketItemType[];
} }
...@@ -61,6 +61,7 @@ export const iconPaths = { ...@@ -61,6 +61,7 @@ export const iconPaths = {
'common/text/t': () => import('./icons/common/text/t.svg'), 'common/text/t': () => import('./icons/common/text/t.svg'),
'common/tickFill': () => import('./icons/common/tickFill.svg'), 'common/tickFill': () => import('./icons/common/tickFill.svg'),
'common/trash': () => import('./icons/common/trash.svg'), 'common/trash': () => import('./icons/common/trash.svg'),
'common/upRightArrowLight': () => import('./icons/common/upRightArrowLight.svg'),
'common/uploadFileFill': () => import('./icons/common/uploadFileFill.svg'), 'common/uploadFileFill': () => import('./icons/common/uploadFileFill.svg'),
'common/viewLight': () => import('./icons/common/viewLight.svg'), 'common/viewLight': () => import('./icons/common/viewLight.svg'),
'common/voiceLight': () => import('./icons/common/voiceLight.svg'), 'common/voiceLight': () => import('./icons/common/voiceLight.svg'),
......
<?xml version="1.0" standalone="no"?> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17 16" >
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1694224177076" <path fill-rule="evenodd" clip-rule="evenodd" d="M7.98468 2.66665C5.40735 2.66665 3.31801 4.75598 3.31801 7.33331C3.31801 9.91064 5.40735 12 7.98468 12C9.24198 12 10.3831 11.5028 11.2223 10.6942C11.2398 10.6714 11.259 10.6495 11.2799 10.6286C11.3008 10.6077 11.3228 10.5885 11.3456 10.5709C12.1541 9.73178 12.6513 8.59061 12.6513 7.33331C12.6513 4.75598 10.562 2.66665 7.98468 2.66665ZM12.6726 11.0784C13.4937 10.052 13.9847 8.74999 13.9847 7.33331C13.9847 4.0196 11.2984 1.33331 7.98468 1.33331C4.67097 1.33331 1.98468 4.0196 1.98468 7.33331C1.98468 10.647 4.67097 13.3333 7.98468 13.3333C9.40136 13.3333 10.7034 12.8423 11.7298 12.0212L14.1799 14.4714C14.4403 14.7317 14.8624 14.7317 15.1228 14.4714C15.3831 14.211 15.3831 13.7889 15.1228 13.5286L12.6726 11.0784Z" />
class="icon" viewBox="0 0 1026 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3984"
xmlns:xlink="http://www.w3.org/1999/xlink" width="64.125" height="64">
<path
d="M989.365124 873.455175c21.85764 24.973422 33.760499 46.831061 35.714294 65.567202 1.948078 18.730424-5.271103 37.076377-21.661831 55.026425-18.736141 21.075836-39.416072 31.030616-62.055515 29.858625-22.633727-1.171991-44.491366-10.344968-65.567202-27.513213L679.093265 806.715982c-35.128298 22.633727-72.786383 40.197876-112.989976 52.68673-40.197876 12.488855-82.545355 18.730424-127.036721 18.730424-60.882095 0-117.863745-11.512672-170.940663-34.536586-53.078347-23.029631-99.523509-54.446147-139.331197-94.252406-39.811976-39.811976-71.228492-86.25285-94.252406-139.329768C11.512672 556.93603 0 499.950092 0 439.066568c0-60.883524 11.512672-117.863745 34.542303-170.940663 23.023914-53.078347 54.44043-99.523509 94.252406-139.331197 39.807688-39.811976 86.25285-71.228492 139.331197-94.252406 53.076918-23.029631 110.058568-34.542303 170.940663-34.542303 60.883524 0 117.869462 11.512672 170.94638 34.542303 53.078347 23.023914 99.517792 54.44043 139.329768 94.252406 39.807688 39.807688 71.222775 86.25285 94.252406 139.331197 23.023914 53.076918 34.536586 110.057139 34.536586 170.940663 0 46.054974-6.633185 89.764536-19.903844 131.134403s-32.002511 79.619664-56.198417 114.742246l38.639985 38.639985c18.730424 18.730424 38.439889 38.249797 59.124108 58.543829s39.61188 39.416072 56.784413 57.371837C973.754771 857.448917 984.680017 868.771497 989.365124 873.455175L989.365124 873.455175zM443.751675 731.779995c40.588063 0 78.83786-7.609369 114.742246-22.829535 35.904385-15.224454 67.13081-36.105911 93.66641-62.641511 26.541317-26.541317 47.422774-57.762025 62.641511-93.66641 15.218737-35.910102 22.835252-74.154183 22.835252-114.747963 0-40.589492-7.615086-78.832143-22.835252-114.742246-15.218737-35.905815-36.100194-67.125093-62.641511-93.667839-26.5356-26.5356-57.762025-47.415628-93.66641-62.641511-35.904385-15.218737-74.154183-22.828106-114.742246-22.828106-40.589492 0-78.83929 7.609369-114.743675 22.828106-35.904385 15.225883-67.129381 36.105911-93.66641 62.641511-26.541317 26.542747-47.422774 57.762025-62.641511 93.667839-15.218737 35.910102-22.829535 74.152753-22.829535 114.742246 0 40.59378 7.610798 78.83786 22.829535 114.747963 15.218737 35.904385 36.100194 67.125093 62.641511 93.66641 26.53703 26.5356 57.762025 47.417057 93.66641 62.641511C364.912385 724.170627 403.162183 731.779995 443.751675 731.779995L443.751675 731.779995zM443.751675 731.779995"
p-id="3985"></path>
</svg> </svg>
\ No newline at end of file
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 24" >
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.07144 6.34314C9.07144 6.89543 9.51916 7.34315 10.0714 7.34314H16.1425L6.53591 16.9497C6.14539 17.3403 6.14539 17.9734 6.53591 18.364C6.92643 18.7545 7.5596 18.7545 7.95012 18.364L17.5567 8.75736L17.5567 14.8284C17.5567 15.3807 18.0044 15.8284 18.5567 15.8284C19.109 15.8284 19.5567 15.3807 19.5567 14.8284L19.5567 6.34314C19.5567 5.79086 19.109 5.34314 18.5567 5.34315H10.0714C9.51916 5.34314 9.07144 5.79086 9.07144 6.34314Z" />
</svg>
\ No newline at end of file
import React from 'react';
import { InputGroup, Input, InputProps, Flex } from '@chakra-ui/react';
import MyIcon from '../../Icon';
const SearchInput = (props: InputProps) => {
return (
<Flex alignItems={'center'} position={'relative'}>
<Input {...props} />
<MyIcon name={'common/searchLight'} w={'1rem'} position={'absolute'} left={2} zIndex={10} />
</Flex>
);
};
export default SearchInput;
...@@ -8,10 +8,10 @@ import { ...@@ -8,10 +8,10 @@ import {
MenuButton, MenuButton,
MenuItemProps MenuItemProps
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import MyIcon from '../Icon';
import MyDivider from '../MyDivider'; import MyDivider from '../MyDivider';
import type { IconNameType } from '../Icon/type'; import type { IconNameType } from '../Icon/type';
import { useSystem } from '../../../hooks/useSystem'; import { useSystem } from '../../../hooks/useSystem';
import Avatar from '../Avatar';
export type MenuItemType = 'primary' | 'danger'; export type MenuItemType = 'primary' | 'danger';
...@@ -172,7 +172,7 @@ const MyMenu = ({ ...@@ -172,7 +172,7 @@ const MyMenu = ({
_notLast={{ mb: 0.5 }} _notLast={{ mb: 0.5 }}
{...typeMapStyle[child.type || 'primary']} {...typeMapStyle[child.type || 'primary']}
> >
{!!child.icon && <MyIcon name={child.icon as any} w={iconSize} mr={3} />} {!!child.icon && <Avatar src={child.icon as any} w={iconSize} mr={3} />}
<Box> <Box>
<Box color={child.description ? 'myGray.900' : 'inherit'} fontSize={'sm'}> <Box color={child.description ? 'myGray.900' : 'inherit'} fontSize={'sm'}>
{child.label} {child.label}
......
...@@ -9,7 +9,6 @@ import { ...@@ -9,7 +9,6 @@ import {
Box, Box,
Image Image
} from '@chakra-ui/react'; } from '@chakra-ui/react';
import MyIcon from '../Icon';
import MyBox from '../MyBox'; import MyBox from '../MyBox';
import { useSystem } from '../../../hooks/useSystem'; import { useSystem } from '../../../hooks/useSystem';
import Avatar from '../Avatar'; import Avatar from '../Avatar';
......
...@@ -35,7 +35,8 @@ export default function Editor({ ...@@ -35,7 +35,8 @@ export default function Editor({
onBlur, onBlur,
value, value,
placeholder = '', placeholder = '',
isFlow isFlow,
bg = 'white'
}: { }: {
h?: number; h?: number;
maxLength?: number; maxLength?: number;
...@@ -49,6 +50,7 @@ export default function Editor({ ...@@ -49,6 +50,7 @@ export default function Editor({
value?: string; value?: string;
placeholder?: string; placeholder?: string;
isFlow?: boolean; isFlow?: boolean;
bg?: string;
}) { }) {
const [key, setKey] = useState(getNanoid(6)); const [key, setKey] = useState(getNanoid(6));
const [_, startSts] = useTransition(); const [_, startSts] = useTransition();
...@@ -95,6 +97,7 @@ export default function Editor({ ...@@ -95,6 +97,7 @@ export default function Editor({
h={`${height}px`} h={`${height}px`}
cursor={'text'} cursor={'text'}
color={'myGray.700'} color={'myGray.700'}
bg={focus ? 'white' : bg}
> >
<LexicalComposer initialConfig={initialConfig} key={key}> <LexicalComposer initialConfig={initialConfig} key={key}>
<PlainTextPlugin <PlainTextPlugin
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
border: 1px solid rgb(232, 235, 240); border: 1px solid rgb(232, 235, 240);
border-radius: var(--chakra-radii-md); border-radius: var(--chakra-radii-md);
padding: 8px 12px; padding: 8px 12px;
background: #fff; // background: #fff;
font-size: var(--chakra-fontSizes-sm); font-size: var(--chakra-fontSizes-sm);
overflow-y: auto; overflow-y: auto;
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
border: 1px solid var(--chakra-colors-myGray-200); border: 1px solid var(--chakra-colors-myGray-200);
border-radius: var(--chakra-radii-sm); border-radius: var(--chakra-radii-sm);
padding: 6px 8px; padding: 6px 8px;
background: #fff; // background: #fff;
font-size: var(--chakra-fontSizes-sm); font-size: var(--chakra-fontSizes-sm);
overflow-y: auto; overflow-y: auto;
} }
......
import { Button, ModalBody, ModalFooter, useDisclosure } from '@chakra-ui/react'; import { Box, Button, ModalBody, ModalFooter, useDisclosure } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { editorStateToText } from './utils'; import { editorStateToText } from './utils';
import Editor from './Editor'; import Editor from './Editor';
...@@ -20,7 +20,8 @@ const PromptEditor = ({ ...@@ -20,7 +20,8 @@ const PromptEditor = ({
maxLength, maxLength,
placeholder, placeholder,
title, title,
isFlow isFlow,
bg = 'white'
}: { }: {
showOpenModal?: boolean; showOpenModal?: boolean;
showResize?: boolean; showResize?: boolean;
...@@ -34,6 +35,7 @@ const PromptEditor = ({ ...@@ -34,6 +35,7 @@ const PromptEditor = ({
placeholder?: string; placeholder?: string;
title?: string; title?: string;
isFlow?: boolean; isFlow?: boolean;
bg?: string;
}) => { }) => {
const { isOpen, onOpen, onClose } = useDisclosure(); const { isOpen, onOpen, onClose } = useDisclosure();
const { t } = useTranslation(); const { t } = useTranslation();
...@@ -62,6 +64,7 @@ const PromptEditor = ({ ...@@ -62,6 +64,7 @@ const PromptEditor = ({
onBlur={onBlurInput} onBlur={onBlurInput}
placeholder={placeholder} placeholder={placeholder}
isFlow={isFlow} isFlow={isFlow}
bg={bg}
/> />
<MyModal isOpen={isOpen} onClose={onClose} iconSrc="modal/edit" title={title} w={'full'}> <MyModal isOpen={isOpen} onClose={onClose} iconSrc="modal/edit" title={title} w={'full'}>
<ModalBody> <ModalBody>
......
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
"confirm_delete_folder_tip": "Are you sure to delete this folder? All the following applications and corresponding chat records will be deleted, please confirm!", "confirm_delete_folder_tip": "Are you sure to delete this folder? All the following applications and corresponding chat records will be deleted, please confirm!",
"copy_one_app": "Copy", "copy_one_app": "Copy",
"create_copy_success": "Create copy success", "create_copy_success": "Create copy success",
"create_empty_app": "Create default app",
"create_empty_plugin": "Create default plugin",
"create_empty_workflow": "Create default workflow",
"cron": { "cron": {
"every_day": "Executed every day", "every_day": "Executed every day",
"every_month": "Executed monthly", "every_month": "Executed monthly",
...@@ -84,6 +87,22 @@ ...@@ -84,6 +87,22 @@
"template": { "template": {
"simple_robot": "Simple Robot" "simple_robot": "Simple Robot"
}, },
"templateMarket": {
"Search_template": "Search template",
"Template_market": "Template market",
"Use": "Use",
"no_intro": "No intro~",
"templateTags": {
"Image_generation": "Image generation",
"Office_services": "Office searvices",
"Roleplay": "Roleplay",
"Web_search": "Web search",
"Writing": "Writing"
}
},
"template_market": "Templates",
"template_market_description": "Explore more ways to play in the template market, configuration tutorials and usage guides will help you understand and get started with various applications.",
"template_market_empty_data": "No suitable template found",
"time_zone": "Time zone", "time_zone": "Time zone",
"tool_input_param_tip": "Configure related information before the plugin runs properly", "tool_input_param_tip": "Configure related information before the plugin runs properly",
"transition_to_workflow": "Transition to workflow", "transition_to_workflow": "Transition to workflow",
...@@ -91,7 +110,7 @@ ...@@ -91,7 +110,7 @@
"transition_to_workflow_create_new_tip": "After converting to workflow, it will not be able to convert back to simple mode, please confirm!", "transition_to_workflow_create_new_tip": "After converting to workflow, it will not be able to convert back to simple mode, please confirm!",
"type": { "type": {
"All": "All", "All": "All",
"Create http plugin tip": "Create plug-ins in batches using OpenAPI schema, compatible with GPTs format.", "Create http plugin tip": "Create plug-ins in batches using OpenAPI schema, compatible with GPTs format",
"Create one plugin tip": "The input and output workflows can be customized", "Create one plugin tip": "The input and output workflows can be customized",
"Create plugin bot": "Create plugin bot", "Create plugin bot": "Create plugin bot",
"Create simple bot": "Create simple bot", "Create simple bot": "Create simple bot",
...@@ -101,6 +120,7 @@ ...@@ -101,6 +120,7 @@
"Http plugin": "Http plugin", "Http plugin": "Http plugin",
"Plugin": "Plugin", "Plugin": "Plugin",
"Simple bot": "Simple bot", "Simple bot": "Simple bot",
"Template": "Create by template",
"Workflow bot": "Workflow" "Workflow bot": "Workflow"
}, },
"upload_file_max_amount": "Max files", "upload_file_max_amount": "Max files",
......
...@@ -271,6 +271,7 @@ ...@@ -271,6 +271,7 @@
} }
}, },
"confirm_choice": "Confirm selection", "confirm_choice": "Confirm selection",
"contribute_app_template": "Contribution template",
"core": { "core": {
"Chat": "Chat", "Chat": "Chat",
"Max Token": "Max token per data", "Max Token": "Max token per data",
...@@ -1431,5 +1432,6 @@ ...@@ -1431,5 +1432,6 @@
}, },
"type": "type" "type": "type"
}, },
"verification": "verify" "verification": "verify",
"xx_search_result": "{{key}} Search results"
} }
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
"confirm_delete_folder_tip": "确认删除该文件夹?将会删除它下面所有应用及对应的聊天记录,请确认!", "confirm_delete_folder_tip": "确认删除该文件夹?将会删除它下面所有应用及对应的聊天记录,请确认!",
"copy_one_app": "创建副本", "copy_one_app": "创建副本",
"create_copy_success": "创建副本成功", "create_copy_success": "创建副本成功",
"create_empty_app": "创建空白应用",
"create_empty_plugin": "创建空白插件",
"create_empty_workflow": "创建空白工作流",
"cron": { "cron": {
"every_day": "每天执行", "every_day": "每天执行",
"every_month": "每月执行", "every_month": "每月执行",
...@@ -84,6 +87,23 @@ ...@@ -84,6 +87,23 @@
"template": { "template": {
"simple_robot": "简易机器人" "simple_robot": "简易机器人"
}, },
"templateMarket": {
"Search_template": "搜索模板",
"Template_market": "模板市场",
"Use": "使用",
"no_intro": "还没有介绍~",
"templateTags": {
"Image_generation": "图片生成",
"Office_services": "办公服务",
"Recommendation": "推荐",
"Roleplay": "角色扮演",
"Web_search": "联网搜索",
"Writing": "文本创作"
}
},
"template_market": "模板市场",
"template_market_description": "在模板市场探索更多玩法,配置教程与使用引导,带你理解并上手各种应用",
"template_market_empty_data": "找不到合适的模板",
"time_zone": "时区", "time_zone": "时区",
"tool_input_param_tip": "该插件正常运行需要配置相关信息", "tool_input_param_tip": "该插件正常运行需要配置相关信息",
"transition_to_workflow": "转成工作流", "transition_to_workflow": "转成工作流",
...@@ -91,16 +111,18 @@ ...@@ -91,16 +111,18 @@
"transition_to_workflow_create_new_tip": "转化成工作流后,将无法转化回简易模式,请确认!", "transition_to_workflow_create_new_tip": "转化成工作流后,将无法转化回简易模式,请确认!",
"type": { "type": {
"All": "全部", "All": "全部",
"Create http plugin tip": "通过 OpenAPI Schema 批量创建插件,兼容 GPTs 格式。", "Create http plugin tip": "通过 OpenAPI Schema 批量创建插件,兼容 GPTs 格式",
"Create one plugin tip": "可以自定义输入和输出的工作流,通常用于封装重复使用的工作流", "Create one plugin tip": "可以自定义输入和输出的工作流,通常用于封装重复使用的工作流",
"Create plugin bot": "创建插件", "Create plugin bot": "创建插件",
"Create simple bot": "创建简易应用", "Create simple bot": "创建简易应用",
"Create simple bot tip": "通过填表单形式,创建简单的 AI 应用,适合新手", "Create simple bot tip": "通过填表单形式,创建简单的 AI 应用,适合新手",
"Create template tip": "在模板市场探索更多玩法,带你理解并上手各种应用",
"Create workflow bot": "创建工作流", "Create workflow bot": "创建工作流",
"Create workflow tip": "通过低代码的方式,构建逻辑复杂的多轮对话 AI 应用,推荐高级玩家使用", "Create workflow tip": "通过低代码的方式,构建逻辑复杂的多轮对话 AI 应用,推荐高级玩家使用",
"Http plugin": "HTTP 插件", "Http plugin": "HTTP 插件",
"Plugin": "插件", "Plugin": "插件",
"Simple bot": "简易应用", "Simple bot": "简易应用",
"Template": "通过模板创建",
"Workflow bot": "工作流" "Workflow bot": "工作流"
}, },
"upload_file_max_amount": "最大文件数量", "upload_file_max_amount": "最大文件数量",
......
...@@ -273,6 +273,7 @@ ...@@ -273,6 +273,7 @@
} }
}, },
"confirm_choice": "确认选择", "confirm_choice": "确认选择",
"contribute_app_template": "贡献模板",
"core": { "core": {
"Chat": "对话", "Chat": "对话",
"Max Token": "单条数据上限", "Max Token": "单条数据上限",
...@@ -359,6 +360,14 @@ ...@@ -359,6 +360,14 @@
"logs": { "logs": {
"Source And Time": "来源 & 时间" "Source And Time": "来源 & 时间"
}, },
"more": "查看更多",
"navbar": {
"External": "外部使用",
"Flow mode": "高级编排",
"Publish": "发布",
"Publish app": "发布应用",
"Simple mode": "简易配置"
},
"no_app": "还没有应用,快去创建一个吧!", "no_app": "还没有应用,快去创建一个吧!",
"not_published": "未发布", "not_published": "未发布",
"outLink": { "outLink": {
...@@ -598,7 +607,8 @@ ...@@ -598,7 +607,8 @@
"success": "开始同步" "success": "开始同步"
} }
}, },
"training": {} "training": {
}
}, },
"data": { "data": {
"Auxiliary Data": "辅助数据", "Auxiliary Data": "辅助数据",
...@@ -1437,5 +1447,6 @@ ...@@ -1437,5 +1447,6 @@
}, },
"type": "类型" "type": "类型"
}, },
"verification": "验证" "verification": "验证",
"xx_search_result": "{{key}} 的搜索结果"
} }
{ {
"author": "FastGPT Team", "author": "FastGPT",
"version": "481", "version": "481",
"templateType": "other", "templateType": "other",
"name": "自定义反馈", "name": "自定义反馈",
......
{ {
"author": "FastGPT Team", "author": "FastGPT",
"version": "481", "version": "481",
"templateType": "tools", "templateType": "tools",
"name": "获取当前时间", "name": "获取当前时间",
......
{ {
"author": "FastGPT Team", "author": "FastGPT",
"version": "481", "version": "481",
"name": "文本加工", "name": "文本加工",
"avatar": "/imgs/workflow/textEditor.svg", "avatar": "/imgs/workflow/textEditor.svg",
......
{ {
"author": "FastGPT Team", "author": "FastGPT",
"templateType": "other", "templateType": "other",
"name": "自定义反馈", "name": "自定义反馈",
"avatar": "/imgs/module/customFeedback.svg", "avatar": "/imgs/module/customFeedback.svg",
......
{ {
"author": "FastGPT Team", "author": "FastGPT",
"templateType": "tools", "templateType": "tools",
"name": "获取当前时间", "name": "获取当前时间",
"avatar": "/imgs/module/getCurrentTime.svg", "avatar": "/imgs/module/getCurrentTime.svg",
......
{ {
"author": "FastGPT Team", "author": "FastGPT",
"templateType": "tools", "templateType": "tools",
"name": "文本加工", "name": "文本加工",
"avatar": "/imgs/module/textEditor.svg", "avatar": "/imgs/module/textEditor.svg",
......
{ {
"abandon": true, "abandon": true,
"author": "FastGPT Team", "author": "FastGPT",
"templateType": "tools", "templateType": "tools",
"name": "判断器", "name": "判断器",
"avatar": "/imgs/module/tfSwitch.svg", "avatar": "/imgs/module/tfSwitch.svg",
......
{
"name": "问题分类 + 知识库",
"intro": "先对用户的问题进行分类,再根据不同类型问题,执行不同的操作",
"author": "Fastgpt",
"avatar": "core/workflow/template/questionClassify",
"tags": ["office-services"],
"type": "advanced",
"workflow": {
"nodes": [
{
"nodeId": "userGuide",
"name": "系统配置",
"intro": "可以配置应用的系统参数",
"avatar": "core/workflow/template/systemConfig",
"flowNodeType": "FlowNodeTypeEnum.systemConfig",
"position": {
"x": 531.2422736065552,
"y": -486.7611729549753
},
"version": "481",
"inputs": [
{
"key": "welcomeText",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.app.Welcome Text",
"value": "你好,我是知识库助手,请不要忘记选择知识库噢~\n[你是谁]\n[如何使用]"
},
{
"key": "variables",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "core.app.Chat Variable",
"value": []
},
{
"key": "questionGuide",
"valueType": "WorkflowIOValueTypeEnum.boolean",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "core.app.Question Guide",
"value": true
},
{
"key": "tts",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": {
"type": "web"
}
},
{
"key": "whisper",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
}
},
{
"key": "scheduleTrigger",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": null
}
],
"outputs": []
},
{
"nodeId": "workflowStartNodeId",
"name": "流程开始",
"intro": "",
"avatar": "core/workflow/template/workflowStart",
"flowNodeType": "FlowNodeTypeEnum.workflowStart",
"position": {
"x": 558.4082376415505,
"y": 123.72387429194112
},
"version": "481",
"inputs": [
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题"
}
],
"outputs": [
{
"id": "userChatInput",
"key": "userChatInput",
"label": "core.module.input.label.user question",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
},
{
"nodeId": "7BdojPlukIQw",
"name": "AI 对话",
"intro": "AI 大模型对话",
"avatar": "core/workflow/template/aiChat",
"flowNodeType": "FlowNodeTypeEnum.chatNode",
"showStatus": true,
"position": {
"x": 2701.1267277679685,
"y": -767.8956312653042
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": [
"FlowNodeInputTypeEnum.settingLLMModel",
"FlowNodeInputTypeEnum.reference"
],
"label": "core.module.input.label.aiModel",
"valueType": "WorkflowIOValueTypeEnum.string",
"value": "gpt-4o-mini"
},
{
"key": "temperature",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 3,
"valueType": "WorkflowIOValueTypeEnum.number",
"min": 0,
"max": 10,
"step": 1
},
{
"key": "maxToken",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 1950,
"valueType": "WorkflowIOValueTypeEnum.number",
"min": 100,
"max": 4000,
"step": 50
},
{
"key": "isResponseAnswerText",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": true,
"valueType": "WorkflowIOValueTypeEnum.boolean"
},
{
"key": "quoteTemplate",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "quotePrompt",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "systemPrompt",
"renderTypeList": ["FlowNodeInputTypeEnum.textarea", "FlowNodeInputTypeEnum.reference"],
"max": 3000,
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.ai.Prompt",
"description": "core.app.tip.chatNodeSystemPromptTip",
"placeholder": "core.app.tip.chatNodeSystemPromptTip",
"value": ""
},
{
"key": "history",
"renderTypeList": [
"FlowNodeInputTypeEnum.numberInput",
"FlowNodeInputTypeEnum.reference"
],
"valueType": "WorkflowIOValueTypeEnum.chatHistory",
"label": "core.module.input.label.chat history",
"required": true,
"min": 0,
"max": 30,
"value": 6
},
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题",
"value": ["workflowStartNodeId", "userChatInput"]
},
{
"key": "quoteQA",
"renderTypeList": ["FlowNodeInputTypeEnum.settingDatasetQuotePrompt"],
"label": "",
"debugLabel": "知识库引用",
"description": "",
"valueType": "WorkflowIOValueTypeEnum.datasetQuote",
"value": ["MNMMMIjjWyMU", "quoteQA"]
}
],
"outputs": [
{
"id": "history",
"key": "history",
"label": "core.module.output.label.New context",
"description": "core.module.output.description.New context",
"valueType": "WorkflowIOValueTypeEnum.chatHistory",
"type": "FlowNodeOutputTypeEnum.static"
},
{
"id": "answerText",
"key": "answerText",
"label": "core.module.output.label.Ai response content",
"description": "core.module.output.description.Ai response content",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
},
{
"nodeId": "rvbo634w3AYj",
"name": "问题分类",
"intro": "根据用户的历史记录和当前问题判断该次提问的类型。可以添加多组问题类型,下面是一个模板例子:\n类型1: 打招呼\n类型2: 关于商品\"使用\"问题\n类型3: 关于商品\"购买\"问题\n类型4: 其他问题",
"avatar": "core/workflow/template/questionClassify",
"flowNodeType": "FlowNodeTypeEnum.classifyQuestion",
"showStatus": true,
"position": {
"x": 1020.9667229609946,
"y": -385.0060974413916
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": [
"FlowNodeInputTypeEnum.selectLLMModel",
"FlowNodeInputTypeEnum.reference"
],
"label": "core.module.input.label.aiModel",
"required": true,
"valueType": "WorkflowIOValueTypeEnum.string",
"llmModelType": "classify",
"value": "gpt-4o-mini"
},
{
"key": "systemPrompt",
"renderTypeList": ["FlowNodeInputTypeEnum.textarea", "FlowNodeInputTypeEnum.reference"],
"max": 3000,
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.module.input.label.Background",
"description": "core.module.input.description.Background",
"placeholder": "core.module.input.placeholder.Classify background",
"value": ""
},
{
"key": "history",
"renderTypeList": [
"FlowNodeInputTypeEnum.numberInput",
"FlowNodeInputTypeEnum.reference"
],
"valueType": "WorkflowIOValueTypeEnum.chatHistory",
"label": "core.module.input.label.chat history",
"required": true,
"min": 0,
"max": 30,
"value": 6
},
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"value": ["workflowStartNodeId", "userChatInput"]
},
{
"key": "agents",
"renderTypeList": ["FlowNodeInputTypeEnum.custom"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": [
{
"value": "关于电影《星际穿越》的问题",
"key": "wqre"
},
{
"value": "打招呼、问候等问题",
"key": "sdfa"
},
{
"value": "其他问题",
"key": "agex"
}
]
}
],
"outputs": [
{
"id": "cqResult",
"key": "cqResult",
"label": "分类结果",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
},
{
"nodeId": "7kwgL1dVlwG6",
"name": "指定回复",
"intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
"avatar": "core/workflow/template/reply",
"flowNodeType": "FlowNodeTypeEnum.answerNode",
"position": {
"x": 1874.9167551056487,
"y": 434.98431875888207
},
"version": "481",
"inputs": [
{
"key": "text",
"renderTypeList": ["FlowNodeInputTypeEnum.textarea", "FlowNodeInputTypeEnum.reference"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.module.input.label.Response content",
"description": "core.module.input.description.Response content",
"placeholder": "core.module.input.description.Response content",
"selectedTypeIndex": 1,
"value": ["rvbo634w3AYj", "cqResult"]
}
],
"outputs": []
},
{
"nodeId": "MNMMMIjjWyMU",
"name": "知识库搜索",
"intro": "调用\"语义检索\"和\"全文检索\"能力,从\"知识库\"中查找可能与问题相关的参考内容",
"avatar": "core/workflow/template/datasetSearch",
"flowNodeType": "FlowNodeTypeEnum.datasetSearchNode",
"showStatus": true,
"position": {
"x": 1851.010152279949,
"y": -613.3555232387284
},
"version": "481",
"inputs": [
{
"key": "datasets",
"renderTypeList": [
"FlowNodeInputTypeEnum.selectDataset",
"FlowNodeInputTypeEnum.reference"
],
"label": "core.module.input.label.Select dataset",
"value": [],
"valueType": "WorkflowIOValueTypeEnum.selectDataset",
"list": [],
"required": true
},
{
"key": "similarity",
"renderTypeList": ["FlowNodeInputTypeEnum.selectDatasetParamsModal"],
"label": "",
"value": 0.4,
"valueType": "WorkflowIOValueTypeEnum.number"
},
{
"key": "limit",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 1500,
"valueType": "WorkflowIOValueTypeEnum.number"
},
{
"key": "searchMode",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string",
"value": "embedding"
},
{
"key": "usingReRank",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.boolean",
"value": false
},
{
"key": "datasetSearchUsingExtensionQuery",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.boolean",
"value": true
},
{
"key": "datasetSearchExtensionModel",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "datasetSearchExtensionBg",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string",
"value": ""
},
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "需要检索的内容",
"value": ["workflowStartNodeId", "userChatInput"]
}
],
"outputs": [
{
"id": "quoteQA",
"key": "quoteQA",
"label": "core.module.Dataset quote.label",
"description": "特殊数组格式,搜索结果为空时,返回空数组。",
"type": "FlowNodeOutputTypeEnum.static",
"valueType": "WorkflowIOValueTypeEnum.datasetQuote"
}
]
}
],
"edges": [
{
"source": "workflowStartNodeId",
"target": "rvbo634w3AYj",
"sourceHandle": "workflowStartNodeId-source-right",
"targetHandle": "rvbo634w3AYj-target-left"
},
{
"source": "rvbo634w3AYj",
"target": "7kwgL1dVlwG6",
"sourceHandle": "rvbo634w3AYj-source-agex",
"targetHandle": "7kwgL1dVlwG6-target-left"
},
{
"source": "rvbo634w3AYj",
"target": "MNMMMIjjWyMU",
"sourceHandle": "rvbo634w3AYj-source-wqre",
"targetHandle": "MNMMMIjjWyMU-target-left"
},
{
"source": "MNMMMIjjWyMU",
"target": "7BdojPlukIQw",
"sourceHandle": "MNMMMIjjWyMU-source-right",
"targetHandle": "7BdojPlukIQw-target-left"
},
{
"source": "rvbo634w3AYj",
"target": "7kwgL1dVlwG6",
"sourceHandle": "rvbo634w3AYj-source-sdfa",
"targetHandle": "7kwgL1dVlwG6-target-left"
}
]
}
}
{
"name": "多轮翻译机器人",
"intro": "通过 4 轮翻译,提高翻译英文的质量",
"author": "Fastgpt",
"avatar": "/appMarketTemplates/TranslateRobot/avatar.svg",
"tags": ["office-services"],
"type": "advanced",
"workflow": {
"nodes": [
{
"nodeId": "userGuide",
"name": "系统配置",
"intro": "可以配置应用的系统参数",
"avatar": "/imgs/workflow/userGuide.png",
"flowNodeType": "userGuide",
"position": {
"x": 531.2422736065552,
"y": -486.7611729549753
},
"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": "boolean",
"renderTypeList": ["hidden"],
"label": "core.app.Question Guide",
"value": 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": "流程开始",
"intro": "",
"avatar": "/imgs/workflow/userChatInput.svg",
"flowNodeType": "workflowStart",
"position": {
"x": 558.4082376415505,
"y": 123.72387429194112
},
"version": "481",
"inputs": [
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题"
}
],
"outputs": [
{
"id": "userChatInput",
"key": "userChatInput",
"label": "core.module.input.label.user question",
"type": "static",
"valueType": "string"
}
]
},
{
"nodeId": "loOvhld2ZTKa",
"name": "第一轮翻译",
"intro": "AI 大模型对话",
"avatar": "/imgs/workflow/AI.png",
"flowNodeType": "chatNode",
"showStatus": true,
"position": {
"x": 1748.8252410306534,
"y": -245.08260685989214
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": ["settingLLMModel", "reference"],
"label": "core.module.input.label.aiModel",
"valueType": "string",
"value": "claude-3-5-sonnet-20240620"
},
{
"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": "# Role: 资深英汉翻译专家\n\n## Background:\n你是一位经验丰富的英汉翻译专家,精通英汉互译,尤其擅长将英文文章译成流畅易懂的现代汉语。你曾多次带领团队完成大型翻译项目,译文广受好评。\n\n## Attention:\n- 翻译过程中要始终坚持\"信、达、雅\"的原则,但\"达\"尤为重要\n- 译文要符合现代汉语的表达习惯,通俗易懂,连贯流畅 \n- 避免使用过于文绉绉的表达和晦涩难懂的典故引用\n\n## Profile: \n- Author: 米开朗基杨 \n- Version: 0.2\n- Language: 中文\n- Description: 你是一位资深英汉翻译专家,精通英汉互译。你擅长将英文文章译成地道流畅的现代汉语,表达准确易懂,符合当代中文语言习惯。\n\n## Constraints:\n- 必须严格遵循四轮翻译流程:直译、意译、校审、定稿 \n- 译文要忠实原文,准确无误,不能遗漏或曲解原意\n- 译文应以现代白话文为主,避免过多使用文言文和古典诗词\n- 每一轮翻译前后必须添加【思考】和【翻译】标记\n- 最终译文使用Markdown的代码块呈现\n\n## Goals:\n- 通过四轮翻译流程,将英文原文译成高质量的现代汉语译文 \n- 译文要准确传达原文意思,语言表达力求浅显易懂,朗朗上口\n- 适度使用一些熟语俗语、流行网络用语等,增强译文的亲和力\n- 在直译的基础上,提供至少2个不同风格的意译版本供选择\n\n## Skills:\n- 精通英汉双语,具有扎实的语言功底和丰富的翻译经验\n- 擅长将英语表达习惯转换为地道自然的现代汉语\n- 对当代中文语言的发展变化有敏锐洞察,善于把握语言流行趋势\n\n## Workflow:\n1. 第一轮直译:逐字逐句忠实原文,不遗漏任何信息\n2. 第二轮意译:在直译的基础上用通俗流畅的现代汉语意译原文,至少提供2个不同风格的版本\n3. 第三轮校审:仔细审视译文,消除偏差和欠缺,使译文更加地道易懂 \n4. 第四轮定稿:择优选取,反复修改润色,最终定稿出一个简洁畅达、符合大众阅读习惯的译文\n\n## OutputFormat: \n- 每一轮翻译前用【思考】说明该轮要点\n- 每一轮翻译后用【翻译】呈现译文\n- 在\\`\\`\\`代码块中展示最终定稿译文\n\n## Suggestions:\n- 直译时力求忠实原文,但不要过于拘泥逐字逐句\n- 意译时在准确表达原意的基础上,用最朴实无华的现代汉语来表达 \n- 校审环节重点关注译文是否符合当代汉语表达习惯,是否通俗易懂\n- 定稿时适度采用一些熟语谚语、网络流行语等,使译文更接地气\n- 善于利用中文的灵活性,用不同的表述方式展现同一内容,提高译文的可读性\n\n## Initialization\n作为一名资深英汉翻译专家,你必须严格遵循翻译流程的各项要求。首先请向用户问好,介绍你将带领团队完成翻译任务,力求将英文原文译成通俗易懂的现代汉语。然后简要说明四轮翻译流程,请用户提供英文原文,开始进行翻译工作。"
},
{
"key": "history",
"renderTypeList": ["numberInput", "reference"],
"valueType": "chatHistory",
"label": "core.module.input.label.chat history",
"description": "最多携带多少轮对话记录",
"required": true,
"min": 0,
"max": 50,
"value": 6
},
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题",
"value": ["gBDvemE4FBhp", "system_text"]
},
{
"key": "quoteQA",
"renderTypeList": ["settingDatasetQuotePrompt"],
"label": "",
"debugLabel": "知识库引用",
"description": "",
"valueType": "datasetQuote"
}
],
"outputs": [
{
"id": "history",
"key": "history",
"required": true,
"label": "core.module.output.label.New context",
"description": "core.module.output.description.New context",
"valueType": "chatHistory",
"type": "static"
},
{
"id": "answerText",
"key": "answerText",
"required": true,
"label": "core.module.output.label.Ai response content",
"description": "core.module.output.description.Ai response content",
"valueType": "string",
"type": "static"
}
]
},
{
"nodeId": "w0oBbQ3YJHye",
"name": "代码运行",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "/imgs/workflow/code.svg",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 2522.61682940854,
"y": -79.74569750380468
},
"version": "482",
"inputs": [
{
"key": "system_addInputParam",
"renderTypeList": ["addInputParam"],
"valueType": "dynamic",
"label": "",
"required": false,
"description": "这些变量会作为代码的运行的输入参数",
"editField": {
"key": true,
"valueType": true
},
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({data1}) {\n const codeBlocks = data1.match(/```[\\s\\S]*?```/g);\n\n if (codeBlocks && codeBlocks.length > 0) {\n const lastCodeBlock = codeBlocks[codeBlocks.length - 1];\n const cleanedCodeBlock = lastCodeBlock.replace(/```[a-zA-Z]*|```/g, '').trim();\n \n return {\n result: cleanedCodeBlock\n };\n }\n\n return {\n result: '未截取到代码块内容'\n };\n}\n"
},
{
"key": "data1",
"valueType": "string",
"label": "data1",
"renderTypeList": ["reference"],
"description": "",
"canEdit": true,
"editField": {
"key": true,
"valueType": true
},
"value": ["loOvhld2ZTKa", "answerText"]
}
],
"outputs": [
{
"id": "system_addOutputParam",
"key": "system_addOutputParam",
"type": "dynamic",
"valueType": "dynamic",
"label": "",
"description": "将代码中 return 的对象作为输出,传递给后续的节点"
},
{
"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"
},
{
"id": "gR0mkQpJ4Og8",
"type": "dynamic",
"key": "data2",
"valueType": "string",
"label": "data2"
}
]
},
{
"nodeId": "foO69L5FOmDQ",
"name": "指定回复",
"intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
"avatar": "/imgs/workflow/reply.png",
"flowNodeType": "answerNode",
"position": {
"x": 3798.4479531204515,
"y": 116.03040242110023
},
"version": "481",
"inputs": [
{
"key": "text",
"renderTypeList": ["textarea", "reference"],
"valueType": "any",
"required": true,
"label": "core.module.input.label.Response content",
"description": "core.module.input.description.Response content",
"placeholder": "core.module.input.description.Response content",
"selectedTypeIndex": 1,
"value": ["bcqtxqxE2R6o", "system_text"]
}
],
"outputs": []
},
{
"nodeId": "gBDvemE4FBhp",
"name": "文本拼接",
"intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。",
"avatar": "/imgs/workflow/textEditor.svg",
"flowNodeType": "textEditor",
"position": {
"x": 1031.371061396644,
"y": 38.65839420088383
},
"version": "486",
"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": false
}
},
{
"key": "system_textareaInput",
"renderTypeList": ["textarea"],
"valueType": "string",
"required": true,
"label": "拼接文本",
"placeholder": "可通过 {{字段名}} 来引用变量",
"value": "原文:\n\"\"\"\n{{q}}\n\"\"\""
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "q",
"label": "q",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"required": true,
"value": ["448745", "userChatInput"]
}
],
"outputs": [
{
"id": "system_text",
"key": "system_text",
"label": "拼接结果",
"type": "static",
"valueType": "string"
}
]
},
{
"nodeId": "bcqtxqxE2R6o",
"name": "合并输出结果",
"intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。",
"avatar": "/imgs/workflow/textEditor.svg",
"flowNodeType": "textEditor",
"position": {
"x": 3113.6227559936665,
"y": 12.909197647746709
},
"version": "486",
"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": false
}
},
{
"key": "system_textareaInput",
"renderTypeList": ["textarea"],
"valueType": "string",
"required": true,
"label": "拼接文本",
"placeholder": "可通过 {{字段名}} 来引用变量",
"value": "****** \n\n最终翻译结果如下: \n\n```\n{{result}}\n```"
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "result",
"label": "result",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"required": true,
"value": ["w0oBbQ3YJHye", "qLUQfhG0ILRX"]
}
],
"outputs": [
{
"id": "system_text",
"key": "system_text",
"label": "拼接结果",
"type": "static",
"valueType": "string"
}
]
}
],
"edges": [
{
"source": "loOvhld2ZTKa",
"target": "w0oBbQ3YJHye",
"sourceHandle": "loOvhld2ZTKa-source-right",
"targetHandle": "w0oBbQ3YJHye-target-left"
},
{
"source": "448745",
"target": "gBDvemE4FBhp",
"sourceHandle": "448745-source-right",
"targetHandle": "gBDvemE4FBhp-target-left"
},
{
"source": "gBDvemE4FBhp",
"target": "loOvhld2ZTKa",
"sourceHandle": "gBDvemE4FBhp-source-right",
"targetHandle": "loOvhld2ZTKa-target-left"
},
{
"source": "w0oBbQ3YJHye",
"target": "bcqtxqxE2R6o",
"sourceHandle": "w0oBbQ3YJHye-source-right",
"targetHandle": "bcqtxqxE2R6o-target-left"
},
{
"source": "bcqtxqxE2R6o",
"target": "foO69L5FOmDQ",
"sourceHandle": "bcqtxqxE2R6o-source-right",
"targetHandle": "foO69L5FOmDQ-target-left"
}
],
"chatConfig": {
"scheduledTriggerConfig": {
"cronString": "",
"timezone": "Asia/Shanghai",
"defaultPrompt": ""
}
}
}
}
{
"name": "对话引导 + 变量",
"intro": "可以在对话开始发送一段提示,或者让用户填写一些内容,作为本次对话的变量",
"author": "Fastgpt",
"avatar": "core/workflow/template/systemConfig",
"tags": ["office-services"],
"type": "simple",
"weight": 1,
"workflow": {
"nodes": [
{
"nodeId": "userGuide",
"name": "系统配置",
"intro": "可以配置应用的系统参数",
"avatar": "/imgs/workflow/userGuide.png",
"flowNodeType": "userGuide",
"position": {
"x": 496.57560693988853,
"y": -490.7611729549753
},
"version": "481",
"inputs": [
{
"key": "welcomeText",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.app.Welcome Text",
"value": "你好,我可以为你翻译各种语言,请告诉我你需要翻译成什么语言?"
},
{
"key": "variables",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "core.app.Chat Variable",
"value": [
{
"id": "myb3xk",
"key": "language",
"label": "目标语言",
"type": "select",
"required": true,
"maxLen": 50,
"enums": [
{
"value": "中文"
},
{
"value": "英文"
}
]
}
]
},
{
"key": "questionGuide",
"valueType": "WorkflowIOValueTypeEnum.boolean",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "core.app.Question Guide",
"value": false
},
{
"key": "tts",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": {
"type": "web"
}
},
{
"key": "whisper",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
}
},
{
"key": "scheduleTrigger",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": null
}
],
"outputs": []
},
{
"nodeId": "448745",
"name": "流程开始",
"intro": "",
"avatar": "/imgs/workflow/userChatInput.svg",
"flowNodeType": "workflowStart",
"position": {
"x": 558.4082376415505,
"y": 123.72387429194112
},
"version": "481",
"inputs": [
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题"
}
],
"outputs": [
{
"id": "userChatInput",
"key": "userChatInput",
"label": "core.module.input.label.user question",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
},
{
"nodeId": "loOvhld2ZTKa",
"name": "AI 对话",
"intro": "AI 大模型对话",
"avatar": "/imgs/workflow/AI.png",
"flowNodeType": "chatNode",
"showStatus": true,
"position": {
"x": 1097.7317280958762,
"y": -244.16014496351386
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": [
"FlowNodeInputTypeEnum.settingLLMModel",
"FlowNodeInputTypeEnum.reference"
],
"label": "core.module.input.label.aiModel",
"valueType": "WorkflowIOValueTypeEnum.string",
"value": "gpt-3.5-turbo"
},
{
"key": "temperature",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 0,
"valueType": "WorkflowIOValueTypeEnum.number",
"min": 0,
"max": 10,
"step": 1
},
{
"key": "maxToken",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 2000,
"valueType": "WorkflowIOValueTypeEnum.number",
"min": 100,
"max": 4000,
"step": 50
},
{
"key": "isResponseAnswerText",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": true,
"valueType": "WorkflowIOValueTypeEnum.boolean"
},
{
"key": "quoteTemplate",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "quotePrompt",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "systemPrompt",
"renderTypeList": ["FlowNodeInputTypeEnum.textarea", "FlowNodeInputTypeEnum.reference"],
"max": 3000,
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.ai.Prompt",
"description": "core.app.tip.chatNodeSystemPromptTip",
"placeholder": "core.app.tip.chatNodeSystemPromptTip",
"value": "请直接将我的问题翻译成{{language}},不需要回答问题。"
},
{
"key": "history",
"renderTypeList": [
"FlowNodeInputTypeEnum.numberInput",
"FlowNodeInputTypeEnum.reference"
],
"valueType": "WorkflowIOValueTypeEnum.chatHistory",
"label": "core.module.input.label.chat history",
"required": true,
"min": 0,
"max": 30,
"value": 6
},
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题",
"value": ["448745", "userChatInput"]
},
{
"key": "quoteQA",
"renderTypeList": ["FlowNodeInputTypeEnum.settingDatasetQuotePrompt"],
"label": "",
"debugLabel": "知识库引用",
"description": "",
"valueType": "WorkflowIOValueTypeEnum.datasetQuote"
}
],
"outputs": [
{
"id": "history",
"key": "history",
"label": "core.module.output.label.New context",
"description": "core.module.output.description.New context",
"valueType": "WorkflowIOValueTypeEnum.chatHistory",
"type": "FlowNodeOutputTypeEnum.static"
},
{
"id": "answerText",
"key": "answerText",
"label": "core.module.output.label.Ai response content",
"description": "core.module.output.description.Ai response content",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
}
],
"edges": [
{
"source": "448745",
"target": "loOvhld2ZTKa",
"sourceHandle": "448745-source-right",
"targetHandle": "loOvhld2ZTKa-target-left"
}
],
"chatConfig": {
"welcomeText": "你好,我可以为你翻译各种语言,请告诉我你需要翻译成什么语言?",
"scheduledTriggerConfig": {
"cronString": "",
"timezone": "Asia/Shanghai",
"defaultPrompt": ""
}
}
}
}
{
"name": "Flux 绘图",
"intro": "通过请求 Flux 接口绘图,需要有 api key",
"author": "Fastgpt",
"avatar": "/appMarketTemplates/flux/avatar.svg",
"type": "plugin",
"tags": ["image-generation"],
"workflow": {
"nodes": [
{
"nodeId": "pluginInput",
"name": "自定义插件输入",
"intro": "可以配置插件需要哪些输入,利用这些输入来运行插件",
"avatar": "core/workflow/template/workflowStart",
"flowNodeType": "pluginInput",
"showStatus": false,
"position": {
"x": 351.2046235980429,
"y": -77.41739975794749
},
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
"key": "绘图提示词",
"label": "绘图提示词",
"description": "绘图提示词",
"required": true,
"toolDescription": "绘图提示词"
}
],
"outputs": [
{
"id": "绘图提示词",
"valueType": "string",
"key": "绘图提示词",
"label": "绘图提示词",
"type": "hidden"
}
]
},
{
"nodeId": "pluginOutput",
"name": "自定义插件输出",
"intro": "自定义配置外部输出,使用插件时,仅暴露自定义配置的输出",
"avatar": "core/workflow/template/pluginOutput",
"flowNodeType": "pluginOutput",
"showStatus": false,
"position": {
"x": 1983.6911708285384,
"y": -95.86447885674228
},
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "图片访问链接",
"label": "图片访问链接",
"description": "",
"value": ["tMvel910bnrJ", "pJXgWoTpPoMy"]
},
{
"renderTypeList": ["reference"],
"valueType": "object",
"canEdit": true,
"key": "error",
"label": "错误信息",
"description": "",
"value": ["tMvel910bnrJ", "error"]
}
],
"outputs": []
},
{
"nodeId": "tMvel910bnrJ",
"name": "HTTP 请求",
"intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
"avatar": "core/workflow/template/httpRequest",
"flowNodeType": "httpRequest468",
"showStatus": true,
"position": {
"x": 1138.1732435351091,
"y": -416.6443415407282
},
"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://fal.run/fal-ai/flux-pro"
},
{
"key": "system_httpHeader",
"renderTypeList": ["custom"],
"valueType": "any",
"value": [
{
"key": "Authorization",
"type": "string",
"value": "Key {{apikey}}"
}
],
"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": "{\n \"prompt\": \"{{prompt}}\",\n \"image_size\": \"landscape_4_3\",\n \"num_inference_steps\": 28,\n \"guidance_scale\": 3.5\n}",
"label": "",
"required": false
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "prompt",
"label": "prompt",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["pluginInput", "绘图提示词"]
}
],
"outputs": [
{
"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": "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": "pJXgWoTpPoMy",
"valueType": "string",
"type": "dynamic",
"key": "images[0].url",
"label": "images[0].url"
}
]
}
],
"edges": [
{
"source": "pluginInput",
"target": "tMvel910bnrJ",
"sourceHandle": "pluginInput-source-right",
"targetHandle": "tMvel910bnrJ-target-left"
},
{
"source": "tMvel910bnrJ",
"target": "pluginOutput",
"sourceHandle": "tMvel910bnrJ-source-right",
"targetHandle": "pluginOutput-target-left"
}
]
}
}
{
"name": "谷歌搜索",
"intro": "通过请求谷歌搜索,查询相关内容作为模型的参考。",
"author": "Fastgpt",
"avatar": "/appMarketTemplates/google/avatar.svg",
"tags": ["recommendation", "web-search"],
"type": "advanced",
"workflow": {
"nodes": [
{
"nodeId": "userGuide",
"name": "系统配置",
"intro": "可以配置应用的系统参数",
"avatar": "/imgs/workflow/userGuide.png",
"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": "boolean",
"renderTypeList": ["hidden"],
"label": "core.app.Question Guide",
"value": 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": "流程开始",
"intro": "",
"avatar": "/imgs/workflow/userChatInput.svg",
"flowNodeType": "workflowStart",
"position": {
"x": 295.8944548701009,
"y": 110.81336038514848
},
"version": "481",
"inputs": [
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题"
}
],
"outputs": [
{
"id": "userChatInput",
"key": "userChatInput",
"label": "core.module.input.label.user question",
"valueType": "string",
"type": "static"
}
]
},
{
"nodeId": "NOgbnBzUwDgT",
"name": "工具调用",
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
"avatar": "/imgs/workflow/tool.svg",
"flowNodeType": "tools",
"showStatus": true,
"position": {
"x": 1028.8358722416106,
"y": -500.8755882990822
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": ["settingLLMModel", "reference"],
"label": "core.module.input.label.aiModel",
"valueType": "string",
"llmModelType": "all",
"value": "FastAI-plus"
},
{
"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": "systemPrompt",
"renderTypeList": ["textarea", "reference"],
"max": 3000,
"valueType": "string",
"label": "core.ai.Prompt",
"description": "core.app.tip.chatNodeSystemPromptTip",
"placeholder": "core.app.tip.chatNodeSystemPromptTip",
"value": ""
},
{
"key": "history",
"renderTypeList": ["numberInput", "reference"],
"valueType": "chatHistory",
"label": "core.module.input.label.chat history",
"description": "最多携带多少轮对话记录",
"required": true,
"min": 0,
"max": 30,
"value": 6
},
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"value": ["448745", "userChatInput"]
}
],
"outputs": [
{
"id": "NodeOutputKeyEnum.answerText",
"key": "NodeOutputKeyEnum.answerText",
"label": "core.module.output.label.Ai response content",
"description": "core.module.output.description.Ai response content",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
},
{
"nodeId": "GMELVPxHfpg5",
"name": "HTTP 请求",
"intro": "调用谷歌搜索,查询相关内容",
"avatar": "/imgs/workflow/http.png",
"flowNodeType": "httpRequest468",
"showStatus": true,
"position": {
"x": 1005.4777753640342,
"y": 319.4905539380939
},
"version": "481",
"inputs": [
{
"key": "system_addInputParam",
"renderTypeList": ["addInputParam"],
"valueType": "dynamic",
"label": "",
"required": false,
"description": "core.module.input.description.HTTP Dynamic Input"
},
{
"valueType": "string",
"renderTypeList": ["reference"],
"key": "query",
"label": "query",
"toolDescription": "谷歌搜索检索词",
"required": true,
"canEdit": true,
"editField": {
"key": true,
"description": true
}
},
{
"key": "system_httpMethod",
"renderTypeList": ["custom"],
"valueType": "string",
"label": "",
"value": "GET",
"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://www.googleapis.com/customsearch/v1"
},
{
"key": "system_httpHeader",
"renderTypeList": ["custom"],
"valueType": "any",
"value": [],
"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": [
{
"key": "q",
"type": "string",
"value": "{{query}}"
},
{
"key": "cx",
"type": "string",
"value": "谷歌搜索cxID"
},
{
"key": "key",
"type": "string",
"value": "谷歌搜索key"
},
{
"key": "c2coff",
"type": "string",
"value": "1"
},
{
"key": "start",
"type": "string",
"value": "1"
},
{
"key": "end",
"type": "string",
"value": "20"
},
{
"key": "dateRestrict",
"type": "string",
"value": "m[1]"
}
],
"label": "",
"required": false
},
{
"key": "system_httpJsonBody",
"renderTypeList": ["hidden"],
"valueType": "any",
"value": "",
"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",
"required": true
},
{
"id": "M5YmxaYe8em1",
"type": "dynamic",
"key": "prompt",
"valueType": "string",
"label": "prompt"
}
]
},
{
"nodeId": "poIbrrA8aiR0",
"name": "代码运行",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "/imgs/workflow/code.svg",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 1711.805344753384,
"y": 650.1023414708576
},
"version": "482",
"inputs": [
{
"key": "system_addInputParam",
"renderTypeList": ["addInputParam"],
"valueType": "dynamic",
"label": "",
"required": false,
"description": "这些变量会作为代码的运行的输入参数",
"editField": {
"key": true,
"valueType": true
}
},
{
"key": "data",
"valueType": "object",
"label": "data",
"renderTypeList": ["reference"],
"description": "",
"canEdit": true,
"editField": {
"key": true,
"valueType": true
},
"value": ["GMELVPxHfpg5", "httpRawResponse"]
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({data}){\n const result = data.items.map((item) => ({\n title: item.title,\n link: item.link,\n snippet: item.snippet\n }))\n return { prompt: JSON.stringify(result) }\n}"
}
],
"outputs": [
{
"id": "system_addOutputParam",
"key": "system_addOutputParam",
"type": "dynamic",
"valueType": "dynamic",
"label": "",
"editField": {
"key": true,
"valueType": true
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点"
},
{
"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": "prompt",
"valueType": "string",
"label": "prompt"
}
]
}
],
"edges": [
{
"source": "448745",
"target": "NOgbnBzUwDgT",
"sourceHandle": "448745-source-right",
"targetHandle": "NOgbnBzUwDgT-target-left"
},
{
"source": "NOgbnBzUwDgT",
"target": "GMELVPxHfpg5",
"sourceHandle": "selectedTools",
"targetHandle": "selectedTools"
},
{
"source": "GMELVPxHfpg5",
"target": "poIbrrA8aiR0",
"sourceHandle": "GMELVPxHfpg5-source-right",
"targetHandle": "poIbrrA8aiR0-target-left"
}
]
}
}
<svg t="1710840512338" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="1309"
width="128" height="128">
<path
d="M572.587621 1023.98262201c-76.09788199-0.13902299-134.661449-22.851956-183.31960699-69.40738501-11.06973101-10.583149-21.20105399-14.128243-36.92806501-12.11240599-165.85480399 21.20105399-308.527471-118.60425799-288.160557-284.78924103 4.48350196-36.65001902-0.76462799-64.10712201-20.227891-96.22150598-85.899025-141.73426003-14.07610999-325.92276201 143.78485399-376.092797 15.13616201-4.81368201 25.52815401-11.20875401 32.618343-27.38759095 35.051251-79.92102299 94.640115-133.37548398 180.76505301-151.23997907 88.245043-18.298943 168.687403-0.03475599 235.470724 63.93334302 9.957544 9.54047401 19.60228598 13.93708601 33.869553 11.83435901 128.63131399-18.92454698 251.96236398 64.87174999 284.23314799 190.20125999 11.347777 44.035632 12.61636501 87.202368-0.10426699 130.64715099-3.527716 12.025516 0.38231401 20.384292 7.61152602 29.73360902 98.637035 127.466993 58.928504 312.80243802-82.89264602 388.79605299-15.066651 8.08073001-31.08908702 13.72855101-47.285302 18.66387799-13.832819 4.22283301-22.45226401 12.12978301-28.11746399 25.632422-27.59612601 65.75802401-74.86405001 111.91376103-140.60469501 139.64891102-31.940604 13.485261-65.34095397 17.412669-90.69532902 18.177297z m251.56267101-383.86072502c0 35.78112295-0.191157 71.562247 0.06951199 107.32599201 0.156401 21.30532201 4.865816 23.82511902 23.738229 13.641662 129.048383-69.650676 135.96479301-253.422108 11.39991099-330.56266501-65.410465-40.50791598-132.95841401-77.557627-199.37679803-116.44939598-9.62736401-5.630444-17.916629-5.03959501-27.12692196 0.59084899-16.02243601 9.783765-32.444564 18.94192498-48.67553503 28.39551001-21.18367598 12.33831801-21.16629801 14.82336002-0.06951195 28.030574 1.54663401 0.973163 3.07589101 1.94632602 4.65728096 2.84997799 70.36317099 40.52529401 140.60469601 81.206988 211.14164502 121.41947901 17.08248901 9.731631 24.954683 22.990979 24.450724 42.88868997-0.85151799 33.939064-0.225913 67.912885-0.20853499 101.86932701zM400.772193 340.96112199c0 9.696876-0.08689001 19.393751 0.017378 29.09062601 0.260669 21.40958901 1.59876799 22.48701999 19.619664 12.12978398 72.987235-41.915527 146.11349399-83.587763 218.492502-126.54596398 19.584908-11.62582399 35.50307702-12.164539 55.29652-0.243291 58.09436397 35.016495 117.24878 68.277821 176.00350501 102.199508 20.245269 11.69533599 24.60712501 9.106027 25.70193398-14.61482499 1.16431999-25.31962003-4.76154804-49.31851799-13.10294699-72.882968-37.049711-104.59766-169.43465398-154.958852-266.107985-100.67025201-58.59832304 32.89638999-115.63263398 68.677513-175.134609 99.83611201-31.14122 16.31785999-51.021553 34.147599-40.785962 71.70126998z m356.421 318.78043901h-0.05213402c0-39.39572897-0.225913-78.77408101 0.15640102-118.169809 0.10426699-10.91332901-3.475583-18.00351801-13.415749-23.26902601-18.194675-9.60998599-35.78112295-20.36691401-53.59348399-30.70677299-18.629123-10.80906201-20.923007-9.557852-20.94038602 12.25142898-0.05213401 84.83897201-0.45182601 169.677945 0.22591303 254.51691701 0.17377898 20.81874003-8.02859599 33.487239-25.91046803 43.54905001-60.16233599 33.817419-119.716444 68.747025-179.426954 103.36382802-16.144081 9.349317-17.01297699 15.396831-2.48504201 24.45072398 58.19863099 36.25032699 119.99449102 42.315219 182.12053102 13.76330701 75.69818998-34.80796 111.61833598-97.229424 113.21710399-179.75713402 0.64298303-33.31345999 0.10426699-66.66167502 0.10426801-99.99251299zM199.20577799 382.546468h-0.10426797c0-34.564669 0.13902299-69.129339-0.05213401-103.69400799-0.13902299-23.842497-3.892653-25.87571299-24.97206101-14.30202299-128.388023 70.57170599-131.238001 255.35105701-4.466124 332.05716598 63.75956401 38.57896701 128.805093 75.020451 193.294529 112.38296401 7.50725899 4.36185599 15.32731899 7.85481701 23.96414202 2.86735599 20.99251901-12.11240602 42.01979402-24.137921 62.83853399-36.510996 8.61944501-5.126484 8.723712-11.00021895-0.05213302-16.47426101-3.597228-2.24175098-7.10756598-4.657281-10.77430699-6.77738599-71.33633399-41.237788-142.55102201-82.701489-214.14802401-123.487452-17.030355-9.696876-25.85833501-22.60866499-25.64979999-42.36735199 0.38231401-34.564669 0.10426699-69.129339 0.10426802-103.69400801z m154.52440402 12.129783h0.22591299c0-38.78750201 1.077431-77.60975998-0.36493699-116.34512899-0.990541-26.36229401 9.262428-42.52375399 32.30554099-55.24438599 59.362951-32.77474401 117.66584999-67.478437 176.29892902-101.55652402 14.684337-8.53255498 14.945005-13.502639 0.78200696-23.043113-13.589528-9.15816-28.186975-16.891332-43.89660897-21.51385699-129.708744-38.231409-250.137683 50.10052399-252.01449701 185.422334-1.00791899 72.10096198 0.069512 144.23668-0.31280297 216.33764099-0.069512 13.902331 5.421909 22.678177 17.41266897 29.03849305 16.56115101 8.81060201 32.77474401 18.316321 48.918826 27.87417295 16.82181998 9.97492199 20.43642597 8.271887 20.57544901-11.90387 0.27804699-43.027713 0.08689001-86.05542599 0.08688998-129.08314001z m269.34027598 288.751406c0-9.696876 0.156401-19.393751-0.03475499-29.09062701-0.38231401-18.82028-3.56247201-20.95776302-19.723932-11.71271299-74.1168 42.38472996-148.16408797 84.89110601-222.02021901 127.72766201-14.19775494 8.23713099-27.943684 11.24350999-42.80179999 2.69357599-18.889792-10.861196-37.796961-21.70501401-56.66937499-32.63572102-44.000876-25.493399-87.84535099-51.31697802-132.05476307-76.44544-15.518476-8.81060201-19.13308199-6.55147299-19.74130895 10.79168404-0.81676199 23.043113 0.43444801 45.70391197 7.82006098 68.12141996 37.98811801 115.52836699 167.22765903 168.079176 273.91066802 109.67201002 58.40716599-31.97536002 114.39880302-68.48635603 173.57059702-98.897704 31.506157-16.196215 45.130441-36.05917001 37.74482698-70.25890301z m-222.28088699-172.56267798c0 16.33523802 0.36493602 32.705233-0.139024 49.02309297-0.31280201 10.235591 3.388693 16.960843 12.39045199 22.06995 27.370213 15.501099 54.636159 31.19335401 81.485035 47.56334802 12.234051 7.47250301 22.97360103 7.83743901 35.32929801 0.27804699 26.310161-16.091948 53.037391-31.488779 79.85151099-46.694453 9.59260801-5.439287 13.45050499-12.94654501 13.363615-23.686096-0.260669-32.079628-0.260669-64.15925599-0.08688899-96.238883 0.05213401-9.27980601-2.81522199-16.230971-11.24350999-21.02727501-28.37813202-16.161459-56.704131-32.39243001-84.786838-49.07522699-9.957544-5.925868-18.92454698-6.13440301-28.88209202-0.22591302-20.80136202 12.355696-41.116143 25.92784599-63.06444697 35.85063502-26.36229401 11.903871-40.00395598 28.725691-34.47778003 58.598324 1.407611 7.61152599 0.208535 15.69225597 0.22591301 23.56444999z"
fill="#2c2c2c" p-id="1310"></path>
</svg>
\ No newline at end of file
{
"name": "Dalle3 绘图",
"intro": "通过请求 Dalle3 接口绘图,需要有 api key",
"author": "Fastgpt",
"avatar": "/appMarketTemplates/plugin-dalle/avatar.svg",
"type": "plugin",
"tags": ["recommendation", "image-generation"],
"workflow": {
"nodes": [
{
"nodeId": "pluginInput",
"name": "自定义插件输入",
"intro": "可以配置插件需要哪些输入,利用这些输入来运行插件",
"avatar": "core/workflow/template/workflowStart",
"flowNodeType": "pluginInput",
"showStatus": false,
"position": {
"x": 412.7756423516722,
"y": -99.80686112290361
},
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"selectedTypeIndex": 0,
"valueType": "string",
"canEdit": true,
"key": "绘图提示词",
"label": "绘图提示词",
"description": "绘图提示词",
"required": true,
"toolDescription": "绘图提示词"
}
],
"outputs": [
{
"id": "绘图提示词",
"valueType": "string",
"key": "绘图提示词",
"label": "绘图提示词",
"type": "hidden"
}
]
},
{
"nodeId": "pluginOutput",
"name": "自定义插件输出",
"intro": "自定义配置外部输出,使用插件时,仅暴露自定义配置的输出",
"avatar": "core/workflow/template/pluginOutput",
"flowNodeType": "pluginOutput",
"showStatus": false,
"position": {
"x": 1822.7195641525896,
"y": -193.54601587659562
},
"version": "481",
"inputs": [
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "图片访问链接",
"label": "图片访问链接",
"description": "",
"value": ["tMvel910bnrJ", "pJXgWoTpPoMy"]
},
{
"renderTypeList": ["reference"],
"valueType": "object",
"canEdit": true,
"key": "error",
"label": "错误信息",
"description": "",
"value": ["tMvel910bnrJ", "error"]
}
],
"outputs": []
},
{
"nodeId": "tMvel910bnrJ",
"name": "HTTP 请求",
"intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
"avatar": "core/workflow/template/httpRequest",
"flowNodeType": "httpRequest468",
"showStatus": true,
"position": {
"x": 1044.8838211811253,
"y": -414.7785530936485
},
"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://api.openai.com/v1/images/generations"
},
{
"key": "system_httpHeader",
"renderTypeList": ["custom"],
"valueType": "any",
"value": [
{
"key": "Authorization",
"type": "string",
"value": "Bearer {{authorization}}"
}
],
"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": "{\n \"model\": \"dall-e-3\",\n \"prompt\": \"{{prompt}}\",\n \"n\": 1,\n \"size\": \"1024x1024\"\n}",
"label": "",
"required": false
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "prompt",
"label": "prompt",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["pluginInput", "绘图提示词"]
}
],
"outputs": [
{
"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": "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": "pJXgWoTpPoMy",
"valueType": "string",
"type": "dynamic",
"key": "data[0].url",
"label": "data[0].url"
}
]
}
],
"edges": [
{
"source": "pluginInput",
"target": "tMvel910bnrJ",
"sourceHandle": "pluginInput-source-right",
"targetHandle": "tMvel910bnrJ-target-left"
},
{
"source": "tMvel910bnrJ",
"target": "pluginOutput",
"sourceHandle": "tMvel910bnrJ-source-right",
"targetHandle": "pluginOutput-target-left"
}
]
}
}
{
"name": "飞书 webhook 插件",
"intro": "通过 webhook 给飞书机器人发送一条消息",
"author": "Fastgpt",
"avatar": "/appMarketTemplates/plugin-feishu/avatar.svg",
"type": "plugin",
"tags": ["recommendation", "office-services"],
"workflow": {
"nodes": [
{
"nodeId": "pluginInput",
"name": "自定义插件输入",
"intro": "自定义配置外部输入,使用插件时,仅暴露自定义配置的输入",
"avatar": "core/workflow/template/workflowStart",
"flowNodeType": "pluginInput",
"showStatus": false,
"position": {
"x": 517.5620777851774,
"y": -173.55711888178655
},
"version": "481",
"inputs": [
{
"inputType": "input",
"valueType": "string",
"key": "飞书机器人地址",
"label": "飞书机器人地址",
"description": "",
"isToolInput": false,
"defaultValue": "",
"editField": {
"key": true
},
"dynamicParamDefaultValue": {
"inputType": "reference",
"valueType": "string",
"required": true
},
"renderTypeList": ["input"],
"required": true,
"canEdit": true,
"value": ""
},
{
"key": "发送的消息",
"valueType": "string",
"label": "发送的消息",
"renderTypeList": ["reference"],
"required": true,
"description": "",
"canEdit": true,
"value": "",
"editField": {
"key": true
},
"dynamicParamDefaultValue": {
"inputType": "reference",
"valueType": "string",
"required": true
}
}
],
"outputs": [
{
"id": "mv52BrPVE6bm",
"key": "飞书机器人地址",
"valueType": "string",
"label": "飞书机器人地址",
"type": "static"
},
{
"id": "p0m68Dv5KaIp",
"key": "发送的消息",
"valueType": "string",
"label": "发送的消息",
"type": "static"
}
]
},
{
"nodeId": "pluginOutput",
"name": "自定义插件输出",
"intro": "自定义配置外部输出,使用插件时,仅暴露自定义配置的输出",
"avatar": "/imgs/workflow/output.png",
"flowNodeType": "pluginOutput",
"showStatus": false,
"position": {
"x": 1668.9410524554828,
"y": -153.47815316221283
},
"version": "481",
"inputs": [],
"outputs": []
},
{
"nodeId": "rKBYGQuYefae",
"name": "HTTP 请求",
"intro": "可以发出一个 HTTP 请求,实现更为复杂的操作(联网搜索、数据库查询等)",
"avatar": "core/workflow/template/httpRequest",
"flowNodeType": "httpRequest468",
"showStatus": true,
"position": {
"x": 1069.7228495148624,
"y": -392.26482361861054
},
"version": "481",
"inputs": [
{
"key": "system_addInputParam",
"renderTypeList": ["addInputParam"],
"valueType": "dynamic",
"label": "",
"required": false,
"description": "core.module.input.description.HTTP Dynamic Input"
},
{
"key": "text",
"valueType": "string",
"label": "text",
"renderTypeList": ["reference"],
"description": "",
"canEdit": true,
"editField": {
"key": true,
"valueType": true
},
"value": ["pluginInput", "p0m68Dv5KaIp"]
},
{
"key": "url",
"valueType": "string",
"label": "url",
"renderTypeList": ["reference"],
"description": "",
"canEdit": true,
"editField": {
"key": true,
"valueType": true
},
"value": ["pluginInput", "mv52BrPVE6bm"]
},
{
"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": "{{url}}"
},
{
"key": "system_httpHeader",
"renderTypeList": ["custom"],
"valueType": "any",
"value": [],
"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 \"msg_type\": \"text\",\r\n \"content\": {\r\n \"text\": \"{{text}}\"\r\n }\r\n}",
"label": "",
"required": false
}
],
"outputs": [
{
"id": "system_addOutputParam",
"key": "system_addOutputParam",
"type": "dynamic",
"valueType": "dynamic",
"label": "",
"editField": {
"key": true,
"valueType": true
}
},
{
"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"
}
]
}
],
"edges": [
{
"source": "pluginInput",
"target": "rKBYGQuYefae",
"sourceHandle": "pluginInput-source-right",
"targetHandle": "rKBYGQuYefae-target-left"
},
{
"source": "rKBYGQuYefae",
"target": "pluginOutput",
"sourceHandle": "rKBYGQuYefae-source-right",
"targetHandle": "pluginOutput-target-left"
}
]
}
}
{
"name": "知识库+对话引导",
"intro": "每次提问时进行一次知识库搜索,将搜索结果注入 LLM 模型进行参考回答",
"author": "Fastgpt",
"avatar": "core/workflow/template/datasetSearch",
"type": "simple",
"tags": ["office-services"],
"workflow": {
"nodes": [
{
"nodeId": "userGuide",
"name": "系统配置",
"intro": "可以配置应用的系统参数",
"avatar": "core/workflow/template/systemConfig",
"flowNodeType": "FlowNodeTypeEnum.systemConfig",
"position": {
"x": 531.2422736065552,
"y": -486.7611729549753
},
"version": "481",
"inputs": [
{
"key": "welcomeText",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.app.Welcome Text",
"value": "你好,我是知识库助手,请不要忘记选择知识库噢~\n[你是谁]\n[如何使用]"
},
{
"key": "variables",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "core.app.Chat Variable",
"value": []
},
{
"key": "questionGuide",
"valueType": "WorkflowIOValueTypeEnum.boolean",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "core.app.Question Guide",
"value": false
},
{
"key": "tts",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": {
"type": "web"
}
},
{
"key": "whisper",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": {
"open": false,
"autoSend": false,
"autoTTSResponse": false
}
},
{
"key": "scheduleTrigger",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"valueType": "WorkflowIOValueTypeEnum.any",
"label": "",
"value": null
}
],
"outputs": []
},
{
"nodeId": "workflowStartNodeId",
"name": "流程开始",
"intro": "",
"avatar": "core/workflow/template/workflowStart",
"flowNodeType": "FlowNodeTypeEnum.workflowStart",
"position": {
"x": 558.4082376415505,
"y": 123.72387429194112
},
"version": "481",
"inputs": [
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题"
}
],
"outputs": [
{
"id": "userChatInput",
"key": "userChatInput",
"label": "core.module.input.label.user question",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
},
{
"nodeId": "7BdojPlukIQw",
"name": "AI 对话",
"intro": "AI 大模型对话",
"avatar": "core/workflow/template/aiChat",
"flowNodeType": "FlowNodeTypeEnum.chatNode",
"showStatus": true,
"position": {
"x": 1638.509551404687,
"y": -341.0428450861567
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": [
"FlowNodeInputTypeEnum.settingLLMModel",
"FlowNodeInputTypeEnum.reference"
],
"label": "core.module.input.label.aiModel",
"valueType": "WorkflowIOValueTypeEnum.string",
"value": "gpt-4o-mini"
},
{
"key": "temperature",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 3,
"valueType": "WorkflowIOValueTypeEnum.number",
"min": 0,
"max": 10,
"step": 1
},
{
"key": "maxToken",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 1950,
"valueType": "WorkflowIOValueTypeEnum.number",
"min": 100,
"max": 4000,
"step": 50
},
{
"key": "isResponseAnswerText",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": true,
"valueType": "WorkflowIOValueTypeEnum.boolean"
},
{
"key": "quoteTemplate",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "quotePrompt",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "systemPrompt",
"renderTypeList": ["FlowNodeInputTypeEnum.textarea", "FlowNodeInputTypeEnum.reference"],
"max": 3000,
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "core.ai.Prompt",
"description": "core.app.tip.chatNodeSystemPromptTip",
"placeholder": "core.app.tip.chatNodeSystemPromptTip",
"value": ""
},
{
"key": "history",
"renderTypeList": [
"FlowNodeInputTypeEnum.numberInput",
"FlowNodeInputTypeEnum.reference"
],
"valueType": "WorkflowIOValueTypeEnum.chatHistory",
"label": "core.module.input.label.chat history",
"required": true,
"min": 0,
"max": 30,
"value": 6
},
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题",
"value": ["workflowStartNodeId", "userChatInput"]
},
{
"key": "quoteQA",
"renderTypeList": ["FlowNodeInputTypeEnum.settingDatasetQuotePrompt"],
"label": "",
"debugLabel": "知识库引用",
"description": "",
"valueType": "WorkflowIOValueTypeEnum.datasetQuote",
"value": ["iKBoX2vIzETU", "quoteQA"]
}
],
"outputs": [
{
"id": "history",
"key": "history",
"label": "core.module.output.label.New context",
"description": "core.module.output.description.New context",
"valueType": "WorkflowIOValueTypeEnum.chatHistory",
"type": "FlowNodeOutputTypeEnum.static"
},
{
"id": "answerText",
"key": "answerText",
"label": "core.module.output.label.Ai response content",
"description": "core.module.output.description.Ai response content",
"valueType": "WorkflowIOValueTypeEnum.string",
"type": "FlowNodeOutputTypeEnum.static"
}
]
},
{
"nodeId": "iKBoX2vIzETU",
"name": "知识库搜索",
"intro": "调用\"语义检索\"和\"全文检索\"能力,从\"知识库\"中查找可能与问题相关的参考内容",
"avatar": "core/workflow/template/datasetSearch",
"flowNodeType": "FlowNodeTypeEnum.datasetSearchNode",
"showStatus": true,
"position": {
"x": 918.5901682164496,
"y": -227.11542247619582
},
"version": "481",
"inputs": [
{
"key": "datasets",
"renderTypeList": [
"FlowNodeInputTypeEnum.selectDataset",
"FlowNodeInputTypeEnum.reference"
],
"label": "core.module.input.label.Select dataset",
"value": [],
"valueType": "WorkflowIOValueTypeEnum.selectDataset",
"list": [],
"required": true
},
{
"key": "similarity",
"renderTypeList": ["FlowNodeInputTypeEnum.selectDatasetParamsModal"],
"label": "",
"value": 0.4,
"valueType": "WorkflowIOValueTypeEnum.number"
},
{
"key": "limit",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"value": 1500,
"valueType": "WorkflowIOValueTypeEnum.number"
},
{
"key": "searchMode",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string",
"value": "embedding"
},
{
"key": "usingReRank",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.boolean",
"value": false
},
{
"key": "datasetSearchUsingExtensionQuery",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.boolean",
"value": true
},
{
"key": "datasetSearchExtensionModel",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string"
},
{
"key": "datasetSearchExtensionBg",
"renderTypeList": ["FlowNodeInputTypeEnum.hidden"],
"label": "",
"valueType": "WorkflowIOValueTypeEnum.string",
"value": ""
},
{
"key": "userChatInput",
"renderTypeList": ["FlowNodeInputTypeEnum.reference", "FlowNodeInputTypeEnum.textarea"],
"valueType": "WorkflowIOValueTypeEnum.string",
"label": "用户问题",
"required": true,
"toolDescription": "需要检索的内容",
"value": ["workflowStartNodeId", "userChatInput"]
}
],
"outputs": [
{
"id": "quoteQA",
"key": "quoteQA",
"label": "core.module.Dataset quote.label",
"type": "FlowNodeOutputTypeEnum.static",
"valueType": "WorkflowIOValueTypeEnum.datasetQuote",
"description": "特殊数组格式,搜索结果为空时,返回空数组。"
}
]
}
],
"edges": [
{
"source": "workflowStartNodeId",
"target": "iKBoX2vIzETU",
"sourceHandle": "workflowStartNodeId-source-right",
"targetHandle": "iKBoX2vIzETU-target-left"
},
{
"source": "iKBoX2vIzETU",
"target": "7BdojPlukIQw",
"sourceHandle": "iKBoX2vIzETU-source-right",
"targetHandle": "7BdojPlukIQw-target-left"
}
]
}
}
{
"name": "长字幕反思翻译机器人",
"intro": "利用 AI 自我反思提升翻译质量,同时循环迭代执行 AI 工作流来突破 LLM tokens 限制,实现一个高效的长字幕翻译机器人",
"author": "Fastgpt",
"avatar": "/appMarketTemplates/TranslateRobot/avatar.svg",
"tags": ["office-services"],
"type": "advanced",
"workflow": {
"nodes": [
{
"nodeId": "userGuide",
"name": "系统配置",
"intro": "可以配置应用的系统参数",
"avatar": "core/workflow/template/systemConfig",
"flowNodeType": "userGuide",
"position": {
"x": -1453.0815298642474,
"y": 269.10239463914263
},
"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": "boolean",
"renderTypeList": ["hidden"],
"label": "core.app.Question Guide",
"value": 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": "流程开始",
"intro": "",
"avatar": "core/workflow/template/workflowStart",
"flowNodeType": "workflowStart",
"position": {
"x": -1491.3235962441404,
"y": 1277.8094190109027
},
"version": "481",
"inputs": [
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题"
}
],
"outputs": [
{
"id": "userChatInput",
"key": "userChatInput",
"label": "common:core.module.input.label.user question",
"type": "static",
"valueType": "string"
}
]
},
{
"nodeId": "yjFO3YcM7KG2",
"name": "LLM 翻译",
"intro": "AI 大模型对话",
"avatar": "core/workflow/template/aiChat",
"flowNodeType": "chatNode",
"showStatus": true,
"position": {
"x": 2584.1800627074813,
"y": 962.3727118784907
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": ["settingLLMModel", "reference"],
"label": "core.module.input.label.aiModel",
"valueType": "string",
"selectedTypeIndex": 0,
"value": "gpt-4o"
},
{
"key": "temperature",
"renderTypeList": ["hidden"],
"label": "",
"value": 3,
"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": false,
"valueType": "boolean"
},
{
"key": "quoteTemplate",
"renderTypeList": ["hidden"],
"label": "",
"valueType": "string"
},
{
"key": "quotePrompt",
"renderTypeList": ["hidden"],
"label": "",
"valueType": "string"
},
{
"key": "aiChatVision",
"renderTypeList": ["hidden"],
"label": "",
"valueType": "boolean",
"value": true
},
{
"key": "systemPrompt",
"renderTypeList": ["textarea", "reference"],
"max": 3000,
"valueType": "string",
"label": "core.ai.Prompt",
"description": "core.app.tip.chatNodeSystemPromptTip",
"placeholder": "core.app.tip.chatNodeSystemPromptTip",
"value": "# Role: 资深字幕翻译专家\n\n## Background:\n你是一位经验丰富的{{source_lang}}和{{target_lang}}字幕翻译专家,精通{{source_lang}}和{{target_lang}}互译,尤其擅长将{{source_lang}}字幕译成流畅易懂的{{target_lang}}字幕。你曾多次带领团队完成大型商业电影的字幕翻译项目,所翻译的字幕广受好评。\n\n## Attention:\n- 翻译过程中要始终坚持\"信、达、雅\"的原则,但\"达\"尤为重要\n- 翻译的字幕要符合{{target_lang}}的表达习惯,通俗易懂,连贯流畅\n- 避免使用过于文绉绉的表达和晦涩难懂的典故引用 \n- 诗词歌词等内容需按原文换行和节奏分行,不破坏原排列格式 \n- 翻译对象是字幕,请进入整段文本的语境中对需要翻译的文本段进行翻译\n- <T>是标识每一帧字幕的标签,请严格按照<T>对文本的分割逐帧翻译\n\n## Constraints:\n- 必须严格遵循四轮翻译流程:直译、意译、反思、提升\n- 译文要忠实原文,准确无误,不能遗漏或曲解原意\n- 最终译文使用Markdown的代码块呈现,但是不用输出markdown这个单词\n- <T>是标识每一帧字幕的标签,请严格按照<T>对文本的分割逐帧翻译,每一帧字幕末尾不要加\\n 回车标识,且第一帧字幕开头不需要加<T>标识\n\n## Goals:\n- 通过四轮翻译流程,将{{source_lang}}字幕译成高质量的{{target_lang}}字幕\n- 翻译的字幕要准确传达原字幕意思,语言表达力求浅显易懂,朗朗上口 \n\n## Workflow:\n1. 第一轮直译:严格按照<T>逐句翻译,不遗漏任何信息\n2. 第二轮意译:在直译的基础上用通俗流畅的{{target_lang}}意译原文,逐句翻译,保留<T>标识标签\n3. 第三轮反思:仔细审视译文,分点列出一份建设性的批评和有用的建议清单以改进翻译,对每一句话提出建议,从以下四个角度展开\n (i) 准确性(纠正添加、误译、遗漏或未翻译的文本错误),\n (ii) 流畅性(应用{{target_lang}}的语法、拼写和标点规则,并确保没有不必要的重复),\n (iii) 风格(确保翻译反映源文本的风格并考虑其文化背景),\n (iv) 术语(确保术语使用一致且反映源文本所在领域,注意确保使用{{target_lang}}中的等效习语)\n4. 第四轮提升:严格遵循第三轮提出的建议对翻译修改,定稿出一个简洁畅达、符合大众观影习惯的字幕译文,保留<T>标识标签\n\n## OutputFormat:\n- 每一轮前用【思考】说明该轮要点\n- 第一轮和第二轮翻译后用【翻译】呈现译文\n- 第三轮输出建议清单,分点列出,在每一点前用*xxx*标识这条建议对应的要点,如*风格*;建议前用【思考】说明该轮要点,建议后用【建议】呈现建议\n- 第四轮在\\`\\`\\`代码块中展示最终{{target_lang}}字幕文件内容,如\\`\\`\\`xxx\\`\\`\\`\n\n## Suggestions:\n- 直译时力求忠实原文,但注意控制每帧字幕的字数,必要时进行精简压缩\n- 意译时在准确表达原意的基础上,用最朴实无华的{{target_lang}}来表达\n- 反思环节重点关注译文是否符合{{target_lang}}表达习惯,是否通俗易懂,是否准确流畅,是否术语一致\n- 提升环节采用反思环节的建议对意译环节的翻译进行修改,适度采用一些口语化的表达、网络流行语等,增强字幕的亲和力\n- 注意<T>是很重要的标识标签,请确保标签能在正确位置输出"
},
{
"key": "history",
"renderTypeList": ["numberInput", "reference"],
"valueType": "chatHistory",
"label": "core.module.input.label.chat history",
"description": "最多携带多少轮对话记录",
"required": true,
"min": 0,
"max": 50,
"value": 6
},
{
"key": "quoteQA",
"renderTypeList": ["settingDatasetQuotePrompt"],
"label": "",
"debugLabel": "知识库引用",
"description": "",
"valueType": "datasetQuote"
},
{
"key": "stringQuoteText",
"renderTypeList": ["reference", "textarea"],
"label": "app:document_quote",
"debugLabel": "app:document_quote",
"description": "app:document_quote_tip",
"valueType": "string"
},
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题",
"value": ["bxz97Vg4Omux", "system_text"]
}
],
"outputs": [
{
"id": "history",
"key": "history",
"required": true,
"label": "core.module.output.label.New context",
"description": "core.module.output.description.New context",
"valueType": "chatHistory",
"type": "static"
},
{
"id": "answerText",
"key": "answerText",
"required": true,
"label": "core.module.output.label.Ai response content",
"description": "core.module.output.description.Ai response content",
"valueType": "string",
"type": "static"
}
]
},
{
"nodeId": "bxz97Vg4Omux",
"name": "LLM 翻译提示词",
"intro": "可对固定或传入的文本进行加工后输出,非字符串类型数据最终会转成字符串类型。",
"avatar": "core/workflow/template/textConcat",
"flowNodeType": "textEditor",
"position": {
"x": 1881.9891746911078,
"y": 1112.4113692581143
},
"version": "486",
"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": false
}
},
{
"key": "system_textareaInput",
"renderTypeList": ["textarea"],
"valueType": "string",
"required": true,
"label": "拼接文本",
"placeholder": "可通过 {{字段名}} 来引用变量",
"value": "你的任务是将文本从{{source_lang}}翻译成{{target_lang}}\n\n源文本如下,由XML标签<SOURCE_TEXT>和</SOURCE_TEXT>分隔:\n\n<SOURCE_TEXT>\n\n{{tagged_text}}\n\n</SOURCE_TEXT>\n\n仅翻译源文本中由<TRANSLATE_THIS>和</TRANSLATE_THIS>分隔的部分,将其余的源文本作为上下文\n\n重申一下,你应该只翻译文本的这一部分,这里再次显示在<TRANSLATE_THIS>和</TRANSLATE_THIS>之间:\n\n<TRANSLATE_THIS>\n\n{{chunk_to_translate}}\n\n</TRANSLATE_THIS>"
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "tagged_text",
"label": "tagged_text",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"required": true,
"value": ["quYZgsW32ApA", "xhXu6sdEWBnF"]
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "chunk_to_translate",
"label": "chunk_to_translate",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"required": true,
"value": ["quYZgsW32ApA", "eCp73lztAEGK"]
}
],
"outputs": [
{
"id": "system_text",
"key": "system_text",
"label": "拼接结果",
"type": "static",
"valueType": "string"
}
]
},
{
"nodeId": "w4heEpNflz59",
"name": "判断是否执行结束",
"intro": "根据一定的条件,执行不同的分支。",
"avatar": "core/workflow/template/ifelse",
"flowNodeType": "ifElseNode",
"showStatus": true,
"position": {
"x": 5610.256715310997,
"y": 1232.1024649538042
},
"version": "481",
"inputs": [
{
"key": "ifElseList",
"renderTypeList": ["hidden"],
"valueType": "any",
"label": "",
"value": [
{
"condition": "AND",
"list": [
{
"variable": ["a2lqxASWi1vb", "nmBmGaARbKkl"],
"condition": "equalTo",
"value": "true"
}
]
}
]
}
],
"outputs": [
{
"id": "ifElseResult",
"key": "ifElseResult",
"label": "判断结果",
"valueType": "string",
"type": "static"
}
]
},
{
"nodeId": "a2lqxASWi1vb",
"name": "判断是否执行结束",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 5068.150809685475,
"y": 940.8168438455639
},
"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
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({chunks, currentChunk}){\n const findIndex = chunks.findIndex((item) => item === currentChunk)\n\n return {\n isEnd: chunks.length-1 === findIndex,\n i: findIndex + 1,\n }\n}"
},
{
"renderTypeList": ["reference"],
"valueType": "arrayString",
"canEdit": true,
"key": "chunks",
"label": "chunks",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["y3WEYOQ09CGC", "qLUQfhG0ILRX"]
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "currentChunk",
"label": "currentChunk",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["quYZgsW32ApA", "eCp73lztAEGK"]
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "完整响应数据",
"valueType": "object",
"type": "static"
},
{
"id": "error",
"key": "error",
"label": "运行错误",
"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",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key"
},
{
"id": "nmBmGaARbKkl",
"valueType": "boolean",
"type": "dynamic",
"key": "isEnd",
"label": "isEnd"
},
{
"id": "nqB98uKpq6Ig",
"valueType": "number",
"type": "dynamic",
"key": "i",
"label": "i"
}
]
},
{
"nodeId": "quYZgsW32ApA",
"name": "格式化源文本块",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 1306.0466226590386,
"y": 1038.0950796039954
},
"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
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({source_text_chunks, i=0}){\n let before = source_text_chunks.slice(0, i).join(\"\");\n let current = \" <TRANSLATE_THIS>\" + source_text_chunks[i] + \"</TRANSLATE_THIS>\";\n let after = source_text_chunks.slice(i + 1).join(\"\");\n let tagged_text = before + current + after;\n\n return {\n tagged_text,\n chunk_to_translate: source_text_chunks[i],\n }\n}"
},
{
"renderTypeList": ["reference"],
"valueType": "number",
"canEdit": true,
"key": "i",
"label": "i",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["a2lqxASWi1vb", "nqB98uKpq6Ig"]
},
{
"renderTypeList": ["reference"],
"valueType": "arrayString",
"canEdit": true,
"key": "source_text_chunks",
"label": "source_text_chunks",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["y3WEYOQ09CGC", "qLUQfhG0ILRX"]
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "完整响应数据",
"valueType": "object",
"type": "static"
},
{
"id": "error",
"key": "error",
"label": "运行错误",
"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",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key"
},
{
"id": "xhXu6sdEWBnF",
"valueType": "string",
"type": "dynamic",
"key": "tagged_text",
"label": "tagged_text"
},
{
"id": "eCp73lztAEGK",
"valueType": "string",
"type": "dynamic",
"key": "chunk_to_translate",
"label": "chunk_to_translate"
}
]
},
{
"nodeId": "izsNX8FXGD1t",
"name": "指定回复",
"intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
"avatar": "core/workflow/template/reply",
"flowNodeType": "answerNode",
"position": {
"x": 6412.138830862469,
"y": 1235.7269544046057
},
"version": "481",
"inputs": [
{
"key": "text",
"renderTypeList": ["textarea", "reference"],
"valueType": "any",
"required": true,
"label": "core.module.input.label.Response content",
"description": "core.module.input.description.Response content",
"placeholder": "core.module.input.description.Response content",
"value": "\n\n*** 字幕反思翻译完成!***"
}
],
"outputs": []
},
{
"nodeId": "vlNHndpNuFXB",
"name": "取出 LLM 翻译第四轮文本",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 3292.3569279448307,
"y": 996.4264559884845
},
"version": "482",
"inputs": [
{
"key": "system_addInputParam",
"renderTypeList": ["addInputParam"],
"valueType": "dynamic",
"label": "",
"required": false,
"description": "这些变量会作为代码的运行的输入参数",
"editField": {
"key": true,
"valueType": true
},
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({data1}){\n const result = data1.split(\"```\").filter(item => !!item.trim())\n\n if(result[result.length-1]) {\n return {\n result: result[result.length-1].trim() \n }\n }\n\n return {\n result: '未截取到翻译内容'\n }\n}"
},
{
"key": "data1",
"valueType": "string",
"label": "data1",
"renderTypeList": ["reference"],
"description": "",
"canEdit": true,
"editField": {
"key": true,
"valueType": true
},
"value": ["yjFO3YcM7KG2", "answerText"],
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
}
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "完整响应数据",
"valueType": "object",
"type": "static"
},
{
"id": "error",
"key": "error",
"label": "运行错误",
"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",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key"
},
{
"id": "qLUQfhG0ILRX",
"type": "dynamic",
"key": "result",
"valueType": "string",
"label": "result"
},
{
"id": "gR0mkQpJ4Og8",
"type": "dynamic",
"key": "data2",
"valueType": "string",
"label": "data2"
}
]
},
{
"nodeId": "qlt9KJbbS9yJ",
"name": "判断源语言和目标语言是否相同",
"intro": "根据一定的条件,执行不同的分支。",
"avatar": "core/workflow/template/ifelse",
"flowNodeType": "ifElseNode",
"showStatus": true,
"position": {
"x": -646.0682391158168,
"y": 1352.6591494737195
},
"version": "481",
"inputs": [
{
"key": "ifElseList",
"renderTypeList": ["hidden"],
"valueType": "any",
"label": "",
"value": [
{
"condition": "AND",
"list": [
{
"variable": ["frjbsrlnJJsR", "qLUQfhG0ILRX"],
"condition": "equalTo",
"value": "false"
}
]
}
]
}
],
"outputs": [
{
"id": "ifElseResult",
"key": "ifElseResult",
"label": "判断结果",
"valueType": "string",
"type": "static"
}
]
},
{
"nodeId": "frjbsrlnJJsR",
"name": "判断源语言和目标语言是否相同",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": -1152.6572772702038,
"y": 1092.3001349756628
},
"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
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({source_lang, target_lang}){\n \n return {\n result: source_lang === target_lang\n }\n}"
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "source_lang",
"label": "source_lang",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["VARIABLE_NODE_ID", "source_lang"]
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "target_lang",
"label": "target_lang",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["VARIABLE_NODE_ID", "target_lang"]
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "完整响应数据",
"valueType": "object",
"type": "static"
},
{
"id": "error",
"key": "error",
"label": "运行错误",
"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",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key"
},
{
"id": "qLUQfhG0ILRX",
"type": "dynamic",
"key": "result",
"valueType": "boolean",
"label": "result"
}
]
},
{
"nodeId": "dFxrGZS3Wmnz",
"name": "提示源语言与目标语言相同",
"intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
"avatar": "core/workflow/template/reply",
"flowNodeType": "answerNode",
"position": {
"x": -523.8880105943567,
"y": 1735.994691812213
},
"version": "481",
"inputs": [
{
"key": "text",
"renderTypeList": ["textarea", "reference"],
"valueType": "any",
"required": true,
"label": "core.module.input.label.Response content",
"description": "core.module.input.description.Response content",
"placeholder": "core.module.input.description.Response content",
"selectedTypeIndex": 0,
"value": "{{source_lang}} 无需再次翻译为 {{target_lang}} ~"
}
],
"outputs": []
},
{
"nodeId": "tqzmK5oPR9BA",
"name": "输出翻译",
"intro": "该模块可以直接回复一段指定的内容。常用于引导、提示。非字符串内容传入时,会转成字符串进行输出。",
"avatar": "core/workflow/template/reply",
"flowNodeType": "answerNode",
"position": {
"x": 4368.135274121754,
"y": 1308.859868496928
},
"version": "481",
"inputs": [
{
"key": "text",
"renderTypeList": ["textarea", "reference"],
"valueType": "any",
"required": true,
"label": "core.module.input.label.Response content",
"description": "core.module.input.description.Response content",
"placeholder": "core.module.input.description.Response content",
"selectedTypeIndex": 1,
"value": ["ppPP6o7YYSTJ", "dYalXmYJ60bj"]
}
],
"outputs": []
},
{
"nodeId": "kbr342XlxSZR",
"name": "提取字幕信息",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 207.77750594024815,
"y": 1057.1062190161417
},
"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
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({text}){\n const lines = text.split('\\n');\n const timePattern = /\\d{2}:\\d{2}:\\d{2},\\d{3} --> \\d{2}:\\d{2}:\\d{2},\\d{3}/;\n const numberInfo = [];\n const timeInfo = [];\n const textInfo = [];\n let currentText = [];\n\n // 提取序号、时间戳和文本信息\n lines.forEach(line => {\n if (/^\\d+$/.test(line.trim())) {\n numberInfo.push(line.trim());\n } else if (timePattern.test(line)) {\n timeInfo.push(line);\n if (currentText.length > 0) {\n textInfo.push(currentText.join(' '));\n currentText = [];\n }\n } else if (line.trim() === '') {\n // Skip empty lines\n } else {\n currentText.push(line.trim());\n }\n });\n\n if (currentText.length > 0) {\n textInfo.push(currentText.join(' '));\n }\n\n return { numberInfo, timeInfo, textInfo };\n}"
},
{
"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": ["448745", "userChatInput"]
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "完整响应数据",
"valueType": "object",
"type": "static"
},
{
"id": "error",
"key": "error",
"label": "运行错误",
"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",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key"
},
{
"id": "h3qVuGhV9HNm",
"valueType": "arrayString",
"type": "dynamic",
"key": "timeInfo",
"label": "timeInfo"
},
{
"id": "zGYRMNA9xGuI",
"valueType": "arrayString",
"type": "dynamic",
"key": "textInfo",
"label": "textInfo"
},
{
"id": "dhzTt6Riz8Dp",
"valueType": "arrayString",
"type": "dynamic",
"key": "numberInfo",
"label": "numberInfo"
}
]
},
{
"nodeId": "ppPP6o7YYSTJ",
"name": "格式化字幕文件",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 3830.732983153034,
"y": 828.5283022715971
},
"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
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({combinedText, transedText, timeInfo, currentIndex=0,numberInfo}){\n const textLines = combinedText.split('<T>');\n const resultLines = transedText.split('<T>');\n const combinedLines = [];\n\n resultLines.forEach((line, index) => {\n combinedLines.push(numberInfo[currentIndex+index]);\n combinedLines.push(timeInfo[currentIndex+index]);\n combinedLines.push(line)\n combinedLines.push(textLines[index]);\n combinedLines.push('');\n });\n\n const srtContent = combinedLines.join('\\n');\n \n\n return {\n srtContent,\n currentIndex: currentIndex+textLines.length\n }\n}"
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "combinedText",
"label": "combinedText",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["quYZgsW32ApA", "eCp73lztAEGK"]
},
{
"renderTypeList": ["reference"],
"valueType": "string",
"canEdit": true,
"key": "transedText",
"label": "transedText",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["vlNHndpNuFXB", "qLUQfhG0ILRX"]
},
{
"renderTypeList": ["reference"],
"valueType": "arrayString",
"canEdit": true,
"key": "timeInfo",
"label": "timeInfo",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["kbr342XlxSZR", "h3qVuGhV9HNm"]
},
{
"renderTypeList": ["reference"],
"valueType": "number",
"canEdit": true,
"key": "currentIndex",
"label": "currentIndex",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["ppPP6o7YYSTJ", "u6eqeC0pEPe0"]
},
{
"renderTypeList": ["reference"],
"valueType": "arrayString",
"canEdit": true,
"key": "numberInfo",
"label": "numberInfo",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["kbr342XlxSZR", "dhzTt6Riz8Dp"]
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "完整响应数据",
"valueType": "object",
"type": "static"
},
{
"id": "error",
"key": "error",
"label": "运行错误",
"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",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key"
},
{
"id": "dYalXmYJ60bj",
"valueType": "string",
"type": "dynamic",
"key": "srtContent",
"label": "srtContent"
},
{
"id": "u6eqeC0pEPe0",
"valueType": "number",
"type": "dynamic",
"key": "currentIndex",
"label": "currentIndex"
}
]
},
{
"nodeId": "y3WEYOQ09CGC",
"name": "切分文本",
"intro": "执行一段简单的脚本代码,通常用于进行复杂的数据处理。",
"avatar": "core/workflow/template/codeRun",
"flowNodeType": "code",
"showStatus": true,
"position": {
"x": 778.9569641790565,
"y": 1108.0575844436903
},
"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
}
},
{
"key": "codeType",
"renderTypeList": ["hidden"],
"label": "",
"value": "js"
},
{
"key": "code",
"renderTypeList": ["custom"],
"label": "",
"value": "function main({textArray}){\n const groupSize = 40\n const delimiter = '<T>'\n\n const result = [];\n\n for (let i = 0; i < textArray.length; i += groupSize) {\n result.push(textArray.slice(i, i + groupSize).join(delimiter));\n }\n\n return {result};\n}"
},
{
"renderTypeList": ["reference"],
"valueType": "arrayString",
"canEdit": true,
"key": "textArray",
"label": "textArray",
"customInputConfig": {
"selectValueTypeList": [
"string",
"number",
"boolean",
"object",
"arrayString",
"arrayNumber",
"arrayBoolean",
"arrayObject",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": true
},
"required": true,
"value": ["kbr342XlxSZR", "zGYRMNA9xGuI"]
}
],
"outputs": [
{
"id": "system_rawResponse",
"key": "system_rawResponse",
"label": "完整响应数据",
"valueType": "object",
"type": "static"
},
{
"id": "error",
"key": "error",
"label": "运行错误",
"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",
"any",
"chatHistory",
"datasetQuote",
"dynamic",
"selectApp",
"selectDataset"
],
"showDescription": false,
"showDefaultValue": false
},
"description": "将代码中 return 的对象作为输出,传递给后续的节点。变量名需要对应 return 的 key"
},
{
"id": "qLUQfhG0ILRX",
"type": "dynamic",
"key": "result",
"valueType": "arrayString",
"label": "result"
}
]
}
],
"edges": [
{
"source": "bxz97Vg4Omux",
"target": "yjFO3YcM7KG2",
"sourceHandle": "bxz97Vg4Omux-source-right",
"targetHandle": "yjFO3YcM7KG2-target-left"
},
{
"source": "a2lqxASWi1vb",
"target": "w4heEpNflz59",
"sourceHandle": "a2lqxASWi1vb-source-right",
"targetHandle": "w4heEpNflz59-target-left"
},
{
"source": "w4heEpNflz59",
"target": "izsNX8FXGD1t",
"sourceHandle": "w4heEpNflz59-source-IF",
"targetHandle": "izsNX8FXGD1t-target-left"
},
{
"source": "448745",
"target": "frjbsrlnJJsR",
"sourceHandle": "448745-source-right",
"targetHandle": "frjbsrlnJJsR-target-left"
},
{
"source": "frjbsrlnJJsR",
"target": "qlt9KJbbS9yJ",
"sourceHandle": "frjbsrlnJJsR-source-right",
"targetHandle": "qlt9KJbbS9yJ-target-left"
},
{
"source": "tqzmK5oPR9BA",
"target": "a2lqxASWi1vb",
"sourceHandle": "tqzmK5oPR9BA-source-right",
"targetHandle": "a2lqxASWi1vb-target-left"
},
{
"source": "yjFO3YcM7KG2",
"target": "vlNHndpNuFXB",
"sourceHandle": "yjFO3YcM7KG2-source-right",
"targetHandle": "vlNHndpNuFXB-target-left"
},
{
"source": "ppPP6o7YYSTJ",
"target": "tqzmK5oPR9BA",
"sourceHandle": "ppPP6o7YYSTJ-source-right",
"targetHandle": "tqzmK5oPR9BA-target-left"
},
{
"source": "kbr342XlxSZR",
"target": "y3WEYOQ09CGC",
"sourceHandle": "kbr342XlxSZR-source-right",
"targetHandle": "y3WEYOQ09CGC-target-left"
},
{
"source": "y3WEYOQ09CGC",
"target": "quYZgsW32ApA",
"sourceHandle": "y3WEYOQ09CGC-source-right",
"targetHandle": "quYZgsW32ApA-target-left"
},
{
"source": "quYZgsW32ApA",
"target": "bxz97Vg4Omux",
"sourceHandle": "quYZgsW32ApA-source-right",
"targetHandle": "bxz97Vg4Omux-target-left"
},
{
"source": "w4heEpNflz59",
"target": "quYZgsW32ApA",
"sourceHandle": "w4heEpNflz59-source-ELSE",
"targetHandle": "quYZgsW32ApA-target-left"
},
{
"source": "qlt9KJbbS9yJ",
"target": "kbr342XlxSZR",
"sourceHandle": "qlt9KJbbS9yJ-source-IF",
"targetHandle": "kbr342XlxSZR-target-left"
},
{
"source": "qlt9KJbbS9yJ",
"target": "dFxrGZS3Wmnz",
"sourceHandle": "qlt9KJbbS9yJ-source-ELSE",
"targetHandle": "dFxrGZS3Wmnz-target-right"
},
{
"source": "vlNHndpNuFXB",
"target": "ppPP6o7YYSTJ",
"sourceHandle": "vlNHndpNuFXB-source-right",
"targetHandle": "ppPP6o7YYSTJ-target-left"
}
],
"chatConfig": {
"welcomeText": "你好,欢迎使用长字幕反思翻译机器人。\n\n在完成下方设置后,可以直接输入需要翻译的文本",
"variables": [
{
"id": "v98n5b",
"key": "source_lang",
"label": "源语言",
"type": "select",
"required": true,
"maxLen": 50,
"enums": [
{
"value": "简体中文"
},
{
"value": "繁體中文"
},
{
"value": "English"
},
{
"value": "Español"
},
{
"value": "Français"
},
{
"value": "Deutsch"
},
{
"value": "Italiano"
},
{
"value": "日本語"
},
{
"value": "한국어"
},
{
"value": "Русский"
},
{
"value": "العربية"
},
{
"value": "Bahasa Indonesia"
},
{
"value": "Polski"
}
],
"icon": "core/app/variable/select"
},
{
"id": "c3tvge",
"key": "target_lang",
"label": "目标语言",
"type": "select",
"required": true,
"maxLen": 50,
"enums": [
{
"value": "简体中文"
},
{
"value": "繁體中文"
},
{
"value": "English"
},
{
"value": "Español"
},
{
"value": "Français"
},
{
"value": "Deutsch"
},
{
"value": "Italiano"
},
{
"value": "日本語"
},
{
"value": "한국어"
},
{
"value": "Русский"
},
{
"value": "العربية"
},
{
"value": "Bahasa Indonesia"
},
{
"value": "Polski"
}
],
"icon": "core/app/variable/select"
}
],
"scheduledTriggerConfig": {
"cronString": "",
"timezone": "Asia/Shanghai",
"defaultPrompt": ""
},
"_id": "6688b45317c65410d61d58aa"
}
}
}
{
"name": "知道时间的机器人",
"intro": "通过挂载时间插件,让模型获取当前最新时间",
"author": "Fastgpt",
"avatar": "core/workflow/template/getTime",
"tags": ["recommendation", "roleplay"],
"type": "simple",
"weight": 1,
"workflow": {
"nodes": [
{
"nodeId": "userGuide",
"name": "系统配置",
"intro": "可以配置应用的系统参数",
"avatar": "/imgs/workflow/userGuide.png",
"flowNodeType": "userGuide",
"position": {
"x": 531.2422736065552,
"y": -486.7611729549753
},
"version": "481",
"inputs": [],
"outputs": []
},
{
"nodeId": "workflowStartNodeId",
"name": "流程开始",
"intro": "",
"avatar": "/imgs/workflow/userChatInput.svg",
"flowNodeType": "workflowStart",
"position": {
"x": 558.4082376415505,
"y": 123.72387429194112
},
"version": "481",
"inputs": [
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"toolDescription": "用户问题"
}
],
"outputs": [
{
"id": "userChatInput",
"key": "userChatInput",
"label": "core.module.input.label.user question",
"valueType": "string",
"type": "static"
}
]
},
{
"nodeId": "jrWPV9",
"name": "工具调用",
"intro": "通过AI模型自动选择一个或多个功能块进行调用,也可以对插件进行调用。",
"avatar": "/imgs/workflow/tool.svg",
"flowNodeType": "tools",
"showStatus": true,
"position": {
"x": 1062.1738942532802,
"y": -223.65033022650476
},
"version": "481",
"inputs": [
{
"key": "model",
"renderTypeList": ["settingLLMModel", "reference"],
"label": "core.module.input.label.aiModel",
"valueType": "string",
"llmModelType": "all",
"value": "gpt-3.5-turbo"
},
{
"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": "systemPrompt",
"renderTypeList": ["textarea", "reference"],
"max": 3000,
"valueType": "string",
"label": "core.ai.Prompt",
"description": "core.app.tip.chatNodeSystemPromptTip",
"placeholder": "core.app.tip.chatNodeSystemPromptTip",
"value": ""
},
{
"key": "history",
"renderTypeList": ["numberInput", "reference"],
"valueType": "chatHistory",
"label": "core.module.input.label.chat history",
"description": "最多携带多少轮对话记录",
"required": true,
"min": 0,
"max": 30,
"value": 6
},
{
"key": "userChatInput",
"renderTypeList": ["reference", "textarea"],
"valueType": "string",
"label": "用户问题",
"required": true,
"value": ["workflowStartNodeId", "userChatInput"]
}
],
"outputs": [
{
"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": "zBxjo5",
"name": "获取当前时间",
"intro": "获取用户当前时区的时间。",
"avatar": "/imgs/workflow/getCurrentTime.svg",
"flowNodeType": "pluginModule",
"showStatus": false,
"position": {
"x": 1000,
"y": 545
},
"version": "481",
"inputs": [],
"outputs": [
{
"id": "time",
"type": "static",
"key": "time",
"valueType": "string",
"label": "time",
"description": ""
}
],
"pluginId": "community-getTime"
}
],
"edges": [
{
"source": "workflowStartNodeId",
"target": "jrWPV9",
"sourceHandle": "workflowStartNodeId-source-right",
"targetHandle": "jrWPV9-target-left"
},
{
"source": "jrWPV9",
"target": "zBxjo5",
"sourceHandle": "selectedTools",
"targetHandle": "selectedTools"
}
],
"chatConfig": {
"scheduledTriggerConfig": {
"cronString": "",
"timezone": "Asia/Shanghai",
"defaultPrompt": ""
}
}
}
}
<svg viewBox="0 0 24 22" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_6458_21426)">
<rect width="16.9863" height="7.72395" rx="2.5" transform="matrix(0.960903 -0.276886 0.36577 0.930705 2.47949 5.24646)" fill="#E1EAFF"/>
</g>
<g clip-path="url(#clip1_6458_21426)">
<rect width="19.1584" height="7.56066" rx="2.5" transform="matrix(0.992604 -0.121398 0.175115 0.984548 1.91479 4.55225)" fill="#C5D7FF"/>
</g>
<g filter="url(#filter0_dd_6458_21426)">
<rect x="2" y="4.22711" width="20" height="15" rx="2.5" fill="url(#paint0_linear_6458_21426)"/>
<rect x="4.5" y="6.62494" width="3.125" height="3.125" rx="1" fill="white" fill-opacity="0.8"/>
<rect x="4.5" y="11.3469" width="15.625" height="1.25" rx="0.625" fill="white" fill-opacity="0.8"/>
<rect x="4.5" y="13.704" width="7.5" height="1.25" rx="0.625" fill="white" fill-opacity="0.8"/>
</g>
<defs>
<filter id="filter0_dd_6458_21426" x="0.75" y="3.60211" width="22.5" height="17.5" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="0.3125"/>
<feComposite in2="hardAlpha" operator="out"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.0745098 0 0 0 0 0.2 0 0 0 0 0.419608 0 0 0 0.08 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_6458_21426"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset dy="0.625"/>
<feGaussianBlur stdDeviation="0.625"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.0745098 0 0 0 0 0.2 0 0 0 0 0.419608 0 0 0 0.05 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_6458_21426" result="effect2_dropShadow_6458_21426"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_6458_21426" result="shape"/>
</filter>
<linearGradient id="paint0_linear_6458_21426" x1="22" y1="4.93495" x2="2" y2="19.2271" gradientUnits="userSpaceOnUse">
<stop stop-color="#94B5FF"/>
<stop offset="1" stop-color="#3370FF"/>
</linearGradient>
<clipPath id="clip0_6458_21426">
<rect width="16.9863" height="7.72395" rx="2.5" transform="matrix(0.960903 -0.276886 0.36577 0.930705 2.47949 5.24646)" fill="white"/>
</clipPath>
<clipPath id="clip1_6458_21426">
<rect width="19.1584" height="7.56066" rx="2.5" transform="matrix(0.992604 -0.121398 0.175115 0.984548 1.91479 4.55225)" fill="white"/>
</clipPath>
</defs>
</svg>
<svg t="1719285602998" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="13146" width="256" height="256"><path d="M383.853714 257.170286l-0.487619-4.681143c-14.019048-104.082286 73.264762-183.759238 184.758857-139.580953 45.83619 18.16381 94.329905 45.884952 126.415238 73.386667A30.47619 30.47619 0 0 1 654.872381 232.594286c-26.575238-22.77181-69.241905-47.201524-109.226667-63.024762-64.121905-25.404952-107.910095 12.653714-102.351238 70.631619l0.487619 4.169143c6.777905 50.785524-13.775238 96.207238-58.148571 114.663619-58.09981 24.137143-121.392762 5.510095-149.138286-55.344762-8.362667-18.334476-34.986667-33.475048-62.342095-32.402286-33.767619 1.316571-64.146286 25.404952-84.163048 77.653333-67.876571 177.005714 15.262476 371.614476 190.805334 441.148953 68.388571 27.111619 147.602286 30.549333 221.379047 11.702857a30.47619 30.47619 0 0 1 15.116191 59.050667c-85.869714 21.942857-178.176 17.92-258.925715-14.092191-206.848-81.92-305.005714-311.661714-225.28-519.631238C61.44 253.123048 112.39619 212.699429 171.78819 210.383238c49.39581-1.926095 97.475048 24.33219 117.906286 63.439238l2.243048 4.559238c13.04381 28.598857 40.569905 36.693333 70.314666 24.356572 15.36-6.38781 23.454476-22.601143 21.601524-45.592381zM826.343619 18.992762a30.47619 30.47619 0 0 1 52.370286 31.134476l-5.290667 9.313524-3.267048 5.948952c-7.070476 12.946286-14.969905 28.184381-23.478857 45.568a1723.026286 1723.026286 0 0 0-71.801904 169.618286c-3.730286 10.264381-7.387429 20.626286-10.971429 31.085714-27.843048 81.188571-43.715048 167.424-50.517333 250.148572a30.47619 30.47619 0 0 1-60.757334-4.998096c7.192381-87.381333 23.942095-178.41981 53.613715-264.923428 3.705905-10.825143 7.484952-21.528381 11.361523-32.134095a1783.710476 1783.710476 0 0 1 74.361905-175.640381l8.679619-17.456762c4.242286-8.362667 8.313905-16.164571 12.190476-23.405714l10.337524-18.797715c1.316571-2.31619 2.364952-4.144762 3.169524-5.461333zM990.305524 45.251048a30.47619 30.47619 0 0 1 28.135619 32.670476l-1.316572 13.921524a959.878095 959.878095 0 0 1-0.950857 8.387047l-2.291809 18.432c-1.706667 12.873143-3.754667 26.86781-6.217143 41.886476a1806.921143 1806.921143 0 0 1-47.542857 209.066667c-15.555048 53.76-37.034667 108.153905-62.927238 162.133333a1327.250286 1327.250286 0 0 1-61.147429 112.88381l-8.533333 13.897143c-2.730667 4.388571-5.412571 8.582095-7.948191 12.55619l-10.678857 16.140191a30.47619 30.47619 0 1 1-51.053714-33.353143l6.972952-10.410667 7.216762-11.215238a1266.736762 1266.736762 0 0 0 70.217143-126.902857c24.527238-51.102476 44.78781-102.4 59.318857-152.673524a1746.236952 1746.236952 0 0 0 45.958095-201.947428c2.340571-14.384762 4.315429-27.769905 5.924572-39.984762l2.194286-17.505524c1.145905-9.849905 1.755429-16.579048 2.023619-19.846095a30.47619 30.47619 0 0 1 29.525333-28.208762l3.120762 0.073143z" fill="#5AC2EE" p-id="13147"></path><path d="M594.944 641.609143c-6.192762 5.38819-13.848381 14.628571-20.967619 28.038095-17.529905 33.01181-23.235048 76.092952-11.434667 128.731429 9.581714 42.73981 3.85219 84.74819-11.702857 123.245714a213.113905 213.113905 0 0 1-11.142095 23.478857l-4.315429 7.265524c-15.335619 22.479238 4.217905 52.248381 30.939429 47.104 15.774476-3.023238 41.447619-11.337143 73.679238-27.452952 52.687238-26.331429 105.130667-65.462857 153.84381-119.759239 4.217905-4.705524 8.411429-9.532952 12.55619-14.457904 53.174857-63.24419 38.838857-154.209524-25.453714-203.580953-54.613333-41.984-131.779048-39.984762-182.393905 4.096l-3.608381 3.291429z m148.870095 40.935619c37.741714 29.013333 45.860571 80.457143 15.945143 116.004571-3.730286 4.437333-7.484952 8.777143-11.288381 13.019429l-8.728381 9.508571c-37.961143 40.350476-77.897143 70.38781-117.784381 91.672381l-4.486095 2.29181 1.194667-4.071619c10.069333-36.985905 12.775619-76.239238 5.266285-116.589715l-1.926095-9.337904c-8.630857-38.473143-4.87619-66.681905 5.802667-86.820572 2.925714-5.485714 5.461333-8.825905 6.631619-10.118095l1.536-1.438476c28.525714-27.209143 75.142095-29.257143 107.836952-4.144762z" fill="#5AC2EE" p-id="13148"></path><path d="M663.210667 743.545905c18.334476-7.314286 38.253714-9.508571 58.294857-2.998857l6.290286 2.340571 4.510476 1.950476c3.120762 1.487238 5.973333 3.169524 12.970666 7.484953l3.267048 1.999238c16.871619 10.361905 20.23619 10.556952 36.181333-3.291429a30.47619 30.47619 0 1 1 39.936 46.08c-37.497905 32.475429-68.266667 32.182857-103.765333 11.702857l-13.628952-8.216381a26.136381 26.136381 0 0 0-2.340572-1.219047l-0.902095-0.365715c-5.193143-2.072381-11.580952-1.511619-18.212571 1.145905l-3.82781 1.755429a30.47619 30.47619 0 1 1-33.401905-50.980572c3.34019-2.194286 8.289524-4.87619 14.628572-7.387428zM759.686095 498.688l96.889905 29.866667-17.944381 58.270476-96.914286-29.891048zM243.321905 571.075048a50.371048 50.371048 0 1 0 0 100.766476 50.371048 50.371048 0 0 0 0-100.766476z m0 39.814095a10.581333 10.581333 0 1 1 0 21.138286 10.581333 10.581333 0 0 1 0-21.138286zM402.529524 650.703238a50.371048 50.371048 0 1 0 0 100.742095 50.371048 50.371048 0 0 0 0-100.742095z m0 39.789714a10.581333 10.581333 0 1 1 0 21.162667 10.581333 10.581333 0 0 1 0-21.162667zM183.588571 411.867429a50.371048 50.371048 0 1 0 0 100.766476 50.371048 50.371048 0 0 0 0-100.766476z m0 39.814095a10.581333 10.581333 0 1 1 0 21.138286 10.581333 10.581333 0 0 1 0-21.138286zM561.761524 252.635429a50.371048 50.371048 0 1 0 0 100.766476 50.371048 50.371048 0 0 0 0-100.766476z m0 39.814095a10.556952 10.556952 0 1 1 0 21.138286 10.556952 10.556952 0 0 1 0-21.138286z" fill="#5AC2EE" p-id="13149"></path></svg>
\ No newline at end of file
...@@ -15,9 +15,15 @@ type Props = { ...@@ -15,9 +15,15 @@ type Props = {
llmModelType?: `${LLMModelTypeEnum}`; llmModelType?: `${LLMModelTypeEnum}`;
defaultData: SettingAIDataType; defaultData: SettingAIDataType;
onChange: (e: SettingAIDataType) => void; onChange: (e: SettingAIDataType) => void;
bg?: string;
}; };
const SettingLLMModel = ({ llmModelType = LLMModelTypeEnum.all, defaultData, onChange }: Props) => { const SettingLLMModel = ({
llmModelType = LLMModelTypeEnum.all,
defaultData,
onChange,
bg = 'white'
}: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { llmModelList } = useSystemStore(); const { llmModelList } = useSystemStore();
...@@ -63,6 +69,7 @@ const SettingLLMModel = ({ llmModelType = LLMModelTypeEnum.all, defaultData, onC ...@@ -63,6 +69,7 @@ const SettingLLMModel = ({ llmModelType = LLMModelTypeEnum.all, defaultData, onC
w={'100%'} w={'100%'}
justifyContent={'flex-start'} justifyContent={'flex-start'}
variant={'whiteFlow'} variant={'whiteFlow'}
bg={bg}
_active={{ _active={{
transform: 'none' transform: 'none'
}} }}
......
...@@ -22,6 +22,7 @@ const WelcomeTextConfig = (props: TextareaProps) => { ...@@ -22,6 +22,7 @@ const WelcomeTextConfig = (props: TextareaProps) => {
mt={2} mt={2}
rows={6} rows={6}
fontSize={'sm'} fontSize={'sm'}
bg={'myGray.50'}
placeholder={t('common:core.app.tip.welcomeTextTip')} placeholder={t('common:core.app.tip.welcomeTextTip')}
{...props} {...props}
/> />
......
...@@ -22,10 +22,11 @@ export type CreateAppBody = { ...@@ -22,10 +22,11 @@ export type CreateAppBody = {
type?: AppTypeEnum; type?: AppTypeEnum;
modules: AppSchema['modules']; modules: AppSchema['modules'];
edges?: AppSchema['edges']; edges?: AppSchema['edges'];
chatConfig?: AppSchema['chatConfig'];
}; };
async function handler(req: ApiRequestProps<CreateAppBody>) { async function handler(req: ApiRequestProps<CreateAppBody>) {
const { parentId, name, avatar, type, modules, edges } = req.body; const { parentId, name, avatar, type, modules, edges, chatConfig } = req.body;
if (!name || !type || !Array.isArray(modules)) { if (!name || !type || !Array.isArray(modules)) {
return Promise.reject(CommonErrEnum.inheritPermissionError); return Promise.reject(CommonErrEnum.inheritPermissionError);
...@@ -50,6 +51,7 @@ async function handler(req: ApiRequestProps<CreateAppBody>) { ...@@ -50,6 +51,7 @@ async function handler(req: ApiRequestProps<CreateAppBody>) {
type, type,
modules, modules,
edges, edges,
chatConfig,
teamId, teamId,
tmbId tmbId
}); });
...@@ -67,6 +69,7 @@ export const onCreateApp = async ({ ...@@ -67,6 +69,7 @@ export const onCreateApp = async ({
type, type,
modules, modules,
edges, edges,
chatConfig,
teamId, teamId,
tmbId, tmbId,
pluginData, pluginData,
...@@ -78,6 +81,7 @@ export const onCreateApp = async ({ ...@@ -78,6 +81,7 @@ export const onCreateApp = async ({
type?: AppTypeEnum; type?: AppTypeEnum;
modules?: AppSchema['modules']; modules?: AppSchema['modules'];
edges?: AppSchema['edges']; edges?: AppSchema['edges'];
chatConfig?: AppSchema['chatConfig'];
intro?: string; intro?: string;
teamId: string; teamId: string;
tmbId: string; tmbId: string;
...@@ -96,6 +100,7 @@ export const onCreateApp = async ({ ...@@ -96,6 +100,7 @@ export const onCreateApp = async ({
tmbId, tmbId,
modules, modules,
edges, edges,
chatConfig,
type, type,
version: 'v2', version: 'v2',
pluginData, pluginData,
...@@ -111,7 +116,8 @@ export const onCreateApp = async ({ ...@@ -111,7 +116,8 @@ export const onCreateApp = async ({
{ {
appId, appId,
nodes: modules, nodes: modules,
edges edges,
chatConfig
} }
], ],
{ session } { session }
......
import type { NextApiRequest, NextApiResponse } from 'next';
import { authCert } from '@fastgpt/service/support/permission/auth/common';
import { NextAPI } from '@/service/middleware/entry';
import { TemplateMarketItemType } from '@fastgpt/global/core/workflow/type';
import { getTemplateMarketItemDetail } from '@/service/core/app/template';
type Props = {
templateId: string;
};
async function handler(
req: NextApiRequest,
res: NextApiResponse<any>
): Promise<TemplateMarketItemType | undefined> {
await authCert({ req, authToken: true });
const { templateId } = req.query as Props;
return getTemplateMarketItemDetail(templateId);
}
export default NextAPI(handler);
import type { NextApiRequest, NextApiResponse } from 'next';
import { authCert } from '@fastgpt/service/support/permission/auth/common';
import { NextAPI } from '@/service/middleware/entry';
import { TemplateMarketListItemType } from '@fastgpt/global/core/workflow/type';
import { getTemplateMarketItemList } from '@/service/core/app/template';
async function handler(
req: NextApiRequest,
res: NextApiResponse<any>
): Promise<TemplateMarketListItemType[]> {
await authCert({ req, authToken: true });
return getTemplateMarketItemList();
}
export default NextAPI(handler);
...@@ -30,7 +30,6 @@ const Edit = ({ ...@@ -30,7 +30,6 @@ const Edit = ({
// show selected dataset // show selected dataset
useMount(() => { useMount(() => {
loadAllDatasets(); loadAllDatasets();
setAppForm( setAppForm(
appWorkflow2Form({ appWorkflow2Form({
nodes: appDetail.modules, nodes: appDetail.modules,
......
...@@ -135,13 +135,14 @@ const EditForm = ({ ...@@ -135,13 +135,14 @@ const EditForm = ({
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<MyIcon name={'core/app/simpleMode/ai'} w={'20px'} /> <MyIcon name={'core/app/simpleMode/ai'} w={'20px'} />
<FormLabel ml={2} flex={1}> <FormLabel ml={2} flex={1}>
{appT('ai_settings')} {t('app:ai_settings')}
</FormLabel> </FormLabel>
</Flex> </Flex>
<Flex alignItems={'center'} mt={5}> <Flex alignItems={'center'} mt={5}>
<Box {...LabelStyles}>{t('common:core.ai.Model')}</Box> <Box {...LabelStyles}>{t('common:core.ai.Model')}</Box>
<Box flex={'1 0 0'}> <Box flex={'1 0 0'}>
<SettingLLMModel <SettingLLMModel
bg="myGray.50"
llmModelType={'all'} llmModelType={'all'}
defaultData={{ defaultData={{
model: appForm.aiSettings.model, model: appForm.aiSettings.model,
...@@ -176,6 +177,7 @@ const EditForm = ({ ...@@ -176,6 +177,7 @@ const EditForm = ({
<Box mt={1}> <Box mt={1}>
<PromptEditor <PromptEditor
value={appForm.aiSettings.systemPrompt} value={appForm.aiSettings.systemPrompt}
bg={'myGray.50'}
onChange={(text) => { onChange={(text) => {
startTst(() => { startTst(() => {
setAppForm((state) => ({ setAppForm((state) => ({
......
...@@ -52,7 +52,6 @@ const Header = ({ ...@@ -52,7 +52,6 @@ const Header = ({
const isPublished = useMemo(() => { const isPublished = useMemo(() => {
const data = form2AppWorkflow(appForm, t); const data = form2AppWorkflow(appForm, t);
return compareWorkflow( return compareWorkflow(
{ {
nodes: appDetail.modules, nodes: appDetail.modules,
......
import React, { useCallback, useRef } from 'react'; import React, { useCallback, useMemo, useRef } from 'react';
import { import { Box, Flex, Button, ModalFooter, ModalBody, Input, Grid, Card } from '@chakra-ui/react';
Box,
Flex,
Button,
ModalFooter,
ModalBody,
Input,
Grid,
useTheme,
Card
} from '@chakra-ui/react';
import { useSelectFile } from '@/web/common/file/hooks/useSelectFile'; import { useSelectFile } from '@/web/common/file/hooks/useSelectFile';
import { useForm } from 'react-hook-form'; import { useForm } from 'react-hook-form';
import { compressImgFileAndUpload } from '@/web/common/file/controller'; import { compressImgFileAndUpload } from '@/web/common/file/controller';
...@@ -17,8 +7,8 @@ import { getErrText } from '@fastgpt/global/common/error/utils'; ...@@ -17,8 +7,8 @@ import { getErrText } from '@fastgpt/global/common/error/utils';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import { postCreateApp } from '@/web/core/app/api'; import { postCreateApp } from '@/web/core/app/api';
import { useRouter } from 'next/router'; import { useRouter } from 'next/router';
import { simpleBotTemplates, workflowTemplates, pluginTemplates } from '@/web/core/app/templates'; import { emptyTemplates } from '@/web/core/app/templates';
import { useRequest } from '@fastgpt/web/hooks/useRequest'; import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import Avatar from '@fastgpt/web/components/common/Avatar'; import Avatar from '@fastgpt/web/components/common/Avatar';
import MyTooltip from '@fastgpt/web/components/common/MyTooltip'; import MyTooltip from '@fastgpt/web/components/common/MyTooltip';
import MyModal from '@fastgpt/web/components/common/MyModal'; import MyModal from '@fastgpt/web/components/common/MyModal';
...@@ -27,20 +17,31 @@ import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants' ...@@ -27,20 +17,31 @@ import { MongoImageTypeEnum } from '@fastgpt/global/common/file/image/constants'
import { useContextSelector } from 'use-context-selector'; import { useContextSelector } from 'use-context-selector';
import { AppListContext } from './context'; import { AppListContext } from './context';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants'; import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { useI18n } from '@/web/context/I18n';
import { useSystem } from '@fastgpt/web/hooks/useSystem'; import { useSystem } from '@fastgpt/web/hooks/useSystem';
import { ChevronRightIcon } from '@chakra-ui/icons';
import MyIcon from '@fastgpt/web/components/common/Icon';
import {
getTemplateMarketItemDetail,
getTemplateMarketItemList
} from '@/web/core/app/api/template';
type FormType = { type FormType = {
avatar: string; avatar: string;
name: string; name: string;
templateId: string;
}; };
export type CreateAppType = AppTypeEnum.simple | AppTypeEnum.workflow | AppTypeEnum.plugin; export type CreateAppType = AppTypeEnum.simple | AppTypeEnum.workflow | AppTypeEnum.plugin;
const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => void }) => { const CreateModal = ({
onClose,
type,
onOpenTemplateModal
}: {
type: CreateAppType;
onClose: () => void;
onOpenTemplateModal: (type: AppTypeEnum) => void;
}) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { appT } = useI18n();
const { toast } = useToast(); const { toast } = useToast();
const router = useRouter(); const router = useRouter();
const { parentId, loadMyApps } = useContextSelector(AppListContext, (v) => v); const { parentId, loadMyApps } = useContextSelector(AppListContext, (v) => v);
...@@ -49,34 +50,39 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo ...@@ -49,34 +50,39 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
const typeMap = useRef({ const typeMap = useRef({
[AppTypeEnum.simple]: { [AppTypeEnum.simple]: {
icon: 'core/app/simpleBot', icon: 'core/app/simpleBot',
title: appT('type.Create simple bot'), title: t('app:type.Create simple bot'),
avatar: '/imgs/app/avatar/simple.svg', avatar: '/imgs/app/avatar/simple.svg',
templates: simpleBotTemplates emptyCreateText: t('app:create_empty_app')
}, },
[AppTypeEnum.workflow]: { [AppTypeEnum.workflow]: {
icon: 'core/app/type/workflowFill', icon: 'core/app/type/workflowFill',
avatar: '/imgs/app/avatar/workflow.svg', avatar: '/imgs/app/avatar/workflow.svg',
title: appT('type.Create workflow bot'), title: t('app:type.Create workflow bot'),
templates: workflowTemplates emptyCreateText: t('app:create_empty_workflow')
}, },
[AppTypeEnum.plugin]: { [AppTypeEnum.plugin]: {
icon: 'core/app/type/pluginFill', icon: 'core/app/type/pluginFill',
avatar: '/imgs/app/avatar/plugin.svg', avatar: '/imgs/app/avatar/plugin.svg',
title: appT('type.Create plugin bot'), title: t('app:type.Create plugin bot'),
templates: pluginTemplates emptyCreateText: t('app:create_empty_plugin')
} }
}); });
const typeData = typeMap.current[type]; const typeData = typeMap.current[type];
const { data: templateList = [] } = useRequest2(getTemplateMarketItemList, {
manual: false
});
const filterTemplates = useMemo(() => {
return templateList.filter((item) => item.type === type).slice(0, 3);
}, [templateList, type]);
const { register, setValue, watch, handleSubmit } = useForm<FormType>({ const { register, setValue, watch, handleSubmit } = useForm<FormType>({
defaultValues: { defaultValues: {
avatar: typeData.avatar, avatar: typeData.avatar,
name: '', name: ''
templateId: typeData.templates[0].id
} }
}); });
const avatar = watch('avatar'); const avatar = watch('avatar');
const templateId = watch('templateId');
const { File, onOpen: onOpenSelectFile } = useSelectFile({ const { File, onOpen: onOpenSelectFile } = useSelectFile({
fileType: '.jpg,.png', fileType: '.jpg,.png',
...@@ -105,29 +111,42 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo ...@@ -105,29 +111,42 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
[setValue, t, toast] [setValue, t, toast]
); );
const { mutate: onclickCreate, isLoading: creating } = useRequest({ const { runAsync: onclickCreate, loading: isCreating } = useRequest2(
mutationFn: async (data: FormType) => { async (data: FormType, templateId?: string) => {
const template = typeData.templates.find((item) => item.id === data.templateId); if (!templateId) {
if (!template) { return postCreateApp({
return Promise.reject(t('common:core.dataset.error.Template does not exist')); parentId,
avatar: data.avatar,
name: data.name,
type,
modules: emptyTemplates[type].nodes,
edges: emptyTemplates[type].edges,
chatConfig: emptyTemplates[type].chatConfig
});
} }
const templateDetail = await getTemplateMarketItemDetail({ templateId: templateId });
return postCreateApp({ return postCreateApp({
parentId, parentId,
avatar: data.avatar || template.avatar, avatar: data.avatar || templateDetail.avatar,
name: data.name, name: data.name,
type: template.type, type: templateDetail.type,
modules: template.modules || [], modules: templateDetail.workflow.nodes || [],
edges: template.edges || [] edges: templateDetail.workflow.edges || [],
chatConfig: templateDetail.workflow.chatConfig
}); });
}, },
onSuccess(id: string) { {
router.push(`/app/detail?appId=${id}`); onSuccess(id: string) {
loadMyApps(); router.push(`/app/detail?appId=${id}`);
onClose(); loadMyApps();
}, onClose();
successToast: t('common:common.Create Success'), },
errorToast: t('common:common.Create Failed') successToast: t('common:common.Create Success'),
}); errorToast: t('common:common.Create Failed')
}
);
return ( return (
<MyModal <MyModal
...@@ -136,8 +155,10 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo ...@@ -136,8 +155,10 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
isOpen isOpen
onClose={onClose} onClose={onClose}
isCentered={!isPc} isCentered={!isPc}
maxW={['90vw', '40rem']}
isLoading={isCreating}
> >
<ModalBody> <ModalBody px={9} pb={8}>
<Box color={'myGray.800'} fontWeight={'bold'}> <Box color={'myGray.800'} fontWeight={'bold'}>
{t('common:common.Set Name')} {t('common:common.Set Name')}
</Box> </Box>
...@@ -146,8 +167,8 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo ...@@ -146,8 +167,8 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
<Avatar <Avatar
flexShrink={0} flexShrink={0}
src={avatar} src={avatar}
w={['28px', '32px']} w={['28px', '36px']}
h={['28px', '32px']} h={['28px', '36px']}
cursor={'pointer'} cursor={'pointer'}
borderRadius={'md'} borderRadius={'md'}
onClick={onOpenSelectFile} onClick={onOpenSelectFile}
...@@ -155,7 +176,7 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo ...@@ -155,7 +176,7 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
</MyTooltip> </MyTooltip>
<Input <Input
flex={1} flex={1}
ml={4} ml={3}
autoFocus autoFocus
bg={'myWhite.600'} bg={'myWhite.600'}
{...register('name', { {...register('name', {
...@@ -163,59 +184,111 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo ...@@ -163,59 +184,111 @@ const CreateModal = ({ onClose, type }: { type: CreateAppType; onClose: () => vo
})} })}
/> />
</Flex> </Flex>
<Box mt={[4, 7]} mb={[0, 3]} color={'myGray.800'} fontWeight={'bold'}> <Flex mt={[4, 7]} mb={[0, 3]}>
{t('common:core.app.Select app from template')} <Box color={'myGray.900'} fontWeight={'bold'} fontSize={'sm'}>
</Box> {t('common:core.app.Select app from template')}
</Box>
<Box flex={1} />
<Flex
onClick={() => onOpenTemplateModal(type)}
alignItems={'center'}
cursor={'pointer'}
color={'myGray.600'}
fontSize={'xs'}
_hover={{ color: 'blue.700' }}
>
{t('common:core.app.more')}
<ChevronRightIcon w={4} h={4} />
</Flex>
</Flex>
<Grid <Grid
userSelect={'none'} userSelect={'none'}
gridTemplateColumns={['repeat(1,1fr)', 'repeat(2,1fr)']} gridTemplateColumns={['repeat(1,1fr)', 'repeat(2,1fr)']}
gridGap={[2, 4]} gridGap={[2, 4]}
> >
{typeData.templates.map((item) => ( <Card
borderWidth={'1px'}
borderRadius={'md'}
cursor={'pointer'}
boxShadow={'3'}
display={'flex'}
flexDirection={'column'}
alignItems={'center'}
justifyContent={'center'}
color={'myGray.500'}
borderColor={'myGray.200'}
h={'8.25rem'}
_hover={{
color: 'primary.700',
borderColor: 'primary.300'
}}
onClick={handleSubmit((data) => onclickCreate(data))}
>
<MyIcon name={'common/addLight'} w={'1.5rem'} />
<Box fontSize={'sm'} mt={2}>
{typeData.emptyCreateText}
</Box>
</Card>
{filterTemplates.map((item) => (
<Card <Card
key={item.id} key={item.id}
border={'base'} p={4}
p={3}
borderRadius={'md'} borderRadius={'md'}
cursor={'pointer'} borderWidth={'1px'}
boxShadow={'sm'} borderColor={'myGray.200'}
{...(templateId === item.id boxShadow={'3'}
? { h={'8.25rem'}
bg: 'primary.50', _hover={{
borderColor: 'primary.500' borderColor: 'primary.300',
} '& .buttons': {
: { display: 'flex'
_hover: { }
boxShadow: 'md'
}
})}
onClick={() => {
setValue('templateId', item.id);
}} }}
display={'flex'}
flexDirection={'column'}
> >
<Flex alignItems={'center'}> <Flex alignItems={'center'}>
<Avatar src={item.avatar} borderRadius={'sm'} w={'1.5rem'} /> <Avatar src={item.avatar} borderRadius={'sm'} w={'1.5rem'} />
<Box ml={3} color={'myGray.900'}> <Box ml={3} color={'myGray.900'} fontWeight={500}>
{t(item.name as any)} {t(item.name as any)}
</Box> </Box>
</Flex> </Flex>
<Box fontSize={'xs'} mt={2} color={'myGray.600'}> <Box fontSize={'xs'} mt={2} color={'myGray.600'} flex={1}>
{t(item.intro as any)} {t(item.intro as any)}
</Box> </Box>
<Box w={'full'} fontSize={'mini'}>
<Box color={'myGray.500'}>By {item.author}</Box>
<Box
className="buttons"
display={'none'}
justifyContent={'center'}
alignItems={'center'}
position={'absolute'}
borderRadius={'lg'}
w={'full'}
h={'full'}
left={0}
right={0}
bottom={0}
height={'40px'}
bg={'white'}
zIndex={1}
>
<Button
variant={'whiteBase'}
h={'1.75rem'}
borderRadius={'xl'}
w={'40%'}
onClick={handleSubmit((data) => onclickCreate(data, item.id))}
>
{t('app:templateMarket.Use')}
</Button>
</Box>
</Box>
</Card> </Card>
))} ))}
</Grid> </Grid>
</ModalBody> </ModalBody>
<ModalFooter>
<Button variant={'whiteBase'} mr={3} onClick={onClose}>
{t('common:common.Close')}
</Button>
<Button px={6} isLoading={creating} onClick={handleSubmit((data) => onclickCreate(data))}>
{t('common:common.Confirm Create')}
</Button>
</ModalFooter>
<File onSelect={onSelectFile} /> <File onSelect={onSelectFile} />
</MyModal> </MyModal>
); );
......
import {
Box,
Button,
Flex,
Grid,
HStack,
Modal,
ModalBody,
ModalCloseButton,
ModalContent,
ModalHeader,
ModalOverlay
} from '@chakra-ui/react';
import Avatar from '@fastgpt/web/components/common/Avatar';
import { useCallback, useState } from 'react';
import MyBox from '@fastgpt/web/components/common/MyBox';
import AppTypeTag from './TypeTag';
import { AppTemplateTypeEnum, AppTypeEnum } from '@fastgpt/global/core/app/constants';
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
import {
getTemplateMarketItemDetail,
getTemplateMarketItemList
} from '@/web/core/app/api/template';
import { TemplateMarketListItemType } from '@fastgpt/global/core/workflow/type';
import { postCreateApp } from '@/web/core/app/api';
import { useContextSelector } from 'use-context-selector';
import { AppListContext } from './context';
import { useRouter } from 'next/router';
import MySelect from '@fastgpt/web/components/common/MySelect';
import { useTranslation } from 'next-i18next';
import { useSystem } from '@fastgpt/web/hooks/useSystem';
import EmptyTip from '@fastgpt/web/components/common/EmptyTip';
import SearchInput from '../../../../../../../packages/web/components/common/Input/SearchInput/index';
import MyIcon from '@fastgpt/web/components/common/Icon';
import { useSystemStore } from '@/web/common/system/useSystemStore';
type TemplateAppType = AppTypeEnum | 'all';
const TemplateMarketModal = ({
defaultType = 'all',
onClose
}: {
defaultType?: TemplateAppType;
onClose: () => void;
}) => {
const { t } = useTranslation();
const { feConfigs } = useSystemStore();
const templateTags = [
{
id: AppTemplateTypeEnum.recommendation,
label: t('app:templateMarket.templateTags.Recommendation')
},
{
id: AppTemplateTypeEnum.writing,
label: t('app:templateMarket.templateTags.Writing')
},
{
id: AppTemplateTypeEnum.imageGeneration,
label: t('app:templateMarket.templateTags.Image_generation')
},
{
id: AppTemplateTypeEnum.webSearch,
label: t('app:templateMarket.templateTags.Web_search')
},
{
id: AppTemplateTypeEnum.roleplay,
label: t('app:templateMarket.templateTags.Roleplay')
},
{
id: AppTemplateTypeEnum.officeServices,
label: t('app:templateMarket.templateTags.Office_services')
}
];
const { parentId } = useContextSelector(AppListContext, (v) => v);
const router = useRouter();
const { isPc } = useSystem();
const [currentTag, setCurrentTag] = useState(templateTags[0].id);
const [currentAppType, setCurrentAppType] = useState<TemplateAppType>(defaultType);
const [currentSearch, setCurrentSearch] = useState('');
const { data: templateList = [], loading: isLoadingTemplates } = useRequest2(
getTemplateMarketItemList,
{
manual: false
}
);
const { runAsync: onUseTemplate, loading: isCreating } = useRequest2(
async (id: string) => {
const templateDetail = await getTemplateMarketItemDetail({ templateId: id });
return postCreateApp({
parentId,
avatar: templateDetail.avatar,
name: templateDetail.name,
type: templateDetail.type,
modules: templateDetail.workflow.nodes || [],
edges: templateDetail.workflow.edges || [],
chatConfig: templateDetail.workflow.chatConfig
});
},
{
onSuccess(id: string) {
onClose();
router.push(`/app/detail?appId=${id}`);
},
successToast: t('common:common.Create Success'),
errorToast: t('common:common.Create Failed')
}
);
const { run: handleScroll } = useRequest2(
async () => {
let firstVisibleTitle: any = null;
templateTags
.map((type) => type.id)
.forEach((type: string) => {
const element = document.getElementById(type);
if (!element) return;
const elementRect = element.getBoundingClientRect();
if (elementRect.top <= window.innerHeight && elementRect.bottom >= 0) {
if (
!firstVisibleTitle ||
elementRect.top < firstVisibleTitle.getBoundingClientRect().top
) {
firstVisibleTitle = element;
}
}
});
if (firstVisibleTitle) {
setCurrentTag(firstVisibleTitle.id);
}
},
{
throttleWait: 100
}
);
const TemplateCard = useCallback(
({ item }: { item: TemplateMarketListItemType }) => {
const { t } = useTranslation();
return (
<MyBox
key={item.id}
lineHeight={1.5}
h="100%"
pt={4}
pb={3}
px={4}
border={'base'}
boxShadow={'2'}
bg={'white'}
borderRadius={'10px'}
position={'relative'}
display={'flex'}
flexDirection={'column'}
_hover={{
borderColor: 'primary.300',
boxShadow: '1.5',
'& .buttons': {
display: 'flex'
}
}}
>
<HStack>
<Avatar src={item.avatar} borderRadius={'sm'} w={'1.5rem'} h={'1.5rem'} />
<Box flex={'1 0 0'} color={'myGray.900'} fontWeight={500}>
{item.name}
</Box>
<Box mr={'-1rem'}>
<AppTypeTag type={item.type} />
</Box>
</HStack>
<Box
flex={['1 0 48px', '1 0 56px']}
mt={3}
pr={8}
textAlign={'justify'}
wordBreak={'break-all'}
fontSize={'xs'}
color={'myGray.500'}
>
<Box className={'textEllipsis2'}>{item.intro || t('app:templateMarket.no_intro')}</Box>
</Box>
<Box w={'full'} fontSize={'mini'}>
<Box color={'myGray.500'}>By {item.author}</Box>
<Box
className="buttons"
display={'none'}
justifyContent={'center'}
alignItems={'center'}
position={'absolute'}
borderRadius={'lg'}
w={'full'}
h={'full'}
left={0}
right={0}
bottom={0}
height={'40px'}
bg={'white'}
zIndex={1}
>
<Button
variant={'whiteBase'}
h={'1.75rem'}
borderRadius={'xl'}
w={'40%'}
onClick={() => onUseTemplate(item.id)}
>
{t('app:templateMarket.Use')}
</Button>
</Box>
</Box>
</MyBox>
);
},
[onUseTemplate]
);
return (
<Modal
isOpen={true}
onClose={() => onClose && onClose()}
autoFocus={false}
blockScrollOnMount={false}
closeOnOverlayClick={false}
isCentered
>
<ModalOverlay />
<ModalContent
w={['90vw', '80vw']}
maxW={'90vw'}
position={'relative'}
h={['90vh']}
boxShadow={'7'}
overflow={'hidden'}
>
<ModalHeader
display={'flex'}
alignItems={'center'}
py={'10px'}
fontSize={'md'}
fontWeight={'600'}
gap={2}
position={'relative'}
>
<Avatar src={'/imgs/app/templateFill.svg'} w={'2rem'} objectFit={'fill'} />
<Box color={'myGray.900'}>{t('app:templateMarket.Template_market')}</Box>
<Box flex={'1'} />
<MySelect
h={'8'}
value={currentAppType}
onchange={(value) => {
setCurrentAppType(value as AppTypeEnum | 'all');
}}
bg={'myGray.100'}
minW={'7rem'}
borderRadius={'sm'}
list={[
{ label: t('app:type.All'), value: 'all' },
{ label: t('app:type.Simple bot'), value: AppTypeEnum.simple },
{ label: t('app:type.Workflow bot'), value: AppTypeEnum.workflow },
{ label: t('app:type.Plugin'), value: AppTypeEnum.plugin }
]}
/>
<ModalCloseButton position={'relative'} fontSize={'xs'} top={0} right={0} />
{isPc && (
<Box
width="15rem"
position={'absolute'}
top={'50%'}
left={'50%'}
transform={'translate(-50%,-50%)'}
>
<SearchInput
pl={7}
placeholder={t('app:templateMarket.Search_template')}
value={currentSearch}
onChange={(e) => setCurrentSearch(e.target.value)}
h={8}
bg={'myGray.50'}
maxLength={20}
borderRadius={'sm'}
/>
</Box>
)}
</ModalHeader>
<MyBox isLoading={isCreating || isLoadingTemplates} flex={'1 0 0'} overflow={'overlay'}>
<ModalBody
h={'100%'}
display={'flex'}
bg={'myGray.100'}
overflow={'auto'}
gap={5}
onScroll={handleScroll}
px={0}
pt={5}
>
{isPc && (
<Flex pl={5} flexDirection={'column'} gap={3}>
{templateTags.map((item) => {
return (
<Box
key={item.id}
cursor={'pointer'}
{...(item.id === currentTag && !currentSearch
? {
bg: 'primary.1',
color: 'primary.600'
}
: {
_hover: { bg: 'primary.1' },
color: 'myGray.600'
})}
w={'9.5rem'}
px={4}
py={2}
rounded={'sm'}
fontSize={'sm'}
fontWeight={500}
onClick={() => {
setCurrentTag(item.id);
const anchor = document.getElementById(item.id);
if (anchor) {
anchor.scrollIntoView({ behavior: 'auto', block: 'start' });
}
}}
>
{item.label}
</Box>
);
})}
<Box flex={1} />
{feConfigs?.appTemplateCourse && (
<Flex
alignItems={'center'}
cursor={'pointer'}
_hover={{
color: 'primary.600'
}}
py={2}
fontWeight={500}
rounded={'sm'}
fontSize={'sm'}
onClick={() => window.open(feConfigs.appTemplateCourse)}
gap={1}
>
<MyIcon name={'common/upRightArrowLight'} w={'1rem'} />
<Box>{t('common:contribute_app_template')}</Box>
</Flex>
)}
</Flex>
)}
<Box pl={[3, 0]} pr={[3, 5]} pt={1} flex={'1'} h={'100%'} overflow={'auto'}>
{currentSearch ? (
<>
<Box fontSize={'lg'} color={'myGray.900'} mb={4}>
{t('common:xx_search_result', { key: currentSearch })}
</Box>
{(() => {
const templates = templateList.filter((template) =>
`${template.name}${template.intro}`.includes(currentSearch)
);
if (templates.length > 0) {
return (
<Grid
gridTemplateColumns={[
'1fr',
'repeat(2,1fr)',
'repeat(3,1fr)',
'repeat(3,1fr)',
'repeat(4,1fr)'
]}
gridGap={4}
alignItems={'stretch'}
pb={5}
>
{templates.map((item) => (
<TemplateCard key={item.id} item={item} />
))}
</Grid>
);
}
return <EmptyTip text={t('app:template_market_empty_data')} />;
})()}
</>
) : (
<>
{templateTags.map((item) => {
const currentTemplates = templateList
?.filter((template) => template.tags.includes(item.id))
.filter((template) => {
if (currentAppType === 'all') return true;
return template.type === currentAppType;
});
if (currentTemplates.length === 0) return null;
return (
<Box key={item.id}>
<Box
id={item.id}
fontSize={['md', 'lg']}
color={'myGray.900'}
mb={4}
fontWeight={500}
>
{item.label}
</Box>
<Grid
gridTemplateColumns={[
'1fr',
'repeat(2,1fr)',
'repeat(3,1fr)',
'repeat(3,1fr)',
'repeat(4,1fr)'
]}
gridGap={4}
alignItems={'stretch'}
pb={5}
>
{currentTemplates.map((item) => (
<TemplateCard key={item.id} item={item} />
))}
</Grid>
</Box>
);
})}
</>
)}
</Box>
</ModalBody>
</MyBox>
</ModalContent>
</Modal>
);
};
export default TemplateMarketModal;
...@@ -45,7 +45,7 @@ const AppTypeTag = ({ type }: { type: AppTypeEnum }) => { ...@@ -45,7 +45,7 @@ const AppTypeTag = ({ type }: { type: AppTypeEnum }) => {
py={0.5} py={0.5}
pl={2} pl={2}
pr={3} pr={3}
borderLeftRadius={'md'} borderLeftRadius={'sm'}
whiteSpace={'nowrap'} whiteSpace={'nowrap'}
> >
<MyIcon name={data.icon as any} w={'0.8rem'} color={'myGray.500'} /> <MyIcon name={data.icon as any} w={'0.8rem'} color={'myGray.500'} />
......
...@@ -42,6 +42,7 @@ import MyBox from '@fastgpt/web/components/common/MyBox'; ...@@ -42,6 +42,7 @@ import MyBox from '@fastgpt/web/components/common/MyBox';
import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs'; import LightRowTabs from '@fastgpt/web/components/common/Tabs/LightRowTabs';
import { useSystem } from '@fastgpt/web/hooks/useSystem'; import { useSystem } from '@fastgpt/web/hooks/useSystem';
import MyIcon from '@fastgpt/web/components/common/Icon'; import MyIcon from '@fastgpt/web/components/common/Icon';
import TemplateMarketModal from './components/TemplateMarketModal';
const CreateModal = dynamic(() => import('./components/CreateModal')); const CreateModal = dynamic(() => import('./components/CreateModal'));
const EditFolderModal = dynamic( const EditFolderModal = dynamic(
...@@ -77,6 +78,7 @@ const MyApps = () => { ...@@ -77,6 +78,7 @@ const MyApps = () => {
onClose: onCloseCreateHttpPlugin onClose: onCloseCreateHttpPlugin
} = useDisclosure(); } = useDisclosure();
const [editFolder, setEditFolder] = useState<EditFolderFormType>(); const [editFolder, setEditFolder] = useState<EditFolderFormType>();
const [templateModalType, setTemplateModalType] = useState<AppTypeEnum | 'all'>();
const { runAsync: onCreateFolder } = useRequest2(postCreateAppFolder, { const { runAsync: onCreateFolder } = useRequest2(postCreateAppFolder, {
onSuccess() { onSuccess() {
...@@ -145,19 +147,19 @@ const MyApps = () => { ...@@ -145,19 +147,19 @@ const MyApps = () => {
<LightRowTabs <LightRowTabs
list={[ list={[
{ {
label: appT('type.All'), label: t('app:type.All'),
value: 'ALL' value: 'ALL'
}, },
{ {
label: appT('type.Simple bot'), label: t('app:type.Simple bot'),
value: AppTypeEnum.simple value: AppTypeEnum.simple
}, },
{ {
label: appT('type.Workflow bot'), label: t('app:type.Workflow bot'),
value: AppTypeEnum.workflow value: AppTypeEnum.workflow
}, },
{ {
label: appT('type.Plugin'), label: t('app:type.Plugin'),
value: AppTypeEnum.plugin value: AppTypeEnum.plugin
} }
]} ]}
...@@ -195,26 +197,26 @@ const MyApps = () => { ...@@ -195,26 +197,26 @@ const MyApps = () => {
children: [ children: [
{ {
icon: 'core/app/simpleBot', icon: 'core/app/simpleBot',
label: appT('type.Simple bot'), label: t('app:type.Simple bot'),
description: appT('type.Create simple bot tip'), description: t('app:type.Create simple bot tip'),
onClick: () => setCreateAppType(AppTypeEnum.simple) onClick: () => setCreateAppType(AppTypeEnum.simple)
}, },
{ {
icon: 'core/app/type/workflowFill', icon: 'core/app/type/workflowFill',
label: appT('type.Workflow bot'), label: t('app:type.Workflow bot'),
description: appT('type.Create workflow tip'), description: t('app:type.Create workflow tip'),
onClick: () => setCreateAppType(AppTypeEnum.workflow) onClick: () => setCreateAppType(AppTypeEnum.workflow)
}, },
{ {
icon: 'core/app/type/pluginFill', icon: 'core/app/type/pluginFill',
label: appT('type.Plugin'), label: t('app:type.Plugin'),
description: appT('type.Create one plugin tip'), description: t('app:type.Create one plugin tip'),
onClick: () => setCreateAppType(AppTypeEnum.plugin) onClick: () => setCreateAppType(AppTypeEnum.plugin)
}, },
{ {
icon: 'core/app/type/httpPluginFill', icon: 'core/app/type/httpPluginFill',
label: appT('type.Http plugin'), label: t('app:type.Http plugin'),
description: appT('type.Create http plugin tip'), description: t('app:type.Create http plugin tip'),
onClick: onOpenCreateHttpPlugin onClick: onOpenCreateHttpPlugin
} }
] ]
...@@ -222,6 +224,16 @@ const MyApps = () => { ...@@ -222,6 +224,16 @@ const MyApps = () => {
{ {
children: [ children: [
{ {
icon: '/imgs/app/templateFill.svg',
label: t('app:template_market'),
description: t('app:template_market_description'),
onClick: () => setTemplateModalType('all')
}
]
},
{
children: [
{
icon: FolderIcon, icon: FolderIcon,
label: t('common:Folder'), label: t('common:Folder'),
onClick: () => setEditFolder({}) onClick: () => setEditFolder({})
...@@ -306,9 +318,19 @@ const MyApps = () => { ...@@ -306,9 +318,19 @@ const MyApps = () => {
/> />
)} )}
{!!createAppType && ( {!!createAppType && (
<CreateModal type={createAppType} onClose={() => setCreateAppType(undefined)} /> <CreateModal
type={createAppType}
onClose={() => setCreateAppType(undefined)}
onOpenTemplateModal={setTemplateModalType}
/>
)} )}
{isOpenCreateHttpPlugin && <HttpEditModal onClose={onCloseCreateHttpPlugin} />} {isOpenCreateHttpPlugin && <HttpEditModal onClose={onCloseCreateHttpPlugin} />}
{!!templateModalType && (
<TemplateMarketModal
onClose={() => setTemplateModalType(undefined)}
defaultType={templateModalType}
/>
)}
</Flex> </Flex>
); );
}; };
......
...@@ -7,9 +7,10 @@ import { useSendCode } from '@/web/support/user/hooks/useSendCode'; ...@@ -7,9 +7,10 @@ import { useSendCode } from '@/web/support/user/hooks/useSendCode';
import type { ResLogin } from '@/global/support/api/userRes'; import type { ResLogin } from '@/global/support/api/userRes';
import { useToast } from '@fastgpt/web/hooks/useToast'; import { useToast } from '@fastgpt/web/hooks/useToast';
import { postCreateApp } from '@/web/core/app/api'; import { postCreateApp } from '@/web/core/app/api';
import { defaultAppTemplates } from '@/web/core/app/templates'; import { emptyTemplates } from '@/web/core/app/templates';
import { useSystemStore } from '@/web/common/system/useSystemStore'; import { useSystemStore } from '@/web/common/system/useSystemStore';
import { useTranslation } from 'next-i18next'; import { useTranslation } from 'next-i18next';
import { AppTypeEnum } from '@fastgpt/global/core/app/constants';
interface Props { interface Props {
loginSuccess: (e: ResLogin) => void; loginSuccess: (e: ResLogin) => void;
setPageType: Dispatch<`${LoginPageTypeEnum}`>; setPageType: Dispatch<`${LoginPageTypeEnum}`>;
...@@ -68,13 +69,13 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => { ...@@ -68,13 +69,13 @@ const RegisterForm = ({ setPageType, loginSuccess }: Props) => {
}); });
// auto register template app // auto register template app
setTimeout(() => { setTimeout(() => {
defaultAppTemplates.forEach((template) => { Object.entries(emptyTemplates).map(([type, emptyTemplate]) => {
postCreateApp({ postCreateApp({
avatar: template.avatar, avatar: emptyTemplate.avatar,
name: t(template.name as any), name: t(emptyTemplate.name as any),
modules: template.modules, modules: emptyTemplate.nodes,
edges: template.edges, edges: emptyTemplate.edges,
type: template.type type: type as AppTypeEnum
}); });
}); });
}, 100); }, 100);
......
...@@ -62,6 +62,8 @@ const defaultFeConfigs: FastGPTFeConfigsType = { ...@@ -62,6 +62,8 @@ const defaultFeConfigs: FastGPTFeConfigsType = {
docUrl: 'https://doc.fastgpt.in', docUrl: 'https://doc.fastgpt.in',
openAPIDocUrl: 'https://doc.fastgpt.in/docs/development/openapi', openAPIDocUrl: 'https://doc.fastgpt.in/docs/development/openapi',
systemPluginCourseUrl: 'https://fael3z0zfze.feishu.cn/wiki/ERZnw9R26iRRG0kXZRec6WL9nwh', systemPluginCourseUrl: 'https://fael3z0zfze.feishu.cn/wiki/ERZnw9R26iRRG0kXZRec6WL9nwh',
appTemplateCourse:
'https://fael3z0zfze.feishu.cn/wiki/CX9wwMGyEi5TL6koiLYcg7U0nWb?fromScene=spaceOverview',
systemTitle: 'FastGPT', systemTitle: 'FastGPT',
concatMd: concatMd:
'项目开源地址: [FastGPT GitHub](https://github.com/labring/FastGPT)\n交流群: ![](https://oss.laf.run/htr4n1-images/fastgpt-qr-code.jpg)', '项目开源地址: [FastGPT GitHub](https://github.com/labring/FastGPT)\n交流群: ![](https://oss.laf.run/htr4n1-images/fastgpt-qr-code.jpg)',
......
import { isProduction } from '@fastgpt/service/common/system/constants';
import { readdirSync, readFileSync } from 'fs';
import path from 'path';
// Get template from memory or file system
const loadTemplateMarketItems = async () => {
if (isProduction && global.appMarketTemplates) return global.appMarketTemplates;
const templatesDir = path.join(process.cwd(), 'public', 'appMarketTemplates');
const templateNames = readdirSync(templatesDir);
global.appMarketTemplates = templateNames.map((name) => {
try {
const filePath = path.join(templatesDir, name, 'template.json');
const fileContent = readFileSync(filePath, 'utf-8');
const data = JSON.parse(fileContent);
return {
id: name,
...data
};
} catch (error) {
console.error(`Error fetching template ${name}:`, error);
return null;
}
});
global.appMarketTemplates.sort((a, b) => (b.weight ?? 0) - (a.weight ?? 0));
return global.appMarketTemplates;
};
export const getTemplateMarketItemDetail = async (id: string) => {
const templateMarketItems = await loadTemplateMarketItems();
return templateMarketItems.find((item) => item.id === id);
};
export const getTemplateMarketItemList = async () => {
const templateMarketItems = await loadTemplateMarketItems();
return templateMarketItems.map((item) => ({
id: item.id,
name: item.name,
avatar: item.avatar,
intro: item.intro,
author: item.author,
tags: item.tags,
type: item.type
}));
};
import { GET } from '@/web/common/api/request';
import {
TemplateMarketItemType,
TemplateMarketListItemType
} from '@fastgpt/global/core/workflow/type';
export const getTemplateMarketItemList = () =>
GET<TemplateMarketListItemType[]>('/core/app/template/list');
export const getTemplateMarketItemDetail = (data: { templateId: string }) =>
GET<TemplateMarketItemType>(`/core/app/template/detail`, data);
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment