This commit is contained in:
Archer
2023-10-17 10:00:32 +08:00
committed by GitHub
parent dd8f2744bf
commit 3b776b6639
98 changed files with 1525 additions and 983 deletions

View File

@@ -36,9 +36,10 @@ export const getDefaultAppForm = (): EditFormType => {
model: defaultChatModel?.model,
systemPrompt: '',
temperature: 0,
[SystemInputEnum.isResponseAnswerText]: true,
quotePrompt: '',
quoteTemplate: '',
maxToken: defaultChatModel ? defaultChatModel.contextMaxToken / 2 : 4000,
maxToken: defaultChatModel ? defaultChatModel.maxToken / 2 : 4000,
frequency: 0.5,
presence: -0.5
},
@@ -185,6 +186,13 @@ const chatModelInput = (formData: EditFormType): FlowInputItemType[] => [
label: '系统提示词',
connected: true
},
{
key: SystemInputEnum.isResponseAnswerText,
value: true,
type: 'hidden',
label: '返回AI内容',
connected: true
},
{
key: 'quoteTemplate',
value: formData.chatModel.quoteTemplate || '',
@@ -328,7 +336,7 @@ const simpleChatTemplate = (formData: EditFormType): AppModuleItemType[] => [
outputs: [
{
key: 'answerText',
label: '模型回复',
label: 'AI回复',
description: '直接响应,无需配置',
type: 'hidden',
targets: []
@@ -533,7 +541,7 @@ const kbTemplate = (formData: EditFormType): AppModuleItemType[] => [
outputs: [
{
key: 'answerText',
label: '模型回复',
label: 'AI回复',
description: '直接响应,无需配置',
type: 'hidden',
targets: []

View File

@@ -12,11 +12,12 @@ export const splitText2Chunks = ({ text = '', maxLen }: { text: string; maxLen:
const tempMarker = 'SPLIT_HERE_SPLIT_HERE';
const stepReg: Record<number, RegExp> = {
0: /(\n)/g,
1: /([。]|\.\s)/g,
2: /([]|!\s|\?\s)/g,
3: /([]|;\s)/g,
4: /([]|,\s)/g
0: /(\n\n)/g,
1: /([\n])/g,
2: /([。]|\.\s)/g,
3: /([]|!\s|\?\s)/g,
4: /([]|;\s)/g,
5: /([]|,\s)/g
};
const splitTextRecursively = ({ text = '', step }: { text: string; step: number }) => {
@@ -43,7 +44,6 @@ export const splitText2Chunks = ({ text = '', maxLen }: { text: string; maxLen:
.filter((part) => part);
let chunks: string[] = [];
let preChunk = '';
let chunk = '';
for (let i = 0; i < splitTexts.length; i++) {