Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
eb28bfb2
authored
Aug 04, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: ts
parent
ffd4e194
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
166 additions
and
41 deletions
+166
-41
client/Dockerfile
+7
-3
client/src/constants/flow/ModuleTemplate.ts
+0
-0
client/src/pages/api/admin/initv4.ts
+18
-0
client/src/pages/app/detail/components/AdEdit/components/Nodes/NodeExtract.tsx
+58
-25
client/src/pages/app/detail/components/AdEdit/components/modules/ExtractFieldModal.tsx
+0
-7
client/src/pages/app/detail/components/AdEdit/components/render/RenderInput.tsx
+2
-0
client/src/pages/app/detail/components/AdEdit/components/render/RenderOutput.tsx
+19
-0
client/src/pages/app/detail/components/AdEdit/components/render/SourceHandle.tsx
+1
-1
client/src/pages/chat/components/SliderApps.tsx
+3
-1
client/src/utils/app.ts
+58
-4
No files found.
client/Dockerfile
View file @
eb28bfb2
...
@@ -7,15 +7,16 @@ WORKDIR /app
...
@@ -7,15 +7,16 @@ WORKDIR /app
# Install dependencies based on the preferred package manager
# Install dependencies based on the preferred package manager
COPY
package.json ./
COPY
package.json ./
COPY
pnpm-lock.yaml* ./
COPY
pnpm-lock.yaml* ./
RUN
pnpm config
set
registry https://registry.npmmirror.com/
RUN
\
RUN
\
[
-f
pnpm-lock.yaml
]
&&
pnpm
install
||
\
[
-f
pnpm-lock.yaml
]
&&
pnpm
fetch
||
\
(
echo
"Lockfile not found."
&&
exit
1
)
(
echo
"Lockfile not found."
&&
exit
1
)
# Rebuild the source code only when needed
# Rebuild the source code only when needed
FROM
node:current-alpine AS builder
FROM
node:current-alpine AS builder
WORKDIR
/app
WORKDIR
/app
COPY
--from=deps /app/node_modules ./node_modules
COPY
--from=deps /app/node_modules ./node_modules
COPY
pnpm-lock.yaml* ./
COPY
package.json ./
COPY
. .
COPY
. .
# Next.js collects completely anonymous telemetry data about general usage.
# Next.js collects completely anonymous telemetry data about general usage.
...
@@ -23,7 +24,10 @@ COPY . .
...
@@ -23,7 +24,10 @@ COPY . .
# Uncomment the following line in case you want to disable telemetry during the build.
# Uncomment the following line in case you want to disable telemetry during the build.
ENV
NEXT_TELEMETRY_DISABLED 1
ENV
NEXT_TELEMETRY_DISABLED 1
RUN
npm install
-g
pnpm
&&
pnpm run build
RUN
npm install
-g
pnpm
RUN
\
[
-f
pnpm-lock.yaml
]
&&
(
pnpm
--offline
install
&&
pnpm run build
)
||
\
(
echo
"Lockfile not found."
&&
exit
1
)
# Production image, copy all the files and run next
# Production image, copy all the files and run next
FROM
node:current-alpine AS runner
FROM
node:current-alpine AS runner
...
...
client/src/constants/flow/ModuleTemplate.ts
View file @
eb28bfb2
This diff is collapsed.
Click to expand it.
client/src/pages/api/admin/initv4.ts
View file @
eb28bfb2
...
@@ -25,42 +25,60 @@ const chatModelInput = ({
...
@@ -25,42 +25,60 @@ const chatModelInput = ({
{
{
key
:
'model'
,
key
:
'model'
,
value
:
model
,
value
:
model
,
type
:
'custom'
,
label
:
'对话模型'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'temperature'
,
key
:
'temperature'
,
value
:
temperature
,
value
:
temperature
,
label
:
'温度'
,
type
:
'slider'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'maxToken'
,
key
:
'maxToken'
,
value
:
maxToken
,
value
:
maxToken
,
type
:
'custom'
,
label
:
'回复上限'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'systemPrompt'
,
key
:
'systemPrompt'
,
value
:
systemPrompt
,
value
:
systemPrompt
,
type
:
'textarea'
,
label
:
'系统提示词'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'limitPrompt'
,
key
:
'limitPrompt'
,
label
:
'限定词'
,
type
:
'textarea'
,
value
:
limitPrompt
,
value
:
limitPrompt
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'switch'
,
key
:
'switch'
,
type
:
'target'
,
label
:
'触发器'
,
connected
:
kbList
.
length
>
0
connected
:
kbList
.
length
>
0
},
},
{
{
key
:
'quoteQA'
,
key
:
'quoteQA'
,
type
:
'target'
,
label
:
'引用内容'
,
connected
:
kbList
.
length
>
0
connected
:
kbList
.
length
>
0
},
},
{
{
key
:
'history'
,
key
:
'history'
,
type
:
'target'
,
label
:
'聊天记录'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'userChatInput'
,
key
:
'userChatInput'
,
type
:
'target'
,
label
:
'用户问题'
,
connected
:
true
connected
:
true
}
}
];
];
...
...
client/src/pages/app/detail/components/AdEdit/components/Nodes/NodeExtract.tsx
View file @
eb28bfb2
...
@@ -22,7 +22,7 @@ const NodeExtract = ({
...
@@ -22,7 +22,7 @@ const NodeExtract = ({
const
[
editExtractFiled
,
setEditExtractField
]
=
useState
<
ContextExtractAgentItemType
>
();
const
[
editExtractFiled
,
setEditExtractField
]
=
useState
<
ContextExtractAgentItemType
>
();
return
(
return
(
<
NodeCard
minW=
{
'
38
0px'
}
moduleId=
{
moduleId
}
{
...
props
}
>
<
NodeCard
minW=
{
'
40
0px'
}
moduleId=
{
moduleId
}
{
...
props
}
>
<
Divider
text=
"Input"
/>
<
Divider
text=
"Input"
/>
<
Container
>
<
Container
>
<
RenderInput
<
RenderInput
...
@@ -64,11 +64,14 @@ const NodeExtract = ({
...
@@ -64,11 +64,14 @@ const NodeExtract = ({
</
Thead
>
</
Thead
>
<
Tbody
>
<
Tbody
>
{
extractKeys
.
map
((
item
,
index
)
=>
(
{
extractKeys
.
map
((
item
,
index
)
=>
(
<
Tr
key=
{
index
}
position=
{
'relative'
}
>
<
Tr
key=
{
index
}
position=
{
'relative'
}
whiteSpace=
{
'pre-wrap'
}
wordBreak=
{
'break-all'
}
>
<
Td
>
{
item
.
key
}
</
Td
>
<
Td
>
{
item
.
key
}
</
Td
>
<
Td
whiteSpace=
{
'pre-wrap'
}
wordBreak=
{
'break-all'
}
>
<
Td
>
{
item
.
desc
}
</
Td
>
{
item
.
desc
}
</
Td
>
<
Td
>
{
item
.
required
?
'✔'
:
''
}
</
Td
>
<
Td
>
{
item
.
required
?
'✔'
:
''
}
</
Td
>
<
Td
whiteSpace=
{
'nowrap'
}
>
<
Td
whiteSpace=
{
'nowrap'
}
>
<
MyIcon
<
MyIcon
...
@@ -139,43 +142,73 @@ const NodeExtract = ({
...
@@ -139,43 +142,73 @@ const NodeExtract = ({
const
newInputs
=
exists
const
newInputs
=
exists
?
extracts
.
map
((
item
)
=>
(
item
.
key
===
editExtractFiled
.
key
?
data
:
item
))
?
extracts
.
map
((
item
)
=>
(
item
.
key
===
editExtractFiled
.
key
?
data
:
item
))
:
extracts
.
concat
(
data
);
:
extracts
.
concat
(
data
);
const
newOutputs
=
exists
?
outputs
.
map
((
output
)
=>
onChangeNode
({
output
.
key
===
editExtractFiled
.
key
moduleId
,
?
{
type
:
'inputs'
,
...
output
,
key
:
ContextExtractEnum
.
extractKeys
,
key
:
data
.
key
,
value
:
{
label
:
`提取结果-${data.desc}`
...
inputs
.
find
((
input
)
=>
input
.
key
===
ContextExtractEnum
.
extractKeys
),
value
:
newInputs
}
}
:
output
});
)
:
outputs
.
concat
({
if
(
!
exists
)
{
onChangeNode
({
moduleId
,
type
:
'outputs'
,
key
:
''
,
value
:
outputs
.
concat
({
key
:
data
.
key
,
key
:
data
.
key
,
label
:
`提取结果-${data.desc}`
,
label
:
`提取结果-${data.desc}`
,
description
:
'无法提取时不会返回'
,
description
:
'无法提取时不会返回'
,
valueType
:
FlowValueTypeEnum
.
string
,
valueType
:
FlowValueTypeEnum
.
string
,
type
:
FlowOutputItemTypeEnum
.
source
,
type
:
FlowOutputItemTypeEnum
.
source
,
targets
:
[]
targets
:
[]
})
});
});
}
else
{
if
(
editExtractFiled
.
key
===
data
.
key
)
{
// update
onChangeNode
({
onChangeNode
({
moduleId
,
moduleId
,
type
:
'inputs'
,
type
:
'outputs'
,
key
:
ContextExtractEnum
.
extractKeys
,
key
:
''
,
value
:
{
value
:
outputs
.
map
((
output
)
=>
...
inputs
.
find
((
input
)
=>
input
.
key
===
ContextExtractEnum
.
extractKeys
),
output
.
key
===
data
.
key
value
:
newInputs
?
{
...
output
,
label
:
`提取结果-${data.desc}`
}
}
:
output
)
});
});
}
else
{
// del and push
const
newOutputs
=
outputs
.
filter
((
output
)
=>
output
.
key
!==
editExtractFiled
.
key
);
onChangeNode
({
onChangeNode
({
moduleId
,
moduleId
,
type
:
'outputs'
,
type
:
'outputs'
,
key
:
''
,
key
:
''
,
value
:
newOutputs
value
:
newOutputs
});
});
setTimeout
(()
=>
{
if
(
editExtractFiled
.
key
&&
editExtractFiled
.
key
!==
data
.
key
)
{
onChangeNode
({
onDelEdge
({
moduleId
,
sourceHandle
:
editExtractFiled
.
key
});
moduleId
,
type
:
'outputs'
,
key
:
''
,
value
:
newOutputs
.
concat
({
key
:
data
.
key
,
label
:
`提取结果-${data.desc}`
,
description
:
'无法提取时不会返回'
,
valueType
:
FlowValueTypeEnum
.
string
,
type
:
FlowOutputItemTypeEnum
.
source
,
targets
:
[]
})
});
},
10
);
}
}
}
setEditExtractField
(
undefined
);
setEditExtractField
(
undefined
);
...
@@ -186,4 +219,4 @@ const NodeExtract = ({
...
@@ -186,4 +219,4 @@ const NodeExtract = ({
);
);
};
};
export
default
NodeExtract
;
export
default
React
.
memo
(
NodeExtract
)
;
client/src/pages/app/detail/components/AdEdit/components/modules/ExtractFieldModal.tsx
View file @
eb28bfb2
...
@@ -34,7 +34,6 @@ const ExtractFieldModal = ({
...
@@ -34,7 +34,6 @@ const ExtractFieldModal = ({
const
{
register
,
handleSubmit
}
=
useForm
<
ContextExtractAgentItemType
>
({
const
{
register
,
handleSubmit
}
=
useForm
<
ContextExtractAgentItemType
>
({
defaultValues
:
defaultField
defaultValues
:
defaultField
});
});
const
isEdit
=
useMemo
(()
=>
!!
defaultField
.
key
,
[
defaultField
]);
return
(
return
(
<
MyModal
isOpen=
{
true
}
onClose=
{
onClose
}
>
<
MyModal
isOpen=
{
true
}
onClose=
{
onClose
}
>
...
@@ -56,17 +55,11 @@ const ExtractFieldModal = ({
...
@@ -56,17 +55,11 @@ const ExtractFieldModal = ({
</
Flex
>
</
Flex
>
<
Flex
mt=
{
5
}
alignItems=
{
'center'
}
>
<
Flex
mt=
{
5
}
alignItems=
{
'center'
}
>
<
Box
flex=
{
'0 0 70px'
}
>
字段 key
</
Box
>
<
Box
flex=
{
'0 0 70px'
}
>
字段 key
</
Box
>
<
MyTooltip
label=
{
isEdit
?
'不支持修改 key'
:
''
}
shouldWrapChildren=
{
false
}
>
<
Input
<
Input
isDisabled=
{
isEdit
}
placeholder=
"name/age/sql"
placeholder=
"name/age/sql"
{
...
register
('
key
',
{
required
:
'字段
key
不能为空'
})}
{
...
register
('
key
',
{
required
:
'字段
key
不能为空'
})}
/>
/>
</
MyTooltip
>
</
Flex
>
</
Flex
>
<
Box
mt=
{
1
}
pl=
{
'70px'
}
color=
{
'myGray.600'
}
fontSize=
{
'sm'
}
>
注意: key 字段创建后无法修改
</
Box
>
</
ModalBody
>
</
ModalBody
>
<
ModalFooter
>
<
ModalFooter
>
...
...
client/src/pages/app/detail/components/AdEdit/components/render/RenderInput.tsx
View file @
eb28bfb2
...
@@ -114,12 +114,14 @@ export const Label = ({
...
@@ -114,12 +114,14 @@ export const Label = ({
key
:
data
.
key
,
key
:
data
.
key
,
value
:
data
value
:
data
});
});
setTimeout
(()
=>
{
onChangeNode
({
onChangeNode
({
moduleId
,
moduleId
,
type
:
'delInput'
,
type
:
'delInput'
,
key
:
editField
.
key
,
key
:
editField
.
key
,
value
:
''
value
:
''
});
});
});
}
}
setEditField
(
undefined
);
setEditField
(
undefined
);
}
}
}
}
...
...
client/src/pages/app/detail/components/AdEdit/components/render/RenderOutput.tsx
View file @
eb28bfb2
...
@@ -77,12 +77,31 @@ const Label = ({
...
@@ -77,12 +77,31 @@ const Label = ({
defaultField=
{
editField
}
defaultField=
{
editField
}
onClose=
{
()
=>
setEditField
(
undefined
)
}
onClose=
{
()
=>
setEditField
(
undefined
)
}
onSubmit=
{
(
data
)
=>
{
onSubmit=
{
(
data
)
=>
{
if
(
editField
.
key
===
data
.
key
)
{
onChangeNode
({
onChangeNode
({
moduleId
,
moduleId
,
type
:
'outputs'
,
type
:
'outputs'
,
key
:
''
,
key
:
''
,
value
:
outputs
.
map
((
output
)
=>
(
output
.
key
===
outputKey
?
data
:
output
))
value
:
outputs
.
map
((
output
)
=>
(
output
.
key
===
outputKey
?
data
:
output
))
});
});
}
else
{
const
storeOutputs
=
outputs
.
filter
((
output
)
=>
output
.
key
!==
editField
.
key
);
onChangeNode
({
moduleId
,
type
:
'outputs'
,
key
:
''
,
value
:
storeOutputs
});
setTimeout
(()
=>
{
onChangeNode
({
moduleId
,
type
:
'outputs'
,
key
:
''
,
value
:
storeOutputs
.
concat
(
data
)
});
},
10
);
}
setEditField
(
undefined
);
setEditField
(
undefined
);
}
}
}
}
...
...
client/src/pages/app/detail/components/AdEdit/components/render/SourceHandle.tsx
View file @
eb28bfb2
...
@@ -42,4 +42,4 @@ const SourceHandle = ({ handleKey, valueType, ...props }: Props) => {
...
@@ -42,4 +42,4 @@ const SourceHandle = ({ handleKey, valueType, ...props }: Props) => {
);
);
};
};
export
default
SourceHandle
;
export
default
React
.
memo
(
SourceHandle
)
;
client/src/pages/chat/components/SliderApps.tsx
View file @
eb28bfb2
...
@@ -3,10 +3,12 @@ import { Flex, Box, IconButton } from '@chakra-ui/react';
...
@@ -3,10 +3,12 @@ import { Flex, Box, IconButton } from '@chakra-ui/react';
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useUserStore
}
from
'@/store/user'
;
import
{
useUserStore
}
from
'@/store/user'
;
import
{
useQuery
}
from
'@tanstack/react-query'
;
import
{
useQuery
}
from
'@tanstack/react-query'
;
import
{
useTranslation
}
from
'react-i18next'
;
import
MyIcon
from
'@/components/Icon'
;
import
MyIcon
from
'@/components/Icon'
;
import
Avatar
from
'@/components/Avatar'
;
import
Avatar
from
'@/components/Avatar'
;
const
SliderApps
=
({
appId
}:
{
appId
:
string
})
=>
{
const
SliderApps
=
({
appId
}:
{
appId
:
string
})
=>
{
const
{
t
}
=
useTranslation
();
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
myApps
,
loadMyApps
}
=
useUserStore
();
const
{
myApps
,
loadMyApps
}
=
useUserStore
();
...
@@ -33,7 +35,7 @@ const SliderApps = ({ appId }: { appId: string }) => {
...
@@ -33,7 +35,7 @@ const SliderApps = ({ appId }: { appId: string }) => {
borderRadius=
{
'50%'
}
borderRadius=
{
'50%'
}
aria
-
label=
{
''
}
aria
-
label=
{
''
}
/>
/>
退出聊天
{
t
(
'chat.Exit Chat'
)
}
</
Flex
>
</
Flex
>
<
Box
mt=
{
5
}
>
<
Box
mt=
{
5
}
>
{
myApps
.
map
((
item
)
=>
(
{
myApps
.
map
((
item
)
=>
(
...
...
client/src/utils/app.ts
View file @
eb28bfb2
import
type
{
AppModuleItemType
,
VariableItemType
}
from
'@/types/app'
;
import
type
{
AppModuleItemType
,
VariableItemType
}
from
'@/types/app'
;
import
{
chatModelList
,
vectorModelList
}
from
'@/store/static'
;
import
{
chatModelList
,
vectorModelList
}
from
'@/store/static'
;
import
{
FlowModuleTypeEnum
,
SpecialInputKeyEnum
}
from
'@/constants/flow'
;
import
{
FlowInputItemTypeEnum
,
FlowModuleTypeEnum
,
FlowValueTypeEnum
,
SpecialInputKeyEnum
}
from
'@/constants/flow'
;
import
{
SystemInputEnum
}
from
'@/constants/app'
;
import
{
SystemInputEnum
}
from
'@/constants/app'
;
import
{
TaskResponseKeyEnum
}
from
'@/constants/chat'
;
import
{
TaskResponseKeyEnum
}
from
'@/constants/chat'
;
import
type
{
SelectedKbType
}
from
'@/types/plugin'
;
import
type
{
SelectedKbType
}
from
'@/types/plugin'
;
...
@@ -153,42 +158,60 @@ const chatModelInput = (formData: EditFormType): FlowInputItemType[] => [
...
@@ -153,42 +158,60 @@ const chatModelInput = (formData: EditFormType): FlowInputItemType[] => [
{
{
key
:
'model'
,
key
:
'model'
,
value
:
formData
.
chatModel
.
model
,
value
:
formData
.
chatModel
.
model
,
type
:
'custom'
,
label
:
'对话模型'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'temperature'
,
key
:
'temperature'
,
value
:
formData
.
chatModel
.
temperature
,
value
:
formData
.
chatModel
.
temperature
,
type
:
'slider'
,
label
:
'温度'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'maxToken'
,
key
:
'maxToken'
,
value
:
formData
.
chatModel
.
maxToken
,
value
:
formData
.
chatModel
.
maxToken
,
type
:
'custom'
,
label
:
'回复上限'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'systemPrompt'
,
key
:
'systemPrompt'
,
value
:
formData
.
chatModel
.
systemPrompt
,
value
:
formData
.
chatModel
.
systemPrompt
,
type
:
'textarea'
,
label
:
'系统提示词'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'limitPrompt'
,
key
:
'limitPrompt'
,
type
:
'textarea'
,
value
:
formData
.
chatModel
.
limitPrompt
,
value
:
formData
.
chatModel
.
limitPrompt
,
label
:
'限定词'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'switch'
,
key
:
'switch'
,
type
:
'target'
,
label
:
'触发器'
,
connected
:
formData
.
kb
.
list
.
length
>
0
connected
:
formData
.
kb
.
list
.
length
>
0
},
},
{
{
key
:
'quoteQA'
,
key
:
'quoteQA'
,
type
:
'target'
,
label
:
'引用内容'
,
connected
:
formData
.
kb
.
list
.
length
>
0
connected
:
formData
.
kb
.
list
.
length
>
0
},
},
{
{
key
:
'history'
,
key
:
'history'
,
type
:
'target'
,
label
:
'聊天记录'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'userChatInput'
,
key
:
'userChatInput'
,
type
:
'target'
,
label
:
'用户问题'
,
connected
:
true
connected
:
true
}
}
];
];
...
@@ -200,6 +223,8 @@ const welcomeTemplate = (formData: EditFormType): AppModuleItemType[] =>
...
@@ -200,6 +223,8 @@ const welcomeTemplate = (formData: EditFormType): AppModuleItemType[] =>
inputs
:
[
inputs
:
[
{
{
key
:
'welcomeText'
,
key
:
'welcomeText'
,
type
:
'input'
,
label
:
'开场白'
,
value
:
formData
.
guide
.
welcome
.
text
,
value
:
formData
.
guide
.
welcome
.
text
,
connected
:
true
connected
:
true
}
}
...
@@ -222,6 +247,8 @@ const variableTemplate = (formData: EditFormType): AppModuleItemType[] =>
...
@@ -222,6 +247,8 @@ const variableTemplate = (formData: EditFormType): AppModuleItemType[] =>
{
{
key
:
'variables'
,
key
:
'variables'
,
value
:
formData
.
variables
,
value
:
formData
.
variables
,
type
:
'systemInput'
,
label
:
'变量输入'
,
connected
:
true
connected
:
true
}
}
],
],
...
@@ -240,7 +267,9 @@ const simpleChatTemplate = (formData: EditFormType): AppModuleItemType[] => [
...
@@ -240,7 +267,9 @@ const simpleChatTemplate = (formData: EditFormType): AppModuleItemType[] => [
inputs
:
[
inputs
:
[
{
{
key
:
'userChatInput'
,
key
:
'userChatInput'
,
connected
:
true
connected
:
true
,
label
:
'用户问题'
,
type
:
'target'
}
}
],
],
outputs
:
[
outputs
:
[
...
@@ -266,10 +295,14 @@ const simpleChatTemplate = (formData: EditFormType): AppModuleItemType[] => [
...
@@ -266,10 +295,14 @@ const simpleChatTemplate = (formData: EditFormType): AppModuleItemType[] => [
{
{
key
:
'maxContext'
,
key
:
'maxContext'
,
value
:
6
,
value
:
6
,
connected
:
true
connected
:
true
,
type
:
'numberInput'
,
label
:
'最长记录数'
},
},
{
{
key
:
'history'
,
key
:
'history'
,
type
:
'hidden'
,
label
:
'聊天记录'
,
connected
:
true
connected
:
true
}
}
],
],
...
@@ -312,6 +345,8 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
...
@@ -312,6 +345,8 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
inputs
:
[
inputs
:
[
{
{
key
:
'userChatInput'
,
key
:
'userChatInput'
,
label
:
'用户问题'
,
type
:
'target'
,
connected
:
true
connected
:
true
}
}
],
],
...
@@ -342,10 +377,14 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
...
@@ -342,10 +377,14 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
{
{
key
:
'maxContext'
,
key
:
'maxContext'
,
value
:
6
,
value
:
6
,
connected
:
true
connected
:
true
,
type
:
'numberInput'
,
label
:
'最长记录数'
},
},
{
{
key
:
'history'
,
key
:
'history'
,
type
:
'hidden'
,
label
:
'聊天记录'
,
connected
:
true
connected
:
true
}
}
],
],
...
@@ -372,24 +411,34 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
...
@@ -372,24 +411,34 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
{
{
key
:
'kbList'
,
key
:
'kbList'
,
value
:
formData
.
kb
.
list
,
value
:
formData
.
kb
.
list
,
type
:
FlowInputItemTypeEnum
.
custom
,
label
:
'关联的知识库'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'similarity'
,
key
:
'similarity'
,
value
:
formData
.
kb
.
searchSimilarity
,
value
:
formData
.
kb
.
searchSimilarity
,
type
:
FlowInputItemTypeEnum
.
slider
,
label
:
'相似度'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'limit'
,
key
:
'limit'
,
value
:
formData
.
kb
.
searchLimit
,
value
:
formData
.
kb
.
searchLimit
,
type
:
FlowInputItemTypeEnum
.
slider
,
label
:
'单次搜索上限'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
'switch'
,
key
:
'switch'
,
type
:
FlowInputItemTypeEnum
.
target
,
label
:
'触发器'
,
connected
:
false
connected
:
false
},
},
{
{
key
:
'userChatInput'
,
key
:
'userChatInput'
,
type
:
FlowInputItemTypeEnum
.
target
,
label
:
'用户问题'
,
connected
:
true
connected
:
true
}
}
],
],
...
@@ -442,11 +491,16 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
...
@@ -442,11 +491,16 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
inputs
:
[
inputs
:
[
{
{
key
:
'switch'
,
key
:
'switch'
,
type
:
FlowInputItemTypeEnum
.
target
,
label
:
'触发器'
,
connected
:
true
connected
:
true
},
},
{
{
key
:
SpecialInputKeyEnum
.
answerText
,
key
:
SpecialInputKeyEnum
.
answerText
,
value
:
formData
.
kb
.
searchEmptyText
,
value
:
formData
.
kb
.
searchEmptyText
,
type
:
FlowInputItemTypeEnum
.
textarea
,
valueType
:
FlowValueTypeEnum
.
string
,
label
:
'回复的内容'
,
connected
:
true
connected
:
true
}
}
],
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment