From bac15be0209ab5c9799dedea30751b5232951b3a Mon Sep 17 00:00:00 2001 From: d-kimsuon Date: Wed, 3 Sep 2025 19:40:11 +0900 Subject: [PATCH] feat: add error report message on invalid schema message --- .../conversationList/ConversationList.tsx | 86 ++++++++++++++++++- src/server/hono/route.ts | 4 +- src/server/service/parseJsonl.ts | 9 +- src/server/service/project/getProjectMeta.ts | 6 +- src/server/service/types.ts | 9 +- 5 files changed, 105 insertions(+), 9 deletions(-) diff --git a/src/app/projects/[projectId]/sessions/[sessionId]/components/conversationList/ConversationList.tsx b/src/app/projects/[projectId]/sessions/[sessionId]/components/conversationList/ConversationList.tsx index 5b870ac..b14e761 100644 --- a/src/app/projects/[projectId]/sessions/[sessionId]/components/conversationList/ConversationList.tsx +++ b/src/app/projects/[projectId]/sessions/[sessionId]/components/conversationList/ConversationList.tsx @@ -1,8 +1,16 @@ "use client"; -import type { FC } from "react"; +import { AlertTriangle, ChevronDown, ExternalLink } from "lucide-react"; +import { type FC, useMemo } from "react"; +import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert"; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "@/components/ui/collapsible"; import type { Conversation } from "@/lib/conversation-schema"; import type { ToolResultContent } from "@/lib/conversation-schema/content/ToolResultContentSchema"; +import type { ErrorJsonl } from "../../../../../../../server/service/types"; import { useSidechain } from "../../hooks/useSidechain"; import { ConversationItem } from "./ConversationItem"; @@ -26,8 +34,66 @@ const getConversationKey = (conversation: Conversation) => { throw new Error(`Unknown conversation type: ${conversation}`); }; +const SchemaErrorDisplay: FC<{ errorLine: string }> = ({ errorLine }) => { + return ( +
  • +
    + + +
    +
    + + + Schema Error + +
    + +
    +
    + +
    +
    + + + + Schema Validation Error + + + This conversation entry failed to parse correctly. This + might indicate a format change or parsing issue.{" "} + + Report this issue + + + + +
    +
    + Raw Content: +
    +
    +                    {errorLine}
    +                  
    +
    +
    +
    +
    +
    +
    +
  • + ); +}; + type ConversationListProps = { - conversations: Conversation[]; + conversations: (Conversation | ErrorJsonl)[]; getToolResult: (toolUseId: string) => ToolResultContent | undefined; }; @@ -35,12 +101,26 @@ export const ConversationList: FC = ({ conversations, getToolResult, }) => { + const validConversations = useMemo( + () => + conversations.filter((conversation) => conversation.type !== "x-error"), + [conversations], + ); const { isRootSidechain, getSidechainConversations } = - useSidechain(conversations); + useSidechain(validConversations); return (