feat(ui): localize friendly agent errors and surface them as toasts

Thread a translate function through friendlyAgentErrorMessage/
friendlyProjectFailureMessage and move the hard-coded zh-CN error copy
into the i18n locale files (with a zh-CN fallback map). Generation
stream failures now report through a toast via showGenerationError in
addition to setError, so the removed inline .panel-error footer is
gone.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-09 09:05:44 +08:00
parent 3eae2beb12
commit 4f2825bb8e
7 changed files with 144 additions and 60 deletions
@@ -459,11 +459,12 @@ function parseResearchPayload(message: AgentMessage): AgentResearchPayload | nul
}
function MessageBubble({ message }: { message: AgentMessage }) {
const { t } = useI18n();
const [copied, setCopied] = useState(false);
const [copyButtonVisible, setCopyButtonVisible] = useState(false);
const hideCopyButtonTimerRef = useRef<number | null>(null);
const rawContent = cleanMessageContent(message.content);
const friendlyError = message.role === "error" ? friendlyAgentErrorMessage({ ...message, content: rawContent }) : null;
const friendlyError = message.role === "error" ? friendlyAgentErrorMessage({ ...message, content: rawContent }, t) : null;
const content = friendlyError?.content || rawContent;
const title = friendlyError?.title || message.title;