[{"data":1,"prerenderedAt":775},["ShallowReactive",2],{"content-query-x48LpeU4Em":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"lastUpdated":10,"body":11,"_type":769,"_id":770,"_source":771,"_file":772,"_stem":773,"_extension":774},"\u002Fmethodology\u002Fchat-mode","methodology",false,"","Chat 模式","通过对话方式与AI协作，适合快速咨询和调试","2026-04-23",{"type":12,"children":13,"toc":741},"root",[14,23,30,44,54,99,103,108,115,125,131,139,145,153,159,167,173,181,184,190,351,354,359,364,369,377,382,390,395,400,408,413,418,451,456,464,467,472,477,500,505,523,528,561,564,570,618,621,626,634,646,649,654],{"type":15,"tag":16,"props":17,"children":19},"element","h1",{"id":18},"chat-模式对话模式",[20],{"type":21,"value":22},"text","Chat 模式（对话模式）",{"type":15,"tag":24,"props":25,"children":27},"h2",{"id":26},"什么是-chat-模式",[28],{"type":21,"value":29},"什么是 Chat 模式",{"type":15,"tag":31,"props":32,"children":33},"p",{},[34,36,42],{"type":21,"value":35},"Chat 模式是最低门槛的 AI 编程协作方式。开发者通过",{"type":15,"tag":37,"props":38,"children":39},"strong",{},[40],{"type":21,"value":41},"自然语言对话",{"type":21,"value":43},"与 AI 交流，获取代码建议、问题解答、调试帮助等。它不需要复杂的配置，打开就能用。",{"type":15,"tag":31,"props":45,"children":46},{},[47,52],{"type":15,"tag":37,"props":48,"children":49},{},[50],{"type":21,"value":51},"核心特点",{"type":21,"value":53},"：",{"type":15,"tag":55,"props":56,"children":57},"ul",{},[58,69,79,89],{"type":15,"tag":59,"props":60,"children":61},"li",{},[62,67],{"type":15,"tag":37,"props":63,"children":64},{},[65],{"type":21,"value":66},"低门槛",{"type":21,"value":68}," — 对话即可，无需学习新工具",{"type":15,"tag":59,"props":70,"children":71},{},[72,77],{"type":15,"tag":37,"props":73,"children":74},{},[75],{"type":21,"value":76},"高灵活",{"type":21,"value":78}," — 不限于代码生成，任何技术问题都能问",{"type":15,"tag":59,"props":80,"children":81},{},[82,87],{"type":15,"tag":37,"props":83,"children":84},{},[85],{"type":21,"value":86},"即时反馈",{"type":21,"value":88}," — 快速获得答案，适合探索性工作",{"type":15,"tag":59,"props":90,"children":91},{},[92,97],{"type":15,"tag":37,"props":93,"children":94},{},[95],{"type":21,"value":96},"上下文感知",{"type":21,"value":98}," — 现代工具支持引用文件、选中代码作为上下文",{"type":15,"tag":100,"props":101,"children":102},"hr",{},[],{"type":15,"tag":24,"props":104,"children":106},{"id":105},"典型使用场景",[107],{"type":21,"value":105},{"type":15,"tag":109,"props":110,"children":112},"h3",{"id":111},"_1-代码解释",[113],{"type":21,"value":114},"1. 代码解释",{"type":15,"tag":116,"props":117,"children":119},"pre",{"code":118},"请解释这段代码的作用：\n[粘贴代码]\n",[120],{"type":15,"tag":121,"props":122,"children":123},"code",{"__ignoreMap":7},[124],{"type":21,"value":118},{"type":15,"tag":109,"props":126,"children":128},{"id":127},"_2-bug-调试",[129],{"type":21,"value":130},"2. Bug 调试",{"type":15,"tag":116,"props":132,"children":134},{"code":133},"这段代码运行报错：\nTypeError: Cannot read property 'map' of undefined\n\n相关代码：\n[粘贴代码]\n\n可能是什么原因？\n",[135],{"type":15,"tag":121,"props":136,"children":137},{"__ignoreMap":7},[138],{"type":21,"value":133},{"type":15,"tag":109,"props":140,"children":142},{"id":141},"_3-技术选型",[143],{"type":21,"value":144},"3. 技术选型",{"type":15,"tag":116,"props":146,"children":148},{"code":147},"我在做一个实时聊天应用，需要选择消息队列。\n候选方案：RabbitMQ、Kafka、Redis Pub\u002FSub\n用户量预计 10 万，消息延迟要求 \u003C 100ms\n推荐哪个？为什么？\n",[149],{"type":15,"tag":121,"props":150,"children":151},{"__ignoreMap":7},[152],{"type":21,"value":147},{"type":15,"tag":109,"props":154,"children":156},{"id":155},"_4-代码审查",[157],{"type":21,"value":158},"4. 代码审查",{"type":15,"tag":116,"props":160,"children":162},{"code":161},"请审查以下代码，重点关注：\n1. 安全漏洞\n2. 性能问题\n3. 代码规范\n\n[粘贴代码]\n",[163],{"type":15,"tag":121,"props":164,"children":165},{"__ignoreMap":7},[166],{"type":21,"value":161},{"type":15,"tag":109,"props":168,"children":170},{"id":169},"_5-学习新概念",[171],{"type":21,"value":172},"5. 学习新概念",{"type":15,"tag":116,"props":174,"children":176},{"code":175},"用通俗的语言解释 React 的 Fiber 架构，\n并对比它和 Vue 3 响应式系统的设计差异\n",[177],{"type":15,"tag":121,"props":178,"children":179},{"__ignoreMap":7},[180],{"type":21,"value":175},{"type":15,"tag":100,"props":182,"children":183},{},[],{"type":15,"tag":24,"props":185,"children":187},{"id":186},"各工具的-chat-入口",[188],{"type":21,"value":189},"各工具的 Chat 入口",{"type":15,"tag":191,"props":192,"children":193},"table",{},[194,218],{"type":15,"tag":195,"props":196,"children":197},"thead",{},[198],{"type":15,"tag":199,"props":200,"children":201},"tr",{},[202,208,213],{"type":15,"tag":203,"props":204,"children":205},"th",{},[206],{"type":21,"value":207},"工具",{"type":15,"tag":203,"props":209,"children":210},{},[211],{"type":21,"value":212},"Chat 入口",{"type":15,"tag":203,"props":214,"children":215},{},[216],{"type":21,"value":217},"特色功能",{"type":15,"tag":219,"props":220,"children":221},"tbody",{},[222,253,285,303,327],{"type":15,"tag":199,"props":223,"children":224},{},[225,231,248],{"type":15,"tag":226,"props":227,"children":228},"td",{},[229],{"type":21,"value":230},"Cursor",{"type":15,"tag":226,"props":232,"children":233},{},[234,240,242],{"type":15,"tag":121,"props":235,"children":237},{"className":236},[],[238],{"type":21,"value":239},"Cmd+L",{"type":21,"value":241}," \u002F ",{"type":15,"tag":121,"props":243,"children":245},{"className":244},[],[246],{"type":21,"value":247},"Ctrl+L",{"type":15,"tag":226,"props":249,"children":250},{},[251],{"type":21,"value":252},"可引用文件、选中代码",{"type":15,"tag":199,"props":254,"children":255},{},[256,261,266],{"type":15,"tag":226,"props":257,"children":258},{},[259],{"type":21,"value":260},"Claude Code",{"type":15,"tag":226,"props":262,"children":263},{},[264],{"type":21,"value":265},"终端直接输入",{"type":15,"tag":226,"props":267,"children":268},{},[269,271,277,279],{"type":21,"value":270},"支持 ",{"type":15,"tag":121,"props":272,"children":274},{"className":273},[],[275],{"type":21,"value":276},"\u002Fexplain",{"type":21,"value":278},"、",{"type":15,"tag":121,"props":280,"children":282},{"className":281},[],[283],{"type":21,"value":284},"\u002Freview",{"type":15,"tag":199,"props":286,"children":287},{},[288,293,298],{"type":15,"tag":226,"props":289,"children":290},{},[291],{"type":21,"value":292},"Trae",{"type":15,"tag":226,"props":294,"children":295},{},[296],{"type":21,"value":297},"侧边栏 Chat 面板",{"type":15,"tag":226,"props":299,"children":300},{},[301],{"type":21,"value":302},"中文对话流畅",{"type":15,"tag":199,"props":304,"children":305},{},[306,311,316],{"type":15,"tag":226,"props":307,"children":308},{},[309],{"type":21,"value":310},"GitHub Copilot",{"type":15,"tag":226,"props":312,"children":313},{},[314],{"type":21,"value":315},"IDE 内联对话",{"type":15,"tag":226,"props":317,"children":318},{},[319,325],{"type":15,"tag":121,"props":320,"children":322},{"className":321},[],[323],{"type":21,"value":324},"@workspace",{"type":21,"value":326}," 全局搜索",{"type":15,"tag":199,"props":328,"children":329},{},[330,335,346],{"type":15,"tag":226,"props":331,"children":332},{},[333],{"type":21,"value":334},"VS Code + AI 插件",{"type":15,"tag":226,"props":336,"children":337},{},[338,344],{"type":15,"tag":121,"props":339,"children":341},{"className":340},[],[342],{"type":21,"value":343},"Ctrl+Shift+P",{"type":21,"value":345}," → Chat",{"type":15,"tag":226,"props":347,"children":348},{},[349],{"type":21,"value":350},"多模型切换",{"type":15,"tag":100,"props":352,"children":353},{},[],{"type":15,"tag":24,"props":355,"children":357},{"id":356},"上下文管理技巧",[358],{"type":21,"value":356},{"type":15,"tag":31,"props":360,"children":361},{},[362],{"type":21,"value":363},"上下文管理是区分高效使用者和低效使用者的关键能力。AI 的回答质量直接取决于你提供的上下文质量。",{"type":15,"tag":109,"props":365,"children":367},{"id":366},"提供充足上下文",[368],{"type":21,"value":366},{"type":15,"tag":116,"props":370,"children":372},{"code":371},"❌ \"这段代码有问题\"\n\n✅ \"这个 Vue 3 组件在 onMounted 中调用 API，但返回的数据是 undefined。\n    组件代码如下：[代码]，API 服务端返回格式：[示例]\"\n",[373],{"type":15,"tag":121,"props":374,"children":375},{"__ignoreMap":7},[376],{"type":21,"value":371},{"type":15,"tag":109,"props":378,"children":380},{"id":379},"明确期望输出",[381],{"type":21,"value":379},{"type":15,"tag":116,"props":383,"children":385},{"code":384},"❌ \"帮我优化这段代码\"\n\n✅ \"请优化这段代码的性能，重点关注：\n    1. 减少不必要的重新渲染\n    2. 使用 useMemo\u002FuseCallback 缓存\n    保持代码风格不变\"\n",[386],{"type":15,"tag":121,"props":387,"children":388},{"__ignoreMap":7},[389],{"type":21,"value":384},{"type":15,"tag":109,"props":391,"children":393},{"id":392},"分步提问",[394],{"type":21,"value":392},{"type":15,"tag":31,"props":396,"children":397},{},[398],{"type":21,"value":399},"复杂问题拆成多个小问题，逐步深入：",{"type":15,"tag":116,"props":401,"children":403},{"code":402},"Step 1: 这个设计模式的优缺点是什么？\nStep 2: 如果用在我的场景中，需要做哪些调整？\nStep 3: 请给出具体的实现代码\n",[404],{"type":15,"tag":121,"props":405,"children":406},{"__ignoreMap":7},[407],{"type":21,"value":402},{"type":15,"tag":109,"props":409,"children":411},{"id":410},"上下文窗口管理",[412],{"type":21,"value":410},{"type":15,"tag":31,"props":414,"children":415},{},[416],{"type":21,"value":417},"AI 的上下文窗口是有限的。当对话过长时，早期的内容会被\"遗忘\"。",{"type":15,"tag":55,"props":419,"children":420},{},[421,431,441],{"type":15,"tag":59,"props":422,"children":423},{},[424,429],{"type":15,"tag":37,"props":425,"children":426},{},[427],{"type":21,"value":428},"对话超过 20 轮",{"type":21,"value":430},"：考虑开新会话，把关键结论带过去",{"type":15,"tag":59,"props":432,"children":433},{},[434,439],{"type":15,"tag":37,"props":435,"children":436},{},[437],{"type":21,"value":438},"引用大文件",{"type":21,"value":440},"：只粘贴相关片段，不要贴整个文件",{"type":15,"tag":59,"props":442,"children":443},{},[444,449],{"type":15,"tag":37,"props":445,"children":446},{},[447],{"type":21,"value":448},"多任务混合",{"type":21,"value":450},"：一个会话只处理一个主题，避免上下文污染",{"type":15,"tag":109,"props":452,"children":454},{"id":453},"追问和确认",[455],{"type":21,"value":453},{"type":15,"tag":116,"props":457,"children":459},{"code":458},"AI: \"建议使用 Redis 缓存\"\n你: \"为什么选 Redis 而不是 Memcached？在我们的场景中 Redis 的持久化策略怎么选？\"\n",[460],{"type":15,"tag":121,"props":461,"children":462},{"__ignoreMap":7},[463],{"type":21,"value":458},{"type":15,"tag":100,"props":465,"children":466},{},[],{"type":15,"tag":24,"props":468,"children":470},{"id":469},"会话生命周期管理",[471],{"type":21,"value":469},{"type":15,"tag":109,"props":473,"children":475},{"id":474},"何时开新会话",[476],{"type":21,"value":474},{"type":15,"tag":55,"props":478,"children":479},{},[480,485,490,495],{"type":15,"tag":59,"props":481,"children":482},{},[483],{"type":21,"value":484},"切换了完全不同的任务（从\"修 Bug\"转到\"设计数据库\"）",{"type":15,"tag":59,"props":486,"children":487},{},[488],{"type":21,"value":489},"对话超过 20 轮，AI 开始\"忘记\"之前的内容",{"type":15,"tag":59,"props":491,"children":492},{},[493],{"type":21,"value":494},"AI 的回答质量明显下降",{"type":15,"tag":59,"props":496,"children":497},{},[498],{"type":21,"value":499},"上一个任务已完成，开始新任务",{"type":15,"tag":109,"props":501,"children":503},{"id":502},"何时复用旧会话",[504],{"type":21,"value":502},{"type":15,"tag":55,"props":506,"children":507},{},[508,513,518],{"type":15,"tag":59,"props":509,"children":510},{},[511],{"type":21,"value":512},"正在迭代同一个功能（AI 已有上下文）",{"type":15,"tag":59,"props":514,"children":515},{},[516],{"type":21,"value":517},"需要引用之前的讨论结果",{"type":15,"tag":59,"props":519,"children":520},{},[521],{"type":21,"value":522},"任务还没有完成",{"type":15,"tag":109,"props":524,"children":526},{"id":525},"最佳实践",[527],{"type":21,"value":525},{"type":15,"tag":55,"props":529,"children":530},{},[531,541,551],{"type":15,"tag":59,"props":532,"children":533},{},[534,539],{"type":15,"tag":37,"props":535,"children":536},{},[537],{"type":21,"value":538},"一个会话一个主题",{"type":21,"value":540},"：不要在一个会话里又改 Bug 又写新功能",{"type":15,"tag":59,"props":542,"children":543},{},[544,549],{"type":15,"tag":37,"props":545,"children":546},{},[547],{"type":21,"value":548},"重要结论写入文件",{"type":21,"value":550},"：不要依赖 AI 的\"记忆\"，把结论写入代码注释或文档",{"type":15,"tag":59,"props":552,"children":553},{},[554,559],{"type":15,"tag":37,"props":555,"children":556},{},[557],{"type":21,"value":558},"定期清理",{"type":21,"value":560},"：关闭不再需要的会话，减少干扰",{"type":15,"tag":100,"props":562,"children":563},{},[],{"type":15,"tag":24,"props":565,"children":567},{"id":566},"chat-模式的局限",[568],{"type":21,"value":569},"Chat 模式的局限",{"type":15,"tag":55,"props":571,"children":572},{},[573,585,596,607],{"type":15,"tag":59,"props":574,"children":575},{},[576,578,583],{"type":21,"value":577},"❌ ",{"type":15,"tag":37,"props":579,"children":580},{},[581],{"type":21,"value":582},"不适合大范围代码生成",{"type":21,"value":584},"：多文件修改应该用 Composer\u002FAgent 模式",{"type":15,"tag":59,"props":586,"children":587},{},[588,589,594],{"type":21,"value":577},{"type":15,"tag":37,"props":590,"children":591},{},[592],{"type":21,"value":593},"上下文有限",{"type":21,"value":595},"：对话太长可能丢失早期上下文",{"type":15,"tag":59,"props":597,"children":598},{},[599,600,605],{"type":21,"value":577},{"type":15,"tag":37,"props":601,"children":602},{},[603],{"type":21,"value":604},"无状态",{"type":21,"value":606},"：关闭对话后上下文丢失（部分工具支持历史记录）",{"type":15,"tag":59,"props":608,"children":609},{},[610,611,616],{"type":21,"value":577},{"type":15,"tag":37,"props":612,"children":613},{},[614],{"type":21,"value":615},"无法直接执行",{"type":21,"value":617},"：Chat 只给建议，不自动修改代码",{"type":15,"tag":100,"props":619,"children":620},{},[],{"type":15,"tag":24,"props":622,"children":624},{"id":623},"与其他模式的关系",[625],{"type":21,"value":623},{"type":15,"tag":116,"props":627,"children":629},{"code":628},"Chat 模式（咨询、探索）\n    ↓ 需求明确后\nPlan 模式（规划、确认）\n    ↓ 计划确认后\nAgent\u002FComposer 模式（执行、生成）\n    ↓ 代码生成后\nChat 模式（审查、调试）\n",[630],{"type":15,"tag":121,"props":631,"children":632},{"__ignoreMap":7},[633],{"type":21,"value":628},{"type":15,"tag":31,"props":635,"children":636},{},[637,639,644],{"type":21,"value":638},"Chat 模式是整个 AI 编程工作流的",{"type":15,"tag":37,"props":640,"children":641},{},[642],{"type":21,"value":643},"起点和终点",{"type":21,"value":645},"——从对话开始理解需求，到对话结束审查结果。",{"type":15,"tag":100,"props":647,"children":648},{},[],{"type":15,"tag":24,"props":650,"children":652},{"id":651},"常见问题",[653],{"type":21,"value":651},{"type":15,"tag":191,"props":655,"children":656},{},[657,673],{"type":15,"tag":195,"props":658,"children":659},{},[660],{"type":15,"tag":199,"props":661,"children":662},{},[663,668],{"type":15,"tag":203,"props":664,"children":665},{},[666],{"type":21,"value":667},"问题",{"type":15,"tag":203,"props":669,"children":670},{},[671],{"type":21,"value":672},"解决方案",{"type":15,"tag":219,"props":674,"children":675},{},[676,689,702,715,728],{"type":15,"tag":199,"props":677,"children":678},{},[679,684],{"type":15,"tag":226,"props":680,"children":681},{},[682],{"type":21,"value":683},"AI 回答越来越\"离题\"",{"type":15,"tag":226,"props":685,"children":686},{},[687],{"type":21,"value":688},"开新会话，重新描述需求",{"type":15,"tag":199,"props":690,"children":691},{},[692,697],{"type":15,"tag":226,"props":693,"children":694},{},[695],{"type":21,"value":696},"AI 不理解我的项目",{"type":15,"tag":226,"props":698,"children":699},{},[700],{"type":21,"value":701},"提供项目背景（技术栈、目录结构）",{"type":15,"tag":199,"props":703,"children":704},{},[705,710],{"type":15,"tag":226,"props":706,"children":707},{},[708],{"type":21,"value":709},"AI 给出过时的 API",{"type":15,"tag":226,"props":711,"children":712},{},[713],{"type":21,"value":714},"明确指定版本号，或提供官方文档链接",{"type":15,"tag":199,"props":716,"children":717},{},[718,723],{"type":15,"tag":226,"props":719,"children":720},{},[721],{"type":21,"value":722},"上下文太长导致截断",{"type":15,"tag":226,"props":724,"children":725},{},[726],{"type":21,"value":727},"只粘贴关键代码片段，不要贴整个文件",{"type":15,"tag":199,"props":729,"children":730},{},[731,736],{"type":15,"tag":226,"props":732,"children":733},{},[734],{"type":21,"value":735},"AI 生成的代码和项目风格不一致",{"type":15,"tag":226,"props":737,"children":738},{},[739],{"type":21,"value":740},"配置项目规则文件（AGENTS.md \u002F .cursorrules）",{"title":7,"searchDepth":742,"depth":742,"links":743},3,[744,746,753,754,761,766,767,768],{"id":26,"depth":745,"text":29},2,{"id":105,"depth":745,"text":105,"children":747},[748,749,750,751,752],{"id":111,"depth":742,"text":114},{"id":127,"depth":742,"text":130},{"id":141,"depth":742,"text":144},{"id":155,"depth":742,"text":158},{"id":169,"depth":742,"text":172},{"id":186,"depth":745,"text":189},{"id":356,"depth":745,"text":356,"children":755},[756,757,758,759,760],{"id":366,"depth":742,"text":366},{"id":379,"depth":742,"text":379},{"id":392,"depth":742,"text":392},{"id":410,"depth":742,"text":410},{"id":453,"depth":742,"text":453},{"id":469,"depth":745,"text":469,"children":762},[763,764,765],{"id":474,"depth":742,"text":474},{"id":502,"depth":742,"text":502},{"id":525,"depth":742,"text":525},{"id":566,"depth":745,"text":569},{"id":623,"depth":745,"text":623},{"id":651,"depth":745,"text":651},"markdown","content:methodology:chat-mode.md","content","methodology\u002Fchat-mode.md","methodology\u002Fchat-mode","md",1777287374676]