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

Proposing onAppend callback method for useChat hook #1160

Open
qunash opened this issue Mar 15, 2024 · 0 comments
Open

Proposing onAppend callback method for useChat hook #1160

qunash opened this issue Mar 15, 2024 · 0 comments
Labels
ai/ui enhancement New feature or request

Comments

@qunash
Copy link

qunash commented Mar 15, 2024

Feature Description

I propose adding an onAppend callback function to the useChatOptions. This callback would be invoked whenever a user message is appended to the chat list using the append function, triggering the API call to fetch the assistant's response.

type UseChatOptions = {
  // ...
  onAppend?: (message: Message | CreateMessage) => void;
  // ...
};

Use Case

The onAppend callback would be useful for enhancing the interactivity and responsiveness of the chat UI. By implementing the onAppend callback, developers can provide visual feedback or trigger animations when a user message is appended to the chat list, indicating that the assistant is processing the message and generating a response (e.g. "typing" indicator or animation).

Additional context

The onAppend callback would be invoked immediately after a user message is appended to the chat list using the append function, but before the API call is made to fetch the assistant's response.

Miguel07Alm added a commit to Miguel07Alm/ai that referenced this issue Mar 16, 2024
@lgrammel lgrammel added enhancement New feature or request ai/ui labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/ui enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants