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/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) { 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"); } }