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
64b9367c
authored
Aug 28, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: quote output prompt
parent
5fcdf28c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
11 deletions
+16
-11
client/src/pages/kb/detail/components/DataCard.tsx
+1
-1
client/src/pages/kb/detail/components/Import/Manual.tsx
+2
-2
client/src/pages/kb/detail/components/InputDataModal.tsx
+2
-2
client/src/service/moduleDispatch/chat/oneapi.ts
+11
-6
No files found.
client/src/pages/kb/detail/components/DataCard.tsx
View file @
64b9367c
...
@@ -163,7 +163,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
...
@@ -163,7 +163,7 @@ const DataCard = ({ kbId }: { kbId: string }) => {
maxW=
{
[
'60%'
,
'300px'
]
}
maxW=
{
[
'60%'
,
'300px'
]
}
size=
{
'sm'
}
size=
{
'sm'
}
value=
{
searchText
}
value=
{
searchText
}
placeholder=
"根据匹配知识,
补充知识
和来源进行搜索"
placeholder=
"根据匹配知识,
预期答案
和来源进行搜索"
onChange=
{
(
e
)
=>
{
onChange=
{
(
e
)
=>
{
setSearchText
(
e
.
target
.
value
);
setSearchText
(
e
.
target
.
value
);
getFirstData
();
getFirstData
();
...
...
client/src/pages/kb/detail/components/Import/Manual.tsx
View file @
64b9367c
...
@@ -95,7 +95,7 @@ const ManualImport = ({ kbId }: { kbId: string }) => {
...
@@ -95,7 +95,7 @@ const ManualImport = ({ kbId }: { kbId: string }) => {
</
Box
>
</
Box
>
<
Box
flex=
{
1
}
h=
{
[
'50%'
,
'100%'
]
}
>
<
Box
flex=
{
1
}
h=
{
[
'50%'
,
'100%'
]
}
>
<
Flex
>
<
Flex
>
<
Box
h=
{
'30px'
}
>
{
'
补充知识
'
}
</
Box
>
<
Box
h=
{
'30px'
}
>
{
'
预期答案
'
}
</
Box
>
<
MyTooltip
<
MyTooltip
label=
{
'匹配的知识点被命中后,这部分内容会随匹配知识点一起注入模型,引导模型回答'
}
label=
{
'匹配的知识点被命中后,这部分内容会随匹配知识点一起注入模型,引导模型回答'
}
>
>
...
@@ -104,7 +104,7 @@ const ManualImport = ({ kbId }: { kbId: string }) => {
...
@@ -104,7 +104,7 @@ const ManualImport = ({ kbId }: { kbId: string }) => {
</
Flex
>
</
Flex
>
<
Textarea
<
Textarea
placeholder=
{
placeholder=
{
'
补充知识。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,你可以讲一些细节的内容填写在这里
。总和最多 3000 字。'
'
预期答案。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,通常是问题的答案
。总和最多 3000 字。'
}
}
h=
{
[
'250px'
,
'500px'
]
}
h=
{
[
'250px'
,
'500px'
]
}
maxLength=
{
3000
}
maxLength=
{
3000
}
...
...
client/src/pages/kb/detail/components/InputDataModal.tsx
View file @
64b9367c
...
@@ -164,7 +164,7 @@ const InputDataModal = ({
...
@@ -164,7 +164,7 @@ const InputDataModal = ({
</
Box
>
</
Box
>
<
Box
flex=
{
1
}
h=
{
[
'50%'
,
'100%'
]
}
>
<
Box
flex=
{
1
}
h=
{
[
'50%'
,
'100%'
]
}
>
<
Flex
>
<
Flex
>
<
Box
h=
{
'30px'
}
>
{
'
补充知识
'
}
</
Box
>
<
Box
h=
{
'30px'
}
>
{
'
预期答案
'
}
</
Box
>
<
MyTooltip
<
MyTooltip
label=
{
'匹配的知识点被命中后,这部分内容会随匹配知识点一起注入模型,引导模型回答'
}
label=
{
'匹配的知识点被命中后,这部分内容会随匹配知识点一起注入模型,引导模型回答'
}
>
>
...
@@ -173,7 +173,7 @@ const InputDataModal = ({
...
@@ -173,7 +173,7 @@ const InputDataModal = ({
</
Flex
>
</
Flex
>
<
Textarea
<
Textarea
placeholder=
{
placeholder=
{
'
补充知识。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,你可以讲一些细节的内容填写在这里
。总和最多 3000 字。'
'
预期答案。这部分内容不会被搜索,但会作为"匹配的知识点"的内容补充,通常是问题的答案
。总和最多 3000 字。'
}
}
maxLength=
{
3000
}
maxLength=
{
3000
}
resize=
{
'none'
}
resize=
{
'none'
}
...
...
client/src/service/moduleDispatch/chat/oneapi.ts
View file @
64b9367c
...
@@ -68,7 +68,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
...
@@ -68,7 +68,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
return
Promise
.
reject
(
'The chat model is undefined, you need to select a chat model.'
);
return
Promise
.
reject
(
'The chat model is undefined, you need to select a chat model.'
);
}
}
const
{
filterQuoteQA
,
quotePrompt
}
=
filterQuote
({
const
{
filterQuoteQA
,
quotePrompt
,
hasQuoteOutput
}
=
filterQuote
({
quoteQA
,
quoteQA
,
model
:
modelConstantsData
model
:
modelConstantsData
});
});
...
@@ -89,7 +89,8 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
...
@@ -89,7 +89,8 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
quotePrompt
,
quotePrompt
,
userChatInput
,
userChatInput
,
systemPrompt
,
systemPrompt
,
limitPrompt
limitPrompt
,
hasQuoteOutput
});
});
const
{
max_tokens
}
=
getMaxTokens
({
const
{
max_tokens
}
=
getMaxTokens
({
model
:
modelConstantsData
,
model
:
modelConstantsData
,
...
@@ -219,7 +220,8 @@ function filterQuote({
...
@@ -219,7 +220,8 @@ function filterQuote({
return
{
return
{
filterQuoteQA
,
filterQuoteQA
,
quotePrompt
quotePrompt
,
hasQuoteOutput
:
!!
filterQuoteQA
.
find
((
item
)
=>
item
.
a
)
};
};
}
}
function
getChatMessages
({
function
getChatMessages
({
...
@@ -228,7 +230,8 @@ function getChatMessages({
...
@@ -228,7 +230,8 @@ function getChatMessages({
systemPrompt
,
systemPrompt
,
limitPrompt
,
limitPrompt
,
userChatInput
,
userChatInput
,
model
model
,
hasQuoteOutput
}:
{
}:
{
quotePrompt
:
string
;
quotePrompt
:
string
;
history
:
ChatProps
[
'history'
];
history
:
ChatProps
[
'history'
];
...
@@ -236,13 +239,15 @@ function getChatMessages({
...
@@ -236,13 +239,15 @@ function getChatMessages({
limitPrompt
:
string
;
limitPrompt
:
string
;
userChatInput
:
string
;
userChatInput
:
string
;
model
:
ChatModelItemType
;
model
:
ChatModelItemType
;
hasQuoteOutput
:
boolean
;
})
{
})
{
const
limitText
=
(()
=>
{
const
limitText
=
(()
=>
{
if
(
!
quotePrompt
)
{
if
(
!
quotePrompt
)
{
return
limitPrompt
;
return
limitPrompt
;
}
}
const
defaultPrompt
=
const
defaultPrompt
=
`三引号引用的内容是我提供给你的知识,它们拥有最高优先级。instruction 是相关介绍
${
'三引号是我提供给你的专属知识,它们拥有最高优先级。instruction 是相关介绍,output 是预期回答,使用引用内容来回答我下面的问题。'
;
hasQuoteOutput
?
',output 是预期回答或补充'
:
''
}
,使用引用内容来回答我下面的问题。`
;
if
(
limitPrompt
)
{
if
(
limitPrompt
)
{
return
`
${
defaultPrompt
}${
limitPrompt
}
`
;
return
`
${
defaultPrompt
}${
limitPrompt
}
`
;
}
}
...
...
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