Skip to content

How can users send a new message after a streaming error? #1001

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

Open
jin-mint opened this issue May 12, 2025 · 2 comments
Open

How can users send a new message after a streaming error? #1001

jin-mint opened this issue May 12, 2025 · 2 comments

Comments

@jin-mint
Copy link

jin-mint commented May 12, 2025

Hello, I’m building an internal service with ai-chatbot,
and first of all—thank you for releasing such a great open-source project. 🙌
I opened this issue because I’m unsure how to let users enter a new message after an error occurs during streaming.

Description
In the multimodal-input component the user can only submit a new message when status is 'ready'.

While a response is streaming, if an error occurs the status is set to 'error'.
At that point pressing Enter no longer triggers a submission, so the user is stuck until the page is refreshed.

I would appreciate guidance on the best-practice way to let the user send another message after an error.

// multimodal-input.tsx

      <Textarea
        data-testid="multimodal-input"
        ref={textareaRef}
        placeholder="Send a message..."
        value={input}
        onChange={handleInput}
        className={cx(
          'min-h-[24px] max-h-[calc(75dvh)] overflow-hidden resize-none rounded-2xl !text-base bg-muted pb-10 dark:border-zinc-700',
          className,
        )}
        rows={2}
        autoFocus
        onKeyDown={(event) => {
          if (
            event.key === 'Enter' &&
            !event.shiftKey &&
            !event.nativeEvent.isComposing
          ) {
            event.preventDefault();

            if (status !== 'ready') { // this point
              toast.error('Please wait for the model to finish its response!');
            } else {
              submitForm();
            }
          }
        }}
      />

Approaches I’m considering

  1. Automatically reset status
    – After setting status to 'error', dispatch another state update that flips it back to 'ready' after a short delay.

  2. Loosen the keyboard guard
    – Change the onKeyDown condition to allow submission when status === 'error':

if (status === 'ready' || status === 'error') {
  submitForm();
}
@0Chan-smc
Copy link

Still looking for a solution here—I’m experiencing the same issue.

@DaveInga
Copy link

i'm implementing a custom chat API endpoint in Lambda and experiencing the same error. Can't test a second request until the status is ready.

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

No branches or pull requests

3 participants