mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-02 19:00:49 +08:00
fix(api): use oauth model alias endpoints
This commit is contained in:
@@ -1399,15 +1399,15 @@ export function AuthFilesPage() {
|
|||||||
>
|
>
|
||||||
<div className={styles.providerField}>
|
<div className={styles.providerField}>
|
||||||
<Input
|
<Input
|
||||||
id="oauth-model-mappings-provider"
|
id="oauth-model-alias-provider"
|
||||||
list="oauth-model-mappings-provider-options"
|
list="oauth-model-alias-provider-options"
|
||||||
label={t('oauth_model_mappings.provider_label')}
|
label={t('oauth_model_mappings.provider_label')}
|
||||||
hint={t('oauth_model_mappings.provider_hint')}
|
hint={t('oauth_model_mappings.provider_hint')}
|
||||||
placeholder={t('oauth_model_mappings.provider_placeholder')}
|
placeholder={t('oauth_model_mappings.provider_placeholder')}
|
||||||
value={mappingForm.provider}
|
value={mappingForm.provider}
|
||||||
onChange={(e) => setMappingForm((prev) => ({ ...prev, provider: e.target.value }))}
|
onChange={(e) => setMappingForm((prev) => ({ ...prev, provider: e.target.value }))}
|
||||||
/>
|
/>
|
||||||
<datalist id="oauth-model-mappings-provider-options">
|
<datalist id="oauth-model-alias-provider-options">
|
||||||
{providerOptions.map((provider) => (
|
{providerOptions.map((provider) => (
|
||||||
<option key={provider} value={provider} />
|
<option key={provider} value={provider} />
|
||||||
))}
|
))}
|
||||||
|
|||||||
@@ -81,8 +81,8 @@ export const authFilesApi = {
|
|||||||
|
|
||||||
// OAuth 模型映射
|
// OAuth 模型映射
|
||||||
async getOauthModelMappings(): Promise<Record<string, OAuthModelMappingEntry[]>> {
|
async getOauthModelMappings(): Promise<Record<string, OAuthModelMappingEntry[]>> {
|
||||||
const data = await apiClient.get('/oauth-model-mappings');
|
const data = await apiClient.get('/oauth-model-alias');
|
||||||
const payload = (data && (data['oauth-model-mappings'] ?? data.items ?? data)) as any;
|
const payload = (data && (data['oauth-model-alias'] ?? data.items ?? data)) as any;
|
||||||
if (!payload || typeof payload !== 'object') return {};
|
if (!payload || typeof payload !== 'object') return {};
|
||||||
const result: Record<string, OAuthModelMappingEntry[]> = {};
|
const result: Record<string, OAuthModelMappingEntry[]> = {};
|
||||||
Object.entries(payload).forEach(([channel, mappings]) => {
|
Object.entries(payload).forEach(([channel, mappings]) => {
|
||||||
@@ -105,10 +105,10 @@ export const authFilesApi = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
saveOauthModelMappings: (channel: string, mappings: OAuthModelMappingEntry[]) =>
|
saveOauthModelMappings: (channel: string, mappings: OAuthModelMappingEntry[]) =>
|
||||||
apiClient.patch('/oauth-model-mappings', { channel, mappings }),
|
apiClient.patch('/oauth-model-alias', { channel, mappings }),
|
||||||
|
|
||||||
deleteOauthModelMappings: (channel: string) =>
|
deleteOauthModelMappings: (channel: string) =>
|
||||||
apiClient.delete(`/oauth-model-mappings?channel=${encodeURIComponent(channel)}`),
|
apiClient.delete(`/oauth-model-alias?channel=${encodeURIComponent(channel)}`),
|
||||||
|
|
||||||
// 获取认证凭证支持的模型
|
// 获取认证凭证支持的模型
|
||||||
async getModelsForAuthFile(name: string): Promise<{ id: string; display_name?: string; type?: string; owned_by?: string }[]> {
|
async getModelsForAuthFile(name: string): Promise<{ id: string; display_name?: string; type?: string; owned_by?: string }[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user