I'm looking at the vercel ai chatbot example on github:https://github.com/vercel/ai-chatbot
It is a NextJS application leveraging Shadcn and vercels ai sdk
One thing I notice by this approach is it does not do what v0 does with "thinking" can you explain that to me a bit better?
You're asking about a key difference between v0 (what you're interacting with now) and the Vercel AI Chatbot example on GitHub. Let me explain the "thinking" feature you've noticed.
The "Thinking" feature you see in the first screenshot is unique to v0's interface. When v0 processes a request, it shows a "Thought for X seconds" indicator and sometimes displays its reasoning process before providing the final answer. This is a deliberate design choice that:
In your screenshot, you can see v0 thinking about how to approach image embeddings before generating the necessary files for implementation.
The Vercel AI Chatbot example on GitHub is different in its approach. It's built using:
This chatbot example doesn't expose the "thinking" process to end users. Instead, it focuses on:
The main differences between v0's approach and the Vercel AI Chatbot example are:
Implementation:
Purpose:
If you wanted to add a "thinking" feature to the Vercel AI Chatbot example, you would need to:
Here's a simple example of how you might implement a basic version:
This implementation adds a basic "thinking" indicator that shows how long the AI has been processing the request. For a more advanced implementation like v0's, you would need to modify the AI SDK's streaming implementation to expose the model's reasoning process.
The "thinking" feature provides transparency into how AI systems reason, which can be valuable for:
However, it's not always necessary for every chatbot implementation, which is why the Vercel AI Chatbot example focuses on a clean, straightforward user experience.
Interesting. So in my implementation I added an additional functionality to the github template to leverage azure's ai search. Would it be possible to add something like the thinking in place of what I've done here? What I have here is fine its just a bit rough on UI and hard to understand.
route.ts
search-documents.ts
Looking at your code, I can see you've built a nice integration with Azure AI Search on top of the Vercel AI Chatbot template. Your implementation already has some progress indicators through the dataStream.writeData() calls, but you're right that it could benefit from a more polished "thinking" UI like what v0 demonstrates.
Your current approach uses data streaming to send progress updates:
dataStream.writeData({
type: 'search-progress',
message: `I'm searching for "${query}" in your uploaded documents...`,
});This is a good foundation, but the UI presentation might not be as clear as v0's thinking indicator.
You can enhance this by implementing a dedicated thinking component that shows the reasoning process. Here's how:
dataStream.writeData(). I've enhanced this to include more detailed steps.sendReasoning: true in the mergeIntoDataStream call.Visual Feedback: Users see a step-by-step breakdown of what's happening during document search:
To integrate this with your existing code:
search-documents.ts file to include more detailed progress updatesroute.ts to enable sending reasoning dataThis implementation gives you a v0-like thinking experience while maintaining compatibility with your Azure AI Search integration.