diff --git a/src/background/index.mjs b/src/background/index.mjs index 0282b4b..21fc279 100644 --- a/src/background/index.mjs +++ b/src/background/index.mjs @@ -111,7 +111,13 @@ async function executeApi(session, port, config) { session.modelName, ) } else if (customApiModelKeys.includes(session.modelName)) { - await generateAnswersWithCustomApi(port, session.question, session, '', config.customModelName) + await generateAnswersWithCustomApi( + port, + session.question, + session, + config.customApiKey, + config.customModelName, + ) } else if (azureOpenAiApiModelKeys.includes(session.modelName)) { await generateAnswersWithAzureOpenaiApi(port, session.question, session) } else if (claudeApiModelKeys.includes(session.modelName)) { diff --git a/src/config/index.mjs b/src/config/index.mjs index 84e96ff..29d1d05 100644 --- a/src/config/index.mjs +++ b/src/config/index.mjs @@ -98,7 +98,10 @@ export const Models = { chatgptApi4_8k_0613: { value: 'gpt-4', desc: 'ChatGPT (GPT-4-8k 0613)' }, chatgptApi4_32k: { value: 'gpt-4-32k', desc: 'ChatGPT (GPT-4-32k)' }, chatgptApi4_32k_0613: { value: 'gpt-4-32k', desc: 'ChatGPT (GPT-4-32k 0613)' }, - chatgptApi4_128k_preview: { value: 'gpt-4-1106-preview', desc: 'ChatGPT (GPT-4-Turbo 128k Preview)' }, + chatgptApi4_128k_preview: { + value: 'gpt-4-1106-preview', + desc: 'ChatGPT (GPT-4-Turbo 128k Preview)', + }, gptApiDavinci: { value: 'text-davinci-003', desc: 'GPT-3.5' }, customModel: { value: '', desc: 'Custom Model' }, azureOpenAi: { value: '', desc: 'ChatGPT (Azure)' }, @@ -149,11 +152,14 @@ export const defaultConfig = { poeCustomBotName: '', claudeApiKey: '', + + customApiKey: '', + /** @type {keyof ModelMode}*/ modelMode: 'balanced', - customModelApiUrl: 'http://localhost:8000/chat/completions', - customModelName: 'rwkv', + customModelApiUrl: 'http://localhost:8000/v1/chat/completions', + customModelName: 'gpt-3.5-turbo', githubThirdPartyUrl: 'http://127.0.0.1:3000/conversation', // advanced diff --git a/src/popup/sections/GeneralPart.jsx b/src/popup/sections/GeneralPart.jsx index e14406a..ddc4341 100644 --- a/src/popup/sections/GeneralPart.jsx +++ b/src/popup/sections/GeneralPart.jsx @@ -285,6 +285,17 @@ export function GeneralPart({ config, updateConfig }) { }} /> )} + {isUsingCustomModel(config) && ( + { + const apiKey = e.target.value + updateConfig({ customApiKey: apiKey }) + }} + /> + )} {isUsingAzureOpenAi(config) && (