small fix

This commit is contained in:
josc146
2024-08-08 11:54:47 +08:00
parent 524f154cf3
commit 5faa3952f4
4 changed files with 3 additions and 10 deletions
+1 -2
View File
@@ -1,5 +1,5 @@
import { getUserConfig } from '../../config/index.mjs'
import { getChatSystemPromptBase, pushRecord, setAbortController } from './shared.mjs'
import { pushRecord, setAbortController } from './shared.mjs'
import { getConversationPairs } from '../../utils/get-conversation-pairs.mjs'
import { fetchSSE } from '../../utils/fetch-sse.mjs'
import { isEmpty } from 'lodash-es'
@@ -20,7 +20,6 @@ export async function generateAnswersWithAzureOpenaiApi(port, question, session)
session.conversationRecords.slice(-config.maxConversationContextLength),
false,
)
prompt.unshift({ role: 'system', content: await getChatSystemPromptBase() })
prompt.push({ role: 'user', content: question })
let answer = ''
-1
View File
@@ -34,7 +34,6 @@ export async function generateAnswersWithCustomApi(
session.conversationRecords.slice(-config.maxConversationContextLength),
false,
)
// prompt.unshift({ role: 'system', content: await getCustomApiPromptBase() })
prompt.push({ role: 'user', content: question })
let answer = ''
+1 -7
View File
@@ -4,12 +4,7 @@ import { getUserConfig } from '../../config/index.mjs'
import { fetchSSE } from '../../utils/fetch-sse.mjs'
import { getConversationPairs } from '../../utils/get-conversation-pairs.mjs'
import { isEmpty } from 'lodash-es'
import {
getChatSystemPromptBase,
getCompletionPromptBase,
pushRecord,
setAbortController,
} from './shared.mjs'
import { getCompletionPromptBase, pushRecord, setAbortController } from './shared.mjs'
import { getModelValue } from '../../utils/model-name-convert.mjs'
/**
@@ -127,7 +122,6 @@ export async function generateAnswersWithChatgptApiCompat(
session.conversationRecords.slice(-config.maxConversationContextLength),
false,
)
prompt.unshift({ role: 'system', content: await getChatSystemPromptBase() })
prompt.push({ role: 'user', content: question })
let answer = ''
+1
View File
@@ -38,6 +38,7 @@ export async function cropText(
const userConfig = await getUserConfig()
const k = modelNameToDesc(
userConfig.apiMode ? apiModeToModelName(userConfig.apiMode) : userConfig.modelName,
null,
userConfig.customModelName,
).match(/[- (]*([0-9]+)k/)?.[1]
if (k) {