From 323c080b5e72d164eca8a7ad046606722f301e41 Mon Sep 17 00:00:00 2001 From: Timothy Carambat Date: Tue, 23 Apr 2024 13:18:28 -0700 Subject: [PATCH] Support single-model providers for workspace LLMs (#1179) --- .../GenericOpenAiOptions/index.jsx | 64 +++++++++---------- .../GeneralSettings/LLMPreference/index.jsx | 6 ++ .../WorkspaceLLMSelection/index.jsx | 5 +- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/frontend/src/components/LLMSelection/GenericOpenAiOptions/index.jsx b/frontend/src/components/LLMSelection/GenericOpenAiOptions/index.jsx index 456b5042..8f5a00b6 100644 --- a/frontend/src/components/LLMSelection/GenericOpenAiOptions/index.jsx +++ b/frontend/src/components/LLMSelection/GenericOpenAiOptions/index.jsx @@ -31,40 +31,36 @@ export default function GenericOpenAiOptions({ settings }) { spellCheck={false} /> - {!settings?.credentialsOnly && ( - <> -
- - -
-
- - e.target.blur()} - defaultValue={settings?.GenericOpenAiTokenLimit} - required={true} - autoComplete="off" - /> -
- - )} +
+ + +
+
+ + e.target.blur()} + defaultValue={settings?.GenericOpenAiTokenLimit} + required={true} + autoComplete="off" + /> +
); } diff --git a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx index 0575f34c..271d9197 100644 --- a/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx +++ b/frontend/src/pages/GeneralSettings/LLMPreference/index.jsx @@ -159,6 +159,12 @@ export const AVAILABLE_LLM_PROVIDERS = [ options: (settings) => , description: "Connect to any OpenAi-compatible service via a custom configuration", + requiredConfig: [ + "GenericOpenAiBasePath", + "GenericOpenAiModelPref", + "GenericOpenAiTokenLimit", + "GenericOpenAiKey", + ], }, { name: "Native", diff --git a/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/index.jsx b/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/index.jsx index 19e6e5da..511ed34b 100644 --- a/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/index.jsx +++ b/frontend/src/pages/WorkspaceSettings/ChatSettings/WorkspaceLLMSelection/index.jsx @@ -5,6 +5,9 @@ import { AVAILABLE_LLM_PROVIDERS } from "@/pages/GeneralSettings/LLMPreference"; import { CaretUpDown, MagnifyingGlass, X } from "@phosphor-icons/react"; import ChatModelSelection from "../ChatModelSelection"; +// Some providers can only be associated with a single model. +// In that case there is no selection to be made so we can just move on. +const NO_MODEL_SELECTION = ["default", "huggingface", "generic-openai"]; const DISABLED_PROVIDERS = ["azure", "lmstudio", "native"]; const LLM_DEFAULT = { name: "System default", @@ -145,7 +148,7 @@ export default function WorkspaceLLMSelection({ )} - {selectedLLM !== "default" && ( + {!NO_MODEL_SELECTION.includes(selectedLLM) && (