fix(ai): 网络失败时显示友好提示,不再直接展示 Failed to fetch

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
fucheng
2026-09-20 09:59:35 +08:00
parent eff59ddd71
commit 4dc2444946
11 changed files with 92 additions and 21 deletions
@@ -1,5 +1,6 @@
import { useMemo } from "react";
import { useDevice } from "@/contexts/DeviceContext";
import { isLikelyNetworkFetchError } from "@/lib/networkError";
import { Loader2, Wifi } from "lucide-react";
import BottomNav from "@/components/BottomNav";
import localeZh from "@/locales/data-zh.json";
@@ -50,7 +51,7 @@ export default function ConnectionPlaceholder() {
<>
<p className="text-[15px] text-white/80 mb-2">{text.failedTitle}</p>
<p className="text-[13px] text-white/45 text-center max-w-xs">
{error ?? text.failedDesc}
{error && !isLikelyNetworkFetchError(error) ? error : text.failedDesc}
</p>
<p className="text-[12px] text-white/30 mt-3 text-center max-w-xs">{text.failedHint}</p>
</>