From e31be19f2f2506727df85ec11ba6bb891cda909c Mon Sep 17 00:00:00 2001 From: Simon Farshid Date: Fri, 18 Oct 2024 16:51:51 -0700 Subject: [PATCH] feat: add a thread welcome string (#1024) Co-Authored-By: Rapha --- packages/react/src/ui/thread-config.tsx | 3 +++ packages/react/src/ui/thread-welcome.tsx | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/react/src/ui/thread-config.tsx b/packages/react/src/ui/thread-config.tsx index e7fb1eec8..b3cf92450 100644 --- a/packages/react/src/ui/thread-config.tsx +++ b/packages/react/src/ui/thread-config.tsx @@ -70,6 +70,9 @@ export type StringsConfig = { tooltip?: string | undefined; }; }; + welcome?: { + message?: string | undefined; + }; userMessage?: { edit?: { tooltip?: string | undefined; diff --git a/packages/react/src/ui/thread-welcome.tsx b/packages/react/src/ui/thread-welcome.tsx index 3d7dee8a4..c613489cc 100644 --- a/packages/react/src/ui/thread-welcome.tsx +++ b/packages/react/src/ui/thread-welcome.tsx @@ -73,11 +73,15 @@ const ThreadWelcomeMessage = forwardRef< ThreadWelcomeMessage.Element, ThreadWelcomeMessage.Props >(({ message: messageProp, ...rest }, ref) => { - const { welcome: { message = "How can I help you today?" } = {} } = - useThreadConfig(); + const { + welcome: { message } = {}, + strings: { + welcome: { message: defaultMessage = "How can I help you today?" } = {}, + } = {}, + } = useThreadConfig(); return ( - {messageProp ?? message} + {messageProp ?? message ?? defaultMessage} ); });