fix(stage-pages): use placeholderLocalized from provider config for API key input (#1391)
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Authored-by-agent: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Matt Van Horn
parent
db3c002e1b
commit
09f2470c22
@@ -11,6 +11,7 @@ import {
|
||||
ProviderValidationAlerts,
|
||||
} from '@proj-airi/stage-ui/components'
|
||||
import { useProviderValidation } from '@proj-airi/stage-ui/composables/use-provider-validation'
|
||||
import { getDefinedProvider } from '@proj-airi/stage-ui/libs'
|
||||
import { useConsciousnessStore } from '@proj-airi/stage-ui/stores/modules/consciousness'
|
||||
import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers'
|
||||
import { storeToRefs } from 'pinia'
|
||||
@@ -60,6 +61,21 @@ const {
|
||||
runManualTest,
|
||||
} = useProviderValidation(providerId)
|
||||
|
||||
const apiKeyPlaceholder = computed(() => {
|
||||
const definition = getDefinedProvider(providerId)
|
||||
if (!definition?.createProviderConfig)
|
||||
return 'sk-...'
|
||||
|
||||
const schema = definition.createProviderConfig({ t }) as any
|
||||
const shape = typeof schema?.shape === 'function' ? schema.shape() : schema?.shape
|
||||
const apiKeySchema = shape?.apiKey
|
||||
if (!apiKeySchema)
|
||||
return 'sk-...'
|
||||
|
||||
const meta = typeof apiKeySchema.meta === 'function' ? apiKeySchema.meta() : undefined
|
||||
return typeof meta?.placeholderLocalized === 'string' ? meta.placeholderLocalized : 'sk-...'
|
||||
})
|
||||
|
||||
function goToModelSelection() {
|
||||
activeProvider.value = providerId
|
||||
router.push('/settings/modules/consciousness')
|
||||
@@ -81,7 +97,7 @@ function goToModelSelection() {
|
||||
<ProviderApiKeyInput
|
||||
v-model="apiKey"
|
||||
:provider-name="providerMetadata?.localizedName"
|
||||
placeholder="sk-..."
|
||||
:placeholder="apiKeyPlaceholder"
|
||||
/>
|
||||
</ProviderBasicSettings>
|
||||
|
||||
|
||||
+17
-1
@@ -7,6 +7,7 @@ import {
|
||||
SpeechProviderSettings,
|
||||
} from '@proj-airi/stage-ui/components'
|
||||
import { useProviderValidation } from '@proj-airi/stage-ui/composables/use-provider-validation'
|
||||
import { getDefinedProvider } from '@proj-airi/stage-ui/libs'
|
||||
import { useSpeechStore } from '@proj-airi/stage-ui/stores/modules/speech'
|
||||
import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers'
|
||||
import { FieldInput, FieldRange } from '@proj-airi/ui'
|
||||
@@ -155,6 +156,21 @@ const {
|
||||
validationMessage,
|
||||
forceValid,
|
||||
} = useProviderValidation(providerId)
|
||||
|
||||
const apiKeyPlaceholder = computed(() => {
|
||||
const definition = getDefinedProvider(providerId)
|
||||
if (!definition?.createProviderConfig)
|
||||
return 'sk-...'
|
||||
|
||||
const schema = definition.createProviderConfig({ t }) as any
|
||||
const shape = typeof schema?.shape === 'function' ? schema.shape() : schema?.shape
|
||||
const apiKeySchema = shape?.apiKey
|
||||
if (!apiKeySchema)
|
||||
return 'sk-...'
|
||||
|
||||
const meta = typeof apiKeySchema.meta === 'function' ? apiKeySchema.meta() : undefined
|
||||
return typeof meta?.placeholderLocalized === 'string' ? meta.placeholderLocalized : 'sk-...'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -162,7 +178,7 @@ const {
|
||||
:provider-id="providerId"
|
||||
:default-model="defaultModel"
|
||||
:additional-settings="defaultVoiceSettings"
|
||||
placeholder="sk-..."
|
||||
:placeholder="apiKeyPlaceholder"
|
||||
>
|
||||
<!-- Voice settings specific to OpenAI Compatible -->
|
||||
<template #voice-settings>
|
||||
|
||||
+17
-1
@@ -13,6 +13,7 @@ import {
|
||||
TranscriptionPlayground,
|
||||
} from '@proj-airi/stage-ui/components'
|
||||
import { useProviderValidation } from '@proj-airi/stage-ui/composables/use-provider-validation'
|
||||
import { getDefinedProvider } from '@proj-airi/stage-ui/libs'
|
||||
import { useHearingStore } from '@proj-airi/stage-ui/stores/modules/hearing'
|
||||
import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers'
|
||||
import { FieldInput } from '@proj-airi/ui'
|
||||
@@ -81,6 +82,21 @@ const {
|
||||
handleResetSettings,
|
||||
forceValid,
|
||||
} = useProviderValidation(providerId)
|
||||
|
||||
const apiKeyPlaceholder = computed(() => {
|
||||
const definition = getDefinedProvider(providerId)
|
||||
if (!definition?.createProviderConfig)
|
||||
return 'sk-...'
|
||||
|
||||
const schema = definition.createProviderConfig({ t }) as any
|
||||
const shape = typeof schema?.shape === 'function' ? schema.shape() : schema?.shape
|
||||
const apiKeySchema = shape?.apiKey
|
||||
if (!apiKeySchema)
|
||||
return 'sk-...'
|
||||
|
||||
const meta = typeof apiKeySchema.meta === 'function' ? apiKeySchema.meta() : undefined
|
||||
return typeof meta?.placeholderLocalized === 'string' ? meta.placeholderLocalized : 'sk-...'
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -98,7 +114,7 @@ const {
|
||||
<ProviderApiKeyInput
|
||||
v-model="apiKey"
|
||||
:provider-name="providerMetadata?.localizedName"
|
||||
placeholder="sk-..."
|
||||
:placeholder="apiKeyPlaceholder"
|
||||
/>
|
||||
<FieldInput
|
||||
v-model="model"
|
||||
|
||||
+17
-1
@@ -13,6 +13,7 @@ import {
|
||||
TranscriptionPlayground,
|
||||
} from '@proj-airi/stage-ui/components'
|
||||
import { useProviderValidation } from '@proj-airi/stage-ui/composables/use-provider-validation'
|
||||
import { getDefinedProvider } from '@proj-airi/stage-ui/libs'
|
||||
import { useHearingStore } from '@proj-airi/stage-ui/stores/modules/hearing'
|
||||
import { useProvidersStore } from '@proj-airi/stage-ui/stores/providers'
|
||||
import { FieldInput, FieldSelect } from '@proj-airi/ui'
|
||||
@@ -109,6 +110,21 @@ const {
|
||||
forceValid,
|
||||
} = useProviderValidation(providerId)
|
||||
|
||||
const apiKeyPlaceholder = computed(() => {
|
||||
const definition = getDefinedProvider(providerId)
|
||||
if (!definition?.createProviderConfig)
|
||||
return 'sk-...'
|
||||
|
||||
const schema = definition.createProviderConfig({ t }) as any
|
||||
const shape = typeof schema?.shape === 'function' ? schema.shape() : schema?.shape
|
||||
const apiKeySchema = shape?.apiKey
|
||||
if (!apiKeySchema)
|
||||
return 'sk-...'
|
||||
|
||||
const meta = typeof apiKeySchema.meta === 'function' ? apiKeySchema.meta() : undefined
|
||||
return typeof meta?.placeholderLocalized === 'string' ? meta.placeholderLocalized : 'sk-...'
|
||||
})
|
||||
|
||||
// Expand Advanced section if there's a base URL validation error
|
||||
const shouldExpandAdvanced = computed(() => {
|
||||
if (!validationMessage.value)
|
||||
@@ -195,7 +211,7 @@ watch(model, () => {
|
||||
<ProviderApiKeyInput
|
||||
v-model="apiKey"
|
||||
:provider-name="providerMetadata?.localizedName"
|
||||
placeholder="sk-..."
|
||||
:placeholder="apiKeyPlaceholder"
|
||||
/>
|
||||
<!-- Model selection: Use dropdown if models are available, otherwise use text input -->
|
||||
<FieldSelect
|
||||
|
||||
Reference in New Issue
Block a user