mirror of
https://github.com/labring/FastGPT.git
synced 2025-08-01 20:27:45 +00:00
v4.6.4-Outlink (#589)
This commit is contained in:
@@ -12,9 +12,10 @@ export const useSelectFile = (props?: {
|
||||
const { fileType = '*', multiple = false, maxCount = 10 } = props || {};
|
||||
const { toast } = useToast();
|
||||
const SelectFileDom = useRef<HTMLInputElement>(null);
|
||||
const openSign = useRef<any>();
|
||||
|
||||
const File = useCallback(
|
||||
({ onSelect }: { onSelect: (e: File[]) => void }) => (
|
||||
({ onSelect }: { onSelect: (e: File[], sign?: any) => void }) => (
|
||||
<Box position={'absolute'} w={0} h={0} overflow={'hidden'}>
|
||||
<input
|
||||
ref={SelectFileDom}
|
||||
@@ -29,7 +30,7 @@ export const useSelectFile = (props?: {
|
||||
title: t('file.Select a maximum of 10 files')
|
||||
});
|
||||
}
|
||||
onSelect(Array.from(e.target.files));
|
||||
onSelect(Array.from(e.target.files), openSign.current);
|
||||
}}
|
||||
/>
|
||||
</Box>
|
||||
@@ -37,7 +38,8 @@ export const useSelectFile = (props?: {
|
||||
[fileType, maxCount, multiple]
|
||||
);
|
||||
|
||||
const onOpen = useCallback(() => {
|
||||
const onOpen = useCallback((sign?: any) => {
|
||||
openSign.current = sign;
|
||||
SelectFileDom.current && SelectFileDom.current.click();
|
||||
}, []);
|
||||
|
||||
|
@@ -233,10 +233,10 @@ export const fileDownload = ({
|
||||
};
|
||||
|
||||
export const fileToBase64 = (file: File) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
return new Promise<string>((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
reader.readAsDataURL(file);
|
||||
reader.onload = () => resolve(reader.result);
|
||||
reader.onload = () => resolve(reader.result as string);
|
||||
reader.onerror = (error) => reject(error);
|
||||
});
|
||||
};
|
||||
|
@@ -27,7 +27,6 @@ export const appTemplates: (AppItemType & {
|
||||
key: 'welcomeText',
|
||||
type: 'input',
|
||||
label: '开场白',
|
||||
value: '',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
@@ -64,46 +63,6 @@ export const appTemplates: (AppItemType & {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'history',
|
||||
name: '聊天记录',
|
||||
flowType: 'historyNode',
|
||||
position: {
|
||||
x: 452.5466249541586,
|
||||
y: 1276.3930310334215
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
type: 'numberInput',
|
||||
label: '最长记录数',
|
||||
value: 6,
|
||||
min: 0,
|
||||
max: 50,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
name: 'AI 对话',
|
||||
@@ -171,7 +130,6 @@ export const appTemplates: (AppItemType & {
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
placeholder:
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
@@ -193,7 +151,8 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'target',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
connected: true
|
||||
connected: true,
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
@@ -285,46 +244,6 @@ export const appTemplates: (AppItemType & {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'history',
|
||||
name: '聊天记录',
|
||||
flowType: 'historyNode',
|
||||
position: {
|
||||
x: 452.5466249541586,
|
||||
y: 1276.3930310334215
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
type: 'numberInput',
|
||||
label: '最长记录数',
|
||||
value: 6,
|
||||
min: 0,
|
||||
max: 50,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'datasetSearch',
|
||||
name: '知识库搜索',
|
||||
@@ -495,7 +414,6 @@ export const appTemplates: (AppItemType & {
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
placeholder:
|
||||
'模型固定的引导词,通过调整该内容,可以引导模型聊天方向。该内容会被固定在上下文的开头。可使用变量,例如 {{language}}',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
@@ -517,7 +435,8 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'target',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
connected: true
|
||||
connected: true,
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
@@ -678,46 +597,6 @@ export const appTemplates: (AppItemType & {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'history',
|
||||
name: '聊天记录',
|
||||
flowType: 'historyNode',
|
||||
position: {
|
||||
x: 452.5466249541586,
|
||||
y: 1276.3930310334215
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
type: 'numberInput',
|
||||
label: '最长记录数',
|
||||
value: 2,
|
||||
min: 0,
|
||||
max: 50,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'chatModule',
|
||||
name: 'AI 对话',
|
||||
@@ -793,7 +672,6 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'hidden',
|
||||
label: '引用内容模板',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
@@ -801,7 +679,6 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'hidden',
|
||||
label: '引用内容提示词',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
@@ -824,7 +701,8 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'target',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
connected: true
|
||||
connected: true,
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
@@ -906,46 +784,6 @@ export const appTemplates: (AppItemType & {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'xj0c9p',
|
||||
name: '聊天记录',
|
||||
flowType: 'historyNode',
|
||||
position: {
|
||||
x: 1770.497690708367,
|
||||
y: 1820.2355054321215
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
type: 'numberInput',
|
||||
label: '最长记录数',
|
||||
value: 6,
|
||||
min: 0,
|
||||
max: 50,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'nlfwkc',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'remuj3',
|
||||
name: '问题分类',
|
||||
@@ -980,7 +818,8 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'target',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
connected: true
|
||||
connected: true,
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
@@ -997,15 +836,15 @@ export const appTemplates: (AppItemType & {
|
||||
value: [
|
||||
{
|
||||
value: '打招呼、问候等问题',
|
||||
key: 'fasw'
|
||||
key: 'wqre'
|
||||
},
|
||||
{
|
||||
value: '“laf” 的问题',
|
||||
key: 'fqsw'
|
||||
value: '关于 xxx 的问题',
|
||||
key: 'sdfa'
|
||||
},
|
||||
{
|
||||
value: '商务问题',
|
||||
key: 'fesw'
|
||||
key: 'agex'
|
||||
},
|
||||
{
|
||||
value: '其他问题',
|
||||
@@ -1017,7 +856,7 @@ export const appTemplates: (AppItemType & {
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'fasw',
|
||||
key: 'wqre',
|
||||
label: '',
|
||||
type: 'hidden',
|
||||
targets: [
|
||||
@@ -1028,7 +867,7 @@ export const appTemplates: (AppItemType & {
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'fqsw',
|
||||
key: 'sdfa',
|
||||
label: '',
|
||||
type: 'hidden',
|
||||
targets: [
|
||||
@@ -1039,7 +878,7 @@ export const appTemplates: (AppItemType & {
|
||||
]
|
||||
},
|
||||
{
|
||||
key: 'fesw',
|
||||
key: 'agex',
|
||||
label: '',
|
||||
type: 'hidden',
|
||||
targets: [
|
||||
@@ -1255,7 +1094,6 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'hidden',
|
||||
label: '引用内容模板',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
@@ -1263,7 +1101,6 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'hidden',
|
||||
label: '引用内容提示词',
|
||||
valueType: 'string',
|
||||
value: '',
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
@@ -1286,7 +1123,8 @@ export const appTemplates: (AppItemType & {
|
||||
type: 'target',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
connected: true
|
||||
connected: true,
|
||||
value: 6
|
||||
},
|
||||
{
|
||||
key: 'userChatInput',
|
||||
@@ -1324,46 +1162,6 @@ export const appTemplates: (AppItemType & {
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 's4v9su',
|
||||
name: '聊天记录',
|
||||
flowType: 'historyNode',
|
||||
position: {
|
||||
x: 193.3803955457983,
|
||||
y: 1316.251200765746
|
||||
},
|
||||
inputs: [
|
||||
{
|
||||
key: 'maxContext',
|
||||
type: 'numberInput',
|
||||
label: '最长记录数',
|
||||
value: 2,
|
||||
min: 0,
|
||||
max: 50,
|
||||
connected: true
|
||||
},
|
||||
{
|
||||
key: 'history',
|
||||
type: 'hidden',
|
||||
label: '聊天记录',
|
||||
connected: true
|
||||
}
|
||||
],
|
||||
outputs: [
|
||||
{
|
||||
key: 'history',
|
||||
label: '聊天记录',
|
||||
valueType: 'chatHistory',
|
||||
type: 'source',
|
||||
targets: [
|
||||
{
|
||||
moduleId: 'remuj3',
|
||||
key: 'history'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
moduleId: 'fljhzy',
|
||||
name: '知识库搜索',
|
||||
|
@@ -21,7 +21,6 @@ import { ModuleTemplateTypeEnum } from '@fastgpt/global/core/module/constants';
|
||||
export const appSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
UserGuideModule,
|
||||
UserInputModule,
|
||||
HistoryModule,
|
||||
AiChatModule,
|
||||
AssignedAnswerModule,
|
||||
DatasetSearchModule,
|
||||
@@ -33,7 +32,6 @@ export const appSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
export const pluginSystemModuleTemplates: FlowModuleTemplateType[] = [
|
||||
PluginInputModule,
|
||||
PluginOutputModule,
|
||||
HistoryModule,
|
||||
AiChatModule,
|
||||
AssignedAnswerModule,
|
||||
DatasetSearchModule,
|
||||
|
Reference in New Issue
Block a user