fix(desktop): isolate AI account auth probes
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { aiPlatformCatalog } from '@geo/shared-types'
|
||||
|
||||
import {
|
||||
probeAIAccountSession,
|
||||
probePublishAccountSession,
|
||||
silentRefreshAIAccountSession,
|
||||
silentRefreshPublishAccountSession,
|
||||
type PublishAccountIdentity,
|
||||
} from './account-binder'
|
||||
@@ -227,6 +229,16 @@ function classifyDongchediFailure(input: PlatformFailureInput): PlatformFailureC
|
||||
return classifyFailure(input)
|
||||
}
|
||||
|
||||
const aiAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probeAIAccountSession(account, partition)
|
||||
},
|
||||
async silentRefresh(account, partition) {
|
||||
return await silentRefreshAIAccountSession(account, partition)
|
||||
},
|
||||
classifyFailure,
|
||||
}
|
||||
|
||||
const genericAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition)
|
||||
@@ -239,20 +251,20 @@ const genericAdapter: PlatformAdapter = {
|
||||
|
||||
const doubaoAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition)
|
||||
return await probeAIAccountSession(account, partition)
|
||||
},
|
||||
async silentRefresh(account, partition) {
|
||||
return await silentRefreshPublishAccountSession(account, partition)
|
||||
return await silentRefreshAIAccountSession(account, partition)
|
||||
},
|
||||
classifyFailure: classifyDoubaoFailure,
|
||||
}
|
||||
|
||||
const wenxinAdapter: PlatformAdapter = {
|
||||
async probe(account, partition) {
|
||||
return await probePublishAccountSession(account, partition)
|
||||
return await probeAIAccountSession(account, partition)
|
||||
},
|
||||
async silentRefresh(account, partition) {
|
||||
return await silentRefreshPublishAccountSession(account, partition)
|
||||
return await silentRefreshAIAccountSession(account, partition)
|
||||
},
|
||||
classifyFailure: classifyWenxinFailure,
|
||||
}
|
||||
@@ -384,10 +396,12 @@ const adapterRegistry = new Map<string, PlatformAdapter>(
|
||||
: platform === 'weixin_gzh'
|
||||
? weixinGzhAdapter
|
||||
: platform === 'zol'
|
||||
? zolAdapter
|
||||
: platform === 'dongchedi'
|
||||
? dongchediAdapter
|
||||
: genericAdapter,
|
||||
? zolAdapter
|
||||
: platform === 'dongchedi'
|
||||
? dongchediAdapter
|
||||
: aiPlatformCatalog.some((item) => item.id === platform)
|
||||
? aiAdapter
|
||||
: genericAdapter,
|
||||
]),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user