From ec36209cbca498208b87f41d0173bb8e32109a31 Mon Sep 17 00:00:00 2001 From: marcolivierbouch Date: Wed, 27 Nov 2024 07:08:43 -0500 Subject: [PATCH 1/6] feat: add feature to remove chat icons --- .../app/window/page.tsx | 1 + packages/ui/components/chat-message.tsx | 64 +++++++++++-------- packages/ui/components/chat.tsx | 3 + packages/ui/src/chatbot.ts | 2 + 4 files changed, 42 insertions(+), 28 deletions(-) diff --git a/examples/website-chatbot-window/app/window/page.tsx b/examples/website-chatbot-window/app/window/page.tsx index cc3acb1..e22f333 100644 --- a/examples/website-chatbot-window/app/window/page.tsx +++ b/examples/website-chatbot-window/app/window/page.tsx @@ -41,6 +41,7 @@ export default function ChatPage() { footerTextName: 'OpenAssistantGPT', messageSourceText: 'Chatbot source:', + withChatMessageIcon: false }; return ( diff --git a/packages/ui/components/chat-message.tsx b/packages/ui/components/chat-message.tsx index ce88e27..01109e7 100644 --- a/packages/ui/components/chat-message.tsx +++ b/packages/ui/components/chat-message.tsx @@ -31,6 +31,7 @@ export interface ChatMessageProps { isFirst?: boolean; fontSize: string; // Keep as string for pixel values references: Reference[]; + withChatMessageIcon: boolean; } const getDirection = (isRTL: boolean) => (isRTL ? 'rtl' : 'ltr'); @@ -44,6 +45,7 @@ export function ChatMessage({ attachments, references, fontSize = '16px', // Default font size in pixels + withChatMessageIcon = true, ...props }: ChatMessageProps) { return ( @@ -64,7 +66,7 @@ export function ChatMessage({ > @@ -72,39 +74,45 @@ export function ChatMessage({ {message.content}

-
- -
- - ) : ( -
- {chatbot.chatbotLogoURL ? ( -
- chatbot logo -
- ) : ( + + {withChatMessageIcon &&
- +
- )} + } +
+ ) : ( +
+ {withChatMessageIcon && + (chatbot.chatbotLogoURL ? ( +
+ chatbot logo +
+ ) : ( +
+ +
+ ) + ) + }
{message.content == 'loading' ? ( diff --git a/packages/ui/components/chat.tsx b/packages/ui/components/chat.tsx index 202b045..8f3a091 100644 --- a/packages/ui/components/chat.tsx +++ b/packages/ui/components/chat.tsx @@ -256,6 +256,7 @@ export function OpenAssistantGPTChat({ { @@ -306,6 +308,7 @@ export function OpenAssistantGPTChat({
Date: Wed, 27 Nov 2024 07:33:50 -0500 Subject: [PATCH 2/6] feat: update feature to remove icons --- packages/ui/components/chat-message.tsx | 6 +++--- packages/ui/components/chat.tsx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/ui/components/chat-message.tsx b/packages/ui/components/chat-message.tsx index 01109e7..280484d 100644 --- a/packages/ui/components/chat-message.tsx +++ b/packages/ui/components/chat-message.tsx @@ -61,12 +61,12 @@ export function ChatMessage({ background: chatbot.userReplyBackgroundColor, fontSize, // Apply font size in pixels here }} - className="p-2 rounded-lg mr-4 whitespace-pre-wrap" + className="p-2 rounded-lg mr-3 whitespace-pre-wrap" dir={getDirection(chatbot.rightToLeftLanguage)} // Set text direction > @@ -78,7 +78,7 @@ export function ChatMessage({ {withChatMessageIcon &&
diff --git a/packages/ui/components/chat.tsx b/packages/ui/components/chat.tsx index 8f3a091..a4654ce 100644 --- a/packages/ui/components/chat.tsx +++ b/packages/ui/components/chat.tsx @@ -249,7 +249,7 @@ export function OpenAssistantGPTChat({
From 91497dc110b7ada5e3e2f22fef3c326f384c0595 Mon Sep 17 00:00:00 2001 From: marcolivierbouch Date: Wed, 27 Nov 2024 07:37:23 -0500 Subject: [PATCH 3/6] feat: add changeset --- .changeset/angry-donkeys-share.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/angry-donkeys-share.md diff --git a/.changeset/angry-donkeys-share.md b/.changeset/angry-donkeys-share.md new file mode 100644 index 0000000..2e25bd9 --- /dev/null +++ b/.changeset/angry-donkeys-share.md @@ -0,0 +1,5 @@ +--- +'@openassistantgpt/ui': patch +--- + +Add feature to remove all icons from chat From 0c518805d7910afc7b65a8102eb12b0fa9a3a208 Mon Sep 17 00:00:00 2001 From: marcolivierbouch Date: Wed, 27 Nov 2024 07:39:30 -0500 Subject: [PATCH 4/6] feat: run prettier --- examples/website-chatbot-window/app/window/page.tsx | 2 +- packages/ui/components/chat-message.tsx | 12 ++++++------ packages/ui/src/chatbot.ts | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/website-chatbot-window/app/window/page.tsx b/examples/website-chatbot-window/app/window/page.tsx index e22f333..618c5ce 100644 --- a/examples/website-chatbot-window/app/window/page.tsx +++ b/examples/website-chatbot-window/app/window/page.tsx @@ -41,7 +41,7 @@ export default function ChatPage() { footerTextName: 'OpenAssistantGPT', messageSourceText: 'Chatbot source:', - withChatMessageIcon: false + withChatMessageIcon: false, }; return ( diff --git a/packages/ui/components/chat-message.tsx b/packages/ui/components/chat-message.tsx index 280484d..3adce56 100644 --- a/packages/ui/components/chat-message.tsx +++ b/packages/ui/components/chat-message.tsx @@ -66,7 +66,9 @@ export function ChatMessage({ > @@ -75,7 +77,7 @@ export function ChatMessage({ {message.content}

- {withChatMessageIcon && + {withChatMessageIcon && (
- } + )}
) : (
- ) - ) - } + ))}
{message.content == 'loading' ? ( diff --git a/packages/ui/src/chatbot.ts b/packages/ui/src/chatbot.ts index 21b4132..1c4c032 100644 --- a/packages/ui/src/chatbot.ts +++ b/packages/ui/src/chatbot.ts @@ -34,5 +34,5 @@ export type ChatbotConfig = { messageSourceText: string; - withChatMessageIcon: boolean + withChatMessageIcon: boolean; }; From aa8938525ddf8fe0c3d22c8ff2fba43c00e2a04c Mon Sep 17 00:00:00 2001 From: marcolivierbouch Date: Wed, 27 Nov 2024 07:46:20 -0500 Subject: [PATCH 5/6] feat: add missing attributes --- README.md | 3 +++ examples/next-website/app/page.tsx | 1 + examples/website-custom-api/app/window/page.tsx | 1 + 3 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 75db6be..ba23a82 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,9 @@ export default function ChatPage() { displayFooterText: true, footerLink: 'https://www.openassistantgpt.io', footerTextName: 'OpenAssistantGPT', + + messageSourceText: '', + withChatMessageIcon: true }; return ( diff --git a/examples/next-website/app/page.tsx b/examples/next-website/app/page.tsx index aebdd7f..650aa2a 100644 --- a/examples/next-website/app/page.tsx +++ b/examples/next-website/app/page.tsx @@ -45,6 +45,7 @@ export default function ChatPage() { fontSize: '14px', messageSourceText: '', + withChatMessageIcon: true }; useEffect(() => { diff --git a/examples/website-custom-api/app/window/page.tsx b/examples/website-custom-api/app/window/page.tsx index d0abd5e..fb4b57f 100644 --- a/examples/website-custom-api/app/window/page.tsx +++ b/examples/website-custom-api/app/window/page.tsx @@ -39,6 +39,7 @@ export default function ChatPage() { fontSize: '15px', messageSourceText: '', + withChatMessageIcon: true }; return ( From f747f56f46b1e414d4109405f1eabd6547dd2b07 Mon Sep 17 00:00:00 2001 From: marcolivierbouch Date: Wed, 27 Nov 2024 07:47:55 -0500 Subject: [PATCH 6/6] feat: run prettier --- README.md | 2 +- examples/next-website/app/page.tsx | 2 +- examples/website-custom-api/app/window/page.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ba23a82..b185bde 100644 --- a/README.md +++ b/README.md @@ -117,7 +117,7 @@ export default function ChatPage() { footerTextName: 'OpenAssistantGPT', messageSourceText: '', - withChatMessageIcon: true + withChatMessageIcon: true, }; return ( diff --git a/examples/next-website/app/page.tsx b/examples/next-website/app/page.tsx index 650aa2a..46a4ba5 100644 --- a/examples/next-website/app/page.tsx +++ b/examples/next-website/app/page.tsx @@ -45,7 +45,7 @@ export default function ChatPage() { fontSize: '14px', messageSourceText: '', - withChatMessageIcon: true + withChatMessageIcon: true, }; useEffect(() => { diff --git a/examples/website-custom-api/app/window/page.tsx b/examples/website-custom-api/app/window/page.tsx index fb4b57f..aa2657c 100644 --- a/examples/website-custom-api/app/window/page.tsx +++ b/examples/website-custom-api/app/window/page.tsx @@ -39,7 +39,7 @@ export default function ChatPage() { fontSize: '15px', messageSourceText: '', - withChatMessageIcon: true + withChatMessageIcon: true, }; return (