Comments (8)
Can you use reload
? https://sdk.vercel.ai/docs/api-reference/use-chat
from ai.
@MaxLeiter unfortunately not, reload works differently. Instead of adding another assistant response, it removes the last assistant response and requests a new one. So you couldn't use it to make the hook request another assistant message without providing an additional user message.
from ai.
I think you can call append
manually with role
set to 'assistant'
?
from ai.
@shuding I don't believe so, append
looks like it's more for adding a message with content you already have, not asking for a new message to be generated.
from ai.
It seems like we need a new option in reload
to explicitly send a request without removing the last assistant response. For example reload({ removeLastAssistantMessage: true })
. Need a better name though.
from ai.
It seems like we need a new option in
reload
to explicitly send a request without removing the last assistant response. For examplereload({ removeLastAssistantMessage: true })
. Need a better name though.
Maybe even more flexibility? reload(messages => transformTheMessagesBeforeSendingThem(messages))
I need this so I can modify the last user
message before reloading.
from ai.
Love the idea from @pomber, vote for this:
reload({
transform: (messages) => newMessages
})
So we can have other options added in the future. PR welcome!
from ai.
from ai.
Related Issues (20)
- Assistant API v2 breaking changes HOT 6
- Trigger API Call without needing a message
- Rendering a mock stream so that avoiding unecessary API calls HOT 2
- Ability to access request headers/metadata
- Append for useAssistant HOT 7
- handleSubmit not being called conditionally
- TypeScript errors with Node HOT 4
- Feature Request: Support for Multiple Completions in OpenAI API Integration
- Using OpenAI SDK with Ollama HOT 2
- Using Antropic with the new Generative UI HOT 3
- Option to still disable data streaming if I just need the text HOT 1
- Annotations array empty with OpenAI and AssistantResponse and useAssistant HOT 3
- Expose a `OpenAIAssistantStream` function
- Super weird bug (not updating) only on Vercel / deployed code HOT 2
- [AI Core] Abort signal causes `BodyStreamBuffer was aborted` HOT 1
- Pages Router AI SDK 404 error HOT 2
- Error in Gemini Chat Template HOT 3
- JSON parsing error - possible fixes
- useAIState with key not correctly inferring type
- [AsistantResponse] - to save streaming data to external database HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ai.