From 0c62b8bbfed85ee9284e59f3b7022f995894725a Mon Sep 17 00:00:00 2001 From: kwaroran Date: Sun, 8 Dec 2024 15:46:54 +0900 Subject: [PATCH] Add pools --- src/lang/en.ts | 2 ++ src/lib/Setting/Pages/BotSettings.svelte | 6 ++++++ src/ts/globalApi.svelte.ts | 1 + src/ts/model/modellist.ts | 7 ++++--- src/ts/process/request.ts | 23 +++++++++++++++++++---- src/ts/storage/database.svelte.ts | 1 + 6 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/lang/en.ts b/src/lang/en.ts index 85b25c67..3ec746a2 100644 --- a/src/lang/en.ts +++ b/src/lang/en.ts @@ -171,6 +171,7 @@ export const languageEnglish = { translatorPrompt: "The prompt that is used for translation. if it is blank, it will use the default prompt. you can also use ChatML formating with {{slot}} for the dest language, {{solt::content}} for the content, and {{slot::tnote}} for the translator note.", translateBeforeHTMLFormatting: "If enabled, it will translate the text before Regex scripts and HTML formatting. this could make the token lesser but could break the formatting.", autoTranslateCachedOnly: "If enabled, it will automatically translate only the text that the user has translated previously.", + APIPool: "If enabled, it will connect to RisuAI API Pool. Every user which API pool is enabled, the API key will be shared if it used for free, rate-limited models, making it user to make more request of rate-limited models by using other's API key that didn't used much." }, setup: { chooseProvider: "Choose AI Provider", @@ -818,4 +819,5 @@ export const languageEnglish = { customFlags: "Custom Flags", enableCustomFlags: "Enable Custom Flags", googleCloudTokenization: "Google Cloud Tokenization", + APIPool: "API Pool" } \ No newline at end of file diff --git a/src/lib/Setting/Pages/BotSettings.svelte b/src/lib/Setting/Pages/BotSettings.svelte index 7f04094a..d66c01a7 100644 --- a/src/lib/Setting/Pages/BotSettings.svelte +++ b/src/lib/Setting/Pages/BotSettings.svelte @@ -220,6 +220,12 @@ {#if DBState.db.aiModel === 'reverse_proxy' || DBState.db.subModel === 'reverse_proxy'} {/if} + {#if modelInfo.flags.includes(LLMFlags.poolSupported) && DBState.db.useExperimental} + + + + + {/if} {#if modelInfo.provider === LLMProvider.NovelAI || subModelInfo.provider === LLMProvider.NovelAI} diff --git a/src/ts/globalApi.svelte.ts b/src/ts/globalApi.svelte.ts index 1e971a5e..cbf3c347 100644 --- a/src/ts/globalApi.svelte.ts +++ b/src/ts/globalApi.svelte.ts @@ -906,6 +906,7 @@ async function fetchWithProxy(url: string, arg: GlobalFetchArgs): Promise