The Open Standard for Generative UI
update message renderer with new message structure
abhishekb842c5a9fdcf
diff --git a/frontend-sdk/packages/react-core/package.json b/frontend-sdk/packages/react-core/package.jsonindex 21e320352..bb96a8485 100644--- a/frontend-sdk/packages/react-core/package.json+++ b/frontend-sdk/packages/react-core/package.json@@ -9,7 +9,7 @@],"scripts": {"test": "echo \"Error: no test specified\" && exit 1",- "build": "tsc -p .",+ "build": "rm -rf dist && tsc -p .","lint:check": "eslint ./src","lint:fix": "eslint ./src --fix","format:fix": "prettier --write ./src",diff --git a/frontend-sdk/packages/react-core/src/types/message.ts b/frontend-sdk/packages/react-core/src/types/message.tsindex 86125b96c..e4014cbfc 100644--- a/frontend-sdk/packages/react-core/src/types/message.ts+++ b/frontend-sdk/packages/react-core/src/types/message.ts@@ -1,3 +1,13 @@+type JSONValue =+ | string+ | number+ | boolean+ | {+ [value: string]: JSONValue;+ }+ | JSONValue[]+ | null;+type common = {id: string;isVisuallyHidden?: boolean;@@ -5,31 +15,22 @@ type common = {export type UserMessage = common & {role: "user";-} & (- | {- type: "prompt";- message?: string;- }- | {- type: "action";- message?: string;- context?: {- formState?: Record<string, any>;- };- actionDetails?: string;- }- );+} & {+ type: "prompt";+ message?: string;+ context?: JSONValue[];+};export type AssistantMessage = common & {role: "assistant";- context?: {- uiState?: Record<string, any>;- };- message?: string;- responseTemplate?: {- name: string;- templateProps: any;- };+ context?: JSONValue[];+ message?: (+ | string+ | {+ name: string;+ templateProps: any;+ }+ )[];};export type Message = UserMessage | AssistantMessage;