mirror of
https://github.com/wassname/chatGPTBox.git
synced 2026-07-01 23:31:19 +08:00
feat: custom bot for poe.com (#189)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
+15
-1
@@ -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) && (
|
||||
<input
|
||||
style="width: 50%;"
|
||||
type="text"
|
||||
value={config.poeCustomBotName}
|
||||
placeholder={t('Bot Name')}
|
||||
onChange={(e) => {
|
||||
const customName = e.target.value
|
||||
updateConfig({ poeCustomBotName: customName })
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isUsingAzureOpenAi(config) && (
|
||||
<input
|
||||
type="password"
|
||||
|
||||
Reference in New Issue
Block a user