fix(share): surface the real error on the share AI widget (#87)
The widget hardcoded a generic 'Something went wrong' body and ignored error.message, violating AGENTS.md. Render describeChatError(error.message, t) — the same helper the internal chat uses — so a reader sees the real 402/429/503 cause instead of a bare 'try again'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -21,6 +21,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { useChat, type UIMessage } from "@ai-sdk/react";
|
||||
import { DefaultChatTransport } from "ai";
|
||||
import MessageList from "@/features/ai-chat/components/message-list.tsx";
|
||||
import { describeChatError } from "@/features/ai-chat/utils/error-message.ts";
|
||||
|
||||
interface ShareAiWidgetProps {
|
||||
/** The share id (or key) the assistant is scoped to. */
|
||||
@@ -174,7 +175,9 @@ export default function ShareAiWidget({ shareId, pageId }: ShareAiWidgetProps) {
|
||||
mb="xs"
|
||||
title={t("Something went wrong")}
|
||||
>
|
||||
{t("The assistant is unavailable right now. Please try again.")}
|
||||
{/* Surface the real cause (provider/gating message) instead of a
|
||||
generic line — same helper the internal chat uses. */}
|
||||
{describeChatError(error.message ?? "", t)}
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user