diff --git a/src/services/apis/azure-openai-api.mjs b/src/services/apis/azure-openai-api.mjs index 9ed2716..4058534 100644 --- a/src/services/apis/azure-openai-api.mjs +++ b/src/services/apis/azure-openai-api.mjs @@ -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 = '' diff --git a/src/services/apis/custom-api.mjs b/src/services/apis/custom-api.mjs index 32b4577..002d1b9 100644 --- a/src/services/apis/custom-api.mjs +++ b/src/services/apis/custom-api.mjs @@ -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 = '' diff --git a/src/services/apis/openai-api.mjs b/src/services/apis/openai-api.mjs index 1bda6f8..2d30c3b 100644 --- a/src/services/apis/openai-api.mjs +++ b/src/services/apis/openai-api.mjs @@ -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 = '' diff --git a/src/utils/crop-text.mjs b/src/utils/crop-text.mjs index c6826f5..7546a00 100644 --- a/src/utils/crop-text.mjs +++ b/src/utils/crop-text.mjs @@ -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) {