-
Notifications
You must be signed in to change notification settings - Fork 39
Feat: 增加了右下角的AI助手功能 #71
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
Conversation
…cies in package.json
…settings provider
…d settings integration
… with refs for API keys
|
@Crokily is attempting to deploy a commit to the longsizhuo's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a comprehensive AI assistant feature to the documentation site, providing users with an interactive chat interface to ask questions about the current page content.
- Implements an AI-powered chat assistant that appears as a floating icon in the bottom-right corner
- Integrates with both OpenAI and Google Gemini APIs with user-configurable API keys stored in localStorage
- Extracts and provides current page content as context to improve AI responses about the documentation
Reviewed Changes
Copilot reviewed 26 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Adds AI SDK dependencies, UI components, and animation libraries |
| lib/github.ts | GitHub API integration for fetching file contributors |
| app/hooks/useAssistantSettings.tsx | Settings management hook with localStorage persistence |
| app/components/ui/* | New UI components (dialog, tooltip, radio-group, etc.) |
| app/components/assistant-ui/* | Complete AI assistant UI implementation |
| app/components/DocsAssistant.tsx | Main assistant component with error handling |
| app/docs/[...slug]/page.tsx | Integrates assistant and contributors into doc pages |
| app/api/chat/route.ts | API endpoint for handling AI chat requests |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…DocPage return with fragment
|
测试通过 |
现在文档内页会有个AI图标,点击能展开AI对话框
AI对话框支持流式运输,错误提示,Markdown显示
正常使用步骤:




点击右下角AI图表,会弹出AI对话框
对话框自带2-4个提示(响应式显示)引导用户使用
刚打开时用户需要点击设置按钮配置自己的key才能使用
可选openai和gemini,默认模型均为最性价比模型 gpt-4.1-nano和gemini-2.0 flash
key会被存储到localStorage中供持续使用
配置了key以后即可正常对话
对话会默认包含页面文档的上下文,用于帮助AI回答和页面相关的问题。
另外一个提交:
投稿工具目前会生成tags: []
但数据形式的tags fumadocs不支持,一直使用的是分点式,eg:
这样的效果,所以目前用投稿工具投的稿件会报错,check会失败,因此修正了这一点