feat: add DeepChat deeplink support (#4668)

This commit is contained in:
yyhhyyyyyy
2026-05-08 18:13:20 +08:00
committed by GitHub
parent 948780e3fa
commit 560ba57c88
9 changed files with 144 additions and 124 deletions
+19
View File
@@ -66,6 +66,15 @@ export function detectChatLinkType(url: string): ChatLinkType {
return 'custom-protocol'
}
export function chatLinkRequiresApiKey(url: string): boolean {
return (
url.includes('{key}') ||
url.includes('{cherryConfig}') ||
url.includes('{aionuiConfig}') ||
url.includes('{deepchatConfig}')
)
}
export function parseChatConfig(raw: RawChatConfig): ChatPreset[] {
let parsed: unknown = raw
@@ -146,6 +155,16 @@ export function resolveChatUrl({
return replaceToken(url, '{aionuiConfig}', encoded)
}
if (url.includes('{deepchatConfig}')) {
const payload = {
id: 'new-api',
baseUrl: safeServerAddress,
apiKey: safeApiKey,
}
const encoded = encodeURIComponent(toBase64(JSON.stringify(payload)))
return replaceToken(url, '{deepchatConfig}', encoded)
}
if (safeServerAddress) {
const encodedAddress = encodeURIComponent(safeServerAddress)
url = replaceToken(url, '{address}', encodedAddress)