mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2025-04-17 18:18:11 +00:00
[FEAT] Add API key support for Oobabooga Web UI (#1354)
* add api key support for oobabooga web ui * dont expose API Key for TextWebGenUi --------- Co-authored-by: timothycarambat <rambat1010@gmail.com>
This commit is contained in:
parent
f0365d41a6
commit
9ed2309757
7 changed files with 23 additions and 2 deletions
|
@ -74,6 +74,7 @@ GID='1000'
|
|||
# LLM_PROVIDER='textgenwebui'
|
||||
# TEXT_GEN_WEB_UI_BASE_PATH='http://127.0.0.1:5000/v1'
|
||||
# TEXT_GEN_WEB_UI_TOKEN_LIMIT=4096
|
||||
# TEXT_GEN_WEB_UI_API_KEY='sk-123abc'
|
||||
|
||||
# LLM_PROVIDER='generic-openai'
|
||||
# GENERIC_OPEN_AI_BASE_PATH='http://proxy.url.openai.com/v1'
|
||||
|
|
|
@ -32,6 +32,20 @@ export default function TextGenWebUIOptions({ settings }) {
|
|||
autoComplete="off"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col w-60">
|
||||
<label className="text-white text-sm font-semibold block mb-4">
|
||||
API Key (Optional)
|
||||
</label>
|
||||
<input
|
||||
type="password"
|
||||
name="TextGenWebUIAPIKey"
|
||||
className="bg-zinc-900 text-white placeholder:text-white/20 text-sm rounded-lg focus:border-white block w-full p-2.5"
|
||||
placeholder="TextGen Web UI API Key"
|
||||
defaultValue={settings?.TextGenWebUIAPIKey ? "*".repeat(20) : ""}
|
||||
autoComplete="off"
|
||||
spellCheck={false}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ JWT_SECRET="my-random-string-for-seeding" # Please generate random string at lea
|
|||
# LLM_PROVIDER='textgenwebui'
|
||||
# TEXT_GEN_WEB_UI_BASE_PATH='http://127.0.0.1:5000/v1'
|
||||
# TEXT_GEN_WEB_UI_TOKEN_LIMIT=4096
|
||||
# TEXT_GEN_WEB_UI_API_KEY='sk-123abc'
|
||||
|
||||
# LLM_PROVIDER='generic-openai'
|
||||
# GENERIC_OPEN_AI_BASE_PATH='http://proxy.url.openai.com/v1'
|
||||
|
|
|
@ -367,6 +367,7 @@ const SystemSettings = {
|
|||
// Text Generation Web UI Keys
|
||||
TextGenWebUIBasePath: process.env.TEXT_GEN_WEB_UI_BASE_PATH,
|
||||
TextGenWebUITokenLimit: process.env.TEXT_GEN_WEB_UI_MODEL_TOKEN_LIMIT,
|
||||
TextGenWebUIAPIKey: !!process.env.TEXT_GEN_WEB_UI_API_KEY,
|
||||
|
||||
// Generic OpenAI Keys
|
||||
GenericOpenAiBasePath: process.env.GENERIC_OPEN_AI_BASE_PATH,
|
||||
|
|
|
@ -14,7 +14,7 @@ class TextGenWebUILLM {
|
|||
this.basePath = process.env.TEXT_GEN_WEB_UI_BASE_PATH;
|
||||
this.openai = new OpenAIApi({
|
||||
baseURL: this.basePath,
|
||||
apiKey: null,
|
||||
apiKey: process.env.TEXT_GEN_WEB_UI_API_KEY ?? null,
|
||||
});
|
||||
this.model = null;
|
||||
this.limits = {
|
||||
|
|
|
@ -13,7 +13,7 @@ class TextWebGenUiProvider extends InheritMultiple([Provider, UnTooled]) {
|
|||
super();
|
||||
const client = new OpenAI({
|
||||
baseURL: process.env.TEXT_GEN_WEB_UI_BASE_PATH,
|
||||
apiKey: null,
|
||||
apiKey: process.env.TEXT_GEN_WEB_UI_API_KEY ?? null,
|
||||
maxRetries: 3,
|
||||
});
|
||||
|
||||
|
|
|
@ -155,6 +155,10 @@ const KEY_MAPPING = {
|
|||
envKey: "TEXT_GEN_WEB_UI_MODEL_TOKEN_LIMIT",
|
||||
checks: [nonZero],
|
||||
},
|
||||
TextGenWebUIAPIKey: {
|
||||
envKey: "TEXT_GEN_WEB_UI_API_KEY",
|
||||
checks: [],
|
||||
},
|
||||
|
||||
// Generic OpenAI InferenceSettings
|
||||
GenericOpenAiBasePath: {
|
||||
|
|
Loading…
Add table
Reference in a new issue