mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-16 08:01:18 +00:00
优化建议模式;修复多索引训练失败问题 (#1043)
* doc * Optimize possible null Pointers and parts of Ux * fix: mulity index training error
This commit is contained in:
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,5 +1,5 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: false
|
||||||
contact_links:
|
contact_links:
|
||||||
- name: 微信交流群
|
- name: 微信交流群
|
||||||
url: https://doc.fastgpt.in/wechat-fastgpt.webp
|
url: https://oss.laf.run/htr4n1-images/fastgpt-qr-code.jpg
|
||||||
about: FastGPT 全是问题群
|
about: FastGPT 全是问题群
|
||||||
|
@@ -9,7 +9,6 @@ import { getCollectionWithDataset } from '../controller';
|
|||||||
import { TrainingModeEnum } from '@fastgpt/global/core/dataset/constants';
|
import { TrainingModeEnum } from '@fastgpt/global/core/dataset/constants';
|
||||||
import { simpleText } from '@fastgpt/global/common/string/tools';
|
import { simpleText } from '@fastgpt/global/common/string/tools';
|
||||||
import { countPromptTokens } from '@fastgpt/global/common/string/tiktoken';
|
import { countPromptTokens } from '@fastgpt/global/common/string/tiktoken';
|
||||||
import type { VectorModelItemType, LLMModelItemType } from '@fastgpt/global/core/ai/model.d';
|
|
||||||
|
|
||||||
export const lockTrainingDataByTeamId = async (teamId: string): Promise<any> => {
|
export const lockTrainingDataByTeamId = async (teamId: string): Promise<any> => {
|
||||||
try {
|
try {
|
||||||
|
@@ -164,6 +164,15 @@ export const runToolWithPromptCall = async (
|
|||||||
parseAnswerResult.toolName = toolModule.name;
|
parseAnswerResult.toolName = toolModule.name;
|
||||||
parseAnswerResult.toolAvatar = toolModule.avatar;
|
parseAnswerResult.toolAvatar = toolModule.avatar;
|
||||||
|
|
||||||
|
// run tool flow
|
||||||
|
const startParams = (() => {
|
||||||
|
try {
|
||||||
|
return json5.parse(parseAnswerResult.arguments);
|
||||||
|
} catch (error) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
// SSE response to client
|
// SSE response to client
|
||||||
if (stream && detail) {
|
if (stream && detail) {
|
||||||
responseWrite({
|
responseWrite({
|
||||||
@@ -182,15 +191,6 @@ export const runToolWithPromptCall = async (
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// run tool flow
|
|
||||||
const startParams = (() => {
|
|
||||||
try {
|
|
||||||
return json5.parse(parseAnswerResult.arguments);
|
|
||||||
} catch (error) {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
const moduleRunResponse = await dispatchWorkFlow({
|
const moduleRunResponse = await dispatchWorkFlow({
|
||||||
...props,
|
...props,
|
||||||
runtimeModules: runtimeModules.map((module) => ({
|
runtimeModules: runtimeModules.map((module) => ({
|
||||||
@@ -374,7 +374,7 @@ const parseAnswer = (str: string): FunctionCallCompletion | string => {
|
|||||||
return {
|
return {
|
||||||
id: getNanoid(),
|
id: getNanoid(),
|
||||||
name: toolCall.toolId,
|
name: toolCall.toolId,
|
||||||
arguments: JSON.stringify(toolCall.arguments)
|
arguments: JSON.stringify(toolCall.arguments || toolCall.parameters)
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return str;
|
return str;
|
||||||
|
@@ -332,8 +332,8 @@ async function streamResponse({
|
|||||||
|
|
||||||
const responseChoice = part.choices?.[0]?.delta;
|
const responseChoice = part.choices?.[0]?.delta;
|
||||||
// console.log(JSON.stringify(responseChoice, null, 2));
|
// console.log(JSON.stringify(responseChoice, null, 2));
|
||||||
if (responseChoice.content) {
|
if (responseChoice?.content) {
|
||||||
const content = responseChoice?.content || '';
|
const content = responseChoice.content || '';
|
||||||
textAnswer += content;
|
textAnswer += content;
|
||||||
|
|
||||||
responseWrite({
|
responseWrite({
|
||||||
@@ -343,7 +343,7 @@ async function streamResponse({
|
|||||||
text: content
|
text: content
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
} else if (responseChoice.tool_calls?.[0]) {
|
} else if (responseChoice?.tool_calls?.[0]) {
|
||||||
const toolCall: ChatCompletionMessageToolCall = responseChoice.tool_calls[0];
|
const toolCall: ChatCompletionMessageToolCall = responseChoice.tool_calls[0];
|
||||||
|
|
||||||
// 流响应中,每次只会返回一个工具. 如果带了 id,说明是执行一个工具
|
// 流响应中,每次只会返回一个工具. 如果带了 id,说明是执行一个工具
|
||||||
|
@@ -1334,6 +1334,7 @@
|
|||||||
"Not sufficient": "Your AI points are insufficient, please upgrade the package or purchase additional AI points before continuing to use.",
|
"Not sufficient": "Your AI points are insufficient, please upgrade the package or purchase additional AI points before continuing to use.",
|
||||||
"Pay error": "Pay error",
|
"Pay error": "Pay error",
|
||||||
"Pay success": "Pay success",
|
"Pay success": "Pay success",
|
||||||
|
"Plan expired time": "Plan expired time",
|
||||||
"Standard Plan Detail": "Standard Plan Detail",
|
"Standard Plan Detail": "Standard Plan Detail",
|
||||||
"To read plan": "Read plan",
|
"To read plan": "Read plan",
|
||||||
"bill": {
|
"bill": {
|
||||||
|
@@ -1336,6 +1336,7 @@
|
|||||||
"Not sufficient": "您的 AI 积分不足,请先升级套餐或购买额外 AI 积分后继续使用。",
|
"Not sufficient": "您的 AI 积分不足,请先升级套餐或购买额外 AI 积分后继续使用。",
|
||||||
"Pay error": "支付失败",
|
"Pay error": "支付失败",
|
||||||
"Pay success": "支付成功",
|
"Pay success": "支付成功",
|
||||||
|
"Plan expired time": "套餐到期时间",
|
||||||
"Standard Plan Detail": "套餐详情",
|
"Standard Plan Detail": "套餐详情",
|
||||||
"To read plan": "查看套餐",
|
"To read plan": "查看套餐",
|
||||||
"bill": {
|
"bill": {
|
||||||
|
@@ -397,15 +397,15 @@ const PlanUsage = () => {
|
|||||||
<Box fontWeight={'bold'} fontSize="xl">
|
<Box fontWeight={'bold'} fontSize="xl">
|
||||||
{t(planName)}
|
{t(planName)}
|
||||||
</Box>
|
</Box>
|
||||||
|
<Flex mt="2" color={'#485264'} fontSize="sm">
|
||||||
|
<Box>{t('support.wallet.Plan expired time')}:</Box>
|
||||||
|
<Box ml={2}>{formatTime2YMD(standardPlan?.expiredTime)}</Box>
|
||||||
|
</Flex>
|
||||||
{isFreeTeam && (
|
{isFreeTeam && (
|
||||||
<Box mt="3" color={'#485264'} fontSize="sm">
|
<Box mt="2" color={'#485264'} fontSize="sm">
|
||||||
免费版用户15天无任何使用记录时,系统会自动清理账号知识库。
|
免费版用户15天无任何使用记录时,系统会自动清理账号知识库。
|
||||||
</Box>
|
</Box>
|
||||||
)}
|
)}
|
||||||
<Flex mt="3" color={'#485264'} fontSize="sm">
|
|
||||||
<Box>{t('common.Expired Time')}:</Box>
|
|
||||||
<Box ml={2}>{formatTime2YMD(standardPlan?.expiredTime)}</Box>
|
|
||||||
</Flex>
|
|
||||||
</Box>
|
</Box>
|
||||||
<Button onClick={() => router.push('/price')}>
|
<Button onClick={() => router.push('/price')}>
|
||||||
{t('support.wallet.subscription.Upgrade plan')}
|
{t('support.wallet.subscription.Upgrade plan')}
|
||||||
|
@@ -8,7 +8,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
|||||||
import { usePagination } from '@fastgpt/web/hooks/usePagination';
|
import { usePagination } from '@fastgpt/web/hooks/usePagination';
|
||||||
import { useLoading } from '@fastgpt/web/hooks/useLoading';
|
import { useLoading } from '@fastgpt/web/hooks/useLoading';
|
||||||
|
|
||||||
const BillTable = () => {
|
const InformTable = () => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const { Loading } = useLoading();
|
const { Loading } = useLoading();
|
||||||
const { isPc } = useSystemStore();
|
const { isPc } = useSystemStore();
|
||||||
@@ -87,4 +87,4 @@ const BillTable = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default BillTable;
|
export default InformTable;
|
||||||
|
@@ -207,7 +207,7 @@ const RenderList = React.memo(function RenderList({
|
|||||||
return templates.length === 0 && !isLoadingData ? (
|
return templates.length === 0 && !isLoadingData ? (
|
||||||
<EmptyTip text={t('core.app.ToolCall.No plugin')} />
|
<EmptyTip text={t('core.app.ToolCall.No plugin')} />
|
||||||
) : (
|
) : (
|
||||||
<MyBox isLoading={isLoading}>
|
<MyBox>
|
||||||
{templates.map((item, i) => {
|
{templates.map((item, i) => {
|
||||||
const selected = !!selectedTools.find((tool) => tool.id === item.id);
|
const selected = !!selectedTools.find((tool) => tool.id === item.id);
|
||||||
return (
|
return (
|
||||||
@@ -257,6 +257,7 @@ const RenderList = React.memo(function RenderList({
|
|||||||
size={'sm'}
|
size={'sm'}
|
||||||
variant={'whiteBase'}
|
variant={'whiteBase'}
|
||||||
leftIcon={<AddIcon fontSize={'10px'} />}
|
leftIcon={<AddIcon fontSize={'10px'} />}
|
||||||
|
isLoading={isLoading}
|
||||||
onClick={() => onClickAdd(item)}
|
onClick={() => onClickAdd(item)}
|
||||||
>
|
>
|
||||||
{t('common.Add')}
|
{t('common.Add')}
|
||||||
|
@@ -44,7 +44,8 @@ export async function insertData2Dataset({
|
|||||||
indexes =
|
indexes =
|
||||||
Array.isArray(indexes) && indexes.length > 0
|
Array.isArray(indexes) && indexes.length > 0
|
||||||
? indexes.map((index) => ({
|
? indexes.map((index) => ({
|
||||||
...index,
|
// @ts-ignore
|
||||||
|
...index.toObject(),
|
||||||
dataId: undefined,
|
dataId: undefined,
|
||||||
defaultIndex: index.text.trim() === qaStr
|
defaultIndex: index.text.trim() === qaStr
|
||||||
}))
|
}))
|
||||||
|
@@ -279,6 +279,380 @@ export async function postForm2Modules(data: AppSimpleEditFormType) {
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
function datasetTemplate(formData: AppSimpleEditFormType): ModuleItemType[] {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
moduleId: 'userChatInput',
|
||||||
|
name: 'core.module.template.Chat entrance',
|
||||||
|
intro: '当用户发送一个内容后,流程将会从这个模块开始执行。',
|
||||||
|
avatar: '/imgs/module/userChatInput.svg',
|
||||||
|
flowType: 'questionInput',
|
||||||
|
position: {
|
||||||
|
x: 324.81436595478294,
|
||||||
|
y: 1527.0012457753612
|
||||||
|
},
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
key: 'userChatInput',
|
||||||
|
type: 'systemInput',
|
||||||
|
valueType: 'string',
|
||||||
|
label: 'core.module.input.label.user question',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{
|
||||||
|
key: 'userChatInput',
|
||||||
|
label: 'core.module.input.label.user question',
|
||||||
|
type: 'source',
|
||||||
|
valueType: 'string',
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
moduleId: '0voh5n',
|
||||||
|
key: 'userChatInput'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
moduleId: '63toub',
|
||||||
|
name: 'AI 对话',
|
||||||
|
intro: 'AI 大模型对话',
|
||||||
|
avatar: '/imgs/module/AI.png',
|
||||||
|
flowType: 'chatNode',
|
||||||
|
showStatus: true,
|
||||||
|
position: {
|
||||||
|
x: 1962.4010270586014,
|
||||||
|
y: 1026.9105717680477
|
||||||
|
},
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
key: 'switch',
|
||||||
|
type: 'target',
|
||||||
|
label: 'core.module.input.label.switch',
|
||||||
|
description: 'core.module.input.description.Trigger',
|
||||||
|
valueType: 'any',
|
||||||
|
showTargetInApp: true,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'model',
|
||||||
|
type: 'settingLLMModel',
|
||||||
|
label: 'core.module.input.label.aiModel',
|
||||||
|
required: true,
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
value: formData.aiSettings.model,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'temperature',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
value: formData.aiSettings.temperature,
|
||||||
|
valueType: 'number',
|
||||||
|
min: 0,
|
||||||
|
max: 10,
|
||||||
|
step: 1,
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'maxToken',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
value: formData.aiSettings.maxToken,
|
||||||
|
valueType: 'number',
|
||||||
|
min: 100,
|
||||||
|
max: 4000,
|
||||||
|
step: 50,
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'isResponseAnswerText',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
value: true,
|
||||||
|
valueType: 'boolean',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'quoteTemplate',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'quotePrompt',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'systemPrompt',
|
||||||
|
type: 'textarea',
|
||||||
|
max: 3000,
|
||||||
|
valueType: 'string',
|
||||||
|
label: 'core.ai.Prompt',
|
||||||
|
description: 'core.app.tip.chatNodeSystemPromptTip',
|
||||||
|
placeholder: 'core.app.tip.chatNodeSystemPromptTip',
|
||||||
|
showTargetInApp: true,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
connected: false,
|
||||||
|
value: formData.aiSettings.systemPrompt
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'history',
|
||||||
|
type: 'numberInput',
|
||||||
|
label: 'core.module.input.label.chat history',
|
||||||
|
required: true,
|
||||||
|
min: 0,
|
||||||
|
max: 30,
|
||||||
|
valueType: 'chatHistory',
|
||||||
|
value: formData.aiSettings.maxHistories,
|
||||||
|
showTargetInApp: true,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'userChatInput',
|
||||||
|
type: 'custom',
|
||||||
|
label: '',
|
||||||
|
required: true,
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: true,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
toolDescription: '用户问题',
|
||||||
|
connected: true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'quoteQA',
|
||||||
|
type: 'settingDatasetQuotePrompt',
|
||||||
|
label: '知识库引用',
|
||||||
|
description: 'core.module.Dataset quote.Input description',
|
||||||
|
valueType: 'datasetQuote',
|
||||||
|
showTargetInApp: true,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
connected: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{
|
||||||
|
key: 'userChatInput',
|
||||||
|
label: 'core.module.input.label.user question',
|
||||||
|
type: 'hidden',
|
||||||
|
valueType: 'string',
|
||||||
|
targets: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'history',
|
||||||
|
label: 'core.module.output.label.New context',
|
||||||
|
description: 'core.module.output.description.New context',
|
||||||
|
valueType: 'chatHistory',
|
||||||
|
type: 'source',
|
||||||
|
targets: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'answerText',
|
||||||
|
label: 'core.module.output.label.Ai response content',
|
||||||
|
description: 'core.module.output.description.Ai response content',
|
||||||
|
valueType: 'string',
|
||||||
|
type: 'source',
|
||||||
|
targets: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'finish',
|
||||||
|
label: 'core.module.output.label.running done',
|
||||||
|
description: 'core.module.output.description.running done',
|
||||||
|
valueType: 'boolean',
|
||||||
|
type: 'source',
|
||||||
|
targets: []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
moduleId: '0voh5n',
|
||||||
|
name: '知识库搜索',
|
||||||
|
intro: '调用知识库搜索能力,查找“有可能”与问题相关的内容',
|
||||||
|
avatar: '/imgs/module/db.png',
|
||||||
|
flowType: 'datasetSearchNode',
|
||||||
|
showStatus: true,
|
||||||
|
position: {
|
||||||
|
x: 1098.245668870126,
|
||||||
|
y: 1166.7285333032098
|
||||||
|
},
|
||||||
|
inputs: [
|
||||||
|
{
|
||||||
|
key: 'switch',
|
||||||
|
type: 'target',
|
||||||
|
label: 'core.module.input.label.switch',
|
||||||
|
description: 'core.module.input.description.Trigger',
|
||||||
|
valueType: 'any',
|
||||||
|
showTargetInApp: true,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'datasets',
|
||||||
|
type: 'selectDataset',
|
||||||
|
label: 'core.module.input.label.Select dataset',
|
||||||
|
value: formData.dataset.datasets,
|
||||||
|
valueType: 'selectDataset',
|
||||||
|
list: [],
|
||||||
|
required: true,
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'similarity',
|
||||||
|
type: 'selectDatasetParamsModal',
|
||||||
|
label: '',
|
||||||
|
value: formData.dataset.similarity,
|
||||||
|
valueType: 'number',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'limit',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
value: formData.dataset.limit,
|
||||||
|
valueType: 'number',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'searchMode',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
value: formData.dataset.searchMode,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'usingReRank',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
valueType: 'boolean',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
value: formData.dataset.usingReRank,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'datasetSearchUsingExtensionQuery',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
valueType: 'boolean',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
value: formData.dataset.datasetSearchUsingExtensionQuery,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'datasetSearchExtensionModel',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
connected: false,
|
||||||
|
value: formData.dataset.datasetSearchExtensionModel
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'datasetSearchExtensionBg',
|
||||||
|
type: 'hidden',
|
||||||
|
label: '',
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: false,
|
||||||
|
showTargetInPlugin: false,
|
||||||
|
value: formData.dataset.datasetSearchExtensionBg,
|
||||||
|
connected: false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'userChatInput',
|
||||||
|
type: 'custom',
|
||||||
|
label: '',
|
||||||
|
required: true,
|
||||||
|
valueType: 'string',
|
||||||
|
showTargetInApp: true,
|
||||||
|
showTargetInPlugin: true,
|
||||||
|
toolDescription: '需要检索的内容',
|
||||||
|
connected: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
outputs: [
|
||||||
|
{
|
||||||
|
key: 'userChatInput',
|
||||||
|
label: 'core.module.input.label.user question',
|
||||||
|
type: 'hidden',
|
||||||
|
valueType: 'string',
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
moduleId: '63toub',
|
||||||
|
key: 'userChatInput'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'isEmpty',
|
||||||
|
label: 'core.module.output.label.Search result empty',
|
||||||
|
type: 'source',
|
||||||
|
valueType: 'boolean',
|
||||||
|
targets: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'unEmpty',
|
||||||
|
label: 'core.module.output.label.Search result not empty',
|
||||||
|
type: 'source',
|
||||||
|
valueType: 'boolean',
|
||||||
|
targets: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'quoteQA',
|
||||||
|
label: 'core.module.Dataset quote.label',
|
||||||
|
type: 'source',
|
||||||
|
valueType: 'datasetQuote',
|
||||||
|
targets: [
|
||||||
|
{
|
||||||
|
moduleId: '63toub',
|
||||||
|
key: 'quoteQA'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: 'finish',
|
||||||
|
label: 'core.module.output.label.running done',
|
||||||
|
description: 'core.module.output.description.running done',
|
||||||
|
valueType: 'boolean',
|
||||||
|
type: 'source',
|
||||||
|
targets: []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
function toolTemplates(formData: AppSimpleEditFormType): ModuleItemType[] {
|
function toolTemplates(formData: AppSimpleEditFormType): ModuleItemType[] {
|
||||||
let tools: ModuleItemType[] =
|
let tools: ModuleItemType[] =
|
||||||
formData.dataset.datasets.length > 0
|
formData.dataset.datasets.length > 0
|
||||||
@@ -607,10 +981,12 @@ export async function postForm2Modules(data: AppSimpleEditFormType) {
|
|||||||
|
|
||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
const modules =
|
|
||||||
data.dataset.datasets.length > 0 || data.selectedTools.length > 0
|
const modules = (() => {
|
||||||
? toolTemplates(data)
|
if (data.selectedTools.length > 0) return toolTemplates(data);
|
||||||
: simpleChatTemplate(data);
|
if (data.dataset.datasets.length > 0) return datasetTemplate(data);
|
||||||
|
return simpleChatTemplate(data);
|
||||||
|
})();
|
||||||
|
|
||||||
return [...userGuideTemplate(data), ...modules];
|
return [...userGuideTemplate(data), ...modules];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user