7f683a8aed
- 添加快速开始页面,包含安装、配置、启动指南 - 添加核心功能文档: Agent 系统、工具系统、MCP 集成 - 添加 API 参考文档: REST API、WebSocket、SDK 使用 - 更新侧边栏导航,重新组织文档分类 - 更新 .gitignore 允许 website docs 页面
73 lines
2.2 KiB
Plaintext
73 lines
2.2 KiB
Plaintext
---
|
|
import DocsLayout from '../../../layouts/DocsLayout.astro';
|
|
---
|
|
|
|
<DocsLayout title="Watch 模式" description="文件监控和 AI 注释处理">
|
|
<h1>Watch 模式 (Watch Mode)</h1>
|
|
|
|
<p>允许用户在代码中添加特殊注释(如 <code># AI: fix this</code>),文件保存时 AI 会自动检测并处理这些注释请求。提供无需离开编辑器就能与 AI 交互的方式。</p>
|
|
|
|
<h2>核心功能</h2>
|
|
<ul>
|
|
<li><strong>文件监控</strong> - 监控项目文件变化</li>
|
|
<li><strong>注释检测</strong> - 识别特殊 AI 注释</li>
|
|
<li><strong>自动处理</strong> - 根据注释内容自动执行任务</li>
|
|
<li><strong>结果反馈</strong> - 将修改写回文件</li>
|
|
</ul>
|
|
|
|
<h2>支持的注释格式</h2>
|
|
<pre><code class="language-python"># AI: 请优化这个函数
|
|
# AI! 这里有 bug,请修复
|
|
# FIXME: AI 请重构这段代码
|
|
# TODO: AI 添加错误处理</code></pre>
|
|
|
|
<pre><code class="language-typescript">// AI: 请优化这个函数
|
|
// AI! 这里有 bug,请修复
|
|
/* AI: 重构这段代码 */</code></pre>
|
|
|
|
<h2>设计方案</h2>
|
|
|
|
<h3>类型定义</h3>
|
|
<pre><code class="language-typescript">export interface AIComment {
|
|
content: string;
|
|
line: number;
|
|
column: number;
|
|
filePath: string;
|
|
original: string;
|
|
type: 'request' | 'todo' | 'fixme' | 'question';
|
|
}
|
|
|
|
export interface WatchConfig {
|
|
enabled: boolean;
|
|
patterns: string[];
|
|
ignorePatterns: string[];
|
|
debounceMs: number;
|
|
autoProcess: boolean;
|
|
confirmBeforeEdit: boolean;
|
|
}</code></pre>
|
|
|
|
<h2>使用示例</h2>
|
|
<pre><code class="language-typescript">// 在代码中添加注释
|
|
function calculateTotal(items: Item[]): number {
|
|
// AI: 请优化这个函数的性能
|
|
let total = 0;
|
|
for (const item of items) {
|
|
total += item.price * item.quantity;
|
|
}
|
|
return total;
|
|
}</code></pre>
|
|
|
|
<h2>配置示例</h2>
|
|
<pre><code class="language-yaml"># .ai-assistant.yml
|
|
watch:
|
|
enabled: false
|
|
patterns: ['**/*.ts', '**/*.tsx', '**/*.py']
|
|
ignorePatterns: ['node_modules/**', 'dist/**']
|
|
debounceMs: 1000
|
|
autoProcess: true
|
|
confirmBeforeEdit: false</code></pre>
|
|
|
|
<h2>实现状态</h2>
|
|
<p><strong>优先级</strong>: 中 | <strong>状态</strong>: 待实现</p>
|
|
</DocsLayout>
|