From 56943b085649ae22ca45eee817c9b246487c345b Mon Sep 17 00:00:00 2001 From: charlesLoder Date: Wed, 3 Sep 2025 12:40:21 -0400 Subject: [PATCH 1/2] Have clear conversation button reset conversation state --- src/plugin/Panel/ChatInput/index.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugin/Panel/ChatInput/index.tsx b/src/plugin/Panel/ChatInput/index.tsx index d677bec..afbe03b 100644 --- a/src/plugin/Panel/ChatInput/index.tsx +++ b/src/plugin/Panel/ChatInput/index.tsx @@ -15,6 +15,7 @@ export const ChatInput: FC = () => { function clearConversation() { dispatch({ type: "clearConversation" }); + dispatch({ type: "setConversationState", conversationState: "idle" }); } async function handleSubmit(e: React.FormEvent) { From ce2f326f1163dbf6d3b5ce872bad5eb497571177 Mon Sep 17 00:00:00 2001 From: charlesLoder Date: Wed, 3 Sep 2025 12:58:10 -0400 Subject: [PATCH 2/2] Improve error handling --- src/components/Messages/style.module.css | 25 ++++++++++++++++------- src/providers/userTokenProvider/index.tsx | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/components/Messages/style.module.css b/src/components/Messages/style.module.css index 78edd2b..34b7e5f 100644 --- a/src/components/Messages/style.module.css +++ b/src/components/Messages/style.module.css @@ -1,4 +1,5 @@ .messagesContainer { + position: relative; display: flex; flex-direction: column; flex-grow: 1; @@ -8,16 +9,26 @@ scrollbar-color: var(--clover-ai-colors-secondaryAlt) transparent; overflow-y: scroll; + &::after { + font-style: italic; + --line-height: 1.5; + line-height: var(--line-height); + /* The multiplier -2 is used to adjust the positioning of the content text + relative to the preceding content. It ensures the text appears slightly above + its default position for better visual alignment. */ + margin-block-start: calc(-2 * (var(--line-height) * var(--clover-ai-sizes-3))); + } + &[data-state="assistant_responding"] { &::after { content: "Thinking..."; - font-style: italic; - --line-height: 1.5; - line-height: var(--line-height); - /* The multiplier -2 is used to adjust the positioning of the "Thinking..." text - relative to the preceding content. It ensures the text appears slightly above - its default position for better visual alignment. */ - margin-block-start: calc(-2 * (var(--line-height) * var(--clover-ai-sizes-3))); + } + } + + &[data-state="error"] { + &::after { + content: "An error occurred. Please try again."; + color: var(--clover-ai-colors-error); } } diff --git a/src/providers/userTokenProvider/index.tsx b/src/providers/userTokenProvider/index.tsx index 7b3e1f9..bb04002 100644 --- a/src/providers/userTokenProvider/index.tsx +++ b/src/providers/userTokenProvider/index.tsx @@ -232,7 +232,7 @@ export class UserTokenProvider extends BaseProvider { this.set_conversation_state("idle"); } catch (error) { - console.error("Error sending messages:", error); // eslint-disable-line no-console + console.error(error); // eslint-disable-line no-console this.set_conversation_state("error"); } }