feat: AI SDK from Vercel AI Gateway#27
Merged
DongDuong2001 merged 6 commits intomainfrom Jan 25, 2026
Merged
Conversation
Replaces the Ollama-based implementation with AI Gateway and streamText for handling chat requests. Adds API key check, updates request handling, and streams responses directly. Improves error handling and simplifies the code.
Replaces manual chat state and API calls with the useChat hook from @ai-sdk/react, simplifying message handling and loading state. Adds a model selection dropdown for users to choose between Gemini, Claude, and GPT-4o, and updates UI to reflect the selected model. Removes provider-specific logic and streamlines the chat input and message rendering.
Introduces a new Select component built on top of Radix UI's Select primitives with custom styling and subcomponents for consistent UI usage across the application.
Added @ai-sdk/google, @ai-sdk/react, and ai packages to dependencies in package.json to support AI-related features.
Added and updated several dependencies including @ai-sdk/google, @ai-sdk/react, ai, swr, and their related packages. This ensures compatibility with the latest features and bug fixes from these libraries.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…tion or class' Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request modernizes the AI chat tool by switching from a local Ollama-based backend to Vercel AI Gateway with streaming and multi-model support. It introduces a model selector UI, improves the chat experience with streaming responses, and refactors the code to use the latest
@ai-sdk/reacthooks for state management. The changes also include a new reusable Select UI component and necessary dependency updates.Key changes:
Backend/API Integration
/api/chatendpoint from using a local Ollama server to Vercel AI Gateway, supporting multiple models and streaming responses via theaipackage. The endpoint now requires anAI_GATEWAY_API_KEYand handles errors accordingly.Frontend Chat Experience
ai-tools/page.tsx) to use the@ai-sdk/reactuseChathook, enabling streaming messages, improved error handling, and more robust state management.UI Components
components/ui/select.tsx) based on Radix UI, used for the model selector in the chat UI.Dependency Updates
@ai-sdk/react,@ai-sdk/google, andaito support new AI integration and streaming. [1] [2]