fix(default): resolve v1 frontend issue regressions
Fix v1 frontend regressions across channel forms, dashboard charts, wallet history, payment callbacks, invite links, API key groups, rate-limit errors, and usage-log scrolling. Fixes #4715 Fixes #4618 Fixes #4699 Fixes #4651 Fixes #4637 Fixes #4682 Fixes #4691 Fixes #4565 Fixes #4334
This commit is contained in:
@@ -143,6 +143,12 @@ function replaceToken(source: string, token: string, value: string) {
|
||||
return source.split(token).join(value)
|
||||
}
|
||||
|
||||
function normalizeApiKey(apiKey: string): string {
|
||||
const trimmed = apiKey.trim()
|
||||
if (!trimmed) return ''
|
||||
return trimmed.startsWith('sk-') ? trimmed : `sk-${trimmed}`
|
||||
}
|
||||
|
||||
export function resolveChatUrl({
|
||||
template,
|
||||
apiKey,
|
||||
@@ -151,7 +157,7 @@ export function resolveChatUrl({
|
||||
let url = template
|
||||
const safeServerAddress = serverAddress || ''
|
||||
|
||||
const safeApiKey = apiKey || ''
|
||||
const safeApiKey = normalizeApiKey(apiKey || '')
|
||||
|
||||
if (url.includes('{cherryConfig}')) {
|
||||
const payload = {
|
||||
|
||||
Reference in New Issue
Block a user