diff --git a/src/common/components/AlreadySet.tsx b/src/common/components/AlreadySet.tsx new file mode 100644 index 000000000..ccb4c9fee --- /dev/null +++ b/src/common/components/AlreadySet.tsx @@ -0,0 +1,15 @@ +import * as React from 'react'; + +import { Typography } from '@mui/joy'; + +import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; + + +export function AlreadySet(props: { required?: boolean }) { + return ( + }> + {/*Installed Already*/} + {props.required ? 'required' : 'Already set on server'} + + ); +} \ No newline at end of file diff --git a/src/modules/browse/BrowseSettings.tsx b/src/modules/browse/BrowseSettings.tsx index 0bed7ea5c..de3e406b0 100644 --- a/src/modules/browse/BrowseSettings.tsx +++ b/src/modules/browse/BrowseSettings.tsx @@ -3,12 +3,13 @@ import { useShallow } from 'zustand/react/shallow'; import { Checkbox, FormControl, FormHelperText, Option, Select, Typography } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; +import { ExternalLink } from '~/common/components/ExternalLink'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; +import { FormLabelStart } from '~/common/components/forms/FormLabelStart'; import { platformAwareKeystrokes } from '~/common/components/KeyStroke'; import { useBrowseCapability, useBrowseStore } from './store-module-browsing'; -import { ExternalLink } from '~/common/components/ExternalLink'; -import { FormLabelStart } from '~/common/components/forms/FormLabelStart'; export function BrowseSettings() { @@ -44,7 +45,7 @@ export function BrowseSettings() { } required={!isServerConfig} isError={!isClientValid && !isServerConfig} placeholder='wss://...' /> diff --git a/src/modules/elevenlabs/ElevenlabsSettings.tsx b/src/modules/elevenlabs/ElevenlabsSettings.tsx index 6c2abfbdc..51b07db94 100644 --- a/src/modules/elevenlabs/ElevenlabsSettings.tsx +++ b/src/modules/elevenlabs/ElevenlabsSettings.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { FormControl } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { FormLabelStart } from '~/common/components/forms/FormLabelStart'; import { useCapabilityElevenLabs } from '~/common/components/useCapabilities'; @@ -31,7 +32,7 @@ export function ElevenlabsSettings() { {!isConfiguredServerSide && } value={apiKey} onChange={setApiKey} required={!isConfiguredServerSide} isError={!isValidKey} />} diff --git a/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx b/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx index c3afef6a2..6c31f648c 100644 --- a/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx +++ b/src/modules/llms/vendors/anthropic/AnthropicSourceSetup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Alert } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { ExternalLink } from '~/common/components/ExternalLink'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { FormTextField } from '~/common/components/forms/FormTextField'; @@ -49,7 +50,7 @@ export function AnthropicSourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='anthropic-key' label={!!anthropicHost ? 'API Key' : 'Anthropic API Key'} rightLabel={<>{needsUserKey ? !anthropicKey && request Key - : '✔️ already set in server' + : } {anthropicKey && keyValid && show tokens usage} } value={anthropicKey} onChange={value => updateSetup({ anthropicKey: value })} diff --git a/src/modules/llms/vendors/azure/AzureSourceSetup.tsx b/src/modules/llms/vendors/azure/AzureSourceSetup.tsx index 24fc0d79e..cfd6572f1 100644 --- a/src/modules/llms/vendors/azure/AzureSourceSetup.tsx +++ b/src/modules/llms/vendors/azure/AzureSourceSetup.tsx @@ -1,5 +1,6 @@ import * as React from 'react'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { FormTextField } from '~/common/components/forms/FormTextField'; import { InlineError } from '~/common/components/InlineError'; @@ -49,7 +50,7 @@ export function AzureSourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='azure-key' label='Azure Key' rightLabel={<>{needsUserKey ? !azureKey && request Key - : '✔️ already set in server'} + : } } value={azureKey} onChange={value => updateSetup({ azureKey: value })} required={needsUserKey} isError={keyError} diff --git a/src/modules/llms/vendors/gemini/GeminiSourceSetup.tsx b/src/modules/llms/vendors/gemini/GeminiSourceSetup.tsx index b0f89ab1d..2044e7c53 100644 --- a/src/modules/llms/vendors/gemini/GeminiSourceSetup.tsx +++ b/src/modules/llms/vendors/gemini/GeminiSourceSetup.tsx @@ -3,6 +3,7 @@ import * as React from 'react'; import { FormControl, FormHelperText, Option, Select } from '@mui/joy'; import HealthAndSafetyIcon from '@mui/icons-material/HealthAndSafety'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { FormLabelStart } from '~/common/components/forms/FormLabelStart'; import { InlineError } from '~/common/components/InlineError'; @@ -50,7 +51,7 @@ export function GeminiSourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='gemini-key' label='Gemini API Key' rightLabel={<>{needsUserKey ? !geminiKey && request Key - : '✔️ already set in server'} + : } } value={geminiKey} onChange={value => updateSetup({ geminiKey: value.trim() })} required={needsUserKey} isError={showKeyError} diff --git a/src/modules/llms/vendors/groq/GroqSourceSetup.tsx b/src/modules/llms/vendors/groq/GroqSourceSetup.tsx index bbce7101e..6b73dff95 100644 --- a/src/modules/llms/vendors/groq/GroqSourceSetup.tsx +++ b/src/modules/llms/vendors/groq/GroqSourceSetup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Typography } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; import { Link } from '~/common/components/Link'; @@ -42,7 +43,7 @@ export function GroqSourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='groq-key' label='Groq API Key' rightLabel={<>{needsUserKey ? !groqKey && API keys - : '✔️ already set in server'} + : } } value={groqKey} onChange={value => updateSetup({ groqKey: value })} required={needsUserKey} isError={showKeyError} diff --git a/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx b/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx index 4d0b3a64c..c62858be5 100644 --- a/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx +++ b/src/modules/llms/vendors/localai/LocalAISourceSetup.tsx @@ -6,6 +6,7 @@ import CheckBoxOutlinedIcon from '@mui/icons-material/CheckBoxOutlined'; import { getBackendCapabilities } from '~/modules/backend/store-backend-capabilities'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { ExpanderAccordion } from '~/common/components/ExpanderAccordion'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; @@ -81,7 +82,7 @@ export function LocalAISourceSetup(props: { sourceId: DModelSourceId }) { noKey required={userHostRequired} isError={userHostError} - rightLabel={backendHasHost ? '✔️ already set in server' : Learn more} + rightLabel={backendHasHost ? : Learn more} value={localAIHost} onChange={value => updateSetup({ localAIHost: value })} /> diff --git a/src/modules/llms/vendors/mistral/MistralSourceSetup.tsx b/src/modules/llms/vendors/mistral/MistralSourceSetup.tsx index 02c8fe5df..fb02d2cf6 100644 --- a/src/modules/llms/vendors/mistral/MistralSourceSetup.tsx +++ b/src/modules/llms/vendors/mistral/MistralSourceSetup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Typography } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; import { Link } from '~/common/components/Link'; @@ -39,7 +40,7 @@ export function MistralSourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='mistral-key' label='Mistral Key' rightLabel={<>{needsUserKey ? !mistralKey && request Key - : '✔️ already set in server'} + : } } value={mistralKey} onChange={value => updateSetup({ oaiKey: value })} required={needsUserKey} isError={showKeyError} diff --git a/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx b/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx index a62c53620..613a0868d 100644 --- a/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx +++ b/src/modules/llms/vendors/openai/OpenAISourceSetup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Alert } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { Brand } from '~/common/app.config'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { FormSwitchControl } from '~/common/components/forms/FormSwitchControl'; @@ -48,7 +49,7 @@ export function OpenAISourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='openai-key' label='API Key' rightLabel={<>{needsUserKey ? !oaiKey && <>create key and request access to GPT-4 - : '✔️ already set in server' + : } {oaiKey && keyValid && check usage} } value={oaiKey} onChange={value => updateSetup({ oaiKey: value })} diff --git a/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx b/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx index 1ec664025..a6d3804c2 100644 --- a/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx +++ b/src/modules/llms/vendors/openrouter/OpenRouterSourceSetup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Button, Typography } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; import { Link } from '~/common/components/Link'; @@ -56,7 +57,7 @@ export function OpenRouterSourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='openrouter-key' label='OpenRouter API Key' rightLabel={<>{needsUserKey ? !oaiKey && your keys - : '✔️ already set in server' + : } {oaiKey && keyValid && check usage} } value={oaiKey} onChange={value => updateSetup({ oaiKey: value })} diff --git a/src/modules/llms/vendors/perplexity/PerplexitySourceSetup.tsx b/src/modules/llms/vendors/perplexity/PerplexitySourceSetup.tsx index 5b47d404d..2e2c269b8 100644 --- a/src/modules/llms/vendors/perplexity/PerplexitySourceSetup.tsx +++ b/src/modules/llms/vendors/perplexity/PerplexitySourceSetup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Typography } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { InlineError } from '~/common/components/InlineError'; import { Link } from '~/common/components/Link'; @@ -42,7 +43,7 @@ export function PerplexitySourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='perplexity-key' label='Perplexity API Key' rightLabel={<>{needsUserKey ? !perplexityKey && API keys - : '✔️ already set in server'} + : } } value={perplexityKey} onChange={value => updateSetup({ perplexityKey: value })} required={needsUserKey} isError={showKeyError} diff --git a/src/modules/llms/vendors/togetherai/TogetherAISourceSetup.tsx b/src/modules/llms/vendors/togetherai/TogetherAISourceSetup.tsx index bd1f53b67..898134e87 100644 --- a/src/modules/llms/vendors/togetherai/TogetherAISourceSetup.tsx +++ b/src/modules/llms/vendors/togetherai/TogetherAISourceSetup.tsx @@ -2,6 +2,7 @@ import * as React from 'react'; import { Alert, Typography } from '@mui/joy'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { FormSwitchControl } from '~/common/components/forms/FormSwitchControl'; import { InlineError } from '~/common/components/InlineError'; @@ -48,7 +49,7 @@ export function TogetherAISourceSetup(props: { sourceId: DModelSourceId }) { autoCompleteId='togetherai-key' label='Together AI Key' rightLabel={<>{needsUserKey ? !togetherKey && request Key - : '✔️ already set in server'} + : } } value={togetherKey} onChange={value => updateSetup({ togetherKey: value })} required={needsUserKey} isError={showKeyError} diff --git a/src/modules/t2i/prodia/ProdiaSettings.tsx b/src/modules/t2i/prodia/ProdiaSettings.tsx index 3a1117e91..99a104615 100644 --- a/src/modules/t2i/prodia/ProdiaSettings.tsx +++ b/src/modules/t2i/prodia/ProdiaSettings.tsx @@ -10,6 +10,7 @@ import StayPrimaryPortraitIcon from '@mui/icons-material/StayPrimaryPortrait'; import { getBackendCapabilities } from '~/modules/backend/store-backend-capabilities'; +import { AlreadySet } from '~/common/components/AlreadySet'; import { FormInputKey } from '~/common/components/forms/FormInputKey'; import { FormLabelStart } from '~/common/components/forms/FormLabelStart'; import { FormRadioControl } from '~/common/components/forms/FormRadioControl'; @@ -80,7 +81,7 @@ export function ProdiaSettings(props: { noSkipKey?: boolean }) { {!backendHasProdia && !!props.noSkipKey && } value={apiKey} onChange={setApiKey} required={!backendHasProdia} isError={!isValidKey} />}