diff --git a/README.md b/README.md index 54b865c..55651da 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,51 @@ -# ai-chat README +# AI Chat -This is the README for your extension "ai-chat". After writing up a brief description, we recommend including the following sections. +AI Chat 是一个 Visual Studio Code 扩展,允许您直接从状态栏打开 AI 聊天 Webview 面板。通过这个扩展,您可以方便地与 AI 进行交互,而无需离开编辑器环境。 -## Features +## 功能特性 -Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. +- **状态栏快速访问**:通过点击状态栏按钮快速打开 AI 聊天面板 +- **代码上下文支持**:可以将当前文件作为上下文发送给 AI +- **代码片段交互**:选中代码后通过右键菜单将代码添加到对话中 +- **智能代码差异对比**:AI 提供的代码修改将以差异对比形式展示 +- **工作区文件管理**:可以接受或拒绝 AI 建议的代码变更 +- **辅助侧边栏集成**:在 VS Code 的辅助侧边栏中直接使用 AI Chat -For example if there is an image subfolder under your extension project workspace: +## 使用方法 -\!\[feature X\]\(images/feature-x.png\) +1. 安装扩展后,您会在 VS Code 状态栏看到一个 "AI Chat" 按钮 +2. 点击按钮打开聊天面板 +3. 可以通过以下方式提供上下文: + - 点击面板中的 "+" 按钮选择文件作为上下文 + - 在编辑器中选中代码,右键选择"添加至对话" +4. 输入您的问题并与 AI 进行交互 +5. 如果 AI 提供了代码修改建议,您可以: + - 查看代码差异 + - 接受或拒绝变更 -> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow. +## 扩展命令 + +- `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