Skip to content
Snippets Groups Projects
Unverified Commit 9ed23097 authored by Sean Hatfield's avatar Sean Hatfield Committed by GitHub
Browse files

[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: default avatartimothycarambat <rambat1010@gmail.com>
parent f0365d41
No related branches found
No related tags found
No related merge requests found
...@@ -74,6 +74,7 @@ GID='1000' ...@@ -74,6 +74,7 @@ GID='1000'
# LLM_PROVIDER='textgenwebui' # LLM_PROVIDER='textgenwebui'
# TEXT_GEN_WEB_UI_BASE_PATH='http://127.0.0.1:5000/v1' # TEXT_GEN_WEB_UI_BASE_PATH='http://127.0.0.1:5000/v1'
# TEXT_GEN_WEB_UI_TOKEN_LIMIT=4096 # TEXT_GEN_WEB_UI_TOKEN_LIMIT=4096
# TEXT_GEN_WEB_UI_API_KEY='sk-123abc'
# LLM_PROVIDER='generic-openai' # LLM_PROVIDER='generic-openai'
# GENERIC_OPEN_AI_BASE_PATH='http://proxy.url.openai.com/v1' # GENERIC_OPEN_AI_BASE_PATH='http://proxy.url.openai.com/v1'
......
...@@ -32,6 +32,20 @@ export default function TextGenWebUIOptions({ settings }) { ...@@ -32,6 +32,20 @@ export default function TextGenWebUIOptions({ settings }) {
autoComplete="off" autoComplete="off"
/> />
</div> </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> </div>
); );
} }
...@@ -71,6 +71,7 @@ JWT_SECRET="my-random-string-for-seeding" # Please generate random string at lea ...@@ -71,6 +71,7 @@ JWT_SECRET="my-random-string-for-seeding" # Please generate random string at lea
# LLM_PROVIDER='textgenwebui' # LLM_PROVIDER='textgenwebui'
# TEXT_GEN_WEB_UI_BASE_PATH='http://127.0.0.1:5000/v1' # TEXT_GEN_WEB_UI_BASE_PATH='http://127.0.0.1:5000/v1'
# TEXT_GEN_WEB_UI_TOKEN_LIMIT=4096 # TEXT_GEN_WEB_UI_TOKEN_LIMIT=4096
# TEXT_GEN_WEB_UI_API_KEY='sk-123abc'
# LLM_PROVIDER='generic-openai' # LLM_PROVIDER='generic-openai'
# GENERIC_OPEN_AI_BASE_PATH='http://proxy.url.openai.com/v1' # GENERIC_OPEN_AI_BASE_PATH='http://proxy.url.openai.com/v1'
......
...@@ -367,6 +367,7 @@ const SystemSettings = { ...@@ -367,6 +367,7 @@ const SystemSettings = {
// Text Generation Web UI Keys // Text Generation Web UI Keys
TextGenWebUIBasePath: process.env.TEXT_GEN_WEB_UI_BASE_PATH, TextGenWebUIBasePath: process.env.TEXT_GEN_WEB_UI_BASE_PATH,
TextGenWebUITokenLimit: process.env.TEXT_GEN_WEB_UI_MODEL_TOKEN_LIMIT, TextGenWebUITokenLimit: process.env.TEXT_GEN_WEB_UI_MODEL_TOKEN_LIMIT,
TextGenWebUIAPIKey: !!process.env.TEXT_GEN_WEB_UI_API_KEY,
// Generic OpenAI Keys // Generic OpenAI Keys
GenericOpenAiBasePath: process.env.GENERIC_OPEN_AI_BASE_PATH, GenericOpenAiBasePath: process.env.GENERIC_OPEN_AI_BASE_PATH,
......
...@@ -14,7 +14,7 @@ class TextGenWebUILLM { ...@@ -14,7 +14,7 @@ class TextGenWebUILLM {
this.basePath = process.env.TEXT_GEN_WEB_UI_BASE_PATH; this.basePath = process.env.TEXT_GEN_WEB_UI_BASE_PATH;
this.openai = new OpenAIApi({ this.openai = new OpenAIApi({
baseURL: this.basePath, baseURL: this.basePath,
apiKey: null, apiKey: process.env.TEXT_GEN_WEB_UI_API_KEY ?? null,
}); });
this.model = null; this.model = null;
this.limits = { this.limits = {
......
...@@ -13,7 +13,7 @@ class TextWebGenUiProvider extends InheritMultiple([Provider, UnTooled]) { ...@@ -13,7 +13,7 @@ class TextWebGenUiProvider extends InheritMultiple([Provider, UnTooled]) {
super(); super();
const client = new OpenAI({ const client = new OpenAI({
baseURL: process.env.TEXT_GEN_WEB_UI_BASE_PATH, baseURL: process.env.TEXT_GEN_WEB_UI_BASE_PATH,
apiKey: null, apiKey: process.env.TEXT_GEN_WEB_UI_API_KEY ?? null,
maxRetries: 3, maxRetries: 3,
}); });
......
...@@ -155,6 +155,10 @@ const KEY_MAPPING = { ...@@ -155,6 +155,10 @@ const KEY_MAPPING = {
envKey: "TEXT_GEN_WEB_UI_MODEL_TOKEN_LIMIT", envKey: "TEXT_GEN_WEB_UI_MODEL_TOKEN_LIMIT",
checks: [nonZero], checks: [nonZero],
}, },
TextGenWebUIAPIKey: {
envKey: "TEXT_GEN_WEB_UI_API_KEY",
checks: [],
},
// Generic OpenAI InferenceSettings // Generic OpenAI InferenceSettings
GenericOpenAiBasePath: { GenericOpenAiBasePath: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment