mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 13:03:50 +00:00
perf: quote prompt
This commit is contained in:
@@ -201,7 +201,7 @@ function filterQuote({
|
|||||||
maxToken: model.quoteMaxToken,
|
maxToken: model.quoteMaxToken,
|
||||||
messages: quoteQA.map((item) => ({
|
messages: quoteQA.map((item) => ({
|
||||||
obj: ChatRoleEnum.System,
|
obj: ChatRoleEnum.System,
|
||||||
value: item.a ? `{instruction:${item.q},output:${item.a}}` : `{instruction:${item.q}}`
|
value: item.a ? `{user:${item.q},assistant:${item.a}}` : `{instruction:${item.q}}`
|
||||||
}))
|
}))
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -210,11 +210,11 @@ function filterQuote({
|
|||||||
|
|
||||||
const quotePrompt =
|
const quotePrompt =
|
||||||
filterQuoteQA.length > 0
|
filterQuoteQA.length > 0
|
||||||
? `下面是知识库内容:
|
? `${filterQuoteQA
|
||||||
${filterQuoteQA
|
.map((item) =>
|
||||||
.map((item) => (item.a ? `{instruction:${item.q},output:${item.a}}` : `{instruction:${item.q}}`))
|
item.a ? `{user:${item.q},assistant:${item.a}}` : `{instruction:${item.q}}`
|
||||||
.join('\n')}
|
)
|
||||||
`
|
.join('\n')}`
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -240,7 +240,7 @@ function getChatMessages({
|
|||||||
const limitText = (() => {
|
const limitText = (() => {
|
||||||
if (limitPrompt) return limitPrompt;
|
if (limitPrompt) return limitPrompt;
|
||||||
if (quotePrompt && !limitPrompt) {
|
if (quotePrompt && !limitPrompt) {
|
||||||
return '严格按照知识库提供的内容回答,不要做过多补充。';
|
return '根据我上文提供的内容回答下面问题,不要进行额外补充。';
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
})();
|
})();
|
||||||
|
Reference in New Issue
Block a user