diff --git a/web/src/helpers/api.js b/web/src/helpers/api.js index e00a5bdb..0646f77b 100644 --- a/web/src/helpers/api.js +++ b/web/src/helpers/api.js @@ -59,7 +59,12 @@ export function updateAPI() { API.interceptors.response.use( (response) => response, (error) => { + // 如果请求配置中显式要求跳过全局错误处理,则不弹出默认错误提示 + if (error.config && error.config.skipErrorHandler) { + return Promise.reject(error); + } showError(error); + return Promise.reject(error); }, ); @@ -83,7 +88,7 @@ export const buildApiPayload = (messages, systemPrompt, inputs, parameterEnabled const payload = { model: inputs.model, messages: processedMessages, - group: inputs.group, + group: inputs.group, stream: inputs.stream, }; diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 5c9e2fcc..29bf9ac6 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -1754,7 +1754,6 @@ "批量创建时会在名称后自动添加随机后缀": "When creating in batches, a random suffix will be automatically added to the name", "额度必须大于0": "Quota must be greater than 0", "生成数量必须大于0": "Generation quantity must be greater than 0", - "创建后可在编辑渠道时获取上游模型列表": "After creation, you can get the upstream model list when editing the channel", "可用端点类型": "Supported endpoint types", "未登录,使用默认分组倍率:": "Not logged in, using default group ratio: ", "该服务器地址将影响支付回调地址以及默认首页展示的地址,请确保正确配置": "This server address will affect the payment callback address and the address displayed on the default homepage, please ensure correct configuration" diff --git a/web/src/pages/Channel/EditChannel.js b/web/src/pages/Channel/EditChannel.js index f53b4abb..024c15f6 100644 --- a/web/src/pages/Channel/EditChannel.js +++ b/web/src/pages/Channel/EditChannel.js @@ -238,9 +238,9 @@ const EditChannel = (props) => { let err = false; if (isEdit) { - // 如果是编辑模式,使用已有的channel id获取模型列表 - const res = await API.get('/api/channel/fetch_models/' + channelId); - if (res.data && res.data.success) { + // 如果是编辑模式,使用已有的 channelId 获取模型列表 + const res = await API.get('/api/channel/fetch_models/' + channelId, { skipErrorHandler: true }); + if (res && res.data && res.data.success) { models.push(...res.data.data); } else { err = true; @@ -252,13 +252,17 @@ const EditChannel = (props) => { err = true; } else { try { - const res = await API.post('/api/channel/fetch_models', { - base_url: inputs['base_url'], - type: inputs['type'], - key: inputs['key'], - }); + const res = await API.post( + '/api/channel/fetch_models', + { + base_url: inputs['base_url'], + type: inputs['type'], + key: inputs['key'], + }, + { skipErrorHandler: true }, + ); - if (res.data && res.data.success) { + if (res && res.data && res.data.success) { models.push(...res.data.data); } else { err = true; @@ -747,7 +751,7 @@ const EditChannel = (props) => {