From 70bcd8c6f1535a2b43ca4351f228be0815800ce8 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Fri, 21 Nov 2025 23:51:09 +0530 Subject: [PATCH] feat(types): add artifact to block, add more blocks --- src/lib/types.ts | 64 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/src/lib/types.ts b/src/lib/types.ts index a96c7ca..824aea0 100644 --- a/src/lib/types.ts +++ b/src/lib/types.ts @@ -1,4 +1,4 @@ -type Message = { +type ChatTurnMessage = { role: 'user' | 'assistant' | 'system'; content: string; }; @@ -8,8 +8,64 @@ type Chunk = { metadata: Record; }; -type Artifact = { +type TextBlock = { id: string; - type: string; - data: any; + type: 'text'; + data: string; }; + +type SourceBlock = { + id: string; + type: 'source'; + data: Chunk[]; +}; + +type SuggestionBlock = { + id: string; + type: 'suggestion'; + data: string[]; +}; + +type WidgetBlock = { + id: string; + type: 'widget'; + data: { + widgetType: string; + params: Record; + }; +}; + +type ReasoningResearchBlock = { + id: string; + reasoning: string; +}; + +type SearchingResearchBlock = { + id: string; + searching: string[]; +}; + +type ReadingResearchBlock = { + id: string; + reading: Chunk[]; +}; + +type ResearchBlockSubStep = + | ReasoningResearchBlock + | SearchingResearchBlock + | ReadingResearchBlock; + +type ResearchBlock = { + id: string; + type: 'research'; + data: { + subSteps: ResearchBlockSubStep[]; + }; +}; + +type Block = + | TextBlock + | SourceBlock + | SuggestionBlock + | WidgetBlock + | ResearchBlock;