allow filling in the API Key of CustomModel mode (#561, previously designed for local offline model or custom server, now you can also use it for regular openai API calls and freely fill in the model name(#563))

This commit is contained in:
josc146
2023-11-13 13:42:46 +08:00
parent 946cadc51d
commit d0fbc9fecb
4 changed files with 29 additions and 6 deletions
+2 -2
View File
@@ -9,7 +9,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 { getCustomApiPromptBase, pushRecord, setAbortController } from './shared.mjs'
import { pushRecord, setAbortController } from './shared.mjs'
/**
* @param {Browser.Runtime.Port} port
@@ -26,7 +26,7 @@ export async function generateAnswersWithCustomApi(port, question, session, apiK
session.conversationRecords.slice(-config.maxConversationContextLength),
false,
)
prompt.unshift({ role: 'system', content: await getCustomApiPromptBase() })
// prompt.unshift({ role: 'system', content: await getCustomApiPromptBase() })
prompt.push({ role: 'user', content: question })
const apiUrl = config.customModelApiUrl