mirror of
https://github.com/router-for-me/Cli-Proxy-API-Management-Center.git
synced 2026-02-03 03:10:50 +08:00
fix(i18n): update API endpoint references from /v1/model to /v1/models
This commit is contained in:
16
i18n.js
16
i18n.js
@@ -210,12 +210,12 @@ const i18n = {
|
|||||||
'ai_providers.openai_model_name_placeholder': '模型名称,如 moonshotai/kimi-k2:free',
|
'ai_providers.openai_model_name_placeholder': '模型名称,如 moonshotai/kimi-k2:free',
|
||||||
'ai_providers.openai_model_alias_placeholder': '模型别名 (可选)',
|
'ai_providers.openai_model_alias_placeholder': '模型别名 (可选)',
|
||||||
'ai_providers.openai_models_add_btn': '添加模型',
|
'ai_providers.openai_models_add_btn': '添加模型',
|
||||||
'ai_providers.openai_models_fetch_button': '从 /v1/model 获取',
|
'ai_providers.openai_models_fetch_button': '从 /v1/models 获取',
|
||||||
'ai_providers.openai_models_fetch_title': '从 /v1/model 选择模型',
|
'ai_providers.openai_models_fetch_title': '从 /v1/models 选择模型',
|
||||||
'ai_providers.openai_models_fetch_hint': '使用上方 Base URL 调用 /v1/model 端点,附带首个 API Key(Bearer)与自定义请求头。',
|
'ai_providers.openai_models_fetch_hint': '使用上方 Base URL 调用 /v1/models 端点,附带首个 API Key(Bearer)与自定义请求头。',
|
||||||
'ai_providers.openai_models_fetch_url_label': '请求地址',
|
'ai_providers.openai_models_fetch_url_label': '请求地址',
|
||||||
'ai_providers.openai_models_fetch_refresh': '重新获取',
|
'ai_providers.openai_models_fetch_refresh': '重新获取',
|
||||||
'ai_providers.openai_models_fetch_loading': '正在从 /v1/model 获取模型列表...',
|
'ai_providers.openai_models_fetch_loading': '正在从 /v1/models 获取模型列表...',
|
||||||
'ai_providers.openai_models_fetch_empty': '未获取到模型,请检查端点或鉴权信息。',
|
'ai_providers.openai_models_fetch_empty': '未获取到模型,请检查端点或鉴权信息。',
|
||||||
'ai_providers.openai_models_fetch_error': '获取模型失败',
|
'ai_providers.openai_models_fetch_error': '获取模型失败',
|
||||||
'ai_providers.openai_models_fetch_back': '返回编辑',
|
'ai_providers.openai_models_fetch_back': '返回编辑',
|
||||||
@@ -730,12 +730,12 @@ const i18n = {
|
|||||||
'ai_providers.openai_model_name_placeholder': 'Model name, e.g. moonshotai/kimi-k2:free',
|
'ai_providers.openai_model_name_placeholder': 'Model name, e.g. moonshotai/kimi-k2:free',
|
||||||
'ai_providers.openai_model_alias_placeholder': 'Model alias (optional)',
|
'ai_providers.openai_model_alias_placeholder': 'Model alias (optional)',
|
||||||
'ai_providers.openai_models_add_btn': 'Add Model',
|
'ai_providers.openai_models_add_btn': 'Add Model',
|
||||||
'ai_providers.openai_models_fetch_button': 'Fetch via /v1/model',
|
'ai_providers.openai_models_fetch_button': 'Fetch via /v1/models',
|
||||||
'ai_providers.openai_models_fetch_title': 'Pick Models from /v1/model',
|
'ai_providers.openai_models_fetch_title': 'Pick Models from /v1/models',
|
||||||
'ai_providers.openai_models_fetch_hint': 'Call the /v1/model endpoint using the Base URL above, sending the first API key as Bearer plus custom headers.',
|
'ai_providers.openai_models_fetch_hint': 'Call the /v1/models endpoint using the Base URL above, sending the first API key as Bearer plus custom headers.',
|
||||||
'ai_providers.openai_models_fetch_url_label': 'Request URL',
|
'ai_providers.openai_models_fetch_url_label': 'Request URL',
|
||||||
'ai_providers.openai_models_fetch_refresh': 'Refresh',
|
'ai_providers.openai_models_fetch_refresh': 'Refresh',
|
||||||
'ai_providers.openai_models_fetch_loading': 'Fetching models from /v1/model...',
|
'ai_providers.openai_models_fetch_loading': 'Fetching models from /v1/models...',
|
||||||
'ai_providers.openai_models_fetch_empty': 'No models returned. Please check the endpoint or auth.',
|
'ai_providers.openai_models_fetch_empty': 'No models returned. Please check the endpoint or auth.',
|
||||||
'ai_providers.openai_models_fetch_error': 'Failed to fetch models',
|
'ai_providers.openai_models_fetch_error': 'Failed to fetch models',
|
||||||
'ai_providers.openai_models_fetch_back': 'Back to edit',
|
'ai_providers.openai_models_fetch_back': 'Back to edit',
|
||||||
|
|||||||
@@ -11,12 +11,14 @@ const getStatsBySource = (stats) => {
|
|||||||
|
|
||||||
const buildModelEndpoint = (baseUrl) => {
|
const buildModelEndpoint = (baseUrl) => {
|
||||||
if (!baseUrl) return '';
|
if (!baseUrl) return '';
|
||||||
try {
|
|
||||||
return new URL('/v1/model', baseUrl).toString();
|
|
||||||
} catch (_) {
|
|
||||||
const trimmed = String(baseUrl).trim().replace(/\/+$/g, '');
|
const trimmed = String(baseUrl).trim().replace(/\/+$/g, '');
|
||||||
return trimmed ? `${trimmed}/v1/model` : '';
|
if (!trimmed) return '';
|
||||||
|
|
||||||
|
// 如果 base 已以 /v1 结尾,直接拼 /models;否则拼 /v1/models,避免丢失中间路径
|
||||||
|
if (trimmed.endsWith('/v1')) {
|
||||||
|
return `${trimmed}/models`;
|
||||||
}
|
}
|
||||||
|
return `${trimmed}/v1/models`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const normalizeModelList = (payload) => {
|
const normalizeModelList = (payload) => {
|
||||||
@@ -1116,7 +1118,7 @@ export function renderOpenAIModelDiscoveryList(models = []) {
|
|||||||
const desc = model.description ? `<div class="model-discovery-desc">${this.escapeHtml(model.description)}</div>` : '';
|
const desc = model.description ? `<div class="model-discovery-desc">${this.escapeHtml(model.description)}</div>` : '';
|
||||||
return `
|
return `
|
||||||
<label class="model-discovery-row">
|
<label class="model-discovery-row">
|
||||||
<input type="checkbox" class="model-discovery-checkbox" data-model-index="${index}" checked>
|
<input type="checkbox" class="model-discovery-checkbox" data-model-index="${index}">
|
||||||
<div class="model-discovery-meta">
|
<div class="model-discovery-meta">
|
||||||
<div class="model-discovery-name">${name} ${alias}</div>
|
<div class="model-discovery-name">${name} ${alias}</div>
|
||||||
${desc}
|
${desc}
|
||||||
|
|||||||
Reference in New Issue
Block a user