diff --git a/src/background/index.mjs b/src/background/index.mjs index 1e55bf6..04edc3b 100644 --- a/src/background/index.mjs +++ b/src/background/index.mjs @@ -120,12 +120,20 @@ Browser.runtime.onConnect.addListener((port) => { } else if (githubThirdPartyApiModelKeys.includes(session.modelName)) { await generateAnswersWithWaylaidwandererApi(port, session.question, session) } else if (poeWebModelKeys.includes(session.modelName)) { - await generateAnswersWithPoeWebApi( - port, - session.question, - session, - Models[session.modelName].value, - ) + if (session.modelName === 'poeAiWebCustom') + await generateAnswersWithPoeWebApi( + port, + session.question, + session, + config.poeCustomBotName, + ) + else + await generateAnswersWithPoeWebApi( + port, + session.question, + session, + Models[session.modelName].value, + ) } } catch (err) { console.error(err) diff --git a/src/config/index.mjs b/src/config/index.mjs index 545cfb9..2971573 100644 --- a/src/config/index.mjs +++ b/src/config/index.mjs @@ -26,6 +26,7 @@ export const Models = { customModel: { value: '', desc: 'Custom Model' }, azureOpenAi: { value: '', desc: 'ChatGPT (Azure)' }, waylaidwandererApi: { value: '', desc: 'Waylaidwanderer API (Github)' }, + poeAiWebCustom: { value: '', desc: 'Poe AI (Web, Custom)' }, poeAiWebChatGpt: { value: 'chatgpt', desc: 'Poe AI (Web, ChatGPT)' }, poeAiWebDragonfly: { value: 'dragonfly', desc: 'Poe AI (Web, Dragonfly)' }, } @@ -42,6 +43,7 @@ export const poeWebModelKeys = [ 'poeAiWebGPT4', 'poeAiWebClaudePlus', 'poeAiWebClaude', + 'poeAiWebCustom', 'poeAiWebChatGpt', 'poeAiWebDragonfly', ] @@ -90,6 +92,8 @@ export const defaultConfig = { azureEndpoint: '', azureDeploymentName: '', + poeCustomBotName: '', + /** @type {keyof ModelMode}*/ modelMode: 'balanced', @@ -182,6 +186,10 @@ export function isUsingCustomModel(configOrSession) { return customApiModelKeys.includes(configOrSession.modelName) } +export function isUsingCustomNameOnlyModel(configOrSession) { + return configOrSession.modelName === 'poeAiWebCustom' +} + export function isUsingAzureOpenAi(configOrSession) { return azureOpenAiApiModelKeys.includes(configOrSession.modelName) } diff --git a/src/popup/Popup.jsx b/src/popup/Popup.jsx index d96d7c6..841a3ac 100644 --- a/src/popup/Popup.jsx +++ b/src/popup/Popup.jsx @@ -7,6 +7,7 @@ import { isUsingApiKey, isUsingAzureOpenAi, isUsingCustomModel, + isUsingCustomNameOnlyModel, isUsingGithubThirdPartyApi, isUsingMultiModeModel, ModelMode, @@ -90,7 +91,8 @@ function GeneralPart({ config, updateConfig }) { isUsingApiKey(config) || isUsingMultiModeModel(config) || isUsingCustomModel(config) || - isUsingAzureOpenAi(config) + isUsingAzureOpenAi(config) || + isUsingCustomNameOnlyModel(config) ? 'width: 50%;' : undefined } @@ -170,6 +172,18 @@ function GeneralPart({ config, updateConfig }) { }} /> )} + {isUsingCustomNameOnlyModel(config) && ( + { + const customName = e.target.value + updateConfig({ poeCustomBotName: customName }) + }} + /> + )} {isUsingAzureOpenAi(config) && (