✨ feat: enable fetching model list in creation mode & refine toast-based error handling
Summary
• **EditChannel.js**
– Displays “Fetch Model List” button for both *create* and *edit* modes (removed `isEdit` guard).
– Unified model selector placeholder to “Please choose supported models”.
– Added null-safety checks when parsing Axios responses.
– Sends requests with `{ skipErrorHandler: true }`, preventing generic *500 Internal Server Error* toasts and relying on context-specific messages instead.
• **helpers/api.js**
– Introduced `skipErrorHandler` flag in the Axios response interceptor.
If present, global `showError` is bypassed, giving callers full control over user-facing notifications.
– Ensures `Promise.reject(error)` is returned for proper error propagation.
Why
Channel creators now enjoy the same convenience as editors when importing upstream model lists.
Meanwhile, suppressing redundant toasts removes confusion caused by simultaneous custom and generic error messages.
This commit is contained in:
@@ -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,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user