[feat] custom proxy requst model

This commit is contained in:
kwaroran
2023-09-23 16:24:57 +09:00
parent 4a34dc3e23
commit dc65a386f2
3 changed files with 13 additions and 2 deletions

View File

@@ -135,7 +135,7 @@
<span class="text-textcolor mt-4"> {language.proxyAPIKey}</span>
<TextInput marginBottom={false} size={"sm"} placeholder="leave it blank if it hasn't password" bind:value={$DataBase.proxyKey} />
<span class="text-textcolor mt-4"> {language.proxyRequestModel}</span>
<SelectInput className="mt-2 mb-4" bind:value={$DataBase.proxyRequestModel}>
<SelectInput className="mt-2" bind:value={$DataBase.proxyRequestModel}>
<OptionInput value="">None</OptionInput>
<OptionInput value="gpt35">GPT 3.5</OptionInput>
<OptionInput value="gpt35_16k">GPT 3.5 16k</OptionInput>
@@ -151,7 +151,13 @@
<OptionInput value="claude-v1.2">claude-v1.2</OptionInput>
<OptionInput value="claude-instant-v1.1">claude-instant-v1.1</OptionInput>
<OptionInput value="claude-instant-v1.1-100k">claude-instant-v1.1-100k</OptionInput>
<OptionInput value="custom">Custom</OptionInput>
</SelectInput>
{#if $DataBase.proxyRequestModel === 'custom'}
<TextInput marginBottom={true} size={"sm"} bind:value={$DataBase.customProxyRequestModel} placeholder="Name" />
{:else}
<div class="mb-4"></div>
{/if}
{/if}
{#if $DataBase.aiModel === 'openrouter' || $DataBase.subModel === 'openrouter'}
<span class="text-textcolor mt-4">Openrouter Key</span>

View File

@@ -168,7 +168,11 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
const oaiFunctionCall = oaiFunctions ? (arg.useEmotion ? {"name": "set_emotion"} : "auto") : undefined
const requestModel = (aiModel === 'reverse_proxy' || aiModel === 'openrouter') ? db.proxyRequestModel : aiModel
let requestModel = (aiModel === 'reverse_proxy' || aiModel === 'openrouter') ? db.proxyRequestModel : aiModel
if(aiModel === 'reverse_proxy' && db.proxyRequestModel === 'custom'){
requestModel = db.customProxyRequestModel
}
const body = ({
model: aiModel === 'openrouter' ? db.openrouterRequestModel :
requestModel === 'gpt35' ? 'gpt-3.5-turbo'

View File

@@ -316,6 +316,7 @@ export function setDatabase(data:Database){
data.NAIsettings.mirostat_tau ??= 0
data.NAIsettings.mirostat_lr ??= 1
data.autofillRequestUrl ??= true
data.customProxyRequestModel ??= ''
changeLanguage(data.language)
DataBase.set(data)
}