feat: add legacy endpoint migration and testing endpoint notice

This commit is contained in:
Simon
2026-02-27 17:50:10 +08:00
parent 9d5c8b2302
commit 07b4dc32f7
3 changed files with 47 additions and 6 deletions
+18
View File
@@ -10,3 +10,21 @@ export const DEMO_CONFIG: LLMConfig = {
baseURL: DEMO_BASE_URL,
model: DEMO_MODEL,
}
/** Legacy testing endpoints that should be auto-migrated to DEMO_BASE_URL */
export const LEGACY_TESTING_ENDPOINTS = [
'https://hwcxiuzfylggtcktqgij.supabase.co/functions/v1/llm-testing-proxy',
]
export function isTestingEndpoint(url: string): boolean {
const normalized = url.replace(/\/+$/, '')
return normalized === DEMO_BASE_URL || LEGACY_TESTING_ENDPOINTS.some((ep) => normalized === ep)
}
export function migrateLegacyEndpoint(config: LLMConfig): LLMConfig {
const normalized = config.baseURL.replace(/\/+$/, '')
if (LEGACY_TESTING_ENDPOINTS.some((ep) => normalized === ep)) {
return { ...DEMO_CONFIG }
}
return config
}