fix(stage-ui): update onboarding provider list and improve validation logic

This commit is contained in:
RainbowBird
2026-03-28 02:25:44 +08:00
committed by RainbowBird
parent 1b3ade3f41
commit 97cadd5f7a
6 changed files with 27 additions and 31 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ common:
schema_config:
configs:
- from: "2024-01-01"
- from: '2024-01-01'
store: tsdb
object_store: filesystem
schema: v13
+1 -1
View File
@@ -171,7 +171,7 @@ async function createApp() {
})
const db = injeca.provide('datastore:db', {
dependsOn: { env: parsedEnv },
dependsOn: { env: parsedEnv, lifecycle },
build: async ({ dependsOn }) => {
const { db: dbInstance, pool } = createDrizzle(dependsOn.env.DATABASE_URL)
await dbInstance.execute('SELECT 1')
@@ -466,9 +466,9 @@ pages:
actions:
open-config: 打开 mcp.json
apply-and-restart: 保存并重启 stdio MCP
messages:
opened: Config file opened at {path}
restarted: MCP servers restarted. Started {started}, failed {failed}, skipped {skipped}
opened: 配置文件已于{path}打开
restarted: >-
MCP 服务已重新启动,启动了{started},未启动{failed},跳过{skipped}
flux:
title: Flux
buy: 充能
@@ -86,7 +86,7 @@ function handleLocalSetup() {
<Button
v-motion
:initial="{ opacity: 0 }"
:visible="{ opacity: 1 }"
:enter="{ opacity: 1 }"
:duration="500"
:delay="200"
:label="t('settings.dialogs.onboarding.loginAction')"
@@ -96,7 +96,7 @@ function handleLocalSetup() {
<Button
v-motion
:initial="{ opacity: 0 }"
:visible="{ opacity: 1 }"
:enter="{ opacity: 1 }"
:duration="500"
:delay="250"
variant="secondary"
+16 -12
View File
@@ -5,7 +5,7 @@ import { computed, ref, watch } from 'vue'
import { useAuthStore } from './auth'
import { useProvidersStore } from './providers'
const essentialProviderIds = ['openai', 'azure-openai', 'anthropic', 'google-generative-ai', 'openrouter-ai', 'ollama', 'deepseek', 'openai-compatible'] as const
const essentialProviderIds = ['openai', 'azure-openai', 'anthropic', 'google-generative-ai', 'openrouter-ai', 'ollama', 'deepseek', 'openai-compatible', 'official-provider'] as const
const credentialBasedEssentialProviderIds = ['openai', 'azure-openai', 'anthropic', 'google-generative-ai', 'openrouter-ai', 'deepseek'] as const
function hasNonEmptyText(value: unknown): boolean {
@@ -25,17 +25,21 @@ export const useOnboardingStore = defineStore('onboarding', () => {
// Check if any essential provider is configured
const hasEssentialProviderConfigured = computed(() => {
const essentialProviders = [
'openai',
'anthropic',
'google-generative-ai',
'openrouter-ai',
'ollama',
'deepseek',
'openai-compatible',
'official-provider',
]
return essentialProviders.some(providerId => providersStore.configuredProviders[providerId])
return essentialProviderIds.some(providerId => providersStore.configuredProviders[providerId])
})
// Fallback for app startup timing:
// If configured state has not been revalidated yet, infer "configured"
// from persisted essential credentials.
const hasEssentialProviderCredentialConfigured = computed(() => {
return credentialBasedEssentialProviderIds.some((providerId) => {
const providerConfig = providersStore.providers[providerId] as Record<string, unknown> | undefined
if (!providerConfig) {
return false
}
return hasNonEmptyText(providerConfig.apiKey)
})
})
// Check if first-time setup should be shown
+4 -12
View File
@@ -1795,18 +1795,10 @@ export const useProvidersStore = defineStore('providers', () => {
if (!forceValidation && runtimeState?.validatedCredentialHash === configString && typeof runtimeState.isConfigured === 'boolean')
return runtimeState.isConfigured
// Always cache the current config string to prevent re-validating the same config
if (providerRuntimeState.value[providerId]) {
providerRuntimeState.value[providerId].validatedCredentialHash = configString
}
const validationResult = await metadata.validators.validateProviderConfig(config || {})
if (providerRuntimeState.value[providerId]) {
providerRuntimeState.value[providerId].isConfigured = validationResult.valid
// Auto-mark Web Speech API as added if valid and available
if (validationResult.valid && ['browser-web-speech-api', 'player2', 'official-provider'].includes(providerId)) {
markProviderAdded(providerId)
if (!forceValidation) {
const pending = providerValidationInFlight.get(cacheKey)
if (pending) {
return pending
}
}