-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (ai/ui): allow empty handleSubmit submissions for useChat (#2164)
- Loading branch information
1 parent
580a5a3
commit 3db90c3
Showing
11 changed files
with
318 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
'solidstart-openai': patch | ||
'@ai-sdk/svelte': patch | ||
'@ai-sdk/react': patch | ||
'@ai-sdk/solid': patch | ||
'ai': patch | ||
'@ai-sdk/vue': patch | ||
--- | ||
|
||
allow empty handleSubmit submissions for useChat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<script setup lang="ts"> | ||
import { useChat } from './use-chat'; | ||
const { messages, handleSubmit, input } = useChat(); | ||
</script> | ||
|
||
<template> | ||
<div class="flex flex-col w-full max-w-md py-24 mx-auto stretch"> | ||
<div | ||
v-for="(m, idx) in messages" | ||
key="m.id" | ||
:data-testid="`message-${idx}`" | ||
> | ||
{{ m.role === 'user' ? 'User: ' : 'AI: ' }} | ||
{{ m.content }} | ||
</div> | ||
|
||
<form @submit.prevent="handleSubmit"> | ||
<input | ||
:data-testid="`do-input`" | ||
v-model="input" | ||
type="text" | ||
placeholder="Type a message..." | ||
/> | ||
</form> | ||
|
||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.