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

handleSubmit only submits the first letter #4534

Open
ghoshan-ai opened this issue Jan 26, 2025 · 1 comment
Open

handleSubmit only submits the first letter #4534

ghoshan-ai opened this issue Jan 26, 2025 · 1 comment
Labels
ai/ui bug Something isn't working

Comments

@ghoshan-ai
Copy link

Description

Commonly seen on mobile. (very rarely seen on desktop)

The input, setInput work fine, as you see on the TextArea it is able to update on input change. However, it only submits the first letter of the input. How can I go about debugging this? The code is similar to the ai-chatbot repo.

ScreenRecording_01-27-2025.00-40-33_1.MP4

Code example

No response

AI provider

@ai-sdk/azure": "^1.1.3

Additional context

"ai": "^4.1.6",
"next": "15.1.6",

@ghoshan-ai ghoshan-ai added the bug Something isn't working label Jan 26, 2025
@ghoshan-ai
Copy link
Author

as a workaround I use append instead.

 const fallbackInput = textareaRef.current?.value || input;
window.history.replaceState({}, '', `/chats/${chatId}`);

append({
    role: "user",
    createdAt: new Date(),
    content: input.length >= fallbackInput.length ? input : fallbackInput,
})

setInput('')

// On mobile it's not working. Use append instead
// handleSubmit(undefined, {
//     // experimental_attachments: attachments,
//     body: {
//         fallback: fallbackInput
//     }
// });

@lgrammel lgrammel added the ai/ui label Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai/ui bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants