refactor: replace uni.showToast calls with shared toast
consolidates repeated toast display logic into a centralized utility, reducing code duplication and standardizing toast behavior across the codebase
This commit is contained in:
@@ -908,10 +908,7 @@ const sendMessage = async (message, isInstruct = false) => {
|
||||
if (!isWsConnected()) {
|
||||
// uni.hideLoading();
|
||||
setTimeout(() => {
|
||||
// uni.showToast({
|
||||
// title: "连接服务器失败,请稍后重试",
|
||||
// icon: "none",
|
||||
// });
|
||||
showToast("连接服务器失败,请稍后重试");
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
@@ -920,20 +917,14 @@ const sendMessage = async (message, isInstruct = false) => {
|
||||
console.error("重新连接WebSocket失败:", error);
|
||||
// uni.hideLoading();
|
||||
setTimeout(() => {
|
||||
// uni.showToast({
|
||||
// title: "连接服务器失败,请稍后重试",
|
||||
// icon: "none",
|
||||
// });
|
||||
showToast("连接服务器失败,请稍后重试");
|
||||
}, 100);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (isSessionActive.value) {
|
||||
// uni.showToast({
|
||||
// title: "请等待当前回复完成",
|
||||
// icon: "none",
|
||||
// });
|
||||
showToast("请等待当前回复完成");
|
||||
return;
|
||||
}
|
||||
isSessionActive.value = true;
|
||||
|
||||
Reference in New Issue
Block a user