# AI Chat AI Chat 是一个 Visual Studio Code 扩展,允许您直接从状态栏打开 AI 聊天 Webview 面板。通过这个扩展,您可以方便地与 AI 进行交互,而无需离开编辑器环境。 ## 功能特性 - **状态栏快速访问**:通过点击状态栏按钮快速打开 AI 聊天面板 - **代码上下文支持**:可以将当前文件作为上下文发送给 AI - **代码片段交互**:选中代码后通过右键菜单将代码添加到对话中 - **智能代码差异对比**:AI 提供的代码修改将以差异对比形式展示 - **工作区文件管理**:可以接受或拒绝 AI 建议的代码变更 - **辅助侧边栏集成**:在 VS Code 的辅助侧边栏中直接使用 AI Chat ## 使用方法 1. 安装扩展后,您会在 VS Code 状态栏看到一个 "AI Chat" 按钮 2. 点击按钮打开聊天面板 3. 可以通过以下方式提供上下文: - 点击面板中的 "+" 按钮选择文件作为上下文 - 在编辑器中选中代码,右键选择"添加至对话" 4. 输入您的问题并与 AI 进行交互 5. 如果 AI 提供了代码修改建议,您可以: - 查看代码差异 - 接受或拒绝变更 ## 扩展命令 - `ai-chat.openWebview`:打开 AI Chat 面板 - `extension.addToChat`:将选中的代码添加到对话中 ## 快捷操作 - 右键菜单:在编辑器中选中代码后,可通过右键菜单快速添加到对话 - 状态栏按钮:点击状态栏的 "AI Chat" 按钮快速打开面板 ## 技术细节 本扩展使用以下技术构建: - [highlight.js](https://highlightjs.org/):代码高亮显示 - [marked](https://marked.js.org/):Markdown 渲染 - [diff](https://github.com/kpdecker/jsdiff):代码差异计算 扩展通过 Webview 技术实现富交互界面,并与 AI 后端服务通信以提供智能代码辅助功能。 ## 注意事项 此扩展需要访问 AI 后端服务才能正常工作。默认配置使用内部测试服务,实际使用时可能需要配置自己的 API 服务地址。 ## Requirements If you have any requirements or dependencies, add a section describing those and how to install and configure them. ## Extension Settings Include if your extension adds any VS Code settings through the `contributes.configuration` extension point. For example: This extension contributes the following settings: * `myExtension.enable`: Enable/disable this extension. * `myExtension.thing`: Set to `blah` to do something. ## Known Issues Calling out known issues can help limit users opening duplicate issues against your extension. ## Release Notes Users appreciate release notes as you update your extension. ### 1.0.0 Initial release of ... ### 1.0.1 Fixed issue #. ### 1.1.0 Added features X, Y, and Z. --- ## Following extension guidelines Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension. * [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines) ## Working with Markdown You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts: * Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux). * Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux). * Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets. ## For more information * [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown) * [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/) **Enjoy!**