mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
Merge pull request #2892 from Arron196/feat/sync-upstream-models-on-create
feat: 添加账号时支持同步上游支持的模型
This commit is contained in:
@@ -487,6 +487,23 @@ export async function syncUpstreamModels(id: number): Promise<SyncUpstreamModels
|
||||
return data
|
||||
}
|
||||
|
||||
export interface SyncUpstreamPreviewParams {
|
||||
platform: string
|
||||
type: string
|
||||
base_url?: string
|
||||
api_key: string
|
||||
}
|
||||
|
||||
/**
|
||||
* Preview upstream models without a saved account (create-flow)
|
||||
* @param params - Connection credentials
|
||||
* @returns List of model IDs returned by the upstream
|
||||
*/
|
||||
export async function syncUpstreamModelsPreview(params: SyncUpstreamPreviewParams): Promise<SyncUpstreamModelsResult> {
|
||||
const { data } = await apiClient.post<SyncUpstreamModelsResult>('/admin/accounts/models/sync-upstream-preview', params)
|
||||
return data
|
||||
}
|
||||
|
||||
export interface CRSPreviewAccount {
|
||||
crs_account_id: string
|
||||
kind: string
|
||||
@@ -703,6 +720,7 @@ export const accountsAPI = {
|
||||
setSchedulable,
|
||||
getAvailableModels,
|
||||
syncUpstreamModels,
|
||||
syncUpstreamModelsPreview,
|
||||
generateAuthUrl,
|
||||
exchangeCode,
|
||||
refreshOpenAIToken,
|
||||
|
||||
Reference in New Issue
Block a user