Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3029: Add typing indicator for automatic replies in chat #3056

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lunars97
Copy link
Contributor

Short description

Typing indicator message (...) for 60 seconds should be shown after automatic answer in chat. It will be a temporary solution untill the websocket implementation

Proposed changes

  • Add typing indicator function
  • Style typing indicator in a similar manner

Side effects

  • none

Resolved issues

Fixes: #3029


@lunars97 lunars97 force-pushed the 3029-add-typing-indicator-for-automatic-replies branch from 50de658 to 2a08823 Compare January 29, 2025 08:29
@lunars97 lunars97 force-pushed the 3029-add-typing-indicator-for-automatic-replies branch from 2a08823 to 529d718 Compare January 29, 2025 09:11
@lunars97 lunars97 changed the title Add typing indicator for automatic replies in chat 3029: Add typing indicator for automatic replies in chat Jan 29, 2025
@lunars97
Copy link
Contributor Author

The typing indicator also appearing before the automatic reply, I have no idea how to limit this behaviour... Any ideas?

Copy link
Member

@steffenkleinle steffenkleinle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good already, I just think the condition when to display the typing indicator is still wrong. I only get it if the last message is not from the user.

web/src/components/ChatConversation.tsx Outdated Show resolved Hide resolved
web/src/components/ChatConversation.tsx Outdated Show resolved Hide resolved
@@ -41,6 +54,19 @@ const ChatConversation = ({ messages, hasError, className }: ChatConversationPro
}
}, [messages, messagesCount])

// eslint-disable-next-line consistent-return
useEffect(() => {
if (!lastMessage?.userIsAuthor && lastMessage?.isAutomaticAnswer) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I am not really sure abot that condition... shouldn't the typing indicator basically be displayed 60s after the user sends a message? i.e. shouldn't this be

Suggested change
if (!lastMessage?.userIsAuthor && lastMessage?.isAutomaticAnswer) {
if (lastMessage?.userIsAuthor) {

Copy link
Contributor Author

@lunars97 lunars97 Jan 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was not working with lastMessage because lastMessage is automatic answer, as Sven noted that we should show it only after the automatic answer, but the problem is that we have only two parameters userIsAuthor and automaticAnswer, we do not have properties for chatbot and for real person to limit it...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misunderstood Svens message, sorry. You implemented it perfectly! See here for clarification: #3029 (comment)
Since you exactly implemented it like this, nothing to do here anymore :)

web/src/components/ChatConversation.tsx Outdated Show resolved Hide resolved
web/src/components/ChatConversation.tsx Outdated Show resolved Hide resolved
@steffenkleinle
Copy link
Member

Also see my question here: #3029 (comment)

Copy link
Member

@steffenkleinle steffenkleinle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on firefox, works as expected.

web/src/components/ChatMessage.tsx Outdated Show resolved Hide resolved
web/src/components/ChatConversation.tsx Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add "Typing" message for automatic replies
2 participants