更新依赖,优化认证流程;添加聊天框动画效果,优化消息处理逻辑
This commit is contained in:
+11
-2
@@ -49,14 +49,23 @@ export const streamCopilotChat = async ({
|
||||
message,
|
||||
conversation_id: conversationId,
|
||||
}),
|
||||
skipAuthRedirect: true,
|
||||
});
|
||||
|
||||
if (!response.ok || !response.body) {
|
||||
const detail = await response.text();
|
||||
let message = "stream request failed";
|
||||
|
||||
if (response.status === 403) {
|
||||
message = "Permission denied. Please contact administrator.";
|
||||
} else if (response.status === 401) {
|
||||
message = "Login expired. Please sign in again.";
|
||||
}
|
||||
|
||||
onEvent({
|
||||
type: "error",
|
||||
message: "stream request failed",
|
||||
detail,
|
||||
message,
|
||||
detail: (response.status === 403 || response.status === 401) ? undefined : detail,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user