<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>0xLuca5博客</title>
        <link>https://www.lucas.hk.cn/</link>
        <description>共你相识三千天我无名无姓</description>
        <lastBuildDate>Mon, 23 Feb 2026 15:58:05 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en-US</language>
        <copyright>All rights reserved 2026, 0xLuca5</copyright>
        <item>
            <title><![CDATA[22 条可维护性规则与权重排名]]></title>
            <link>https://www.lucas.hk.cn/article/30452c4c-a1ae-81ee-a565-c97a9ef93e84</link>
            <guid>https://www.lucas.hk.cn/article/30452c4c-a1ae-81ee-a565-c97a9ef93e84</guid>
            <pubDate>Sun, 30 Dec 2018 00:00:00 GMT</pubDate>
            <description><![CDATA[本文系统梳理了 22 条代码可维护性规则，按权重（4~32）从高到低排列，涵盖函数级（圈复杂度、调用栈深度、函数体积）、类与模块级（上帝类、数据类、紊乱类）、依赖耦合（循环依赖、不稳定依赖）、继承抽象（稳定抽象原则、继承层次）及其他代码异味（重复代码、消息链、散弹式修改）五大分类，并给出每条规则的识别方法与优化建议。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-30452c4ca1ae81eea565c97a9ef93e84"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-text notion-block-30452c4ca1ae8104be3dfd0ca4da49cd">写代码就像盖房子——地基歪了，楼层再高也是危房。代码的&quot;可维护性&quot;就是这个地基。你今天偷的每一个懒，未来的你（或者你的接盘侠）都会加倍偿还。</div><div class="notion-text notion-block-30452c4ca1ae8118b259eb0ffab2e4cb">本文梳理了 <b>22 条</b>常见的代码可维护性规则，并按权重排列。权重越高，对系统的杀伤力越大。读完这篇，你会对代码里的&quot;坏味道&quot;有一个系统性的认知——下次 Code Review 的时候，你就是那个让同事又爱又恨的人。</div><div class="notion-callout notion-blue_background_co notion-block-30452c4ca1ae81b2983ad113d9c10eb1"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🎯">🎯</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30452c4ca1ae81db8bb9f719ce813cb3"><b>核心要点</b></div><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81f7a929fd8b7cf6210c"><li>权重范围 <b>4 ~ 32</b>，权重越高代表对可维护性的破坏力越强</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81aa86eedbc47b7cd982"><li><b>上帝类/上帝模块</b>（权重32）是头号公敌，<b>重复代码</b>（权重30）紧随其后</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae810ab5acc99378f917fa"><li>函数级问题（复杂度、栈深、体积）是最容易修复的低垂果实</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae8154ab0ddfac43ec4824"><li>依赖与耦合问题往往牵一发动全身，需要架构层面的治理</li></ul></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30452c4ca1ae812a9b21c06ce919922b" data-id="30452c4ca1ae812a9b21c06ce919922b"><span><div id="30452c4ca1ae812a9b21c06ce919922b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae812a9b21c06ce919922b" title="规则权重一览"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">规则权重一览</span></span></h2><div class="notion-text notion-block-30452c4ca1ae81ec91e0f52035b83088">先来一张全景图，把所有规则按权重从高到低排个座次。权重就是&quot;危险指数&quot;——数字越大，技术债越重。</div><table class="notion-simple-table notion-block-30452c4ca1ae8112a812d5151eaaed7e"><tbody><tr class="notion-simple-table-row notion-blue_background notion-simple-table-header-row notion-block-30452c4ca1ae812d8d0dffc39814070b"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>权重</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>规则名称</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>分类</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>一句话概括</b></div></td></tr><tr class="notion-simple-table-row notion-red_background notion-block-30452c4ca1ae81228e0ef6787b29f205"><td class="" style="width:120px"><div class="notion-simple-table-cell">32</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">上帝类</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">类/模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">什么都管的&quot;独裁者&quot;类</div></td></tr><tr class="notion-simple-table-row notion-red_background notion-block-30452c4ca1ae8106ae9cc0086e6f40e2"><td class="" style="width:120px"><div class="notion-simple-table-cell">32</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">上帝模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">类/模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">模块版的独裁者</div></td></tr><tr class="notion-simple-table-row notion-orange_background notion-block-30452c4ca1ae813c93bad8e6cb4c567d"><td class="" style="width:120px"><div class="notion-simple-table-cell">30</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">重复代码</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">其他异味</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Ctrl+C / Ctrl+V 的罪恶</div></td></tr><tr class="notion-simple-table-row notion-orange_background notion-block-30452c4ca1ae818c96c4ecdaa0e5ba3c"><td class="" style="width:120px"><div class="notion-simple-table-cell">26</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">消息链</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">其他异味</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">a.getB().getC().getD() 式灾难</div></td></tr><tr class="notion-simple-table-row notion-yellow_background notion-block-30452c4ca1ae8108acf3cc7b896ec2f7"><td class="" style="width:120px"><div class="notion-simple-table-cell">20</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">破坏稳定抽象原则</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">继承/抽象</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">该抽象的没抽象</div></td></tr><tr class="notion-simple-table-row notion-yellow_background notion-block-30452c4ca1ae813fafdce6e52da68b1e"><td class="" style="width:120px"><div class="notion-simple-table-cell">18</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">数据类</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">类/模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">只有数据没有灵魂的 DTO</div></td></tr><tr class="notion-simple-table-row notion-yellow_background notion-block-30452c4ca1ae81cba306d3b1818d67bd"><td class="" style="width:120px"><div class="notion-simple-table-cell">18</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">数据模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">类/模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">数据裸奔的模块</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8141a844efe8e9f0c046"><td class="" style="width:120px"><div class="notion-simple-table-cell">15</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">子类不使用父类的遗产</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">继承/抽象</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">继承了个寂寞</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae812a9541d47983d9ad1f"><td class="" style="width:120px"><div class="notion-simple-table-cell">15</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">头文件循环包含</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">依赖/耦合</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">头文件的&quot;你中有我，我中有你&quot;</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81e094e8d0e025f7d486"><td class="" style="width:120px"><div class="notion-simple-table-cell">12</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">循环依赖</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">依赖/耦合</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">A→B→C→A 的死循环</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81299d09d6084335f5d1"><td class="" style="width:120px"><div class="notion-simple-table-cell">11</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">继承层次混乱</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">继承/抽象</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">继承树又深又窄像竹竿</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81eeb358d6a3f514a098"><td class="" style="width:120px"><div class="notion-simple-table-cell">11</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">紊乱模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">类/模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">一个模块干了八辈子的活</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81819f70fc6ea826ac57"><td class="" style="width:120px"><div class="notion-simple-table-cell">11</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">散弹式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">其他异味</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">改一个 bug 要动十个文件</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae819f825ac2935493239b"><td class="" style="width:120px"><div class="notion-simple-table-cell">10</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">不必要的耦合</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">依赖/耦合</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">引入了但没用的依赖</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8178b552ead7167baf55"><td class="" style="width:120px"><div class="notion-simple-table-cell">9</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">不稳定依赖</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">依赖/耦合</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">不稳定的系统依赖更不稳定的系统</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8106ad9dfc1666b37fa5"><td class="" style="width:120px"><div class="notion-simple-table-cell">8</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">超深栈函数</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">函数级</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">调用栈深度超过 7 层</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8183864ddbcf8f81ae0f"><td class="" style="width:120px"><div class="notion-simple-table-cell">6</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">紊乱类</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">类/模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">一个类干了八辈子的活</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81188805d82b07d717ee"><td class="" style="width:120px"><div class="notion-simple-table-cell">5</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">过复杂函数</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">函数级</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">圈复杂度超过 15</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81158154f39bf2439ee8"><td class="" style="width:120px"><div class="notion-simple-table-cell">5</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">超大函数</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">函数级</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">超过 400 行的庞然大物</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8165b04fdf412634e08e"><td class="" style="width:120px"><div class="notion-simple-table-cell">5</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">重定义符号</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">其他异味</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">重复定义的宏/枚举/结构</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae815d8097f749afc01d5c"><td class="" style="width:120px"><div class="notion-simple-table-cell">5</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">垃圾符号</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">其他异味</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">编译后无人引用的符号</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81718a1ef374c5b7aaee"><td class="" style="width:120px"><div class="notion-simple-table-cell">5</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">数据泥团</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">其他异味</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">反复出现却没封装的数据组</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81548312c0691fc53433"><td class="" style="width:120px"><div class="notion-simple-table-cell">4</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">大而复杂的类</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">类/模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">超过体积阈值的类</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae811fa166d1c8e2461c81"><td class="" style="width:120px"><div class="notion-simple-table-cell">—</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">特性依赖</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">其他异味</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">总在访问别人的数据</div></td></tr></tbody></table><hr class="notion-hr notion-block-30452c4ca1ae81748476d824b529fc7e"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30452c4ca1ae81908c56c5f00a60202c" data-id="30452c4ca1ae81908c56c5f00a60202c"><span><div id="30452c4ca1ae81908c56c5f00a60202c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81908c56c5f00a60202c" title="函数级坏味道"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数级坏味道</span></span></h2><div class="notion-text notion-block-30452c4ca1ae8164ba77d53ced6a5017">函数是代码的最小执行单元。如果连函数都烂了，整个系统基本上就是&quot;在沼泽里盖摩天大楼&quot;。好消息是：函数级的问题通常也是最容易修复的。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81a08c7addb6b747dec3" data-id="30452c4ca1ae81a08c7addb6b747dec3"><span><div id="30452c4ca1ae81a08c7addb6b747dec3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81a08c7addb6b747dec3" title="过复杂函数（权重 5）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">过复杂函数（权重 5）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81a7a3bcde21f7a7611b">过复杂函数指<b>圈复杂度超过 15</b> 的函数。圈复杂度越高，理解和维护的难度就越大——就像一份需要翻五页的菜单，你还没点完菜，服务员已经下班了。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30452c4ca1ae812197c7d5ad6717a8f2" data-id="30452c4ca1ae812197c7d5ad6717a8f2"><span><div id="30452c4ca1ae812197c7d5ad6717a8f2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae812197c7d5ad6717a8f2" title="什么是圈复杂度？"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">什么是圈复杂度？</span></span></h4><div class="notion-text notion-block-30452c4ca1ae8117b2d5f5ca1997ff1c">圈复杂度（Cyclomatic Complexity，CC）也称为条件复杂度，是一种衡量代码复杂度的标准，符号为 <b>V(G)</b>。</div><div class="notion-text notion-block-30452c4ca1ae8147a177c93457d39676">它衡量的是一个模块<b>判定结构</b>的复杂程度，数量上表现为独立路径的条数。换个说法：要覆盖所有可能情况，你最少需要写多少个测试用例？这个数字就是圈复杂度。</div><div class="notion-text notion-block-30452c4ca1ae818aa9bdcef487db94de">麦凯布（McCabe）最早提出了&quot;基础路径测试&quot;（Basis Path Testing），测试程序中的每一条线性独立路径，所需测试用例数即为圈复杂度。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30452c4ca1ae8168b2f4d886153316d1"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ab1eb342a-34c6-4662-bd5b-8416188b45f6%3A1.jpg?table=block&amp;id=30452c4c-a1ae-8168-b2f4-d886153316d1&amp;t=30452c4c-a1ae-8168-b2f4-d886153316d1" alt="圈复杂度" loading="lazy" decoding="async"/></div></figure><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30452c4ca1ae810b9415f89633c3dcd6" data-id="30452c4ca1ae810b9415f89633c3dcd6"><span><div id="30452c4ca1ae810b9415f89633c3dcd6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae810b9415f89633c3dcd6" title="怎么算？"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">怎么算？</span></span></h4><div class="notion-text notion-block-30452c4ca1ae817db928d05fe4106050">圈复杂度有两种计算方法：<b>点边计算法</b> 和 <b>节点判定法</b>。</div><div class="notion-text notion-block-30452c4ca1ae81699575d97661205a3d"><b>方法一：点边计算法</b></div><div class="notion-text notion-block-30452c4ca1ae81ca96f0fd60989b0c6c">圈复杂度由程序的控制流图计算：有向图的节点对应程序中的代码块，边表示代码块之间的执行跳转。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30452c4ca1ae813dafe4f605a055c273"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A842174d9-6cee-42c4-a0b5-51b095e58378%3A2.jpg?table=block&amp;id=30452c4c-a1ae-813d-afe4-f605a055c273&amp;t=30452c4c-a1ae-813d-afe4-f605a055c273" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30452c4ca1ae817bad25ed0738419792">公式很简单：</div><blockquote class="notion-quote notion-block-30452c4ca1ae8154aa88d2c95fa78d25"><div><b>V(G) = E - N + 2</b></div></blockquote><div class="notion-text notion-block-30452c4ca1ae8121a5e2d1c2101ae0f0">其中 E 是边的数量，N 是节点的数量。</div><div class="notion-text notion-block-30452c4ca1ae815abc94c7d8846ab8e0">看下面三种基本结构的控制流图：</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30452c4ca1ae81448249e57beac95df3"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A5a4d2e64-0e02-45d8-ac4b-1bee82281d60%3A3.jpg?table=block&amp;id=30452c4c-a1ae-8144-8249-e57beac95df3&amp;t=30452c4c-a1ae-8144-8249-e57beac95df3" alt="圈复杂度的计算" loading="lazy" decoding="async"/></div></figure><table class="notion-simple-table notion-block-30452c4ca1ae81b08bcffd893a62f096"><tbody><tr class="notion-simple-table-row notion-blue_background notion-simple-table-header-row notion-block-30452c4ca1ae812f8f2ed82d8a2265f4"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>结构</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>圈复杂度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>说明</b></div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8174aa4dd20b34bd5ee7"><td class="" style="width:120px"><div class="notion-simple-table-cell">正常顺序</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">1</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">一条路走到黑</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81519832f92396f39c81"><td class="" style="width:120px"><div class="notion-simple-table-cell">if-else</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">2</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">两条分叉路</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81fbb31af16a09861af8"><td class="" style="width:120px"><div class="notion-simple-table-cell">while</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">2</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">循环也是一种分叉</div></td></tr></tbody></table><div class="notion-text notion-block-30452c4ca1ae81eeb5c4c4a0aebed81d"><b>方法二：节点判定法</b></div><div class="notion-text notion-block-30452c4ca1ae81c8920de16cda646039">更直观的方式——数一数&quot;判定节点&quot;有几个，加 1 就行：</div><blockquote class="notion-quote notion-block-30452c4ca1ae816bb3cee4bead3279e8"><div><b>V(G) = P + 1</b></div></blockquote><div class="notion-text notion-block-30452c4ca1ae81b8aadaec7a46fe1fff">常见的判定节点包括：<code class="notion-inline-code">if</code>、<code class="notion-inline-code">while</code>、<code class="notion-inline-code">for</code>、<code class="notion-inline-code">case</code>、<code class="notion-inline-code">catch</code>、<code class="notion-inline-code">&amp;&amp;</code>、<code class="notion-inline-code">||</code>、<code class="notion-inline-code">?:</code> 三元运算符。</div><div class="notion-callout notion-orange_background_co notion-block-30452c4ca1ae81378ab0e654f068a019"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="⚠️">⚠️</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30452c4ca1ae819f81afcef1cda505c0"><b>注意：</b> 对于 <code class="notion-inline-code">switch-case</code> 或 <code class="notion-inline-code">if-else if-else</code> 结构，每个 <code class="notion-inline-code">case</code> 和每个 <code class="notion-inline-code">else if</code> 都要单独算一个判定节点！</div></div></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30452c4ca1ae81009b9ee55f904347e0" data-id="30452c4ca1ae81009b9ee55f904347e0"><span><div id="30452c4ca1ae81009b9ee55f904347e0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81009b9ee55f904347e0" title="如何降低圈复杂度？"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">如何降低圈复杂度？</span></span></h4><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81f5b71ce76ddc7d652a"><li><b>简化、合并</b>条件表达式</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae811a9664eb715c4831b6"><li>将条件判定<b>提炼为独立函数</b></li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81f7adfae525df58c790"><li>把大函数<b>拆成小函数</b></li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae8143ab10de3ebca5f217"><li>用<b>明确函数</b>取代晦涩参数</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae818ea875cd4679f1b999"><li><b>替换算法</b>——有时候换个思路比硬优化更有效</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81c18ecff6f848375484" data-id="30452c4ca1ae81c18ecff6f848375484"><span><div id="30452c4ca1ae81c18ecff6f848375484" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81c18ecff6f848375484" title="超深栈函数（权重 8）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">超深栈函数（权重 8）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81c69156cc6c65753954">超深栈函数指<b>调用栈深度超过 7</b> 的函数。栈越深，调试定位 bug 的难度越大。递归函数是超深栈的&quot;惯犯&quot;。</div><div class="notion-text notion-block-30452c4ca1ae81b194b3c66710c803aa">想象你在一栋 8 层楼里找一把钥匙，每层都得搜一遍——这就是调试超深栈的体验。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30452c4ca1ae81ffa138dcb89d735a77" data-id="30452c4ca1ae81ffa138dcb89d735a77"><span><div id="30452c4ca1ae81ffa138dcb89d735a77" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81ffa138dcb89d735a77" title="函数调用的底层机制"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">函数调用的底层机制</span></span></h4><div class="notion-text notion-block-30452c4ca1ae81d8acfed700645dd1c0">线程执行的基本行为是函数调用，每次调用的数据通过 <b>Java 栈</b>传递。Java 栈是一个<b>先进后出</b>的数据结构，核心内容是<b>栈帧</b>。</div><div class="notion-text notion-block-30452c4ca1ae81238f29fc898816c122">每次函数调用，一个栈帧入栈；调用结束（无论正常返回还是抛异常），栈帧出栈。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30452c4ca1ae81dea7b5c8d458c0d27f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A265321a2-8112-4ff1-aa3b-03b8e96e090f%3A4.png?table=block&amp;id=30452c4c-a1ae-81de-a7b5-c8d458c0d27f&amp;t=30452c4c-a1ae-81de-a7b5-c8d458c0d27f" alt="函数调用的过程" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30452c4ca1ae816aa0ded78b665b4acb">每个栈帧都会占用内存。HotSpot 虚拟机中，栈内存大小由 <code class="notion-inline-code">-Xss</code> 参数设定。当栈撑不住了，JVM 会给你两个&quot;惊喜&quot;：</div><table class="notion-simple-table notion-block-30452c4ca1ae816ea315fe3d3c434668"><tbody><tr class="notion-simple-table-row notion-red_background notion-simple-table-header-row notion-block-30452c4ca1ae819c96c1f694340b3ff8"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>异常</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>触发条件</b></div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81249b8fe3f81d668ee2"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">StackOverflowError</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">请求栈深度超过虚拟机允许的最大深度</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81bfb513c9ff7b615d96"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">OutOfMemoryError</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">扩展栈时无法申请到足够内存</div></td></tr></tbody></table><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30452c4ca1ae81a1ab88cae64c44488a" data-id="30452c4ca1ae81a1ab88cae64c44488a"><span><div id="30452c4ca1ae81a1ab88cae64c44488a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81a1ab88cae64c44488a" title="优化方法"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">优化方法</span></span></h4><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81eba0e1d80272d36f29"><li>用<b>循环</b>代替递归</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81c7b0b5c92c1b1d9ead"><li>将普通递归改为<b>尾递归</b></li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81a29fe3c46139be0994"><li><b>减少递归层次</b>——递归能少一层是一层</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81858e5df49dbd7f1537" data-id="30452c4ca1ae81858e5df49dbd7f1537"><span><div id="30452c4ca1ae81858e5df49dbd7f1537" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81858e5df49dbd7f1537" title="超大函数（权重 5）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">超大函数（权重 5）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae8137a168f7c9cee56cab">超过 <b>400 行</b>的函数就是超大函数。400 行是什么概念？大约是你滚动鼠标滚轮到手指抽筋的长度。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30452c4ca1ae8132b540edecbb16313c" data-id="30452c4ca1ae8132b540edecbb16313c"><span><div id="30452c4ca1ae8132b540edecbb16313c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae8132b540edecbb16313c" title="常见原因与解决方案"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">常见原因与解决方案</span></span></h4><table class="notion-simple-table notion-block-30452c4ca1ae8169a5cbf6e40610ac02"><tbody><tr class="notion-simple-table-row notion-blue_background notion-simple-table-header-row notion-block-30452c4ca1ae8164a015c729ba49b415"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>原因</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>解决方案</b></div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81b5a305e908897474bb"><td class="" style="width:120px"><div class="notion-simple-table-cell">大量重复代码（数据库连接、日志操作、权限校验等）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">抽成工具类；异常校验和权限校验通过 <b>AOP</b> 或<b>拦截器</b>处理</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae812f831ce35dcf39a08a"><td class="" style="width:120px"><div class="notion-simple-table-cell">复杂的业务逻辑</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">抽离通用逻辑，不通用的逻辑拆分为多个<b>小函数</b></div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8137be73d60c8d4dd63b"><td class="" style="width:120px"><div class="notion-simple-table-cell">代码缺乏设计</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">引入<b>设计模式</b>（如抽象工厂、装饰模式等）进行优化</div></td></tr></tbody></table><hr class="notion-hr notion-block-30452c4ca1ae811f93dfc083d4f8e6f0"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30452c4ca1ae8111929ff5a58a61c179" data-id="30452c4ca1ae8111929ff5a58a61c179"><span><div id="30452c4ca1ae8111929ff5a58a61c179" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae8111929ff5a58a61c179" title="类与模块级坏味道"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">类与模块级坏味道</span></span></h2><div class="notion-text notion-block-30452c4ca1ae81c0803ce111bcbd814c">如果说函数级问题是&quot;小病&quot;，那类和模块级问题就是&quot;慢性病&quot;——不致命，但日积月累会拖垮整个系统。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81e08e1bdd5582488bde" data-id="30452c4ca1ae81e08e1bdd5582488bde"><span><div id="30452c4ca1ae81e08e1bdd5582488bde" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81e08e1bdd5582488bde" title="上帝类 / 上帝模块（权重 32）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">上帝类 / 上帝模块（权重 32）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81d7aa6ade27434d2a6b"><b>权重最高，头号公敌。</b></div><div class="notion-text notion-block-30452c4ca1ae81b7859fe0efdc847acf">上帝类（God Class）就是那种什么都管、什么都做的类——它知道整个系统的秘密，控制着所有的外部功能，像一个独裁者。上帝模块同理，只是范围从类扩大到了模块。</div><div class="notion-text notion-block-30452c4ca1ae81dda78ac40fac53e5ed">它们的共同特征：<b>复杂且缺乏内聚</b>，大量使用外部数据，控制过多外部功能。</div><div class="notion-callout notion-red_background_co notion-block-30452c4ca1ae819da6ddf3051719acf5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🚨">🚨</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30452c4ca1ae81309ed6f3270ec983e5"><b>经验法则：</b> 如果一个类的职责你用一句话说不清楚，它八成就是个上帝类。拆！</div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae817eb061fe5a00d8f6b0" data-id="30452c4ca1ae817eb061fe5a00d8f6b0"><span><div id="30452c4ca1ae817eb061fe5a00d8f6b0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae817eb061fe5a00d8f6b0" title="数据类（权重 18）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据类（权重 18）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae812b8c32c2e2e816b1ec">数据类拥有一堆&quot;哑数据&quot;，自身没有复杂功能，严重依赖系统的其他类。通常被称为 Data Transfer Objects（DTO）。</div><div class="notion-text notion-block-30452c4ca1ae81359b25c04f0c881586">问题不在于 DTO 本身，而在于<b>业务逻辑散落在外部</b>。看个例子：</div><div class="notion-text notion-block-30452c4ca1ae81c1851afd2d692b4daa">外部到处在拼装 <code class="notion-inline-code">idCard</code> 的逻辑：</div><div class="notion-text notion-block-30452c4ca1ae8178bb2dd681b4e50680">一旦 <code class="notion-inline-code">idCard</code> 的字段名或逻辑变更，你得满世界找哪些地方用到了它。<b>正确做法：把逻辑收回数据类内部。</b></div><div class="notion-text notion-block-30452c4ca1ae81d3846ed7e10b922e6d">封装逻辑、减少外部耦合——这就是面向对象的基本功。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae8167a2d1f998743105ac" data-id="30452c4ca1ae8167a2d1f998743105ac"><span><div id="30452c4ca1ae8167a2d1f998743105ac" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae8167a2d1f998743105ac" title="数据模块（权重 18）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据模块（权重 18）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81e2b42df876baf2ce65">和数据类类似，数据模块定义了公共接口并拥有私有数据和函数，但<b>数据对外暴露过多</b>，本身功能简单。本质上就是&quot;模块版的数据类&quot;。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae813d9dcff9c78890512c" data-id="30452c4ca1ae813d9dcff9c78890512c"><span><div id="30452c4ca1ae813d9dcff9c78890512c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae813d9dcff9c78890512c" title="紊乱类 / 紊乱模块（权重 6 / 11）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">紊乱类 / 紊乱模块（权重 6 / 11）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81a28415e324dc41e2e6">一个类或模块提供了几组<b>完全不相关</b>的接口，接口没有按功能进行内聚。</div><div class="notion-text notion-block-30452c4ca1ae8155a1fdcf96c3a0b91d">打个比方：一家既卖火锅又修手机还能做美甲的店——每样都能做，但没一样做得好。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae8195b2adc315576eea91" data-id="30452c4ca1ae8195b2adc315576eea91"><span><div id="30452c4ca1ae8195b2adc315576eea91" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae8195b2adc315576eea91" title="大而复杂的类（权重 4）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">大而复杂的类（权重 4）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81abbfaee1c61cac94c2">体积超过阈值的类。虽然权重最低，但它往往是其他问题的<b>前兆</b>——今天的大类，明天可能就是上帝类。</div><hr class="notion-hr notion-block-30452c4ca1ae81ccb9f9f44e9dca3703"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30452c4ca1ae8142a85cd9857a712ab3" data-id="30452c4ca1ae8142a85cd9857a712ab3"><span><div id="30452c4ca1ae8142a85cd9857a712ab3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae8142a85cd9857a712ab3" title="依赖与耦合问题"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">依赖与耦合问题</span></span></h2><div class="notion-text notion-block-30452c4ca1ae81479a8cd7d91f77595f">依赖关系是架构的骨架。骨架歪了，整个系统都会变形。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81fdb335f0094fff4019" data-id="30452c4ca1ae81fdb335f0094fff4019"><span><div id="30452c4ca1ae81fdb335f0094fff4019" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81fdb335f0094fff4019" title="循环依赖（权重 12）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">循环依赖（权重 12）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae812fbc30fec177ea7165">各子模块互相依赖形成闭环：A 依赖 B，B 依赖 C，C 又依赖 A——经典的&quot;你中有我，我中有你&quot;。</div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30452c4ca1ae81afb47bc31b6331f29f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:493px;max-width:100%;flex-direction:column"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A4098fb81-5a49-44b5-8fbe-91df35bedfcb%3A5.jpeg?table=block&amp;id=30452c4c-a1ae-81af-b47b-c31b6331f29f&amp;t=30452c4c-a1ae-81af-b47b-c31b6331f29f" alt="函数调用的过程" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30452c4ca1ae81479a79f1a9b35b1eba">循环依赖分为<b>构造器依赖</b>和<b>属性依赖</b>两种：</div><table class="notion-simple-table notion-block-30452c4ca1ae8179bf57d031f3c82bf7"><tbody><tr class="notion-simple-table-row notion-blue_background notion-simple-table-header-row notion-block-30452c4ca1ae819fa9efdd0780f68350"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>类型</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>解决方案</b></div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae81df9161c44b5996177a"><td class="" style="width:120px"><div class="notion-simple-table-cell">属性依赖</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Spring 能自动解决大部分问题（三级缓存机制）</div></td></tr><tr class="notion-simple-table-row notion-block-30452c4ca1ae8141b929fe2d07b15d48"><td class="" style="width:120px"><div class="notion-simple-table-cell">构造器依赖</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">使用 <code class="notion-inline-code">@Lazy</code> 注解延迟初始化</div></td></tr></tbody></table><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae8185a941c020cbd85c84" data-id="30452c4ca1ae8185a941c020cbd85c84"><span><div id="30452c4ca1ae8185a941c020cbd85c84" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae8185a941c020cbd85c84" title="头文件循环包含（权重 15）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">头文件循环包含（权重 15）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae8148b131e737dc6abd92">存在循环包含关系的头文件。这是 C/C++ 世界里的&quot;循环依赖&quot;变体，解决思路是<b>前向声明</b>和<b>合理拆分头文件</b>。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81e48582eae829988b24" data-id="30452c4ca1ae81e48582eae829988b24"><span><div id="30452c4ca1ae81e48582eae829988b24" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81e48582eae829988b24" title="不必要的耦合（权重 10）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">不必要的耦合（权重 10）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81139e5fee93015856d3">包含了某个头文件，但根本没有使用里面的内容。这就像你把整个工具箱搬到了工地，结果只用了一把螺丝刀。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81c78e45d0808d1ad260" data-id="30452c4ca1ae81c78e45d0808d1ad260"><span><div id="30452c4ca1ae81c78e45d0808d1ad260" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81c78e45d0808d1ad260" title="不稳定依赖（权重 9）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">不稳定依赖（权重 9）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae8193b91ad0dbd57b762e">一个不稳定的子系统依赖了另一个<b>更不稳定</b>的系统。这就好比两个都站不稳的人互相搀扶——迟早一起摔倒。</div><hr class="notion-hr notion-block-30452c4ca1ae812b8984e477831b123f"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30452c4ca1ae81728058d6e3c16c7c85" data-id="30452c4ca1ae81728058d6e3c16c7c85"><span><div id="30452c4ca1ae81728058d6e3c16c7c85" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81728058d6e3c16c7c85" title="继承与抽象问题"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">继承与抽象问题</span></span></h2><div class="notion-text notion-block-30452c4ca1ae816ead96d6429b4f7285">继承是面向对象的利器，用好了削铁如泥，用烂了自废武功。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae814f9574d01651c43c72" data-id="30452c4ca1ae814f9574d01651c43c72"><span><div id="30452c4ca1ae814f9574d01651c43c72" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae814f9574d01651c43c72" title="破坏稳定抽象原则（权重 20）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">破坏稳定抽象原则（权重 20）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81fab48ed96128704a51">稳定的内容没有被好好抽象出来。换句话说：<b>那些不太会变的核心逻辑</b>，应该放在抽象层（接口/抽象类）里。如果稳定的东西散落在具体实现中，每次修改都可能引发连锁反应。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81c59d21c28b15585b72" data-id="30452c4ca1ae81c59d21c28b15585b72"><span><div id="30452c4ca1ae81c59d21c28b15585b72" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81c59d21c28b15585b72" title="子类不使用父类的遗产（权重 15）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">子类不使用父类的遗产（权重 15）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81f7a3e2ed47f3ffd6b2">继承了父类，却不使用父类提供的属性或方法。这意味着继承关系本身就是错误的——你不需要继承，你需要的是<b>组合</b>。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81eaa315fac40d98f949" data-id="30452c4ca1ae81eaa315fac40d98f949"><span><div id="30452c4ca1ae81eaa315fac40d98f949" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81eaa315fac40d98f949" title="继承层次混乱（权重 11）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">继承层次混乱（权重 11）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae8150b244e6378ba52c40">继承层次过深，且继承宽度比较窄。想象一棵只长主干不长分支的树——又高又细，一阵风就倒。适当的<b>扁平化</b>和<b>组合替代继承</b>是解药。</div><hr class="notion-hr notion-block-30452c4ca1ae81b3a7c1f467087ae998"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30452c4ca1ae817b8148d634fac8862d" data-id="30452c4ca1ae817b8148d634fac8862d"><span><div id="30452c4ca1ae817b8148d634fac8862d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae817b8148d634fac8862d" title="其他代码异味"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">其他代码异味</span></span></h2><div class="notion-text notion-block-30452c4ca1ae817989a3d9775b6cecca">这些问题不好归类，但每一个都值得警惕。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae813a968adcaabfd4320e" data-id="30452c4ca1ae813a968adcaabfd4320e"><span><div id="30452c4ca1ae813a968adcaabfd4320e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae813a968adcaabfd4320e" title="重复代码（权重 30）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">重复代码（权重 30）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81258d1ddc0ca6634dc7">完全相同的代码文件。权重 30，仅次于上帝类/上帝模块。</div><div class="notion-text notion-block-30452c4ca1ae81fcbb62c68629f00e6d">复制粘贴是最快的&quot;开发方式&quot;，也是最快的&quot;挖坑方式&quot;。一个 bug 出现在一个地方，意味着它同时出现在所有复制的地方。<b>DRY（Don&#x27;t Repeat Yourself）不是建议，是生存法则。</b></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae8189a706d4d80fb264c3" data-id="30452c4ca1ae8189a706d4d80fb264c3"><span><div id="30452c4ca1ae8189a706d4d80fb264c3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae8189a706d4d80fb264c3" title="消息链（权重 26）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">消息链（权重 26）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81c9acfbd3d5400441e9">需要经过多次中间传递和调用才能获取目标数据，中间遍历传递过多。典型特征：</div><div class="notion-text notion-block-30452c4ca1ae81b5a9e8c2f276d1f413">每个 <code class="notion-inline-code">.get()</code> 都是一个耦合点。任何中间环节的变化都会导致链条断裂。解决方案：<b>迪米特法则</b>（最少知识原则）——只和直接朋友说话。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81ad937df567dbe10961" data-id="30452c4ca1ae81ad937df567dbe10961"><span><div id="30452c4ca1ae81ad937df567dbe10961" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81ad937df567dbe10961" title="散弹式修改（权重 11）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">散弹式修改（权重 11）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae8103826fe61e2eb3e2f3">修改一个问题，要更改多处的代码。这与&quot;重复代码&quot;是一对孪生兄弟——只不过散弹式更隐蔽，代码可能不完全相同，但逻辑是耦合的。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae816380dfd7cc36dc97ba" data-id="30452c4ca1ae816380dfd7cc36dc97ba"><span><div id="30452c4ca1ae816380dfd7cc36dc97ba" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae816380dfd7cc36dc97ba" title="重定义符号（权重 5）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">重定义符号（权重 5）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81fd8735e096ba0c31f1">出现重定义的宏/枚举/结构类型的符号。同一个名字被定义了两次——编译器可能不会报错，但维护的人一定会崩溃。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81679d86e090e9317ee0" data-id="30452c4ca1ae81679d86e090e9317ee0"><span><div id="30452c4ca1ae81679d86e090e9317ee0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81679d86e090e9317ee0" title="垃圾符号（权重 5）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">垃圾符号（权重 5）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae81c8bda0dd0ce2645bf3">编译后分析出来<b>未被引用</b>的符号。它们就像家里堆满杂物的角落——虽然不碍事，但会让空间越来越拥挤。定期清理，保持代码库的整洁。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae819495e1d0851187593e" data-id="30452c4ca1ae819495e1d0851187593e"><span><div id="30452c4ca1ae819495e1d0851187593e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae819495e1d0851187593e" title="数据泥团（权重 5）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据泥团（权重 5）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae810eb733c3a85e5cf78b">系统中多次重复出现的数据组，比如相似的函数参数列表，到处传递却没有封装成结构体或对象。</div><div class="notion-text notion-block-30452c4ca1ae81d5b871d1299a5b60a8">一旦你发现三个以上的参数总是形影不离，是时候给它们一个&quot;家&quot;了——把它们封装成一个类或结构体。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30452c4ca1ae81649650fe510a22effa" data-id="30452c4ca1ae81649650fe510a22effa"><span><div id="30452c4ca1ae81649650fe510a22effa" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81649650fe510a22effa" title="特性依赖（无权重）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">特性依赖（无权重）</span></span></h3><div class="notion-text notion-block-30452c4ca1ae812c8729fe01dad11feb">函数很少访问自己模块的数据，总是去访问外部模块的数据。这个函数放错了位置——它的心不在这里，应该搬到它真正关心的模块去。</div><hr class="notion-hr notion-block-30452c4ca1ae81cdb4f1c01d81b72c84"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30452c4ca1ae81468d96d597e77ae0f8" data-id="30452c4ca1ae81468d96d597e77ae0f8"><span><div id="30452c4ca1ae81468d96d597e77ae0f8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30452c4ca1ae81468d96d597e77ae0f8" title="总结"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">总结</span></span></h2><div class="notion-text notion-block-30452c4ca1ae81b3b2daf0f6b76a2244">代码可维护性不是一个&quot;有或没有&quot;的开关，而是一个<b>连续的光谱</b>。22 条规则、不同的权重，背后是一个核心理念：</div><blockquote class="notion-quote notion-block-30452c4ca1ae81d48ae6c3cc473fe97b"><div><b>高内聚、低耦合、职责单一、适度抽象。</b></div></blockquote><div class="notion-callout notion-teal_background_co notion-block-30452c4ca1ae812b8afae1d907f100ce"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30452c4ca1ae8155b077e83dcad9b7ec"><b>实践建议</b></div><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae810fbfe0d01c4b013f2f"><li>🔴 <b>立即修复</b>（权重 ≥ 20）：上帝类、重复代码、消息链、破坏稳定抽象原则</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae819397ead53a07d44cb2"><li>🟡 <b>计划修复</b>（权重 10~19）：数据类、循环依赖、散弹式、继承混乱</li></ul><ul class="notion-list notion-list-disc notion-block-30452c4ca1ae81088233dd3b3a33e2b6"><li>🟢 <b>持续改善</b>（权重 &lt; 10）：过复杂函数、超深栈、超大函数、垃圾符号</li></ul></div></div><div class="notion-text notion-block-30452c4ca1ae813cbe01ed509714e0c8">代码是写给人看的，顺便让机器能跑。与其在未来的某个深夜对着一个 2000 行的上帝类崩溃，不如现在就动手重构。毕竟，最好的重构时机是三个月前，其次是现在。</div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[解码人格密码：从荣格八维到MBTI的完整进化史]]></title>
            <link>https://www.lucas.hk.cn/article/30752c4c-a1ae-81f8-96b8-c77cce0013f1</link>
            <guid>https://www.lucas.hk.cn/article/30752c4c-a1ae-81f8-96b8-c77cce0013f1</guid>
            <pubDate>Fri, 14 Feb 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[MBTI用4个字母定义人格，但背后的核心是荣格的八维认知功能（Ne/Ni/Se/Si/Te/Ti/Fe/Fi）。本文拆解从荣格心理类型学到MBTI 16型人格的完整逻辑，详解每种认知功能的特征与表现，提供官方测试渠道与验证方法，深入剖析16种人格的功能堆栈、气质分类与实战应用，助你真正理解人格测试的科学依据。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-full-width notion-block-30752c4ca1ae81f896b8c77cce0013f1"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-30752c4ca1ae81209f42da2ec8c50144"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae81a99a57ff89abd0acf4">MBTI用4个字母描述人格类型，通过问卷调查推断个体的八维认知功能属性，最终归纳出对应的人格角色。这套系统能让我们快速把握一个人的行为模式，在人际交往中更有针对性地沟通。但你有没有想过：这些字母组合背后的逻辑是什么？MBTI的理论基础究竟从何而来？</div></div></div><div class="notion-text notion-block-30752c4ca1ae8163a79ce97356d327ea">想象一下，如果有一套&quot;人格说明书&quot;能告诉你：为什么有些人喜欢天马行空地联想，而有些人偏爱脚踏实地地执行？为什么有人习惯用逻辑分析问题，而有人更倾向于照顾他人感受？</div><div class="notion-text notion-block-30752c4ca1ae81be9fd9d2c57ea73d43">这套说明书的雏形，早在一百年前就被心理学家卡尔·荣格（Carl Jung）勾勒出来了。他提出的<b>八维认知功能理论</b>，正是MBTI的理论基石。今天我们就来拆解这个有趣的心理学框架——从荣格的八维功能，到MBTI的16种人格，看看这些字母背后藏着怎样的认知密码。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae812a9b27fde470dfbc67" data-id="30752c4ca1ae812a9b27fde470dfbc67"><span><div id="30752c4ca1ae812a9b27fde470dfbc67" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae812a9b27fde470dfbc67" title="荣格八维"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">荣格八维</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae817da319e80f418cfcee"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A60c27d9e-1f06-46db-ab5c-d9d852499a3b%3A%E8%A7%A3%E8%AF%BB_MBTI_%E5%92%8C%E8%8D%A3%E6%A0%BC%E5%85%AB%E7%BB%B4_(2).png?table=block&amp;id=30752c4c-a1ae-817d-a319-e80f418cfcee&amp;t=30752c4c-a1ae-817d-a319-e80f418cfcee" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae814db1b3c3b68d4a01d1" data-id="30752c4ca1ae814db1b3c3b68d4a01d1"><span><div id="30752c4ca1ae814db1b3c3b68d4a01d1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae814db1b3c3b68d4a01d1" title="概念来源"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">概念来源</span></span></h3><div class="notion-text notion-block-30752c4ca1ae813e8830f546a07a8ad6">20世纪初，瑞士心理学家<b>卡尔·荣格（Carl Gustav Jung）</b>在其著作《心理类型》（<em>Psychological Types</em>, 1921）中首次提出了<b>心理类型理论</b>。他观察到，人们在感知世界和做出决策时，会表现出截然不同的偏好模式。</div><div class="notion-text notion-block-30752c4ca1ae81f69a84c39a6e3ad17d">荣格将人的心理功能分为两大类：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d78ce0fdb0a16c6557"><li><b>感知功能</b>（Perceiving Functions）：如何获取信息</li><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d78ce0fdb0a16c6557"><li><b>直觉（Intuition, N）</b>：关注可能性、模式、未来</li><li><b>感觉（Sensing, S）</b>：关注具体事实、细节、当下</li></ul></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d4b40dfea6e4ea2b3c"><li><b>判断功能</b>（Judging Functions）：如何处理信息</li><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d4b40dfea6e4ea2b3c"><li><b>思维（Thinking, T）</b>：基于逻辑和客观标准</li><li><b>情感（Feeling, F）</b>：基于价值观和人际和谐</li></ul></ul><div class="notion-text notion-block-30752c4ca1ae816c9619fc57ccbede94">同时，每种功能又分为<b>外向（Extraverted, e）</b>和<b>内向（Introverted, i）</b>两个方向：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8189a5c1e46905433fd5"><li><b>外向</b>：能量指向外部世界，关注客观环境</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81b79b25cd29371db661"><li><b>内向</b>：能量指向内心世界，关注主观体验</li></ul><div class="notion-text notion-block-30752c4ca1ae819a9439dcfbeb413d38">这样一来，2种感知功能 × 2种判断功能 × 2个方向 = <b>8种认知功能</b>，这就是所谓的&quot;荣格八维&quot;。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae810093b2dc41f43509ef" data-id="30752c4ca1ae810093b2dc41f43509ef"><span><div id="30752c4ca1ae810093b2dc41f43509ef" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae810093b2dc41f43509ef" title="八维功能"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">八维功能</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81669d71dfa46740b6d8" data-id="30752c4ca1ae81669d71dfa46740b6d8"><span><div id="30752c4ca1ae81669d71dfa46740b6d8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81669d71dfa46740b6d8" title="Ne（外向直觉型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ne（外向直觉型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae81898caec27ce6ad4214"><b>核心特质</b>：可能性猎人，脑洞制造机</div><div class="notion-text notion-block-30752c4ca1ae81d98b3dc8ce839b4e96">Ne主导的人像个永不停歇的创意发电机，他们能从一个话题跳到另一个话题，在看似无关的事物之间建立奇妙的联系。他们的口头禅是：&quot;哎！我突然想到一个点子！&quot;</div><div class="notion-text notion-block-30752c4ca1ae81a58943c7b6e2c7390f"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae815abdf8d5cd19272329"><li>看到一朵云，能联想到希腊神话、明天的天气、还有上周看的科幻电影</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d0badfe8f1eac965b0"><li>开会时最爱头脑风暴，10分钟能提出20个方案</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81bb9e5fc1b66c8144fa"><li>喜欢探索新领域，但容易&quot;挖坑不填&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d5a4a2e5d872901b8a"><li>对未来充满憧憬：&quot;如果我们这样做会怎样？&quot;</li></ul><div class="notion-text notion-block-30752c4ca1ae8132b590fd621f341c12"><b>现实场景</b>：朋友说要开奶茶店，Ne用户已经脑补出了&quot;元宇宙奶茶体验馆&quot;的商业模式。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81b494cbfec014e2ce5d" data-id="30752c4ca1ae81b494cbfec014e2ce5d"><span><div id="30752c4ca1ae81b494cbfec014e2ce5d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81b494cbfec014e2ce5d" title="Ni（内向直觉型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ni（内向直觉型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae8125a942e9096bfad0ba"><b>核心特质</b>：先知型玩家，未来洞察者</div><div class="notion-text notion-block-30752c4ca1ae81858316c6df5cace9f3">Ni就像一台高性能的模式识别引擎，它在潜意识中整合海量信息，突然给出一个&quot;啊哈！&quot;式的顿悟。他们看问题总能透过表象抓住本质，提前预见趋势。</div><div class="notion-text notion-block-30752c4ca1ae815db4e7ee5db7096060"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d680cedb8b45eab593"><li>擅长长期规划：&quot;三年后的目标是……&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f6a5e8dfff4d7d6db7"><li>直觉准确但说不清楚：&quot;我就是觉得会这样&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81958e8ecda4213cc679"><li>思考时需要独处，在安静中提炼洞见</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8164a646cee871534bc8"><li>对符号、隐喻、深层含义特别敏感</li></ul><div class="notion-text notion-block-30752c4ca1ae81e59497eda7e7da8d4e"><b>现实场景</b>：别人还在讨论当前行业热点，Ni用户已经在思考五年后的技术变革。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8124a007c4fc5db629b7" data-id="30752c4ca1ae8124a007c4fc5db629b7"><span><div id="30752c4ca1ae8124a007c4fc5db629b7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8124a007c4fc5db629b7" title="Se（外向感觉型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Se（外向感觉型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae8128a550d9a176d8ac18"><b>核心特质</b>：行动派，当下体验家</div><div class="notion-text notion-block-30752c4ca1ae8155b6a0f3844de7ecc1">Se活在&quot;此时此刻&quot;，他们对环境的感知敏锐到近乎本能。美食、运动、音乐、刺激体验——凡是能调动感官的东西，都能让他们兴奋。</div><div class="notion-text notion-block-30752c4ca1ae8189b41ce9e260238c6b"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8114a413f6695d0e1587"><li>反应速度快，身体协调性好，运动能力强</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae818c9e5be2bc31fcccee"><li>享受即时体验：&quot;人生得意须尽欢！&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8125a659c89cc74b30e5"><li>观察力敏锐，能注意到房间里多了一幅画</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d3a493f7ca56b78e6e"><li>喜欢冒险和新鲜刺激：&quot;走，今晚去蹦极！&quot;</li></ul><div class="notion-text notion-block-30752c4ca1ae810bb7abffc40cf3a7a0"><b>现实场景</b>：旅行时别人在查攻略，Se用户已经在街头找到了最地道的小吃摊。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81548a8ac689539ddf97" data-id="30752c4ca1ae81548a8ac689539ddf97"><span><div id="30752c4ca1ae81548a8ac689539ddf97" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81548a8ac689539ddf97" title="Si（内向感觉型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Si（内向感觉型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae81b99ddefb822c07f355"><b>核心特质</b>：记忆守护者，经验主义者</div><div class="notion-text notion-block-30752c4ca1ae817786acf292947fcc01">Si是个人数据库管理员，擅长存储和调用过往经验。他们重视传统、稳定和细节，相信&quot;试过的方法才靠谱&quot;。</div><div class="notion-text notion-block-30752c4ca1ae81a1be7ecb1ab69f03df"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81709586decc57c996e8"><li>记忆力惊人：&quot;2018年3月我们也遇到过类似情况&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a08fa0ed0403dd3732"><li>喜欢按既定流程办事，抗拒突然变化</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d79f0bfa2e01e80fa0"><li>注重细节和准确性，容易发现不一致之处</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae819d98f9c5e8624215ff"><li>重视身体感受：&quot;这个椅子坐着不舒服&quot;</li></ul><div class="notion-text notion-block-30752c4ca1ae8116b3b7d7732d9523ba"><b>现实场景</b>：写报告时，Si用户会严格参照上次的模板和格式，确保万无一失。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae813c8b4fdfc49483f3e0" data-id="30752c4ca1ae813c8b4fdfc49483f3e0"><span><div id="30752c4ca1ae813c8b4fdfc49483f3e0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae813c8b4fdfc49483f3e0" title="Te（外向思维型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Te（外向思维型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae81069d89c5d3fc7b73cb"><b>核心特质</b>：效率优化器，目标达成机器</div><div class="notion-text notion-block-30752c4ca1ae815585dbf30a72c0682e">Te是现实世界的项目经理，他们用客观标准、数据和逻辑来组织资源，追求最高效的结果。</div><div class="notion-text notion-block-30752c4ca1ae81668739e80a40f40a69"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae816cba02f6223dbba2fc"><li>目标导向：&quot;这件事的KPI是什么？&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81688673eea7147e58e2"><li>决策果断，执行力强：&quot;别废话，开干！&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81759b53c32b999acfed"><li>喜欢制定计划、分配任务、追踪进度</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81c4b5f8ff4ccb48c105"><li>重视规则和系统，&quot;怎么最有效就怎么来&quot;</li></ul><div class="notion-text notion-block-30752c4ca1ae817dba1fe1a76685b901"><b>现实场景</b>：团队项目延期，Te用户会立刻拉出甘特图，重新分配任务和截止日期。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae814eaf7edd5fb8ac8a39" data-id="30752c4ca1ae814eaf7edd5fb8ac8a39"><span><div id="30752c4ca1ae814eaf7edd5fb8ac8a39" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae814eaf7edd5fb8ac8a39" title="Ti（内向思维型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ti（内向思维型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae812db9d3f0560f9c3184"><b>核心特质</b>：逻辑炼金术士，理论建构者</div><div class="notion-text notion-block-30752c4ca1ae81c58155d5e242f7ca66">Ti是思维的精密仪器，他们在脑内构建严密的逻辑框架，追求&quot;完美自洽&quot;的理解体系。</div><div class="notion-text notion-block-30752c4ca1ae81acb04cef76cf9c34ff"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81fd8191f3784e6d0d20"><li>喜欢刨根问底：&quot;为什么会这样？底层原理是什么？&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8195bd27f9f1f0806645"><li>质疑现有理论，自己推导逻辑</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81449051e36afec7410f"><li>思考时需要时间，不喜欢被催</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8141a850d427302dc7e7"><li>对逻辑矛盾极度敏感：&quot;这里说不通啊&quot;</li></ul><div class="notion-text notion-block-30752c4ca1ae81069ee6eb5b9c03c77a"><b>现实场景</b>：看到一个算法，Ti用户不会直接用，而是要先理解其数学原理和适用边界。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81cd8b4cf16057bc0cc3" data-id="30752c4ca1ae81cd8b4cf16057bc0cc3"><span><div id="30752c4ca1ae81cd8b4cf16057bc0cc3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81cd8b4cf16057bc0cc3" title="Fe（外向情感型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Fe（外向情感型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae81bc9065d06947e3a513"><b>核心特质</b>：氛围调节师，人际和谐大使</div><div class="notion-text notion-block-30752c4ca1ae81f89644dcd5611a0b62">Fe像社交雷达，能敏锐感知群体情绪，并主动营造温暖和谐的氛围。他们的快乐来自&quot;大家都开心&quot;。</div><div class="notion-text notion-block-30752c4ca1ae816f9ef2c5930ed1a74d"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a89786c7fcdb5da700"><li>善于共情：&quot;你是不是不开心？&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8147a603e18365ccd908"><li>主动照顾他人感受，避免冲突</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae811e86facf289bae416a"><li>重视社会规范和礼仪：&quot;这样做不太合适吧&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a19fbedadbec009a8e"><li>喜欢团队协作，讨厌孤立和冷场</li></ul><div class="notion-text notion-block-30752c4ca1ae816683e0e9d1165cbc55"><b>现实场景</b>：聚会时，Fe用户会确保每个人都被照顾到，主动调节尴尬气氛。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81e5bbcacb538c97a3a5" data-id="30752c4ca1ae81e5bbcacb538c97a3a5"><span><div id="30752c4ca1ae81e5bbcacb538c97a3a5" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81e5bbcacb538c97a3a5" title="Fi（内向情感型）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Fi（内向情感型）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae81d29e4ac6597fe0775b"><b>核心特质</b>：价值守护者，真实自我追寻者</div><div class="notion-text notion-block-30752c4ca1ae816397ffe5629331d7be">Fi是内心的道德指南针，他们依据深层价值观和个人信念做决策，追求&quot;真实地活着&quot;。</div><div class="notion-text notion-block-30752c4ca1ae812292a4fdf00da08ea3"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81969ed6ed5e70cf3563"><li>价值观坚定：&quot;这违背了我的原则&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81edad68f7efa6bc43c3"><li>情感深刻但不轻易表露</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81098218d16931436415"><li>重视个体独特性，反感&quot;随大流&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8131aecff11cd1d0cbbf"><li>对真诚、正义、美感有强烈追求</li></ul><div class="notion-text notion-block-30752c4ca1ae8114ad1cf7a035faf3c6"><b>现实场景</b>：职业选择时，Fi用户会问自己：&quot;这份工作真的有意义吗？符合我的价值观吗？&quot;</div><hr class="notion-hr notion-block-30752c4ca1ae81e2aaaec4be3d807fab"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae818297d6d49b6e060b12" data-id="30752c4ca1ae818297d6d49b6e060b12"><span><div id="30752c4ca1ae818297d6d49b6e060b12" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae818297d6d49b6e060b12" title="MBTI"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">MBTI</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae8147a6b7f0e03b1f9888"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A3f635e8d-492e-4a5e-afa9-6a66229692a9%3A17710507192c0f.png?table=block&amp;id=30752c4c-a1ae-8147-a6b7-f0e03b1f9888&amp;t=30752c4c-a1ae-8147-a6b7-f0e03b1f9888" alt="notion image" loading="lazy" decoding="async"/></div></figure><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae819d83a1fc57ea3755af" data-id="30752c4ca1ae819d83a1fc57ea3755af"><span><div id="30752c4ca1ae819d83a1fc57ea3755af" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae819d83a1fc57ea3755af" title="概念来源"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">概念来源</span></span></h3><div class="notion-text notion-block-30752c4ca1ae812d913ef319d275fc99"><b>MBTI</b>（Myers-Briggs Type Indicator，迈尔斯-布里格斯类型指标）由美国母女档<b>Katharine Cook Briggs</b>和<b>Isabel Briggs Myers</b>在20世纪40年代开发，她们将荣格的理论系统化，设计出一套可操作的测评工具。</div><div class="notion-text notion-block-30752c4ca1ae8134ab56c50640b33864">MBTI通过4个维度来定义人格类型：</div><table class="notion-simple-table notion-block-30752c4ca1ae819f87eae73647bbfe0d"><tbody><tr class="notion-simple-table-row notion-block-30752c4ca1ae817cb71bef4bedfd76bf"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>维度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>两极</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>核心区别</b></div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81f9b23efa3ecd26f596"><td class="" style="width:120px"><div class="notion-simple-table-cell">能量方向</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>E</b>xtraversion 外向 vs <b>I</b>ntroversion 内向</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">从外部世界获取能量 vs 从内心世界获取能量</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81b18cc5d862d778db8a"><td class="" style="width:120px"><div class="notion-simple-table-cell">信息获取</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>S</b>ensing 实感 vs i<b>N</b>tuition 直觉</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">关注具体事实 vs 关注可能性和模式</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae8138b0ddef829424bca2"><td class="" style="width:120px"><div class="notion-simple-table-cell">决策方式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>T</b>hinking 思考 vs <b>F</b>eeling 情感</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">基于逻辑分析 vs 基于价值和人际</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81fe8432cd249f3b5747"><td class="" style="width:120px"><div class="notion-simple-table-cell">生活方式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>J</b>udging 判断 vs <b>P</b>erceiving 感知</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">偏好计划和结构 vs 偏好灵活和开放</div></td></tr></tbody></table><div class="notion-text notion-block-30752c4ca1ae81d4a30bd970ff5ffe8a">4个维度，每个维度2个选项，组合出<b>2^4 = 16种人格类型</b>。</div><div class="notion-text notion-block-30752c4ca1ae8186baa6d5236e2f42c7"><b>关键连接</b>：MBTI的每种类型对应一个特定的<b>认知功能堆栈</b>（由4个荣格八维功能按优先级排列）。例如：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae810a9dd5d0a681a967ab"><li><b>INFJ</b> 的功能堆栈是：Ni（主导）→ Fe → Ti → Se</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8174b9d7e14ce89ecf15"><li><b>ENTP</b> 的功能堆栈是：Ne（主导）→ Ti → Fe → Si</li></ul><div class="notion-text notion-block-30752c4ca1ae816ab723d17057fa221d">这就是MBTI与荣格八维的桥梁：<b>4个字母只是表象，八维功能才是内核</b>。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae81c7a2d5d7e9b192e3ff" data-id="30752c4ca1ae81c7a2d5d7e9b192e3ff"><span><div id="30752c4ca1ae81c7a2d5d7e9b192e3ff" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81c7a2d5d7e9b192e3ff" title="如何进行MBTI测试"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">如何进行MBTI测试</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81c0b618e95ff78717d9">了解了理论，你可能迫不及待想知道自己是哪种类型了。那么，如何科学地测试自己的MBTI类型呢？</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81abbfd8dd614fb67828" data-id="30752c4ca1ae81abbfd8dd614fb67828"><span><div id="30752c4ca1ae81abbfd8dd614fb67828" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81abbfd8dd614fb67828" title="官方测试渠道"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">官方测试渠道</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8155ba39e9da922e3cb0" data-id="30752c4ca1ae8155ba39e9da922e3cb0"><span><div id="30752c4ca1ae8155ba39e9da922e3cb0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8155ba39e9da922e3cb0" title="1. Myers-Briggs 官方测试（收费）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. Myers-Briggs 官方测试（收费）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae81479fbee81db95ab947"><b>网址</b>：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.myersbriggs.org">https://www.myersbriggs.org</a></div><div class="notion-text notion-block-30752c4ca1ae8153a061c7cab48207b9"><b>特点</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8108b721d276eb643c20"><li>最权威的官方测试</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81aeadf2c95ea792f255"><li>由专业认证施测师解读结果</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81cda5a2f7fd8bc34990"><li>费用较高（通常需要几百美元）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae811982d2f93e26e1d452"><li>提供详细的个人报告和职业建议</li></ul><div class="notion-text notion-block-30752c4ca1ae81849d14ce7a8cf883e4"><b>适合人群</b>：需要用于职业规划、团队建设等正式场合</div><hr class="notion-hr notion-block-30752c4ca1ae81158b89ef5ce657c5f9"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8192a73ae005e2cf88b0" data-id="30752c4ca1ae8192a73ae005e2cf88b0"><span><div id="30752c4ca1ae8192a73ae005e2cf88b0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8192a73ae005e2cf88b0" title="2. 16Personalities（免费推荐）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 16Personalities（免费推荐）</span></span></h4><div class="notion-text notion-block-30752c4ca1ae8157953bd07a639bf316"><b>网址</b>：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.16personalities.com">https://www.16personalities.com</a></div><div class="notion-text notion-block-30752c4ca1ae81728134e4d1f782bd52"><b>特点</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81b49ab2c1a95a4c7b5e"><li>完全免费，支持中文</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81978d29cd88bc169a95"><li>界面友好，结果呈现精美</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81c79b96e1c85058587c"><li>基于五因素模型（Big Five）改进</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81bb9632cc957f7ea5df"><li>题目约60道，10分钟完成</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8199b1dccdaeaf9ceb46"><li>提供详细的类型描述和职业建议</li></ul><div class="notion-text notion-block-30752c4ca1ae81148e87ca4ab7589bce"><b>注意</b>：16Personalities使用的是改进版模型（增加了T/A维度，代表自信程度），严格来说不是传统MBTI，但仍然非常有参考价值。</div><hr class="notion-hr notion-block-30752c4ca1ae81479604e559911faa38"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81d3b784c3d979b82073" data-id="30752c4ca1ae81d3b784c3d979b82073"><span><div id="30752c4ca1ae81d3b784c3d979b82073" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81d3b784c3d979b82073" title="3. Sakinorva 认知功能测试"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. Sakinorva 认知功能测试</span></span></h4><div class="notion-text notion-block-30752c4ca1ae8152bc44e76c62da6925"><b>网址</b>：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://sakinorva.net/functions">https://sakinorva.net/functions</a></div><div class="notion-text notion-block-30752c4ca1ae81b69d36e325a52aece6"><b>特点</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81818327e7e6b03dbd82"><li>直接测量八维认知功能</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81fa980beb154d18f52d"><li>提供多种算法结果对比</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81878638d31026ac1b02"><li>适合深入了解自己的功能堆栈</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae810291eeeaf2a5dc6918"><li>英文界面（可用翻译工具）</li></ul><div class="notion-text notion-block-30752c4ca1ae812f8679cd878f024928"><b>适合人群</b>：对认知功能理论有一定了解的进阶用户</div><hr class="notion-hr notion-block-30752c4ca1ae819fb074dfd14dd2e6ad"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81e19a2cecb049f1133e" data-id="30752c4ca1ae81e19a2cecb049f1133e"><span><div id="30752c4ca1ae81e19a2cecb049f1133e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81e19a2cecb049f1133e" title="测试注意事项"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">测试注意事项</span></span></h4><div class="notion-callout notion-yellow_background_co notion-block-30752c4ca1ae814989e1f0a94261085b"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="⚠️">⚠️</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae81c7a74af3266cf303fc"><b>重要提醒：测试只是参考，不是绝对真理！</b></div></div></div><div class="notion-text notion-block-30752c4ca1ae81cd84a8fd4d141aa5b9">在进行MBTI测试时，请注意以下几点：</div><div class="notion-text notion-block-30752c4ca1ae81239399d55352cb94c2">诚实作答，选择真实的自己</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8103bd48f0b08576be40"><li><b>不要选择&quot;理想中的自己&quot;</b>：题目问的是你实际如何行事，而非你希望如何</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae817fa932ed77052b3ef0"><li><b>避免职场人格</b>：回答时想象自己在放松、自然的状态下会怎么做</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81ab9ff9d41bea7bcdae"><li><b>关注自然倾向</b>：如果两种方式都能做，选择更轻松、更符合本能的那个</li></ul><div class="notion-text notion-block-30752c4ca1ae812ebf15f36ee6eb7b96"><b>举例</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f197edda453a70297f"><li>❌ 错误：&quot;我想成为一个有计划的人，所以选J&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81839a18cf38d645fe8a"><li>✅ 正确：&quot;我实际上更喜欢灵活应变，虽然工作要求我做计划，但那让我感到束缚，所以我是P&quot;</li></ul><hr class="notion-hr notion-block-30752c4ca1ae818fbabbc6a078e42c65"/><div class="notion-text notion-block-30752c4ca1ae8124991dc70c0961d138">多次测试，交叉验证</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81efb550fad02eaf7b09"><li>在不同网站测试2-3次</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81fc9a1cf97a245f7422"><li>间隔一段时间再测（如1个月后）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8185bf46d917421d9bd7"><li>对比不同测试的认知功能得分</li></ul><div class="notion-text notion-block-30752c4ca1ae81969388d2a659c512c1"><b>为什么</b>：单次测试可能受情绪、环境影响，多次测试能看到更稳定的模式。</div><hr class="notion-hr notion-block-30752c4ca1ae8166bf16f20a9c5968af"/><div class="notion-text notion-block-30752c4ca1ae817fb022c0b27823112e">理解模糊边界</div><div class="notion-text notion-block-30752c4ca1ae8179ac91c2c1281ecda1">如果你发现自己在某个维度上得分接近50%（比如E和I都是50%左右），这是正常的：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81218002dc01e443ff5b"><li><b>人格是光谱，不是二元对立</b>：你可能在E/I之间偏中性</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae816cab11fbce4fa1464b"><li><b>情境影响</b>：在不同场合可能展现不同倾向</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8121859dd57c68c24b8e"><li><b>成长过程</b>：随着年龄增长，你可能发展了非主导功能</li></ul><div class="notion-text notion-block-30752c4ca1ae81809f47ec05db4edd4f"><b>建议</b>：此时重点看认知功能堆栈，而不只是4个字母。</div><hr class="notion-hr notion-block-30752c4ca1ae81dfb4b5ddea35a4e242"/><div class="notion-text notion-block-30752c4ca1ae8197b9d1c6bff54aa41e">深入学习认知功能</div><div class="notion-text notion-block-30752c4ca1ae81f1a713d5f7641fcc9c">单纯靠问卷得出的字母组合只是表面，真正理解MBTI需要学习认知功能理论：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae813a90bfcaa09eeb1a67"><li>阅读每种功能的详细描述（见前文&quot;八维功能&quot;章节）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae817ba936d17b0eadf901"><li>观察自己在压力下、放松时、工作中分别使用哪些功能</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae814f9ab1d42b783afbe7"><li>思考自己的主导功能和劣势功能</li></ul><div class="notion-text notion-block-30752c4ca1ae81eaa4e8eb33f1819fcd"><b>提示</b>：有时候，通过认知功能自我分析得出的类型，比问卷测试更准确。</div><hr class="notion-hr notion-block-30752c4ca1ae81f0b716d82b87e2ba5c"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae813e96abc32cfe2110d1" data-id="30752c4ca1ae813e96abc32cfe2110d1"><span><div id="30752c4ca1ae813e96abc32cfe2110d1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae813e96abc32cfe2110d1" title="测试后：如何验证结果"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">测试后：如何验证结果</span></span></h4><div class="notion-text notion-block-30752c4ca1ae81fba513dcf5d2990256">拿到测试结果后，不要盲目相信，试试以下方法验证：</div><div class="notion-text notion-block-30752c4ca1ae818f802bfb30799cfbf5">1. 阅读类型描述，看共鸣度</div><div class="notion-text notion-block-30752c4ca1ae811e9c63d55245e1823c">找到你的类型详细描述（可在16Personalities或MBTI相关网站），如果你读完后感觉&quot;这说的就是我！&quot;，那结果可能比较准确。</div><div class="notion-text notion-block-30752c4ca1ae81eaa5edeb23a66c1313">如果感觉&quot;有些对，但有些完全不像我&quot;，可能：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8159a59bf8da49c901d9"><li>测试结果不准（重新测试）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae813b893ffcbca95fe4c6"><li>你处于边界类型（比如INFP和INFJ之间）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8190baa2e63b8ed0919b"><li>你还在发展非主导功能</li></ul><hr class="notion-hr notion-block-30752c4ca1ae81f6aa35cf97dc328eed"/><div class="notion-text notion-block-30752c4ca1ae81c88464dbdfcdd29373">2. 对比认知功能堆栈</div><div class="notion-text notion-block-30752c4ca1ae8137a00fc2aeaf335722">查看你的类型对应的功能堆栈（见前文&quot;16种人格详解&quot;），问自己：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8163a830f1161920b526"><li><b>主导功能</b>：这是我最常用、最自然的思维方式吗？</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f28c28ee544e3993f5"><li><b>辅助功能</b>：我确实用这个功能来支持主导功能吗？</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8117aa1ee9466765314f"><li><b>劣势功能</b>：我在这方面是否确实比较弱？</li></ul><div class="notion-text notion-block-30752c4ca1ae8128b146d40522148759"><b>案例</b>：如果测出INTJ（Ni-Te-Fi-Se），但你发现自己其实不太擅长长期规划（Ni），更喜欢分析逻辑细节（Ti），那你可能是INTP而不是INTJ。</div><hr class="notion-hr notion-block-30752c4ca1ae81b3b34ffb4143a04d5f"/><div class="notion-text notion-block-30752c4ca1ae817fa934fd6724c501b7">3. 请了解你的人帮忙判断</div><div class="notion-text notion-block-30752c4ca1ae81f78a54cc1fd1ddc2a9">有时候，旁观者清：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8126a6b6e189af175c43"><li>问亲近的朋友：&quot;你觉得我是内向还是外向？&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae814f9008d25526ffcb3d"><li>问同事：&quot;我做决策时更看重逻辑还是人际关系？&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8112a9c8d52f91a890db"><li>观察他人反馈：&quot;大家总说我太理想化&quot;（可能是NF）或&quot;大家总说我太较真&quot;（可能是NT）</li></ul><hr class="notion-hr notion-block-30752c4ca1ae81a38374cdb255d90df8"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8160bbd7dee4731d4065" data-id="30752c4ca1ae8160bbd7dee4731d4065"><span><div id="30752c4ca1ae8160bbd7dee4731d4065" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8160bbd7dee4731d4065" title="测试的局限性"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">测试的局限性</span></span></h4><div class="notion-text notion-block-30752c4ca1ae8193b1a0d2fa707f617e">MBTI测试很有趣，也有参考价值，但请记住：</div><div class="notion-callout notion-blue_background_co notion-block-30752c4ca1ae81a3acf3ebaf2cbcc0c5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💭">💭</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae81e48db0e0b1a4533a6b"><b>MBTI不能决定你的命运，更不能限制你的可能性。</b></div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8168963ce21fec1e7dd6"><li>它不是科学诊断工具（信度和效度在心理学界有争议）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81abbb07d88b8a5afe77"><li>它不能预测成功或失败</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f5a3c4e15aa1c1d841"><li>它不应该成为给人贴标签的借口</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81489798d95be869e3ec"><li>人是复杂的、动态的、不断成长的</li></ul><div class="notion-text notion-block-30752c4ca1ae81198864d0602c763384">MBTI最大的价值是：<b>提供一个框架，帮助你更好地理解自己和他人。</b></div></div></div><div class="notion-text notion-block-30752c4ca1ae81bf8f16f53de4f3bea6">用它来增进自我认知，而不是限制自己。记住，你永远可以突破&quot;类型&quot;的边界，发展任何你想发展的能力。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae81009ee6d32dfbf56d26" data-id="30752c4ca1ae81009ee6d32dfbf56d26"><span><div id="30752c4ca1ae81009ee6d32dfbf56d26" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81009ee6d32dfbf56d26" title="性格类型"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">性格类型</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81cbb646e7e7f04c8775">MBTI的16种类型可以按气质分为4大家族：</div><table class="notion-simple-table notion-block-30752c4ca1ae81da9d5ddae24a12cc66"><tbody><tr class="notion-simple-table-row notion-block-30752c4ca1ae813eaf92fd152166e830"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>气质类型</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>包含类型</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>核心特质</b></div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae8115b590cb6600a9afd0"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>分析家（NT）</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">INTJ, INTP, ENTJ, ENTP</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">理性、创新、战略思维，擅长系统性解决复杂问题</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81bcb62bd2e8af87726a"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>外交家（NF）</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">INFJ, INFP, ENFJ, ENFP</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">理想主义、共情能力强，关注人的成长和意义</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae8186b904f272d1757f48"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>守护者（SJ）</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">ISTJ, ISFJ, ESTJ, ESFJ</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">务实、可靠、重视传统，是社会的稳定基石</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81829e84d13c576a3746"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>探险家（SP）</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">ISTP, ISFP, ESTP, ESFP</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">灵活、行动派、享受当下，擅长应对突发状况</div></td></tr></tbody></table><div class="notion-text notion-block-30752c4ca1ae816b9acddc94d543eea2"><b>举个例子</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8116b8e1d7c2dc2509c7"><li><b>ENFP（外交家）</b>：Ne主导+Fi辅助 → &quot;创意梦想家&quot;，热情洋溢，喜欢探索人生各种可能性，同时坚守内心价值观。典型职业：创意总监、心理咨询师、作家。</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a3a2c4de5470295b41"><li><b>ISTJ（守护者）</b>：Si主导+Te辅助 → &quot;可靠执行者&quot;，注重细节，按部就班，用经验和逻辑保证任务完成。典型职业：会计师、项目经理、质量检测员。</li></ul><div class="notion-text notion-block-30752c4ca1ae81ebb878fbf38efc7c2e"><b>实际应用场景</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81278b3aea04593b7633"><li><b>团队协作</b>：了解队友的认知偏好，合理分工（Ne负责头脑风暴，Te负责执行落地，Fe负责团队氛围）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae813585b2e752ad8d79f2"><li><b>职业发展</b>：选择匹配自己优势功能的职业赛道（Ti用户适合研究岗，Se用户适合需要快速反应的工作）</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f79db0eaba5412ea0e"><li><b>人际沟通</b>：理解对方的决策逻辑（跟Te讲效率数据，跟Fi讲价值意义）</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae816eb94cfe71c697b977" data-id="30752c4ca1ae816eb94cfe71c697b977"><span><div id="30752c4ca1ae816eb94cfe71c697b977" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae816eb94cfe71c697b977" title="16种人格详解"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">16种人格详解</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81e7bcefd99ea5ab8ef6">接下来，让我们深入了解每一种MBTI人格类型。每种类型都有独特的认知功能组合和行为模式。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81038804d7e66646f676" data-id="30752c4ca1ae81038804d7e66646f676"><span><div id="30752c4ca1ae81038804d7e66646f676" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81038804d7e66646f676" title="INTJ - 建筑师"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">INTJ - 建筑师</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81bd8ecddca295886c6f"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Aa52fba67-6524-45f1-bda5-d4c840c77faa%3An6So4ZAH9o20D1.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81bd-8ecd-dca295886c6f&amp;t=30752c4c-a1ae-81bd-8ecd-dca295886c6f" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae816e819dcb89661e290d"><b>认知功能栈</b>：Ni &gt; Te &gt; Fi &gt; Se</div><div class="notion-text notion-block-30752c4ca1ae81d48eacd6c9adab5c6f"><b>核心特质</b>：战略大师，长期规划专家，独立思考者</div><div class="notion-text notion-block-30752c4ca1ae816a8e02df168ed15e50"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae811d8b3bee9ec27843ef"><li>擅长看透系统本质，设计长期战略</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8186bbbffd89ce13e65a"><li>对效率和能力有极高追求</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d7a931f035e1d6d053"><li>独立性强，不随波逐流</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8179a922dd64e5fd7744"><li>对不合逻辑的事物零容忍</li></ul><div class="notion-text notion-block-30752c4ca1ae812cb89ce34f794b9926"><b>口头禅</b>：&quot;这个系统可以优化&quot;、&quot;从长远来看……&quot;</div><div class="notion-text notion-block-30752c4ca1ae81d29d20d8e6659acdfd"><b>适合职业</b>：架构师、战略顾问、科研人员、创业者</div><div class="notion-text notion-block-30752c4ca1ae81adb4f4ea3c52db9bac"><b>成长建议</b>：多关注他人情感需求，避免过于冷酷；培养Se功能，享受当下</div><hr class="notion-hr notion-block-30752c4ca1ae812d9ff1f0de422eac2c"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8167a4c9f9d88f3df9b9" data-id="30752c4ca1ae8167a4c9f9d88f3df9b9"><span><div id="30752c4ca1ae8167a4c9f9d88f3df9b9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8167a4c9f9d88f3df9b9" title="INTP - 逻辑学家"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">INTP - 逻辑学家</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81bea7bbf43088c84ad7"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Abbf27908-7cc1-4012-8cf1-ddd42626e879%3AaLSoJwQH0omXgb.jpeg?table=block&amp;id=30752c4c-a1ae-81be-a7bb-f43088c84ad7&amp;t=30752c4c-a1ae-81be-a7bb-f43088c84ad7" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae8145bcd5c02a5b133661"><b>认知功能栈</b>：Ti &gt; Ne &gt; Si &gt; Fe</div><div class="notion-text notion-block-30752c4ca1ae81da99ffd740e062b466"><b>核心特质</b>：理论建构者，好奇心驱动，追求逻辑完美</div><div class="notion-text notion-block-30752c4ca1ae81158862ff73b66dadaa"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81769c69c7028b4890e0"><li>热爱探索抽象概念和理论模型</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81e0a3a4e347ec876f7b"><li>能从多角度分析问题</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8166ac43f81c362c8e60"><li>思考深度远超表达能力</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae812b8afad63c3758f672"><li>对社交礼仪不太敏感</li></ul><div class="notion-text notion-block-30752c4ca1ae81a9bdbaca2dfa78b15e"><b>口头禅</b>：&quot;理论上来说……&quot;、&quot;这里有个逻辑问题&quot;</div><div class="notion-text notion-block-30752c4ca1ae810d8244de70ceac4c21"><b>适合职业</b>：研究员、程序员、哲学家、数学家</div><div class="notion-text notion-block-30752c4ca1ae819a8529cb8c450c7aec"><b>成长建议</b>：提升执行力，把想法落地；发展Fe，改善人际关系</div><hr class="notion-hr notion-block-30752c4ca1ae81c8986cd82f31b7b59c"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8178965edcddf854936c" data-id="30752c4ca1ae8178965edcddf854936c"><span><div id="30752c4ca1ae8178965edcddf854936c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8178965edcddf854936c" title="ENTJ - 指挥官"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ENTJ - 指挥官</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae8127a87dc09a6b8feb10"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ae7868fb2-316a-4bd1-9c05-8070a2e901df%3A6zSZjqOHq6Lbdd.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-8127-a87d-c09a6b8feb10&amp;t=30752c4c-a1ae-8127-a87d-c09a6b8feb10" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae81f0b3edffaf8cd2fdea"><b>认知功能栈</b>：Te &gt; Ni &gt; Se &gt; Fi</div><div class="notion-text notion-block-30752c4ca1ae818c9d0eda9a3abdc0c4"><b>核心特质</b>：天生领导者，目标驱动，执行力MAX</div><div class="notion-text notion-block-30752c4ca1ae81ad8d7df24fc3fb6dd9"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81319615d812e67cf2ad"><li>快速决策，果断执行</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae815f860cd0f9a9f84d8f"><li>善于组织资源，推动目标达成</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81759e8df8125d57a799"><li>直言不讳，有时显得强势</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f98cb9ec7728a18261"><li>对低效率深恶痛绝</li></ul><div class="notion-text notion-block-30752c4ca1ae810cb6a4c4f0bd87e34c"><b>口头禅</b>：&quot;按计划执行&quot;、&quot;效率第一&quot;</div><div class="notion-text notion-block-30752c4ca1ae81fabf03fe726769ff4d"><b>适合职业</b>：企业高管、项目经理、律师、创业者</div><div class="notion-text notion-block-30752c4ca1ae8131b13bde03644f773c"><b>成长建议</b>：倾听他人意见，避免独断专行；培养同理心</div><hr class="notion-hr notion-block-30752c4ca1ae816cb04eda4ddb74c643"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81099bfdcdb58d3687f6" data-id="30752c4ca1ae81099bfdcdb58d3687f6"><span><div id="30752c4ca1ae81099bfdcdb58d3687f6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81099bfdcdb58d3687f6" title="ENTP - 辩论家"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ENTP - 辩论家</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81b8b2e9f9cf43bab50a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A189c8bc4-b1f4-4503-9bb9-12e7354ba7d6%3ADWS4nwLId3gVQ2.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81b8-b2e9-f9cf43bab50a&amp;t=30752c4c-a1ae-81b8-b2e9-f9cf43bab50a" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae81cfab8fcdd702eb28d3"><b>认知功能栈</b>：Ne &gt; Ti &gt; Fe &gt; Si</div><div class="notion-text notion-block-30752c4ca1ae814a90cdcef046f01487"><b>核心特质</b>：思维体操运动员，创新狂人，天生辩手</div><div class="notion-text notion-block-30752c4ca1ae816396f7e4a3f1ef9a8a"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a6ad4cd70f0c65455e"><li>脑洞无限，能提出各种创意方案</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81b2ba0fc8eb5ff5464c"><li>喜欢智力挑战和辩论</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8109a113e2da5e75d8f1"><li>善于发现系统漏洞和矛盾</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae812abc2ff4ecf7766b9b"><li>容易厌倦重复工作</li></ul><div class="notion-text notion-block-30752c4ca1ae8141a7b5da1e86904b1c"><b>口头禅</b>：&quot;我有个大胆的想法&quot;、&quot;换个角度想……&quot;</div><div class="notion-text notion-block-30752c4ca1ae81cd9cd3f99f3a4c03b7"><b>适合职业</b>：产品经理、咨询顾问、发明家、市场策划</div><div class="notion-text notion-block-30752c4ca1ae81679358f5c97b6aeb36"><b>成长建议</b>：提高执行力，完成已开始的项目；发展Si，注重细节</div><hr class="notion-hr notion-block-30752c4ca1ae8180bd32da6762da760e"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae816db4dcf0d535b31267" data-id="30752c4ca1ae816db4dcf0d535b31267"><span><div id="30752c4ca1ae816db4dcf0d535b31267" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae816db4dcf0d535b31267" title="INFJ - 提倡者"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">INFJ - 提倡者</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81d4b731e2eea1b550f0"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A382c7f25-a7fd-4bc4-a2d9-ecdc2bd7c1e5%3Az2SoP2wHxeJOmV.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81d4-b731-e2eea1b550f0&amp;t=30752c4c-a1ae-81d4-b731-e2eea1b550f0" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae81b98b2bc86801ea45f8"><b>认知功能栈</b>：Ni &gt; Fe &gt; Ti &gt; Se</div><div class="notion-text notion-block-30752c4ca1ae81aca08df270908cad0e"><b>核心特质</b>：神秘的理想主义者，洞察人心，追求意义</div><div class="notion-text notion-block-30752c4ca1ae817081e8e42b68340510"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae813bac70f95aa2b63cf3"><li>对他人情绪和动机有惊人洞察</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81e18d69fe4620bb1e0f"><li>追求深层次的人际连接</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a5a99debd193cdb46a"><li>有强烈的使命感和价值追求</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8142b7adf78baa3546c3"><li>容易为他人的痛苦感同身受</li></ul><div class="notion-text notion-block-30752c4ca1ae81b7bb20d1578f579779"><b>口头禅</b>：&quot;我觉得这件事背后的意义是……&quot;</div><div class="notion-text notion-block-30752c4ca1ae8169b66fcf9f107177e9"><b>适合职业</b>：心理咨询师、作家、教育工作者、社会工作者</div><div class="notion-text notion-block-30752c4ca1ae8134a175d1c175502e23"><b>成长建议</b>：设定边界，避免过度消耗；发展Se，活在当下</div><hr class="notion-hr notion-block-30752c4ca1ae81ab8867e111b8cee9d6"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81b8be12ca5bad530af1" data-id="30752c4ca1ae81b8be12ca5bad530af1"><span><div id="30752c4ca1ae81b8be12ca5bad530af1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81b8be12ca5bad530af1" title="INFP - 调停者"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">INFP - 调停者</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81839a3dedca534662d2"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Afd528dd3-64f3-4b4b-a802-aa6f5b390183%3AM6Sbq2dFBdwaxQ.jpeg?table=block&amp;id=30752c4c-a1ae-8183-9a3d-edca534662d2&amp;t=30752c4c-a1ae-8183-9a3d-edca534662d2" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae8123b8e2d567b26ad059"><b>认知功能栈</b>：Fi &gt; Ne &gt; Si &gt; Te</div><div class="notion-text notion-block-30752c4ca1ae81f68538c6a6785cbf4c"><b>核心特质</b>：价值守护者，真诚艺术家，理想主义追梦人</div><div class="notion-text notion-block-30752c4ca1ae8160b4efecf506243808"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81eaa9b7f597032f120a"><li>内心情感丰富而深刻</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae810d9889c297392d13b0"><li>坚守个人价值观和原则</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81039298ed675f4b1189"><li>富有创造力和想象力</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81bab042e990be0bcd2d"><li>讨厌虚伪和表面化社交</li></ul><div class="notion-text notion-block-30752c4ca1ae8147b2a3ee64d934cb88"><b>口头禅</b>：&quot;这符合我的价值观吗？&quot;</div><div class="notion-text notion-block-30752c4ca1ae81eeb4d8f516b5d6b829"><b>适合职业</b>：作家、艺术家、心理咨询师、非营利组织工作者</div><div class="notion-text notion-block-30752c4ca1ae8141900ade41a182b5e4"><b>成长建议</b>：平衡理想与现实；发展Te，提升组织能力</div><hr class="notion-hr notion-block-30752c4ca1ae81fb886acbdac10908a4"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81c5bdcdc6ce3d5757d9" data-id="30752c4ca1ae81c5bdcdc6ce3d5757d9"><span><div id="30752c4ca1ae81c5bdcdc6ce3d5757d9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81c5bdcdc6ce3d5757d9" title="ENFJ - 主人公"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ENFJ - 主人公</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81b3b59cd34cbca6010c"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A38405575-2f0d-42a0-9394-f42e4ee3631e%3ALySoN78Hq5jJgx.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81b3-b59c-d34cbca6010c&amp;t=30752c4c-a1ae-81b3-b59c-d34cbca6010c" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae818aa5e8c5ae08325daa"><b>认知功能栈</b>：Fe &gt; Ni &gt; Se &gt; Ti</div><div class="notion-text notion-block-30752c4ca1ae8193926ec41037797dec"><b>核心特质</b>：天生导师，魅力领袖，激励他人成长</div><div class="notion-text notion-block-30752c4ca1ae81f0ad0bd946a10352a1"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8169991fd0834938a2b9"><li>善于激发他人潜能</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae815d9bcfd3fcfd77ccb8"><li>对群体氛围敏感，主动营造和谐</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81849f14f4371d88871a"><li>有强烈的责任感和使命感</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae818986eae8a522dbf4b3"><li>容易忽视自己的需求</li></ul><div class="notion-text notion-block-30752c4ca1ae8104aef9f973261fb2c2"><b>口头禅</b>：&quot;我们一起可以做到！&quot;</div><div class="notion-text notion-block-30752c4ca1ae81a8822fe548706f9968"><b>适合职业</b>：教师、HR、培训师、政治家、公关专家</div><div class="notion-text notion-block-30752c4ca1ae81578b4ce3c98aae1468"><b>成长建议</b>：关注自己的需求，学会说不；发展Ti，独立思考</div><hr class="notion-hr notion-block-30752c4ca1ae81b983acc199b8ca5ded"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae810f8057c200b5cd0619" data-id="30752c4ca1ae810f8057c200b5cd0619"><span><div id="30752c4ca1ae810f8057c200b5cd0619" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae810f8057c200b5cd0619" title="ENFP - 竞选者"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ENFP - 竞选者</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81558b54c0af36e245f4"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A33825d48-20c2-4883-8b69-d25ef460b89f%3AYxS4L9qIqdawzG.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-8155-8b54-c0af36e245f4&amp;t=30752c4c-a1ae-8155-8b54-c0af36e245f4" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae811392b2ffb03eda30c2"><b>认知功能栈</b>：Ne &gt; Fi &gt; Te &gt; Si</div><div class="notion-text notion-block-30752c4ca1ae817699cef9339b477c74"><b>核心特质</b>：热情洋溢的梦想家，社交达人，可能性探索者</div><div class="notion-text notion-block-30752c4ca1ae81268030e880ed037c0b"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81abb2a8e99005305a62"><li>充满热情和感染力</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d0b347e5ab1a4e8b28"><li>善于发现人的潜力和闪光点</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d8a5def1c5522b516d"><li>喜欢新鲜体验和多样性</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81008a04fa377e6d10ca"><li>决策时会考虑价值观</li></ul><div class="notion-text notion-block-30752c4ca1ae8154bf81d3b35fa13f8f"><b>口头禅</b>：&quot;这太酷了！我们试试吧！&quot;</div><div class="notion-text notion-block-30752c4ca1ae81e4a6dcc25a524ff6db"><b>适合职业</b>：市场营销、媒体工作者、创意总监、HR</div><div class="notion-text notion-block-30752c4ca1ae815fbfded5550c15070a"><b>成长建议</b>：培养专注力，避免三分钟热度；发展Te，提升执行力</div><hr class="notion-hr notion-block-30752c4ca1ae813891f2e093802f137e"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81f7a620f489e4a3f27c" data-id="30752c4ca1ae81f7a620f489e4a3f27c"><span><div id="30752c4ca1ae81f7a620f489e4a3f27c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81f7a620f489e4a3f27c" title="守护者（SJ）：务实可靠者"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">守护者（SJ）：务实可靠者</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81d58c5ed524216f0efb" data-id="30752c4ca1ae81d58c5ed524216f0efb"><span><div id="30752c4ca1ae81d58c5ed524216f0efb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81d58c5ed524216f0efb" title="ISTJ - 物流师"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ISTJ - 物流师</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81e18684c8a21ec0ff89"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A7077c529-71d6-4f87-859b-223425dc893f%3A4ESq0l2IoN0EmA.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81e1-8684-c8a21ec0ff89&amp;t=30752c4c-a1ae-81e1-8684-c8a21ec0ff89" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae81a48f02d08306f631a3"><b>认知功能栈</b>：Si &gt; Te &gt; Fi &gt; Ne</div><div class="notion-text notion-block-30752c4ca1ae813a9c8ed8dde40f57c3"><b>核心特质</b>：可靠执行者，细节把控专家，传统维护者</div><div class="notion-text notion-block-30752c4ca1ae819da377f42768f9a1f4"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f1892bd6b15befad09"><li>极度负责，言出必行</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae813d9feae5940518bf7b"><li>注重细节和准确性</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a1aabad7031c68da25"><li>遵守规则和流程</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a8914efe73a30fd69b"><li>依赖经验和既定方法</li></ul><div class="notion-text notion-block-30752c4ca1ae81888b6ef9d3760c975a"><b>口头禅</b>：&quot;按照标准流程来&quot;、&quot;以前我们这样做的&quot;</div><div class="notion-text notion-block-30752c4ca1ae81c4b52efe96a77c21f8"><b>适合职业</b>：会计师、审计师、质量管理、行政人员</div><div class="notion-text notion-block-30752c4ca1ae8157a8abe4ad4eaaaac8"><b>成长建议</b>：拥抱变化，尝试新方法；发展Ne，开放思维</div><hr class="notion-hr notion-block-30752c4ca1ae8152a6c4c838d230fd80"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae817b98fec5dcd9ddff54" data-id="30752c4ca1ae817b98fec5dcd9ddff54"><span><div id="30752c4ca1ae817b98fec5dcd9ddff54" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae817b98fec5dcd9ddff54" title="ISFJ - 守卫者"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ISFJ - 守卫者</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae814fb365eaf9ade47125"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Acaafd5ea-57fa-4384-b3f0-4efd32b7c097%3AgVSoq1ZHQoMX50.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-814f-b365-eaf9ade47125&amp;t=30752c4c-a1ae-814f-b365-eaf9ade47125" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae81959fa8e0761edd1fec"><b>认知功能栈</b>：Si &gt; Fe &gt; Ti &gt; Ne</div><div class="notion-text notion-block-30752c4ca1ae81e4bb82c1621851aa66"><b>核心特质</b>：温暖的守护者，细心照顾者，默默付出型</div><div class="notion-text notion-block-30752c4ca1ae81429ebdca108f0bd0dd"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81edb39aeea6c7f74d18"><li>善于照顾他人的实际需求</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae810d962ad89cd8bbab75"><li>记得每个人的喜好和细节</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81479737e72dde02b8b0"><li>忠诚可靠，值得信赖</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81caa25ad1f28ae81ba0"><li>不善于拒绝他人请求</li></ul><div class="notion-text notion-block-30752c4ca1ae8113a41cca1979dd76b4"><b>口头禅</b>：&quot;我来帮你&quot;、&quot;我记得你喜欢……&quot;</div><div class="notion-text notion-block-30752c4ca1ae814993fef6c39d850e71"><b>适合职业</b>：护士、教师、行政助理、社会工作者</div><div class="notion-text notion-block-30752c4ca1ae81edabaede711ded6461"><b>成长建议</b>：学会设定边界，优先照顾自己；培养Ne，接受变化</div><hr class="notion-hr notion-block-30752c4ca1ae81f38923ead394989630"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81fd8030dea84898c1d8" data-id="30752c4ca1ae81fd8030dea84898c1d8"><span><div id="30752c4ca1ae81fd8030dea84898c1d8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81fd8030dea84898c1d8" title="ESTJ - 总经理"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ESTJ - 总经理</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81c38b6dcfa00f969c20"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A45789470-a88c-4c01-ba2e-db3a8a34ffd8%3A2YSb3P6F6ZX8aw.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81c3-8b6d-cfa00f969c20&amp;t=30752c4c-a1ae-81c3-8b6d-cfa00f969c20" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae81ad8341fd89a35de923"><b>认知功能栈</b>：Te &gt; Si &gt; Ne &gt; Fi</div><div class="notion-text notion-block-30752c4ca1ae81aba1bdfac8605edc0e"><b>核心特质</b>：高效管理者，秩序维护者，实干家</div><div class="notion-text notion-block-30752c4ca1ae81dc95f1e6fc6e7c37ef"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8184be14f721afb202af"><li>组织能力强，执行力高</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81b4b84dc2897b98f030"><li>重视规则、制度和传统</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81518680f28e43a0b8a6"><li>直接坦率，有时显得生硬</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8161bb42e989aeff7a0c"><li>对结果和效率有明确追求</li></ul><div class="notion-text notion-block-30752c4ca1ae81bdbf72cdc90ab690a0"><b>口头禅</b>：&quot;按规定办事&quot;、&quot;别拖延，马上做&quot;</div><div class="notion-text notion-block-30752c4ca1ae813eb1bede4035759cf9"><b>适合职业</b>：企业管理者、军官、法官、运营总监</div><div class="notion-text notion-block-30752c4ca1ae8164968be03881e6b430"><b>成长建议</b>：倾听不同意见，灵活应变；发展Fi，关注情感</div><hr class="notion-hr notion-block-30752c4ca1ae81f18ebeeabea6e7c9c9"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81939a8deb8225d72b5a" data-id="30752c4ca1ae81939a8deb8225d72b5a"><span><div id="30752c4ca1ae81939a8deb8225d72b5a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81939a8deb8225d72b5a" title="ESFJ - 执政官"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ESFJ - 执政官</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81b79b3fe91f8c1d3b1c"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A93ecbf60-8a1b-48a7-bd48-392bd8a7a1cc%3AGgS34aQfdGXzly.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81b7-9b3f-e91f8c1d3b1c&amp;t=30752c4c-a1ae-81b7-9b3f-e91f8c1d3b1c" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae810d8e73fdbfbf2a68cd"><b>认知功能栈</b>：Fe &gt; Si &gt; Ne &gt; Ti</div><div class="notion-text notion-block-30752c4ca1ae81aca5e0c29bf259c225"><b>核心特质</b>：社交组织者，传统捍卫者，热心肠</div><div class="notion-text notion-block-30752c4ca1ae81a59baae19caea6cf75"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d08f23cc7b44a87e4a"><li>善于营造温暖和谐的氛围</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81aa902ec843e09ceffb"><li>重视社会规范和礼仪</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8176a145e5920e655c50"><li>喜欢帮助他人，组织活动</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8196a810ff31c9e769fe"><li>在意他人的评价</li></ul><div class="notion-text notion-block-30752c4ca1ae81fc8178d7a8f7578468"><b>口头禅</b>：&quot;大家都还好吗？&quot;、&quot;按惯例应该……&quot;</div><div class="notion-text notion-block-30752c4ca1ae818c8650daadb47aeb0b"><b>适合职业</b>：活动策划、客户服务、护士、教师</div><div class="notion-text notion-block-30752c4ca1ae81fb9218ca18787d5c55"><b>成长建议</b>：减少对他人评价的依赖；发展Ti，独立判断</div><hr class="notion-hr notion-block-30752c4ca1ae81dca231feda78d63a60"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81a68af9dd0f961fc57e" data-id="30752c4ca1ae81a68af9dd0f961fc57e"><span><div id="30752c4ca1ae81a68af9dd0f961fc57e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81a68af9dd0f961fc57e" title="ISTP - 鉴赏家"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ISTP - 鉴赏家</span></span></h4><div class="notion-text notion-block-30752c4ca1ae8196b7eac5931b00e65a"><b>认知功能栈</b>：Ti &gt; Se &gt; Ni &gt; Fe</div><div class="notion-text notion-block-30752c4ca1ae819097f1cc2c22ab997d"><b>核心特质</b>：冷静的问题解决者，动手能力强，工具达人</div><div class="notion-text notion-block-30752c4ca1ae81cc8482e416986d1283"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81729183e281826464a3"><li>擅长拆解和修理各种东西</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8130947df5ab8cd3f9e4"><li>在危机中保持冷静</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81979e84d6a6e0afe5e1"><li>喜欢独立工作，不喜欢被管</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae814abc5dd259c452c5fa"><li>通过实践学习，而非理论</li></ul><div class="notion-text notion-block-30752c4ca1ae81129cbbdbcb73f69589"><b>口头禅</b>：&quot;让我试试&quot;、&quot;这个问题很简单&quot;</div><div class="notion-text notion-block-30752c4ca1ae81579766f8670e839979"><b>适合职业</b>：工程师、机械师、飞行员、运动员</div><div class="notion-text notion-block-30752c4ca1ae816a9cb8c51f3d1a28d6"><b>成长建议</b>：提升沟通表达能力；发展Fe，考虑他人感受</div><hr class="notion-hr notion-block-30752c4ca1ae81a598ccf348c04b9dd2"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8168a015e09a57f17d82" data-id="30752c4ca1ae8168a015e09a57f17d82"><span><div id="30752c4ca1ae8168a015e09a57f17d82" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8168a015e09a57f17d82" title="ISFP - 探险家"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ISFP - 探险家</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae813bb7d6c8361b7f00de"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A593d7b75-2cc8-408b-855d-93d363ac9abc%3A4ESq0l2IoN0EYd.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-813b-b7d6-c8361b7f00de&amp;t=30752c4c-a1ae-813b-b7d6-c8361b7f00de" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae8156a56dfb9451e099d1"><b>认知功能栈</b>：Fi &gt; Se &gt; Ni &gt; Te</div><div class="notion-text notion-block-30752c4ca1ae81de868ce47bafbdd898"><b>核心特质</b>：艺术家气质，温和自由，活在当下</div><div class="notion-text notion-block-30752c4ca1ae81d7b4f9e127d1e18ca7"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae816fbb25fe0e4652a6a0"><li>对美和艺术有敏锐感知</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81af8f0aec261033d0a9"><li>温和友善，但保持独立</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81c4867ec2b0c48584c7"><li>享受感官体验和自然</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81b5b5eaef9abfa9a419"><li>不喜欢冲突和约束</li></ul><div class="notion-text notion-block-30752c4ca1ae81afaa6cd96b34c40ca8"><b>口头禅</b>：&quot;跟着感觉走&quot;、&quot;活在当下&quot;</div><div class="notion-text notion-block-30752c4ca1ae81619483e51bf9feb119"><b>适合职业</b>：艺术家、设计师、厨师、摄影师</div><div class="notion-text notion-block-30752c4ca1ae8135b073cd57c6545cbf"><b>成长建议</b>：发展长期规划能力；培养Te，提升组织性</div><hr class="notion-hr notion-block-30752c4ca1ae81cb845fcacb54b07e9e"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae815fadcbdf52e92f7798" data-id="30752c4ca1ae815fadcbdf52e92f7798"><span><div id="30752c4ca1ae815fadcbdf52e92f7798" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae815fadcbdf52e92f7798" title="ESTP - 企业家"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ESTP - 企业家</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81da8fbfd7c5d558a3ba"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A93b7b66d-7750-43d0-99e7-9cba4c12fffb%3AlGSomQGHxo81N9.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81da-8fbf-d7c5d558a3ba&amp;t=30752c4c-a1ae-81da-8fbf-d7c5d558a3ba" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae81d0ad81fdaa8edf13f8"><b>认知功能栈</b>：Se &gt; Ti &gt; Fe &gt; Ni</div><div class="notion-text notion-block-30752c4ca1ae81b2a2ccc6433873f7a9"><b>核心特质</b>：行动派，风险爱好者，谈判高手</div><div class="notion-text notion-block-30752c4ca1ae8116a6afe6f3215308c4"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8153a3c1cd013db46682"><li>反应迅速，善于抓住机会</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8180b204eb7105b612be"><li>喜欢刺激和冒险</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81c4900eedb776e07a41"><li>务实、直接、不拘小节</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8160b98ec83a905b2c48"><li>善于应对突发状况</li></ul><div class="notion-text notion-block-30752c4ca1ae812dbad4c20822273999"><b>口头禅</b>：&quot;干就完了&quot;、&quot;车到山前必有路&quot;</div><div class="notion-text notion-block-30752c4ca1ae815cade7ff30df9fe16b"><b>适合职业</b>：销售、创业者、急救人员、交易员</div><div class="notion-text notion-block-30752c4ca1ae81008577fb7fb8ff17d1"><b>成长建议</b>：培养长期思维，避免冲动决策；发展Ni，看到后果</div><hr class="notion-hr notion-block-30752c4ca1ae81758a8ec7f0782d8abd"/><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81dfa929ddc323cd33e6" data-id="30752c4ca1ae81dfa929ddc323cd33e6"><span><div id="30752c4ca1ae81dfa929ddc323cd33e6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81dfa929ddc323cd33e6" title="ESFP - 表演者"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ESFP - 表演者</span></span></h4><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae81f88a94c77a3d30bccd"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3Ad9e323a9-a4ad-4311-ac73-28854c89dff6%3A2YSb3P6F6ZX8je.thumb.1000_0.jpeg?table=block&amp;id=30752c4c-a1ae-81f8-8a94-c77a3d30bccd&amp;t=30752c4c-a1ae-81f8-8a94-c77a3d30bccd" alt="notion image" loading="lazy" decoding="async"/></div></figure><div class="notion-text notion-block-30752c4ca1ae815d96c8f7ed1863a259"><b>认知功能栈</b>：Se &gt; Fi &gt; Te &gt; Ni</div><div class="notion-text notion-block-30752c4ca1ae811fb69cfb1a143d84d7"><b>核心特质</b>：派对之星，人群焦点，快乐传播者</div><div class="notion-text notion-block-30752c4ca1ae81bd8003f88306611bdf"><b>典型表现</b>：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a6a184fbf266dcd439"><li>充满活力，感染力强</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8146be94f4d404e520ba"><li>享受当下，活得精彩</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81ddb285f179a553e783"><li>善于娱乐他人，制造欢乐</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8122aaf8d543b9a3f857"><li>不喜欢规划和理论</li></ul><div class="notion-text notion-block-30752c4ca1ae811783dfececb39cb120"><b>口头禅</b>：&quot;人生苦短，及时行乐！&quot;</div><div class="notion-text notion-block-30752c4ca1ae816b8d99fb466cca7b1d"><b>适合职业</b>：演员、主持人、导游、活动策划</div><div class="notion-text notion-block-30752c4ca1ae813ebfc2d709e495248f"><b>成长建议</b>：培养计划能力，考虑长远；发展Ni，看到模式</div><hr class="notion-hr notion-block-30752c4ca1ae81fe9e21f814953bb2f0"/><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae81c5bc5be67288724280" data-id="30752c4ca1ae81c5bc5be67288724280"><span><div id="30752c4ca1ae81c5bc5be67288724280" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81c5bc5be67288724280" title="写在最后"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">写在最后</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81439d8de71c00cad497">荣格八维和MBTI就像是一套&quot;认知操作系统&quot;的说明书。它们不是要给人贴标签，而是帮助我们理解：<b>为什么同一件事，不同人会有完全不同的反应？</b></div><div class="notion-text notion-block-30752c4ca1ae81dab816cf89a8cff8b3">当你下次遇到&quot;难以理解&quot;的人，不妨试着从认知功能的角度去解读：也许他不是故意抬杠，只是Ti在寻求逻辑自洽；也许她不是优柔寡断，只是Fi需要确认决策符合价值观。</div><div class="notion-text notion-block-30752c4ca1ae816d8562e2d878640a1d">理解差异，才能更好地合作。而这，正是这套理论最大的价值。</div><div class="notion-text notion-block-30752c4ca1ae81e4bf1adb7963936144">当然，<b>任何人格测试都只是工具，不是绝对真理</b>。人是复杂的、动态的、不断成长的。MBTI能提供一个框架，但千万别让4个字母限制了你的无限可能。</div><div class="notion-text notion-block-30752c4ca1ae817a87e8ce5ed9980e8f">毕竟，最酷的事情是：<b>你可以了解自己的默认模式，同时选择在需要时突破它</b>。</div><hr class="notion-hr notion-block-30752c4ca1ae81e59ed2d369d2036e1c"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae81faad76e101f80a9773" data-id="30752c4ca1ae81faad76e101f80a9773"><span><div id="30752c4ca1ae81faad76e101f80a9773" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81faad76e101f80a9773" title="我的MBTI"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">我的MBTI</span></span></h2><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30752c4ca1ae805b9483eff92ad58b99"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A4946c5d3-cc2f-4944-aac1-13f88095ead3%3Aimage.png?table=block&amp;id=30752c4c-a1ae-805b-9483-eff92ad58b99&amp;t=30752c4c-a1ae-805b-9483-eff92ad58b99" alt="notion image" loading="lazy" decoding="async"/></div></figure><hr class="notion-hr notion-block-30752c4ca1ae8105a75af24c8657caaa"/><div class="notion-blank notion-block-30752c4ca1ae8169bd41c29926dd2c7c"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae8164a902d511f120ee58" data-id="30752c4ca1ae8164a902d511f120ee58"><span><div id="30752c4ca1ae8164a902d511f120ee58" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8164a902d511f120ee58" title="📎 参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📎 参考文章</span></span></h2><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81b5b258e684beba6990"><li>Jung, C. G. (1921). <em>Psychological Types</em>. (荣格《心理类型》)</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae810db02af3b617d62344"><li>Myers, I. B., &amp; Myers, P. B. (1995). <em>Gifts Differing: Understanding Personality Type</em>.</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae818dbc64cb23480e55c0"><li>16Personalities 官方网站：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.16personalities.com">https://www.16personalities.com</a></li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81c39cc7e78283944ef6"><li>Cognitive Functions 理论详解：<a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://mbti-notes.tumblr.com">https://mbti-notes.tumblr.com</a></li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae805c9a8efd5984faff8c"></ul><div class="notion-callout notion-gray_background_co notion-block-30752c4ca1ae814c88a5da4dc052645b"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae812cacbcda59e19c3454">欢迎您在底部评论区留言，一起交流~</div></div></div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Prompt Engineering 全解析：从核心原理到四大框架的实战攻略]]></title>
            <link>https://www.lucas.hk.cn/article/30752c4c-a1ae-811d-931f-e301936b2d65</link>
            <guid>https://www.lucas.hk.cn/article/30752c4c-a1ae-811d-931f-e301936b2d65</guid>
            <pubDate>Sat, 15 Feb 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[本文系统梳理Prompt Engineering的起源、核心原理（Token机制、温度参数、注意力衰减）、四大主流框架（RICE/RICECO/CRISPE/CO-STAR）横评对比，以及Zero-shot、Few-shot、Chain-of-Thought等实战技巧与避雷指南，最后探讨Multi-Agent协同中的Prompt设计原则与未来演进方向。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-30752c4ca1ae811d931fe301936b2d65"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-30752c4ca1ae81ce875fced14f6e5e40"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🧠">🧠</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae8155bd9dc6629aad1556">你有没有发现，同样一个 AI 模型，有人用它写出惊艳的技术方案，有人只能得到一堆正确的废话？差距往往不在模型本身，而在于你怎么“问”。Prompt Engineering（提示词工程）就是这门“问”的艺术与科学。本文将从原理出发，拆解 RICE、CRISPE、CO-STAR 等主流框架，配合 Zero-shot、Few-shot、Chain-of-Thought 等实战技巧，带你从“能用 AI”进化到“会用 AI”。</div></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae81ceb690f005ad98e659" data-id="30752c4ca1ae81ceb690f005ad98e659"><span><div id="30752c4ca1ae81ceb690f005ad98e659" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81ceb690f005ad98e659" title="什么是Prompt Engineering"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">什么是Prompt Engineering</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae810c97a3c84348ad80b3" data-id="30752c4ca1ae810c97a3c84348ad80b3"><span><div id="30752c4ca1ae810c97a3c84348ad80b3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae810c97a3c84348ad80b3" title="定义与起源"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">定义与起源</span></span></h3><div class="notion-text notion-block-30752c4ca1ae813f8881f05dec5e9acc">你有没有过这种经历——跟AI说&quot;帮我写个方案&quot;，结果它给你一坨不知所云的废话？然后你加了一句&quot;你是一个资深产品经理，请用结构化的方式输出&quot;，瞬间输出质量飙升三个档次？</div><div class="notion-text notion-block-30752c4ca1ae818f8cf6dedfe17be4c6">这个&quot;加戏&quot;的过程，就是 <b>Prompt Engineering（提示词工程）</b> 的雏形。</div><div class="notion-text notion-block-30752c4ca1ae812c8bcde3c6e3d9b91e"><b>Prompt</b> 直译就是&quot;提示&quot;，在AI语境下指的是你输入给语言模型的那段文字。<b>Prompt Engineering</b> 则是一门系统化设计、优化这些输入的技术，目标是让AI更精准、更稳定地输出你想要的结果。</div><div class="notion-callout notion-blue_background_co notion-block-30752c4ca1ae815c8513fdc76cc32775"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="📌">📌</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae81bab366d1234d3aca92"><b>一句话定义：</b> Prompt Engineering 是通过精心设计输入文本，引导大语言模型产出高质量输出的工程化方法。</div></div></div><div class="notion-text notion-block-30752c4ca1ae81b8b6c7ff84b06187dd">这个概念的起源可以追溯到 <b>2020年 GPT-3 发布</b>。当时 OpenAI 发现，同一个模型在不同提示词下表现天差地别——不需要重新训练模型，只需要换个问法，就能解锁完全不同的能力。这个发现直接催生了一个新领域。</div><div class="notion-text notion-block-30752c4ca1ae8129b53ce4a46b8407ad">到了 <b>2022-2023年</b>，随着 ChatGPT 爆火，Prompt Engineering 从学术圈走入大众视野。Google、Anthropic、Meta 等大厂纷纷发布自己的 Prompt 最佳实践指南，&quot;提示词工程师&quot;甚至一度成为硅谷最热门的岗位之一。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae815bb377f621cb38107d" data-id="30752c4ca1ae815bb377f621cb38107d"><span><div id="30752c4ca1ae815bb377f621cb38107d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae815bb377f621cb38107d" title="为什么需要Prompt Engineering"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">为什么需要Prompt Engineering</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81ff99bad23928fdab5f">你可能会想：AI不是很聪明吗？我随便说一句它不就懂了？</div><div class="notion-text notion-block-30752c4ca1ae81089a26d6319903b017">还真不是。大语言模型本质上是一个<b>概率预测机器</b>——它在猜你&quot;下一个最可能想看到的词&quot;是什么。你的输入越模糊，它猜的方向就越发散；你的输入越精准，它的输出就越聚焦。</div><div class="notion-text notion-block-30752c4ca1ae81ebad3ac00901688247">举个例子：</div><table class="notion-simple-table notion-block-30752c4ca1ae818f9dfced98af6c1597"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30752c4ca1ae8198aa9ecff6320cc2e2"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>提示词</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>输出质量</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>问题</b></div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae818fbca5fee64503a187"><td class="" style="width:120px"><div class="notion-simple-table-cell">帮我写篇文章</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">主题不明、风格不定、长度随缘</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae810ebc1fc098e11a22e7"><td class="" style="width:120px"><div class="notion-simple-table-cell">写一篇关于K8s的技术博客</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐⭐</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">有方向了，但深度和结构不可控</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81919b60c31ba6e66c23"><td class="" style="width:120px"><div class="notion-simple-table-cell">你是资深DevOps工程师，写一篇面向初学者的K8s入门博客，包含核心概念、架构图和实战案例，风格幽默易懂，2000字左右</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐⭐⭐⭐</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">精准命中需求</div></td></tr></tbody></table><div class="notion-text notion-block-30752c4ca1ae8170bb43f3ca83173447">同一个模型，三种问法，三种人生。</div><div class="notion-text notion-block-30752c4ca1ae810a95d4c6912d35a5fc">Prompt Engineering 的核心价值在于：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae814e915aefd3291cbccd"><li><b>降低沟通成本</b> — 一次写对，不用反复&quot;调教&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8130a3d3dcfb75e0650b"><li><b>提升输出稳定性</b> — 减少AI的&quot;幻觉&quot;和跑偏</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a5b272f176a612e1e8"><li><b>解锁隐藏能力</b> — 很多模型能力只有通过特定Prompt才能触发</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81e68fa4c95b64fab745"><li><b>节约Token费用</b> — 精准的Prompt = 更少的来回 = 更低的API调用成本</li></ul><hr class="notion-hr notion-block-30752c4ca1ae81058bf6fa3bb8072944"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae81e98dc4c856e5285201" data-id="30752c4ca1ae81e98dc4c856e5285201"><span><div id="30752c4ca1ae81e98dc4c856e5285201" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81e98dc4c856e5285201" title="Prompt Engineering的核心原理"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Prompt Engineering的核心原理</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae81ab9b76fdb47ff1b311" data-id="30752c4ca1ae81ab9b76fdb47ff1b311"><span><div id="30752c4ca1ae81ab9b76fdb47ff1b311" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81ab9b76fdb47ff1b311" title="语言模型如何理解提示词"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">语言模型如何理解提示词</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81df82b0cc50c1d0b57b">要写好Prompt，你得先搞清楚对面坐的&quot;这位同事&quot;是怎么工作的。</div><div class="notion-text notion-block-30752c4ca1ae81738757e15c62b26272">大语言模型（LLM）并不&quot;理解&quot;语言——它做的事情本质上是<b>统计学上的模式匹配</b>。当你输入一段文字，模型会：</div><ol start="1" class="notion-list notion-list-numbered notion-block-30752c4ca1ae812c8b2ec78e03a3a334" style="list-style-type:decimal"><li><b>分词（Tokenization）</b> — 把你的文字拆成一个个Token</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-30752c4ca1ae81968ffadadad04ed723" style="list-style-type:decimal"><li><b>编码（Encoding）</b> — 将Token转换为高维向量</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-30752c4ca1ae81528cfbe972816d02a9" style="list-style-type:decimal"><li><b>注意力计算（Attention）</b> — 通过Transformer架构分析Token之间的关系</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-30752c4ca1ae818993a6e28a0d381174" style="list-style-type:decimal"><li><b>概率预测（Prediction）</b> — 计算下一个Token出现的概率分布</li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-30752c4ca1ae813da0ece6a72563ee07" style="list-style-type:decimal"><li><b>采样输出（Sampling）</b> — 根据概率分布选择下一个Token</li></ol><div class="notion-callout notion-yellow_background_co notion-block-30752c4ca1ae814a8face7541951c25c"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae818ea1f0e3f11a639fe4"><b>关键洞察：</b> 模型并不是在&quot;思考你的问题&quot;，而是在&quot;预测你最可能想看到的回答&quot;。所以Prompt的核心技巧就是——<b>让模型的预测方向和你的期望方向对齐</b>。</div></div></div><div class="notion-text notion-block-30752c4ca1ae81489bedd3b59e34df94">这就解释了为什么&quot;你是一个资深工程师&quot;这种角色设定有效——它激活了模型在训练数据中学到的&quot;资深工程师的语言模式&quot;，让后续输出更符合这个角色的风格和深度。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae810aa433fc65996cdb3d" data-id="30752c4ca1ae810aa433fc65996cdb3d"><span><div id="30752c4ca1ae810aa433fc65996cdb3d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae810aa433fc65996cdb3d" title="上下文窗口与Token机制"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">上下文窗口与Token机制</span></span></h3><div class="notion-text notion-block-30752c4ca1ae8110a700d4c926cd78b9"><b>上下文窗口（Context Window）</b> 是模型一次能&quot;看到&quot;的文本长度上限，以Token为单位。</div><table class="notion-simple-table notion-block-30752c4ca1ae819d8be9e544e247d266"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30752c4ca1ae8187960bf0d380b15b31"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>模型</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>上下文窗口</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>约等于</b></div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81ebbde9f405cba98bcd"><td class="" style="width:120px"><div class="notion-simple-table-cell">GPT-3.5</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">4K / 16K tokens</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">约 3,000 / 12,000 中文字</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae816f9c90f6851b8eee14"><td class="" style="width:120px"><div class="notion-simple-table-cell">GPT-4o</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">128K tokens</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">约 96,000 中文字</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae8127b730db5400dead94"><td class="" style="width:120px"><div class="notion-simple-table-cell">Claude 3.5</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">200K tokens</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">约 150,000 中文字</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81c89741e13ef1b1d2aa"><td class="" style="width:120px"><div class="notion-simple-table-cell">Gemini 1.5 Pro</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">1M tokens</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">约 750,000 中文字</div></td></tr></tbody></table><div class="notion-text notion-block-30752c4ca1ae8193bb90d728f7b39bed">几个实用要点：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae813ab02de4dd123181ee"><li><b>中文比英文更&quot;贵&quot;</b> — 一个中文字通常需要 1.5-2 个Token，英文单词约 1-1.5 个Token</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae819ea9f3f66cd1874449"><li><b>输入+输出共享窗口</b> — 你的Prompt越长，留给模型回答的空间就越小</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8133a6f0ed9b864edbf0"><li><b>注意力衰减</b> — 虽然窗口很大，但模型对中间部分的&quot;注意力&quot;往往弱于开头和结尾（Lost in the Middle 现象）</li></ul><div class="notion-callout notion-orange_background_co notion-block-30752c4ca1ae811797effb21a7ab5c9d"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="⚠️">⚠️</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae81bcbe87e27d1feede47"><b>实战建议：</b> 把最关键的指令放在Prompt的<b>开头</b>和<b>结尾</b>，中间放补充上下文。这能最大化模型对关键信息的注意力。</div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae8187b8f2ddc6f7d9146b" data-id="30752c4ca1ae8187b8f2ddc6f7d9146b"><span><div id="30752c4ca1ae8187b8f2ddc6f7d9146b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8187b8f2ddc6f7d9146b" title="温度参数与输出控制"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">温度参数与输出控制</span></span></h3><div class="notion-text notion-block-30752c4ca1ae814e8918d646b0197868"><b>Temperature（温度）</b> 是控制模型输出&quot;创造力&quot;的关键参数，取值范围通常在 0-2 之间。</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae817e98a7fae9ec8ee07f"><li><b>Temperature = 0</b> — 输出最确定、最保守，每次运行结果几乎一致。适合写代码、做数据分析</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae816abb06e72609314624"><li><b>Temperature = 0.7</b> — 平衡模式，兼顾创意和准确性。适合写文章、做翻译</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae819b8114eac690dcc35d"><li><b>Temperature = 1.5+</b> — 脑洞大开模式，输出更随机、更有创意。适合头脑风暴、创意写作</li></ul><div class="notion-text notion-block-30752c4ca1ae81bf80fbeadc3cc82f7d">除了温度，还有两个常用参数：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81898071cb6d0234eca8"><li><b>Top-P（核采样）</b> — 只从概率最高的前P%的Token中采样。Top-P = 0.9 意味着排除掉概率最低的10%选项</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f0983bc5bc44ec2f93"><li><b>Max Tokens</b> — 限制输出的最大长度</li></ul><div class="notion-callout notion-teal_background_co notion-block-30752c4ca1ae816d8832cf8855ca7b10"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🎯">🎯</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae81b39504f62189c7ccb9"><b>参数搭配速查：</b>
代码生成 → Temperature: 0, Top-P: 0.95
技术文档 → Temperature: 0.3, Top-P: 0.9
博客文章 → Temperature: 0.7, Top-P: 0.95
创意写作 → Temperature: 1.0, Top-P: 1.0</div></div></div><hr class="notion-hr notion-block-30752c4ca1ae81d694c4e9d6acd95ecd"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae8186b2f2d09a9be4b6b4" data-id="30752c4ca1ae8186b2f2d09a9be4b6b4"><span><div id="30752c4ca1ae8186b2f2d09a9be4b6b4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8186b2f2d09a9be4b6b4" title="Prompt的黄金结构"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Prompt的黄金结构</span></span></h2><div class="notion-text notion-block-30752c4ca1ae8156a3b4c097e88f9f36">写Prompt和写代码一样——没有框架的代码能跑，但有框架的代码更好维护、更可复用。下面介绍几个主流的Prompt结构框架。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae816d9595d95540f5b2ee" data-id="30752c4ca1ae816d9595d95540f5b2ee"><span><div id="30752c4ca1ae816d9595d95540f5b2ee" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae816d9595d95540f5b2ee" title="RICE / RICECO 框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">RICE / RICECO 框架</span></span></h3><div class="notion-text notion-block-30752c4ca1ae812183edf39e6eefacc6"><b>RICE</b> 是最简洁实用的入门框架，四个字母代表四个核心要素：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8112a7dfc3dd4283a589"><li><b>R — Role（角色）</b> ：定义AI扮演的身份</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81fc9fe6cc74acb706e4"><li><b>I — Instruction（指令）</b> ：明确具体任务</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae819bb449c2ab96f016a9"><li><b>C — Context（上下文）</b> ：提供背景信息</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8163b93ac271498c13d3"><li><b>E — Examples（示例）</b> ：给出期望的输出样例</li></ul><div class="notion-text notion-block-30752c4ca1ae81269cd8fd17cd461316">扩展版 <b>RICECO</b> 在此基础上增加了两个维度：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8141b8c0d76a727d875f"><li><b>C — Constraints（约束）</b> ：限制条件，比如&quot;不超过500字&quot;、&quot;不要使用专业术语&quot;</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81af9b8df08a64b095ed"><li><b>O — Output Format（输出格式）</b> ：指定输出结构，比如&quot;用Markdown表格&quot;、&quot;用JSON格式&quot;</li></ul><div class="notion-text notion-block-30752c4ca1ae8176b721f4fe555b7dd1"><b>实战示例：</b></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae8165be27cfa5001bba7a" data-id="30752c4ca1ae8165be27cfa5001bba7a"><span><div id="30752c4ca1ae8165be27cfa5001bba7a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8165be27cfa5001bba7a" title="CRISPE 框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">CRISPE 框架</span></span></h3><div class="notion-text notion-block-30752c4ca1ae8147b5e5d0c3e38e70be"><b>CRISPE</b> 更适合需要深度输出的复杂场景：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8139aef9c3c7c25c05cc"><li><b>C — Capacity（能力）</b> ：AI应具备的专业能力</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81849c59fc47503bd596"><li><b>R — Role（角色）</b> ：扮演的身份</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae815faa14e989cf54c699"><li><b>I — Insight（洞察）</b> ：你掌握的背景知识或数据</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae818da1ace826ae77e5b3"><li><b>S — Statement（声明）</b> ：具体要完成的任务</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae817d83b0c9371831df5e"><li><b>P — Personality（个性）</b> ：输出的风格和语气</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f28aafe1d55f3ef047"><li><b>E — Experiment（实验）</b> ：要求多个方案供选择</li></ul><div class="notion-text notion-block-30752c4ca1ae817db0c0eadd85008b6b"><b>实战示例：</b></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae811ca528dd9360e9dd3c" data-id="30752c4ca1ae811ca528dd9360e9dd3c"><span><div id="30752c4ca1ae811ca528dd9360e9dd3c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae811ca528dd9360e9dd3c" title="CO-STAR 框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">CO-STAR 框架</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81168a1bfdde2b5eca3a"><b>CO-STAR</b> 由新加坡GovTech团队提出，在结构化程度上更胜一筹：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d19c7edb77f674acdd"><li><b>C — Context（背景）</b> ：任务的背景信息</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81d7aea9ed232e3c5b60"><li><b>O — Objective（目标）</b> ：你希望AI完成什么</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f3b1a5ce9ac5daaf8a"><li><b>S — Style（风格）</b> ：写作风格或参考对象</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a3bdc0f7f018aa6dd0"><li><b>T — Tone（语气）</b> ：正式/轻松/幽默等</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81298877d64b2232c790"><li><b>A — Audience（受众）</b> ：目标读者是谁</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81af8312c993bb214dd5"><li><b>R — Response Format（响应格式）</b> ：输出的格式要求</li></ul><div class="notion-text notion-block-30752c4ca1ae816299e5ebcda3708cc5"><b>实战示例：</b></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae81b3b8b3dfddf90c11e8" data-id="30752c4ca1ae81b3b8b3dfddf90c11e8"><span><div id="30752c4ca1ae81b3b8b3dfddf90c11e8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81b3b8b3dfddf90c11e8" title="框架横评对比"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">框架横评对比</span></span></h3><table class="notion-simple-table notion-block-30752c4ca1ae816ea793cdb0345fe9f2"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30752c4ca1ae81fca2cdd078b51ce8ca"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>框架</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>核心要素</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>适用场景</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>复杂度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>特点</b></div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81c4a302c2782864d8d9"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>RICE</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">角色+指令+上下文+示例</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">日常对话、快速任务</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">简洁万能，入门首选</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81b09424e31c6bbc9eff"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>RICECO</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">RICE+约束+输出格式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">需要精确控制输出的任务</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐⭐</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">RICE的增强版，更可控</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae8121b966e5d2fac30cb3"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>CRISPE</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">能力+角色+洞察+声明+个性+实验</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">复杂技术方案、深度分析</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐⭐⭐</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">强调多方案对比</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81ac98d4c166a1265b11"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>CO-STAR</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">背景+目标+风格+语气+受众+格式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">内容创作、文档写作</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐⭐⭐</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">对受众和风格拆分最细</div></td></tr></tbody></table><div class="notion-callout notion-yellow_background_co notion-block-30752c4ca1ae815d9e24e752133862ea"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae812fa8e9d233c0b9336a"><b>选择建议：</b> 没必要死记硬背所有框架。日常用 <b>RICE</b> 就够了，写长文或做技术方案时切换到 <b>CO-STAR</b> 或 <b>CRISPE</b>。框架是工具，不是枷锁。</div></div></div><hr class="notion-hr notion-block-30752c4ca1ae81a99e79df9e47fffe64"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae8102a46ec1e396366948" data-id="30752c4ca1ae8102a46ec1e396366948"><span><div id="30752c4ca1ae8102a46ec1e396366948" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8102a46ec1e396366948" title="Prompt Engineering实战技巧"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Prompt Engineering实战技巧</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae81808558fbe88f10b1c7" data-id="30752c4ca1ae81808558fbe88f10b1c7"><span><div id="30752c4ca1ae81808558fbe88f10b1c7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81808558fbe88f10b1c7" title="Zero-shot vs Few-shot"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Zero-shot vs Few-shot</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81a29646ded6a5205834">这是Prompt Engineering中最基础也最重要的两个策略。</div><div class="notion-text notion-block-30752c4ca1ae815eb189f9d0e2b847b4"><b>Zero-shot（零样本）</b> — 不给任何示例，直接让模型完成任务：</div><div class="notion-text notion-block-30752c4ca1ae81f99ea5d1be485855ac"><b>Few-shot（少样本）</b> — 先给几个输入输出的示例，再让模型处理新输入：</div><div class="notion-text notion-block-30752c4ca1ae81fca788dc6330450865">Few-shot 的输出质量通常更高，因为示例帮模型&quot;校准&quot;了输出风格和格式。</div><table class="notion-simple-table notion-block-30752c4ca1ae818dbdfbf48442bcc239"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30752c4ca1ae81948696e497367f127e"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>策略</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>优点</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>缺点</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>适用场景</b></div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81ea8697c7592f715d9f"><td class="" style="width:120px"><div class="notion-simple-table-cell">Zero-shot</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">省Token、快速</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">输出格式不可控</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">简单任务、模型能力足够时</div></td></tr><tr class="notion-simple-table-row notion-block-30752c4ca1ae81e587abfbe87c24cc27"><td class="" style="width:120px"><div class="notion-simple-table-cell">Few-shot</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">输出更稳定、格式可控</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">消耗更多Token</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">格式要求严格、风格需统一</div></td></tr></tbody></table><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae816da778d538de28d58f" data-id="30752c4ca1ae816da778d538de28d58f"><span><div id="30752c4ca1ae816da778d538de28d58f" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae816da778d538de28d58f" title="Chain-of-Thought（思维链）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Chain-of-Thought（思维链）</span></span></h3><div class="notion-text notion-block-30752c4ca1ae8179a0b2c4547ad92d8f"><b>CoT（Chain-of-Thought）</b> 是2022年Google提出的技术，核心思路是：<b>让模型&quot;说出&quot;推理过程，而不是直接给答案。</b></div><div class="notion-text notion-block-30752c4ca1ae8196a62dd3dbe3029290">普通Prompt：</div><div class="notion-text notion-block-30752c4ca1ae8189a4c7e3cdb9cc175a">CoT Prompt：</div><div class="notion-text notion-block-30752c4ca1ae81a2ae63cf6689444cba">仅仅加了一句&quot;请一步步推理&quot;，模型就会展开中间步骤：</div><blockquote class="notion-quote notion-block-30752c4ca1ae819c9607f03baebeb8bc"><div><em>第一步：计算苹果费用 = 3 × 5 = 15元</em></div></blockquote><blockquote class="notion-quote notion-block-30752c4ca1ae8187aec8e3e0ee5b042b"><div><em>第二步：计算橙子费用 = 8 × 2 = 16元</em></div></blockquote><blockquote class="notion-quote notion-block-30752c4ca1ae81c0ae32df14d47930eb"><div><em>第三步：总费用 = 15 + 16 = 31元</em></div></blockquote><div class="notion-text notion-block-30752c4ca1ae8105b136cdd752f5e0ee">这个技巧在<b>数学推理、逻辑分析、代码调试</b>等需要多步骤推理的场景中效果显著。</div><div class="notion-text notion-block-30752c4ca1ae8196926ed5a160448264">CoT 的变体还有：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8112957ee7e898941df9"><li><b>Zero-shot CoT</b> — 只加&quot;Let&#x27;s think step by step&quot;就能激活推理能力</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81f2b8b0e208ef7de2e6"><li><b>Self-Consistency</b> — 让模型用CoT生成多个推理路径，取多数一致的答案</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae811bb3defd5e2c9b75a5"><li><b>Tree-of-Thought（ToT）</b> — 多分支探索+回溯评估，适合复杂决策问题</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae813496fbe231138e081b" data-id="30752c4ca1ae813496fbe231138e081b"><span><div id="30752c4ca1ae813496fbe231138e081b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae813496fbe231138e081b" title="提示词迭代优化流程"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">提示词迭代优化流程</span></span></h3><div class="notion-text notion-block-30752c4ca1ae811d8e80cf4e7307a7a7">写Prompt不是一次性的事，而是一个<b>迭代优化</b>的过程。推荐以下工作流：</div><div class="notion-text notion-block-30752c4ca1ae81388f7ed016b1808759"><b>每一步的关键动作：</b></div><ol start="1" class="notion-list notion-list-numbered notion-block-30752c4ca1ae81189dddcd70adac2f81" style="list-style-type:decimal"><li><b>明确目标</b> — 在写Prompt之前，先用一句话说清楚&quot;我到底要什么&quot;</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-30752c4ca1ae81cb8afffd966e0b2969" style="list-style-type:decimal"><li><b>初版Prompt</b> — 用RICE框架快速搭建第一版</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-30752c4ca1ae81df9f64dd9d9ef9ce92" style="list-style-type:decimal"><li><b>测试输出</b> — 运行3-5次，观察输出的稳定性</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-30752c4ca1ae81e5a9e4c847abf3fb75" style="list-style-type:decimal"><li><b>分析问题</b> — 输出跑偏了？格式不对？太浅了？太长了？</li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-30752c4ca1ae811ea0a7fc9c4b7e7803" style="list-style-type:decimal"><li><b>调整Prompt</b> — 针对性修改：加约束、加示例、换角色、调温度</li></ol><ol start="6" class="notion-list notion-list-numbered notion-block-30752c4ca1ae81d697dacd2989f72a77" style="list-style-type:decimal"><li><b>固化模板</b> — 效果稳定后，存为可复用的Prompt模板</li></ol><div class="notion-callout notion-purple_background_co notion-block-30752c4ca1ae813189dce08756b7476c"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🔑">🔑</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae8168bec4cdcb537871e6"><b>迭代核心原则：</b> 每次只改一个变量。如果同时改了角色、加了示例、又调了温度，你就无法判断是哪个改动起了作用。</div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae81d39b77ce8564e0497e" data-id="30752c4ca1ae81d39b77ce8564e0497e"><span><div id="30752c4ca1ae81d39b77ce8564e0497e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81d39b77ce8564e0497e" title="常见坑点与避雷指南"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">常见坑点与避雷指南</span></span></h3><div class="notion-text notion-block-30752c4ca1ae817e8d96e8845cf86c31">踩过的坑比读过的论文多，这里总结几个最常见的翻车现场：</div><div class="notion-text notion-block-30752c4ca1ae81daa87bffedd9fff003"><b>❌ 坑1：指令太模糊</b></div><div class="notion-text notion-block-30752c4ca1ae8109abcef930c67199d0"><b>❌ 坑2：上下文过载</b></div><div class="notion-text notion-block-30752c4ca1ae81dcbf7feeb7c56e8c0a">把整个项目文档丢给AI，期望它自动提炼重点。结果？模型被淹没在信息海洋里，输出反而更差。</div><div class="notion-text notion-block-30752c4ca1ae81ca9f7ccb0fac739f00"><b>✅ 解法：</b> 只提供与当前任务直接相关的上下文，其他信息用一句话概括。</div><div class="notion-text notion-block-30752c4ca1ae81968ac6fa8f86cecdde"><b>❌ 坑3：否定式指令</b></div><div class="notion-text notion-block-30752c4ca1ae815a9ac1ce0169496474">模型对&quot;不要做什么&quot;的理解远不如&quot;要做什么&quot;精准。</div><div class="notion-text notion-block-30752c4ca1ae81f2a627c148d52b1927"><b>❌ 坑4：期望模型有实时信息</b></div><div class="notion-text notion-block-30752c4ca1ae811aa832ff19a90aaa20">模型的训练数据有截止日期。问它&quot;今天天气怎么样&quot;或&quot;最新的K8s版本是什么&quot;，大概率得到过时信息。需要实时信息时，应该结合搜索工具或RAG架构。</div><hr class="notion-hr notion-block-30752c4ca1ae8171b91cd82791705535"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae81598921c3c3e78f574a" data-id="30752c4ca1ae81598921c3c3e78f574a"><span><div id="30752c4ca1ae81598921c3c3e78f574a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81598921c3c3e78f574a" title="进阶应用场景"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">进阶应用场景</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae819c90fdd50e6e611c3c" data-id="30752c4ca1ae819c90fdd50e6e611c3c"><span><div id="30752c4ca1ae819c90fdd50e6e611c3c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae819c90fdd50e6e611c3c" title="日常工作中的Prompt实战"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">日常工作中的Prompt实战</span></span></h3><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81b1a44df174865f5fe0" data-id="30752c4ca1ae81b1a44df174865f5fe0"><span><div id="30752c4ca1ae81b1a44df174865f5fe0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81b1a44df174865f5fe0" title="代码生成与Review"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">代码生成与Review</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae814ab6a3e29ca67372a7" data-id="30752c4ca1ae814ab6a3e29ca67372a7"><span><div id="30752c4ca1ae814ab6a3e29ca67372a7" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae814ab6a3e29ca67372a7" title="技术文档撰写"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">技术文档撰写</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae8144b460feb292d80551" data-id="30752c4ca1ae8144b460feb292d80551"><span><div id="30752c4ca1ae8144b460feb292d80551" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8144b460feb292d80551" title="数据分析与报表"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">数据分析与报表</span></span></h4><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30752c4ca1ae813d9093ef69801be675" data-id="30752c4ca1ae813d9093ef69801be675"><span><div id="30752c4ca1ae813d9093ef69801be675" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae813d9093ef69801be675" title="Multi-Agent协同中的Prompt设计"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Multi-Agent协同中的Prompt设计</span></span></h3><div class="notion-text notion-block-30752c4ca1ae81788dbfec7c73ea071e">在Multi-Agent架构中，Prompt的作用从&quot;指导一个模型&quot;升级为&quot;协调多个Agent&quot;。每个Agent都需要精心设计的<b>System Prompt</b>来定义它的职责边界。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81d495fde9dbe941fc54" data-id="30752c4ca1ae81d495fde9dbe941fc54"><span><div id="30752c4ca1ae81d495fde9dbe941fc54" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81d495fde9dbe941fc54" title="Agent角色定义示例"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Agent角色定义示例</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30752c4ca1ae81af97d7c30a197d2bcf" data-id="30752c4ca1ae81af97d7c30a197d2bcf"><span><div id="30752c4ca1ae81af97d7c30a197d2bcf" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae81af97d7c30a197d2bcf" title="关键设计原则"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">关键设计原则</span></span></h4><div class="notion-callout notion-blue_background_co notion-block-30752c4ca1ae81a3a0a5c0e428c86554"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🏗️">🏗️</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae815d8c18e2d6d8034fc9"><b>Multi-Agent Prompt 设计四原则：</b>
<b>1. 职责单一</b> — 每个Agent只做一件事，避免&quot;全能Agent&quot;
<b>2. 边界清晰</b> — 明确定义什么该做、什么不该做
<b>3. 通信协议</b> — 统一Agent之间的输入输出格式（推荐JSON）
<b>4. 失败回退</b> — 定义异常情况下的处理策略</div></div></div><div class="notion-text notion-block-30752c4ca1ae81d98328d93ecbfd9968">这部分和 ReAct、DAG工作流等Agent编排范式密切相关，更深入的讨论可以参考 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.notion.so/30630b12a8b4809a87d7c16513ad37b1">为什么AI框架这么多？拆解Agent编排的五种流派</a>。</div><hr class="notion-hr notion-block-30752c4ca1ae8143b52ece76f055cc44"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae8118b88dc0f405c1e9fd" data-id="30752c4ca1ae8118b88dc0f405c1e9fd"><span><div id="30752c4ca1ae8118b88dc0f405c1e9fd" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8118b88dc0f405c1e9fd" title="总结与展望"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">总结与展望</span></span></h2><div class="notion-text notion-block-30752c4ca1ae81c7bc9fffb2b91299f2">Prompt Engineering 是当下与AI协作最核心的技能。回顾全文要点：</div><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81498429c60cc1ca3156"><li><b>核心原理</b> — 模型在做概率预测，Prompt的本质是引导预测方向</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81c89d38ca1dd716d800"><li><b>结构框架</b> — RICE入门够用，CO-STAR/CRISPE应对复杂场景</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae8169b610c3164baa383c"><li><b>实战技巧</b> — Few-shot提升稳定性，CoT激活推理能力，迭代优化是关键</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81e79bdaf36ffb58f42b"><li><b>进阶应用</b> — 从单模型Prompt到Multi-Agent协同，Prompt设计的复杂度在升级</li></ul><div class="notion-text notion-block-30752c4ca1ae81d2a440feb86659b834">展望未来，Prompt Engineering 正在经历一个有趣的悖论：</div><div class="notion-text notion-block-30752c4ca1ae816499cef34f0a9d601b">一方面，模型越来越智能，&quot;理解能力&quot;越来越强，简单的自然语言就能完成复杂任务。另一方面，Agent、RAG、Tool Use等新范式的涌现，让Prompt的设计空间反而在<b>扩大</b>——你不再只是写一段话给模型，而是在设计一整套&quot;AI协作系统&quot;的通信协议。</div><div class="notion-text notion-block-30752c4ca1ae81b8bd2cc3fb6433ed5b">所以，Prompt Engineering不会消失，它只是在<b>进化</b>。从&quot;写好一句话&quot;进化到&quot;设计好一个系统&quot;。</div><div class="notion-text notion-block-30752c4ca1ae81cc9c26fff6002a7748">掌握这门技能，就是掌握了与AI时代对话的语言。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30752c4ca1ae8189b07ac8f3c721c15c" data-id="30752c4ca1ae8189b07ac8f3c721c15c"><span><div id="30752c4ca1ae8189b07ac8f3c721c15c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30752c4ca1ae8189b07ac8f3c721c15c" title="📎 参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">📎 参考文章</span></span></h2><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81a0b1d9ea6a6fad6c86"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.promptingguide.ai/">Prompt Engineering Guide</a> — 最全面的Prompt工程指南</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81218610e572594e3881"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://platform.openai.com/docs/guides/prompt-engineering">OpenAI Prompt Engineering Best Practices</a> — OpenAI官方最佳实践</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81b3a946f7a42cd64501"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://arxiv.org/abs/2201.11903">Chain-of-Thought Prompting（Google Research）</a> — CoT原始论文</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae817c9523e1c0a57ad49c"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.notion.so/30630b12a8b4809a87d7c16513ad37b1">CO-STAR Framework（GovTech Singapore）</a> — CO-STAR框架详解</li></ul><ul class="notion-list notion-list-disc notion-block-30752c4ca1ae81febb31ca312bfbf9e1"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.aifire.co/p/the-riceco-prompting-framework-a-guide-to-a-better-ai-prompt">RICECO Prompting Framework</a> — RICECO框架指南</li></ul><div class="notion-blank notion-block-30752c4ca1ae81b89634c6458a2a8ac1"> </div><div class="notion-callout notion-gray_background_co notion-block-30752c4ca1ae8108835dfbd0dbe0c61a"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30752c4ca1ae816cb4a8d20d1e60b189">欢迎您在底部评论区留言，一起交流~</div></div></div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pentaho 8.3 资源库迁移：PostgreSQL → MySQL 实战配置指南]]></title>
            <link>https://www.lucas.hk.cn/article/30052c4c-a1ae-81df-8fb5-da9ee54af359</link>
            <guid>https://www.lucas.hk.cn/article/30052c4c-a1ae-81df-8fb5-da9ee54af359</guid>
            <pubDate>Wed, 31 Mar 2021 00:00:00 GMT</pubDate>
            <description><![CDATA[以 Pentaho 8.3 为例，演示如何将默认的 PostgreSQL 资源库迁移到 MySQL：包含脚本导入、驱动放置，以及 security、hibernate、quartz、JNDI、Tomcat 与 Jackrabbit 等关键配置文件的修改清单与核对表。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-30052c4ca1ae81df8fb5da9ee54af359"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><figure class="notion-asset-wrapper notion-asset-wrapper-image notion-block-30052c4ca1ae810c9f8eef0ab716c19a"><div style="position:relative;display:flex;justify-content:center;align-self:center;width:100%;max-width:100%;flex-direction:column;height:100%"><img style="object-fit:cover" src="https://www.notion.so/image/attachment%3A4ee44e49-13a7-430a-81d1-4f05ef5a34bc%3A1.jfif?table=block&amp;id=30052c4c-a1ae-810c-9f8e-ef0ab716c19a&amp;t=30052c4c-a1ae-810c-9f8e-ef0ab716c19a" alt="notion image" loading="lazy" decoding="async"/></div></figure><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30052c4ca1ae81ba8389db6f4e07fbeb" data-id="30052c4ca1ae81ba8389db6f4e07fbeb"><span><div id="30052c4ca1ae81ba8389db6f4e07fbeb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae81ba8389db6f4e07fbeb" title="前言"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">前言</span></span></h2><div class="notion-text notion-block-30052c4ca1ae8115aa78f41ce93ab195">Pentaho 默认把资源库放在 PostgreSQL 里。</div><div class="notion-text notion-block-30052c4ca1ae81bbba80c347a43ba05b">包括 KTR、报表等内容。</div><div class="notion-text notion-block-30052c4ca1ae8113b58bf47fa5cb86cc">它们会以加密的形式存放在数据库中。</div><div class="notion-text notion-block-30052c4ca1ae8186aee7f08a87736580">如果你想把资源库迁移到别的数据库，最常见的一步就是先把它迁到 MySQL。</div><div class="notion-text notion-block-30052c4ca1ae8152ba02c98b21693ffc">本文用 <em>Pentaho 8.3</em> 举例。</div><div class="notion-callout notion-yellow_background_co notion-block-30052c4ca1ae813a9291c70bd23762ed"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🎯">🎯</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30052c4ca1ae819dacc5f459fa67cd76"><b>目标</b>：把 Pentaho 默认的 PostgreSQL 资源库迁移到 MySQL，并完成必要的配置改动。</div></div></div><hr class="notion-hr notion-block-30052c4ca1ae8136b005fabd2a72eb2f"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30052c4ca1ae81b89b73ee680872fcc3" data-id="30052c4ca1ae81b89b73ee680872fcc3"><span><div id="30052c4ca1ae81b89b73ee680872fcc3" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae81b89b73ee680872fcc3" title="0. 准备环境"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">0. 准备环境</span></span></h2><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae819eb487d15933477665"><li>MySQL：5.7.17（或 MariaDB：10.3.13）</li></ul><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae81b98dd5d69c1d719405"><li>对应的 SQL 脚本目录：<code class="notion-inline-code">pentaho-server/data/mysql5</code></li></ul><div class="notion-callout notion-orange_background_co notion-block-30052c4ca1ae812dbaa7cbe48b70f116"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="⚠️">⚠️</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30052c4ca1ae81b4a23fef962c2f3198">下面脚本会创建数据库与用户。</div><div class="notion-text notion-block-30052c4ca1ae814890f7d18e4c09f079">默认密码通常是 <code class="notion-inline-code">password</code>。</div><div class="notion-text notion-block-30052c4ca1ae811a89bfc6d43a3bf877">如果你要改密码，只要在后续配置文件中把对应的用户名与密码一起改掉即可。</div></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30052c4ca1ae813f8449f0a5e683ef41" data-id="30052c4ca1ae813f8449f0a5e683ef41"><span><div id="30052c4ca1ae813f8449f0a5e683ef41" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae813f8449f0a5e683ef41" title="1. 导入数据库脚本"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">1. 导入数据库脚本</span></span></h2><div class="notion-text notion-block-30052c4ca1ae8123a2bbdf59ad2ec586">目录：<code class="notion-inline-code">pentaho-server/data/mysql5</code></div><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae814f8528e0fd34c9a3e0"><li><code class="notion-inline-code">create_jcr_mysql.sql</code></li><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae814f8528e0fd34c9a3e0"><li>创建 <b>jackrabbit</b> 相关库。</li><li>负责存储用户相关、内容存储等。</li></ul></ul><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae81b8b57de0b1f937df0d"><li><code class="notion-inline-code">create_quartz_mysql.sql</code></li><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae81b8b57de0b1f937df0d"><li>创建 <b>Quartz</b> 计划任务器所需的库。</li></ul></ul><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae81d7b2ceff0c45d8bb7c"><li><code class="notion-inline-code">create_repository_mysql.sql</code></li><ul class="notion-list notion-list-disc notion-block-30052c4ca1ae81d7b2ceff0c45d8bb7c"><li>创建 <b>hibernate</b> 相关库。</li><li>用于存储用户授权认证、solution repository 以及数据源配置。</li></ul></ul><blockquote class="notion-quote notion-block-30052c4ca1ae81b384c0ede0c3689cb3"><div>运行完脚本后，你通常会得到 3 个数据库：<code class="notion-inline-code">hibernate</code>、<code class="notion-inline-code">quartz</code>、<code class="notion-inline-code">jackrabbit</code>。</div></blockquote><blockquote class="notion-quote notion-block-30052c4ca1ae81259f6cd96652fcb035"><div>以及对应用户：<code class="notion-inline-code">hibuser</code>、<code class="notion-inline-code">pentaho_user</code>、<code class="notion-inline-code">jcr_user</code>（具体以脚本为准）。</div></blockquote><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30052c4ca1ae81c29cdae013b5d96062" data-id="30052c4ca1ae81c29cdae013b5d96062"><span><div id="30052c4ca1ae81c29cdae013b5d96062" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae81c29cdae013b5d96062" title="2. 导入 MySQL 驱动包"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">2. 导入 MySQL 驱动包</span></span></h2><div class="notion-text notion-block-30052c4ca1ae8145a2bcffbc2e7f9294">把 MySQL JDBC 驱动复制到 Pentaho webapp 的 lib 目录下：</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30052c4ca1ae81f1bd9cd0ea1f7f4b02" data-id="30052c4ca1ae81f1bd9cd0ea1f7f4b02"><span><div id="30052c4ca1ae81f1bd9cd0ea1f7f4b02" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae81f1bd9cd0ea1f7f4b02" title="3. 修改配置文件（按顺序）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3. 修改配置文件（按顺序）</span></span></h2><div class="notion-text notion-block-30052c4ca1ae8152bd47d936b52aa5bf">配置文件目录：<code class="notion-inline-code">pentaho-server/pentaho-solutions/system/</code></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae813299e3f7aff0e4e3a4" data-id="30052c4ca1ae813299e3f7aff0e4e3a4"><span><div id="30052c4ca1ae813299e3f7aff0e4e3a4" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae813299e3f7aff0e4e3a4" title="3.1 applicationContext-spring-security-jdbc.properties"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.1 <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://applicationContext-spring-security-jdbc.properties">applicationContext-spring-security-jdbc.properties</a></code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae817e99f7e937827a0089">主要是 datasource 配置。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae81a3abe3fd873c892e02" data-id="30052c4ca1ae81a3abe3fd873c892e02"><span><div id="30052c4ca1ae81a3abe3fd873c892e02" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae81a3abe3fd873c892e02" title="3.2 applicationContext-spring-security-hibernate.properties"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.2 <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://applicationContext-spring-security-hibernate.properties">applicationContext-spring-security-hibernate.properties</a></code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae8133a4cfdca4fc259c4c">主要是 JDBC + Hibernate 方言。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae8127b754cbfce7dc1270" data-id="30052c4ca1ae8127b754cbfce7dc1270"><span><div id="30052c4ca1ae8127b754cbfce7dc1270" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae8127b754cbfce7dc1270" title="3.3 hibernate-settings.xml"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.3 <code class="notion-inline-code">hibernate-settings.xml</code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae8120a957e9949a02dea7">指定数据库类型配置文件（从 HSQLDB 切到 MySQL）。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae8196b8aff1ef1228b9c9" data-id="30052c4ca1ae8196b8aff1ef1228b9c9"><span><div id="30052c4ca1ae8196b8aff1ef1228b9c9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae8196b8aff1ef1228b9c9" title="3.4 quartz.properties"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.4 <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://quartz.properties">quartz.properties</a></code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae81588338d9406a7d4dd5">Quartz 的 driver delegate 指定。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae81b0bca2ebe9ea2f69b8" data-id="30052c4ca1ae81b0bca2ebe9ea2f69b8"><span><div id="30052c4ca1ae81b0bca2ebe9ea2f69b8" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae81b0bca2ebe9ea2f69b8" title="3.5 simple-jndi.properties"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.5 <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://simple-jndi.properties">simple-jndi.properties</a></code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae81b9b3c1f3aa26cd5e4b">JNDI 数据源配置。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae8131a956d49c21e344d1" data-id="30052c4ca1ae8131a956d49c21e344d1"><span><div id="30052c4ca1ae8131a956d49c21e344d1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae8131a956d49c21e344d1" title="3.6 webapps-INF.xml"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.6 <code class="notion-inline-code">webapps-INF.xml</code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae81f093a3d37516141991">Tomcat Context 下的 Resource 配置示例。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae81b694fcfc3f211be8ac" data-id="30052c4ca1ae81b694fcfc3f211be8ac"><span><div id="30052c4ca1ae81b694fcfc3f211be8ac" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae81b694fcfc3f211be8ac" title="3.7 tomcat-INF.xml"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.7 <code class="notion-inline-code">tomcat-INF.xml</code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae819f8054ea1147708cdd">如果你之前启用了 Pentaho 默认的 HSQLDB 启动器，迁移后需要禁用它。</div><div class="notion-text notion-block-30052c4ca1ae818d919edea3729d05f4">把以下两段内容注释掉：</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30052c4ca1ae814ebdd3fc625169c904" data-id="30052c4ca1ae814ebdd3fc625169c904"><span><div id="30052c4ca1ae814ebdd3fc625169c904" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae814ebdd3fc625169c904" title="3.8 jackrabbit.xml"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">3.8 <code class="notion-inline-code">jackrabbit.xml</code></span></span></h3><div class="notion-text notion-block-30052c4ca1ae816bafaac6c3915c2992">把 Jackrabbit 的 FileSystem、DataStore、PersistenceManager、Cluster Journal 等配置切到 MySQL。</div><div class="notion-text notion-block-30052c4ca1ae81bf9e48e2318fae71ca">下面给出常见片段（按你的实际库名、用户、密码调整）：</div><hr class="notion-hr notion-block-30052c4ca1ae81ccb016d939141cbea5"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30052c4ca1ae811699f6da9ddbdf46e1" data-id="30052c4ca1ae811699f6da9ddbdf46e1"><span><div id="30052c4ca1ae811699f6da9ddbdf46e1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30052c4ca1ae811699f6da9ddbdf46e1" title="一张表看懂你要改哪些文件"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">一张表看懂你要改哪些文件</span></span></h2><table class="notion-simple-table notion-block-30052c4ca1ae810e91f6f474c05a23f0"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30052c4ca1ae81439a70e44e435305f8"><td class="" style="width:120px"><div class="notion-simple-table-cell">文件</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">你要改什么</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">关键点</div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae81bfb817c8722ba0ba57"><td class="" style="width:120px"><div class="notion-simple-table-cell"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://applicationContext-spring-security-jdbc.properties">applicationContext-spring-security-jdbc.properties</a></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">datasource 改成 MySQL</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">validation query 用 <code class="notion-inline-code">SELECT 1</code></div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae81639af2c07a4569bde7"><td class="" style="width:120px"><div class="notion-simple-table-cell"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://applicationContext-spring-security-hibernate.properties">applicationContext-spring-security-hibernate.properties</a></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">hibernate JDBC + 方言</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">MySQL 方言：MySQL5InnoDBDialect</div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae81f58de1cbf6644d3d85"><td class="" style="width:120px"><div class="notion-simple-table-cell">hibernate-settings.xml</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">指定 mysql5.hibernate.cfg.xml</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">从 HSQLDB 切到 MySQL</div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae819fa234e56573375062"><td class="" style="width:120px"><div class="notion-simple-table-cell"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://quartz.properties">quartz.properties</a></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">driverDelegateClass</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">通常用 StdJDBCDelegate</div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae81a59e2dcfa60a0b499b"><td class="" style="width:120px"><div class="notion-simple-table-cell"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://simple-jndi.properties">simple-jndi.properties</a></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">JNDI 数据源</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">库名、账号、密码要一致</div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae81659281d08eb1d94cea"><td class="" style="width:120px"><div class="notion-simple-table-cell">webapps-INF.xml</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Tomcat Resource</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">jdbc/Hibernate、jdbc/Quartz</div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae81ffb353f438ebb09e0e"><td class="" style="width:120px"><div class="notion-simple-table-cell">tomcat-INF.xml</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">禁用 HSQLDB 启动器</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">否则可能启动时还去拉 HSQLDB</div></td></tr><tr class="notion-simple-table-row notion-block-30052c4ca1ae81c5bbfde74d83f69c50"><td class="" style="width:120px"><div class="notion-simple-table-cell">jackrabbit.xml</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Jackrabbit 存储切到 MySQL</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">FileSystem、DataStore、PM、Journal</div></td></tr></tbody></table><div class="notion-callout notion-teal_background_co notion-block-30052c4ca1ae81ef9676f2c9d84efefa"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🧪">🧪</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30052c4ca1ae8117a2a8df3eb72ea04e"><b>验证建议</b>：修改完成后启动 Pentaho。</div><div class="notion-text notion-block-30052c4ca1ae818c807ce607461371ff">如果能正常登录，并且能访问 solution repository、计划任务与内容存储，基本就迁移成功了。</div></div></div><div class="notion-blank notion-block-30052c4ca1ae81c0bbbcc7f1f1c49bd8"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[为什么AI框架这么多?拆解Agent编排的五种流派]]></title>
            <link>https://www.lucas.hk.cn/article/30652c4c-a1ae-81c3-be26-c401a7534e31</link>
            <guid>https://www.lucas.hk.cn/article/30652c4c-a1ae-81c3-be26-c401a7534e31</guid>
            <pubDate>Fri, 13 Feb 2026 00:00:00 GMT</pubDate>
            <description><![CDATA[从 ReAct 链式、ToT 树状思维、工作流有向图、角色协同到自定义组装，本文拆解五种主流 AI Agent 编排范式的核心差异，揭示框架之争的本质——上下文管理策略。涵盖 LangChain、LangGraph、Dify、N8N、CrewAI、MetaGPT、AutoGen 等代表框架的优劣与发展趋势。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-30652c4ca1ae81c3be26c401a7534e31"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-30652c4ca1ae81839819e8858baf42a6"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30652c4ca1ae813d82bfe7bdded062d9">现在的 AI 框架简直是开了闸的洪水——从元老 LangChain、LangGraph,到新秀 Dify、N8N,还有最近在 GitHub 狂揽 18 万星的 OpenClaw。看着这些名字,你可能会一头雾水:<b>它们到底有啥不一样?难道不都是让 AI 干活的工具吗?</b></div><div class="notion-text notion-block-30652c4ca1ae81cd886fd92616f7b693">其实,这些框架背后的差异,藏着一个目前没有标准答案的大型实验——<b>AI Agent 的编排方式</b>。就像炒菜有粤菜、川菜、鲁菜的分别,AI 框架也有自己的「流派」。今天咱们就来拆解这场「武林大会」,看看各路门派到底在比拼什么内功。</div></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae81ce93f3e154a16c3931" data-id="30652c4ca1ae81ce93f3e154a16c3931"><span><div id="30652c4ca1ae81ce93f3e154a16c3931" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81ce93f3e154a16c3931" title="全景速览:五大编排门派"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">全景速览:五大编排门派</span></span></h2><div class="notion-text notion-block-30652c4ca1ae819c874cdf33f5624403"><b>这些框架的高下,不在于功能清单有多长,而在于编排哲学的分野</b>。</div><table class="notion-simple-table notion-block-30652c4ca1ae814aa156dc066d6532a4"><tbody><tr class="notion-simple-table-row notion-blue_background notion-simple-table-header-row notion-block-30652c4ca1ae81e5a37ec1e83fdbe308"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>编排范式</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>核心思想</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>代表框架</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>适合场景</b></div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8163b6b6f7eeac9e2107"><td class="" style="width:120px"><div class="notion-simple-table-cell">🔗 ReAct 链式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">推理-行动交替，单线程循环</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">LangChain、SmolAgents</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">快速原型、单 Agent 任务</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae815eb9c2ea518f75adbc"><td class="" style="width:120px"><div class="notion-simple-table-cell">🌳 ToT 树状思维</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">分支探索，回溯择优</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">LangGraph、Tree-of-Thought Prompting</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">复杂推理、数学证明、代码生成</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8158887fcc2644edbb5d"><td class="" style="width:120px"><div class="notion-simple-table-cell">📊 工作流有向图</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">节点+连线，精确上下文隔离</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Dify、N8N、Flowise</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">企业自动化、流程固定的业务</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8127b4e2ff030cfd849d"><td class="" style="width:120px"><div class="notion-simple-table-cell">🎭 角色协同</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">多 Agent 扮演角色，协商完成任务</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">CrewAI、MetaGPT、AutoGen</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">模拟团队、内容生产、多步决策</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae810f928dfd40ba7b554d"><td class="" style="width:120px"><div class="notion-simple-table-cell">🧩 自定义组装</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">原子化组件，开发者自行拼装</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Atomic Agents、Pydantic AI</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">追求极致可控的生产级系统</div></td></tr></tbody></table><div class="notion-text notion-block-30652c4ca1ae8176b5e0efefd5c267a0">看到这张表你可能会问:<b>为什么不能一个框架通吃所有场景?</b></div><div class="notion-text notion-block-30652c4ca1ae81b6ae17f95126d6d105">答案很简单——<b>编排方式决定了上下文的流动策略,而上下文就是 LLM 的氧气</b>。供氧方式不同,Agent 的「体力」和「智力」表现自然天差地别。就像短跑运动员和马拉松选手的呼吸节奏完全不同,不同任务需要不同的上下文管理策略。</div><div class="notion-text notion-block-30652c4ca1ae816bbd3ff13680bd3fa0">接下来,我们逐一拆解每种编排。</div><hr class="notion-hr notion-block-30652c4ca1ae81fc950dd927bf2c8c49"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae81198758c5acf9930554" data-id="30652c4ca1ae81198758c5acf9930554"><span><div id="30652c4ca1ae81198758c5acf9930554" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81198758c5acf9930554" title="ReAct 链式"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ReAct 链式</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81e6a550d81db460e636" data-id="30652c4ca1ae81e6a550d81db460e636"><span><div id="30652c4ca1ae81e6a550d81db460e636" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81e6a550d81db460e636" title="特点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">特点</span></span></h3><div class="notion-text notion-block-30652c4ca1ae811aada4e9fcb9054d22">ReAct（Reasoning + Acting）是目前最经典也最直觉的编排模式。简单说就是:<b>边想边做,走一步看一步</b>。它就像一个新手司机开车——看到红绿灯才想起要刹车,到了路口才开始琢磨该往哪拐。</div><div class="notion-text notion-block-30652c4ca1ae81ae9dc3c62490360bc0">整条执行链是单线程的,所有的想法、动作、观察结果都堆在同一个对话窗口里,像流水账一样越记越长。</div><div class="notion-text notion-block-30652c4ca1ae81caad37dfac4c89904f">它的优点是<b>简单粗暴</b>——你不需要提前画流程图,Agent 自己边走边想,特别适合快速原型验证。</div><div class="notion-text notion-block-30652c4ca1ae81fb9a8be1e86acf2d0f">但致命弱点也很明显:<b>上下文像滚雪球,越滚越大</b>。每一步的 Thought(想法)、Action(动作)、Observation(观察) 都会塞进对话历史。走三步还好,走十步八步,Token 窗口就爆了,Agent 开始「失忆」,前面说过的话转头就忘。</div><table class="notion-simple-table notion-block-30652c4ca1ae816ba98fc9be76e3b1d2"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30652c4ca1ae8155825bf980ad2c8983"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>维度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>表现</b></div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae813089c9d428f721665a"><td class="" style="width:120px"><div class="notion-simple-table-cell">上下文管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">❌ 全部累积，容易超限</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8128b8e2f63c498f9847"><td class="" style="width:120px"><div class="notion-simple-table-cell">任务复杂度</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⚠️ 适合 3~5 步内的任务，步骤多了容易&quot;迷路&quot;</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81059ba4f81be72d057a"><td class="" style="width:120px"><div class="notion-simple-table-cell">可控性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">❌ Agent 自主决策，难以精确干预中间步骤</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8127b105de2c89d66286"><td class="" style="width:120px"><div class="notion-simple-table-cell">上手难度</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 非常低，几行代码就能跑</div></td></tr></tbody></table><div class="notion-text notion-block-30652c4ca1ae8175a15ff09301f040c7"><b>形象点说:</b>ReAct 链式就像一个路痴<b>边走边问路</b>——每到一个路口就掏出手机查导航,想想该往哪走。从家走到便利店?完美。但如果要从上海徒步到北京,中途记忆的岔路口、地标、路牌信息会把大脑撑爆。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae8135b5bdf7bc348e6976" data-id="30652c4ca1ae8135b5bdf7bc348e6976"><span><div id="30652c4ca1ae8135b5bdf7bc348e6976" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae8135b5bdf7bc348e6976" title="代表框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">代表框架</span></span></h3><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81d699b5e3164f8fbb36"><li><b>LangChain</b>:ReAct 模式的开山鼻祖,生态最丰富,拥有海量的工具集成和文档。但也因为抽象层套了一层又一层,被开发者戏称为「胶水框架」——<b>想打个钉子,结果得先组装一台钉枪</b>。不过对于快速接入各种第三方服务,LangChain 确实无可替代。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81f7ba7def1adbfa3237"><li><b>SmolAgents（HuggingFace）</b>:极简主义的 ReAct 实现。它的特色是 Agent 直接<b>生成 Python 代码来执行动作</b>,而不是输出 JSON 让框架去解析。代码量极小,整个核心逻辑不到 500 行,适合 Hackathon 快速验证想法。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81cd9b8aeb28a101528d" data-id="30652c4ca1ae81cd9b8aeb28a101528d"><span><div id="30652c4ca1ae81cd9b8aeb28a101528d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81cd9b8aeb28a101528d" title="目前发展"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">目前发展</span></span></h3><div class="notion-text notion-block-30652c4ca1ae81efb29fe7ee1d2f625d">ReAct 链式作为「第一代编排范式」已经非常成熟,但它的局限性也很明显。讽刺的是,<b>连 LangChain 团队自己都推出了 LangGraph 来补短板</b>（支持分支、循环、状态持久化）——这本身就说明,纯链式已经不够用了。</div><div class="notion-text notion-block-30652c4ca1ae8121a36aed799c24880c">不过 ReAct 也没有被淘汰。它更像是编排世界的「Hello World」——每个人学 Agent 开发都从它开始,大多数复杂框架的底层仍然用 ReAct 循环作为单个 Agent 的基础认知引擎,只是在外面套了更高级的编排结构。</div><hr class="notion-hr notion-block-30652c4ca1ae8114bbe0f2210a22ac0c"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae813f8a4ee2486df80a62" data-id="30652c4ca1ae813f8a4ee2486df80a62"><span><div id="30652c4ca1ae813f8a4ee2486df80a62" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae813f8a4ee2486df80a62" title="ToT 树状思维"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">ToT 树状思维</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81559064d84f94a60350" data-id="30652c4ca1ae81559064d84f94a60350"><span><div id="30652c4ca1ae81559064d84f94a60350" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81559064d84f94a60350" title="特点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">特点</span></span></h3><div class="notion-text notion-block-30652c4ca1ae816cbf20d070d43da629">ToT（Tree of Thought）的核心理念是<b>分治求解</b>。面对一个复杂问题,它不像 ReAct 那样一条路走到黑,而是<b>像 AlphaGo 下棋一样,同时展开多条思路</b>,给每条路线打分,选最优的那条继续深入。走不通?没关系,回溯到上一个分叉点,换条路再试。</div><div class="notion-text notion-block-30652c4ca1ae817ebc11e4a16d63e4b5">这就像你在玩 RPG 游戏时开了存档——打不过 Boss?读档重来,换个打法。</div><table class="notion-simple-table notion-block-30652c4ca1ae810ab361d5d40d27bf1a"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30652c4ca1ae819795e8e92f7f15b28e"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>维度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>ReAct 链式</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>ToT 树状</b></div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81108443d159a896adf4"><td class="" style="width:120px"><div class="notion-simple-table-cell">探索策略</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">单路径，走到底</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">多路径并行，择优前进</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8101b226e2cefb7190df"><td class="" style="width:120px"><div class="notion-simple-table-cell">错误恢复</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">重来一遍</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">回溯到上一个分支点</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81baa4fadf506b45cad8"><td class="" style="width:120px"><div class="notion-simple-table-cell">Token 消耗</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">较低（单线程）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">较高（多分支并行评估）</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81a9a209c1904ed6a46c"><td class="" style="width:120px"><div class="notion-simple-table-cell">适用任务</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">信息检索、简单问答</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">数学推理、代码生成、方案规划</div></td></tr></tbody></table><div class="notion-text notion-block-30652c4ca1ae81de974eede31a050913"><b>再举个生活例子:</b>如果说 ReAct 是「边走边问路」,那 ToT 就是<b>打开导航 App 同时规划三条路线,标注每条的拥堵程度、红绿灯数量、预计耗时,最后选最优方案出发</b>。专业,但费流量(Token)。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81f78089d84d1b5e534e" data-id="30652c4ca1ae81f78089d84d1b5e534e"><span><div id="30652c4ca1ae81f78089d84d1b5e534e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81f78089d84d1b5e534e" title="代表框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">代表框架</span></span></h3><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81ceb2bcea2f71183b94"><li><b>LangGraph</b>:LangChain 团队的「升级版」,用<b>有状态的有向图</b>来编排 Agent。支持条件分支、循环、检查点,甚至可以插入「人工审批节点」——关键决策让人类把关。虽然它不是纯粹的 ToT 实现,但图结构天然支持树状探索,灵活性远超链式。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81ffa301ec8ae8e3d11b"><li><b>Tree-of-Thought Prompting</b>:这是 Princeton 和 Google DeepMind 研究团队提出的学术方法论,不依赖框架。通过精心设计的 Prompt 策略,让 LLM <b>自己进行分支思考和自我评估</b>。有点像「催眠」AI,让它以为自己有多个大脑在并行思考。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae815f85f9fb9a8e49a53b" data-id="30652c4ca1ae815f85f9fb9a8e49a53b"><span><div id="30652c4ca1ae815f85f9fb9a8e49a53b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae815f85f9fb9a8e49a53b" title="目前发展"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">目前发展</span></span></h3><div class="notion-text notion-block-30652c4ca1ae818f9993cc088c005b42">ToT 在<b>推理密集型任务</b>上战绩辉煌——数学题准确率提升 40%~70%,代码生成的 Bug 率大幅下降。但代价也很现实:<b>Token 消耗成倍增长,推理延迟翻番</b>。</div><div class="notion-text notion-block-30652c4ca1ae8168b280c1beb0692919">不过,随着模型自身推理能力的进化（比如 OpenAI 的 o1 系列内置了类似 ToT 的「思维链」）,未来框架层面的 ToT 可能会<b>向下沉淀到模型层</b>——就像现在没人手动管理 CPU 缓存了,都交给硬件自己优化。到那时,你不再需要在外面搭树,模型自己就会「种树」。</div><hr class="notion-hr notion-block-30652c4ca1ae81448db7f88bff0d866b"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae817093fae20ee8ad8e96" data-id="30652c4ca1ae817093fae20ee8ad8e96"><span><div id="30652c4ca1ae817093fae20ee8ad8e96" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae817093fae20ee8ad8e96" title="工作流有向图"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">工作流有向图</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae8186ad80d533919993fb" data-id="30652c4ca1ae8186ad80d533919993fb"><span><div id="30652c4ca1ae8186ad80d533919993fb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae8186ad80d533919993fb" title="特点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">特点</span></span></h3><div class="notion-text notion-block-30652c4ca1ae8157bf7cde1854a72b72">工作流有向图（Workflow DAG）是最「工程化」的编排范式。<b>你在可视化画布上拖节点、连线,每个节点干一件事,数据沿着箭头流动</b>——就像在 Figma 里设计界面一样直观。</div><div class="notion-text notion-block-30652c4ca1ae816f9722eb57e0a4a402">它最大的优势是<b>精细的上下文隔离</b>:每个节点只看到它需要的数据,不多也不少。不像 ReAct 那样把所有历史对话都塞进一个窗口,工作流 DAG 让每个节点都有独立的「工位」,互不干扰。</div><div class="notion-text notion-block-30652c4ca1ae814fa6d5e025710a4f78">你可以精确控制:<b>哪些信息传给下游节点,哪些信息到此为止</b>。这对企业应用至关重要——比如客户的身份证号只能在「验证」节点使用,绝不能流到「日志记录」节点。</div><table class="notion-simple-table notion-block-30652c4ca1ae813d86ffecbe7bb934d5"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30652c4ca1ae81708679dd4cb1f185d5"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>维度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>表现</b></div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81a1bc04e3e4edb0a870"><td class="" style="width:120px"><div class="notion-simple-table-cell">上下文管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 节点级隔离，Token 消耗可控</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81d8a082f28e10a23a19"><td class="" style="width:120px"><div class="notion-simple-table-cell">可控性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 所见即所得，流程透明</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8183a24ace07de18d2d4"><td class="" style="width:120px"><div class="notion-simple-table-cell">灵活性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">❌ 流程需要预先设计，难以应对意外情况</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81028905e19d7f1f9aba"><td class="" style="width:120px"><div class="notion-simple-table-cell">上手难度</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 拖拽式，非程序员友好</div></td></tr></tbody></table><div class="notion-text notion-block-30652c4ca1ae810baf8ccad3231c0bee"><b>用一句话概括:</b>工作流有向图就像<b>汽车工厂的流水线</b>——每个工位只负责一道工序(装轮胎、喷漆、质检),零件按既定路线流转。效率极高、质量稳定、可追溯,但要改流程就得重新设计产线,灵活性不如 ReAct。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae812aa042c6bf71be787c" data-id="30652c4ca1ae812aa042c6bf71be787c"><span><div id="30652c4ca1ae812aa042c6bf71be787c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae812aa042c6bf71be787c" title="代表框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">代表框架</span></span></h3><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81e2a61dece2778e1691"><li><b>Dify</b>:国产开源 LLM 应用平台,提供可视化的 Workflow 编辑器。内置 RAG、Agent、工作流三种模式,<b>开箱即用,对中文支持友好</b>。如果你是国内团队,Dify 的中文文档和社区氛围会让你少踩很多坑。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81eb80f2c3fa965b5810"><li><b>N8N</b>:老牌开源工作流自动化工具,原本是连接 Slack、GitHub、Google Sheets 的「数字胶水」。近期大力拥抱 AI,支持将 Agent 节点嵌入传统自动化流程,实现<b>「AI + RPA」的混合编排</b>。比如:每天自动抓取竞品动态 → AI 总结 → 发到飞书群。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae8162870de34dc7dc7c20"><li><b>Flowise</b>:把 LangChain 的组件<b>变成可拖拽的节点</b>。如果你喜欢 LangChain 的生态(几百种集成),但讨厌写代码(一堆 import 语句),Flowise 是完美的折中方案——鼠标拖拽就能搭建 RAG 系统。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae8151867cd1cc4e941fd6" data-id="30652c4ca1ae8151867cd1cc4e941fd6"><span><div id="30652c4ca1ae8151867cd1cc4e941fd6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae8151867cd1cc4e941fd6" title="目前发展"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">目前发展</span></span></h3><div class="notion-text notion-block-30652c4ca1ae81ab9861fb659e157520">工作流 DAG 是目前<b>企业落地最多</b>的编排模式。原因很现实:</div><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81c8ac0cee75001ca609"><li><b>老板要看懂流程图</b>,不能是一堆 Python 代码</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81b48d0cc6a598545137"><li><b>运维要知道哪个环节挂了</b>,不能黑盒报错</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81b78c6ed09ddfb2c4f5"><li><b>审计要追溯数据流向</b>,不能说不清楚客户信息去了哪</li></ul><div class="notion-text notion-block-30652c4ca1ae8165a7dfef05dc14a0ff">这些「工程需求」是 ReAct 和 ToT 很难满足的——它们太「聪明」了,聪明到连开发者都不知道下一步会干啥。</div><div class="notion-text notion-block-30652c4ca1ae81deb1a5e7bef3616faa">未来趋势是<b>工作流 + Agent 的混合模式</b>:用 DAG 固定主干流程保证稳定性,但在某些需要灵活决策的节点里嵌入 ReAct Agent。比如:客服工单流程是固定的(接单 → 分类 → 处理 → 归档),但「处理」节点内部让 AI 自己判断该查文档还是转人工。N8N 已经在这么干了。</div><hr class="notion-hr notion-block-30652c4ca1ae81a69c2ec4f28d5bde22"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae81ee93e3dc86e0e07a7c" data-id="30652c4ca1ae81ee93e3dc86e0e07a7c"><span><div id="30652c4ca1ae81ee93e3dc86e0e07a7c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81ee93e3dc86e0e07a7c" title="角色协同"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">角色协同</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81eb88bec2ebff474e96" data-id="30652c4ca1ae81eb88bec2ebff474e96"><span><div id="30652c4ca1ae81eb88bec2ebff474e96" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81eb88bec2ebff474e96" title="特点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">特点</span></span></h3><div class="notion-text notion-block-30652c4ca1ae81248d0df189434fef3b">角色协同是最有「科幻感」的编排模式:<b>你不再指挥一个 Agent,而是组建一支 AI 虚拟团队</b>。每个 Agent 扮演一个职业角色——产品经理、程序员、设计师、测试工程师……它们之间通过对话、投票、审批等方式协作,就像一家真实的公司。</div><div class="notion-text notion-block-30652c4ca1ae81f4a2d3cd87830ca408">听起来很酷对吧?但实际体验可能是:<b>看着三个 AI 在群里寒暄了五分钟,才开始讨论正事</b>。</div><table class="notion-simple-table notion-block-30652c4ca1ae81c2b316d381787a7ccf"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30652c4ca1ae8100bbecdc3104b59420"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>维度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>表现</b></div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae811d8389fa77cd4236d1"><td class="" style="width:120px"><div class="notion-simple-table-cell">任务复杂度</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 天然适合多步骤、多角色的复杂任务</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81ceb53bf9eef5847aef"><td class="" style="width:120px"><div class="notion-simple-table-cell">上下文管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⚠️ 角色间通信开销大，需要精心设计消息传递</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81c6ad6ed34c8d5dd6ae"><td class="" style="width:120px"><div class="notion-simple-table-cell">可调试性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">❌ 多 Agent 交互难以预测，Debug 像在追踪群聊</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81758cd9d0d60acd7aa1"><td class="" style="width:120px"><div class="notion-simple-table-cell">Token 消耗</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">❌ 多个 Agent 同时运行，成本翻倍</div></td></tr></tbody></table><div class="notion-text notion-block-30652c4ca1ae817a80f3fb8169c0b3f6">角色协同就像<b>组建一个虚拟公司</b>：你不再给 AI 一份任务清单，而是给它一个组织架构图。每个&quot;员工&quot;各司其职，互相 Review，理论上能产出比单个 Agent 更高质量的结果。</div><div class="notion-text notion-block-30652c4ca1ae814fb108ddbf811c7724">但理想很丰满，现实很骨感——多 Agent 之间的&quot;废话&quot;也不少，经常出现两个 Agent 互相客套三轮才进入正题的尴尬场面。</div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae810c95d2e2a7b377026e" data-id="30652c4ca1ae810c95d2e2a7b377026e"><span><div id="30652c4ca1ae810c95d2e2a7b377026e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae810c95d2e2a7b377026e" title="代表框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">代表框架</span></span></h3><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81f8bf1df464f151a674"><li><b>CrewAI</b>:目前最火的角色协同框架。用 Python 定义每个 Agent 的「人设」(角色、目标、工具),然后组成一个 Crew(团队)。支持<b>顺序执行</b>(像接力赛)和<b>层级管理</b>(像公司汇报线)两种协作模式。API 设计很 Pythonic,上手快。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81b4a6a7fee69fd64e0c"><li><b>MetaGPT</b>:来自 DeepWisdom 的开源项目,野心最大——<b>模拟一家完整的软件公司</b>。产品经理写 PRD → 架构师出技术方案 → 程序员写代码 → 测试工程师跑用例,全程自动化。Demo 效果惊艳,但实际产出质量......就像真实世界的外包团队,时好时坏。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81d7aea3f290d166159d"><li><b>AutoGen（微软）</b>:微软出品,更注重<b>结构化对话</b>和<b>人类介入</b>。Agent 之间的每一轮对话都有明确的协议,支持在关键节点暂停让人类审批。适合银行、医疗等需要严格审计的企业场景——毕竟 AI 开药方之前,最好让医生过目一下。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81ce887acc3d5efc879b" data-id="30652c4ca1ae81ce887acc3d5efc879b"><span><div id="30652c4ca1ae81ce887acc3d5efc879b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81ce887acc3d5efc879b" title="目前发展"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">目前发展</span></span></h3><div class="notion-text notion-block-30652c4ca1ae815197ebd4eaa1245887">角色协同是当前 AI Agent 领域<b>最热门但也最有争议</b>的方向。支持者认为它代表了 AGI 的雏形——多个专业 Agent 协作的效果可以超越单个通用 Agent。反对者则吐槽：<b>你花 10 倍的 Token，只得到 1.2 倍的效果</b>。</div><div class="notion-text notion-block-30652c4ca1ae812ea6b7d790152d6f17">不过，Google 在 2025 年发布的 <b>A2A（Agent-to-Agent）协议</b>正在为多 Agent 协作建立标准。就像 MCP 统一了 Agent 与工具的连接，A2A 试图统一 Agent 与 Agent 之间的通信。一旦标准成熟，角色协同的效率问题可能会大幅改善。</div><hr class="notion-hr notion-block-30652c4ca1ae81039abdd4121baa2fd9"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae81fca8fbdcad6aed57c9" data-id="30652c4ca1ae81fca8fbdcad6aed57c9"><span><div id="30652c4ca1ae81fca8fbdcad6aed57c9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81fca8fbdcad6aed57c9" title="自定义组装框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">自定义组装框架</span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81cf9bbedf1df4efc506" data-id="30652c4ca1ae81cf9bbedf1df4efc506"><span><div id="30652c4ca1ae81cf9bbedf1df4efc506" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81cf9bbedf1df4efc506" title="特点"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">特点</span></span></h3><div class="notion-text notion-block-30652c4ca1ae818cb026d7e1ccc8b83e">这一类框架的哲学是<b>极简主义 + 完全掌控</b>:不给你预设的编排模式,而是提供一堆经过精心设计的<b>原子化组件</b>,就像乐高积木,由你自己拼出任何想要的造型。</div><div class="notion-text notion-block-30652c4ca1ae81b284eaf97edcf1196e"><b>打个比方:</b>如果前面四种编排模式是「买精装修的商品房」,自定义组装就是<b>「买毛坯 + 自己设计装修」</b>——累,但每一面墙、每一盏灯都在你的掌控之中,没有框架黑盒,没有隐藏的「惊喜」。</div><table class="notion-simple-table notion-block-30652c4ca1ae813ea1bdead329ffe705"><tbody><tr class="notion-simple-table-row notion-gray_background notion-simple-table-header-row notion-block-30652c4ca1ae815d91a4cdd0509bcab5"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>维度</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>表现</b></div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8165b57cf967654ef06f"><td class="" style="width:120px"><div class="notion-simple-table-cell">可控性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 最高，每一行逻辑都由你决定</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8150b316e0c59ed9c08c"><td class="" style="width:120px"><div class="notion-simple-table-cell">上手难度</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">❌ 最高，需要深入理解 Agent 原理</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81ff968dcc9586ee161b"><td class="" style="width:120px"><div class="notion-simple-table-cell">灵活性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 可实现任意编排模式</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8111a6f6fd9aa5b938cd"><td class="" style="width:120px"><div class="notion-simple-table-cell">生产可靠性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 没有框架黑盒，Debug 直接看源码</div></td></tr></tbody></table><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81e1b030db56e57fc55c" data-id="30652c4ca1ae81e1b030db56e57fc55c"><span><div id="30652c4ca1ae81e1b030db56e57fc55c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81e1b030db56e57fc55c" title="代表框架"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">代表框架</span></span></h3><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81cbadbec0d5c34543a9"><li><b>Atomic Agents</b>：GitHub 上口碑极好的轻量级框架。核心理念是&quot;每个 Agent 只是一个输入-输出清晰的原子单元&quot;，你可以像搭积木一样把多个 Atomic Agent 组合起来。没有魔法，没有隐藏抽象，所有行为都是显式的。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81b6a191dceb26b27a09"><li><b>Pydantic AI</b>：由 Pydantic（Python 最流行的数据验证库）团队出品。用<b>类型安全</b>的方式定义 Agent 的输入、输出和工具调用，编译器帮你抓错。适合对代码质量有洁癖的团队。</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81feaa58e062f646c3bd"><li><b>Semantic Kernel（微软）</b>：面向企业级场景，内置安全和合规机制。如果你的 Agent 需要跑在银行或医疗系统里，Semantic Kernel 的治理能力是其他框架不具备的。</li></ul><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30652c4ca1ae81e28467fbe7cda15f5a" data-id="30652c4ca1ae81e28467fbe7cda15f5a"><span><div id="30652c4ca1ae81e28467fbe7cda15f5a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81e28467fbe7cda15f5a" title="目前发展"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">目前发展</span></span></h3><div class="notion-text notion-block-30652c4ca1ae81759997f0b7879ab915">自定义组装框架代表了一种<b>&quot;反框架&quot;的趋势</b>——越来越多的资深开发者开始抛弃&quot;大而全&quot;的框架，转向更轻量、更透明的方案。Reddit 上有个高赞评论说得好：</div><blockquote class="notion-quote notion-block-30652c4ca1ae81caaa9cda4fbd025a11"><div><em>&quot;Drop the idea of framework. Look for solid infra and time-saving libraries instead.&quot;</em></div></blockquote><div class="notion-text notion-block-30652c4ca1ae813fac75e309a3c9c929">这并不是说框架没有价值，而是说当你的 Agent 系统需要上生产环境时，<b>可观测性和可控性比开发速度更重要</b>。自定义组装方案在前期投入更多，但后期维护成本远低于那些&quot;黑盒框架&quot;。</div><hr class="notion-hr notion-block-30652c4ca1ae8154a81dc0dbf87050a3"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae8193b413f3582f846a86" data-id="30652c4ca1ae8193b413f3582f846a86"><span><div id="30652c4ca1ae8193b413f3582f846a86" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae8193b413f3582f846a86" title="揭秘:框架之争的本质"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">揭秘:框架之争的本质</span></span></h2><div class="notion-text notion-block-30652c4ca1ae812c99d7c82378016843">说了这么多编排,终于可以回答文章标题的核心问题:<b>AI 框架到底在比什么?</b></div><div class="notion-text notion-block-30652c4ca1ae817592f8c2eb610ad4ab"><b>答案只有三个字:上下文。</b></div><div class="notion-callout notion-blue_background_co notion-block-30652c4ca1ae81fbb210fea91cd5b098"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🎯">🎯</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30652c4ca1ae8195bda2c9138e493473">所有编排方式的本质差异,都在于<b>如何管理送给 LLM 的上下文</b>:</div><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81be967ad5e15a5f6096"><li><b>给多少?</b>(Token 预算分配)</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81ea9e69cc762c9352f9"><li><b>给什么?</b>(信息筛选与压缩)</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81bbad04e8021a943dfe"><li><b>什么时候给?</b>(时序控制)</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae817cbd10d493110f9268"><li><b>怎么在多个 Agent 之间分配?</b>(跨 Agent 的上下文路由)</li></ul><div class="notion-text notion-block-30652c4ca1ae8153a764cf3549e09aa3">这就像氧气管理——<b>上下文就是 LLM 的氧气,供氧策略决定了 Agent 的体力和智力上限</b>。</div></div></div><table class="notion-simple-table notion-block-30652c4ca1ae81d2baebce57ac237c04"><tbody><tr class="notion-simple-table-row notion-blue_background notion-simple-table-header-row notion-block-30652c4ca1ae810889def3c49e4fd7aa"><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>编排范式</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>上下文策略</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>优势</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>代价</b></div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81509055f2211375b1fb"><td class="" style="width:120px"><div class="notion-simple-table-cell">ReAct 链式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">全部堆在一起</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">简单、直觉</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Token 爆炸、记忆力衰退</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81e5911cef13f3614514"><td class="" style="width:120px"><div class="notion-simple-table-cell">ToT 树状</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">分支独立，择优合并</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">推理质量高</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Token 消耗大、延迟高</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae818faa9dd2134dbfb9c4"><td class="" style="width:120px"><div class="notion-simple-table-cell">工作流 DAG</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">节点级隔离，按需传递</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">精准可控</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">灵活性受限</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae8175b710c3627c5220d2"><td class="" style="width:120px"><div class="notion-simple-table-cell">角色协同</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">角色间消息传递</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">模拟真实协作</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">通信开销、冗余对话</div></td></tr><tr class="notion-simple-table-row notion-block-30652c4ca1ae81d3b56cefef5e79d01a"><td class="" style="width:120px"><div class="notion-simple-table-cell">自定义组装</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">完全自定义</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">极致可控</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">开发成本高</div></td></tr></tbody></table><div class="notion-text notion-block-30652c4ca1ae8147b365ea55b074f411">未来的方向很可能不是「一统江湖」,而是<b>混合编排</b>:</div><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81019e67c5a8194e38ac"><li>用 <b>DAG 搭主干流程</b>保证稳定性和可追溯性</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81b7b42bf662930f176a"><li>用 <b>ReAct 做灵活节点</b>应对意外情况</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81de8c9af93593ddf056"><li>用 <b>角色协同</b>处理需要多专业视角的复杂任务</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81be903ce320f2f65b60"><li>用 <b>ToT 攻克推理难题</b>(数学证明、代码生成)</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae816aa518e1974e6bd847"><li>用 <b>自定义组件</b>填补框架空白</li></ul><div class="notion-text notion-block-30652c4ca1ae816781d3ef4cae98a32f"><b>最好的 Agent 系统,可能不属于任何一种范式,而是所有范式的有机融合</b>——就像现代建筑会同时用钢筋、混凝土、玻璃、木材,没有人会只用一种材料盖房子。</div><hr class="notion-hr notion-block-30652c4ca1ae81caafc7f1e07896fa7f"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae81629e52da09978e8fae" data-id="30652c4ca1ae81629e52da09978e8fae"><span><div id="30652c4ca1ae81629e52da09978e8fae" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae81629e52da09978e8fae" title="参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">参考文章</span></span></h2><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae8101a46af31f58da4fd3"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://langfuse.com/blog/2025-03-19-ai-agent-comparison">Comparing Open-Source AI Agent Frameworks — Langfuse Blog</a> — 开源 Agent 框架横评</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81e29be4f8cadf320ed6"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://medium.com/data-science-collective/agentic-ai-comparing-new-open-source-frameworks-21ec676732df">Agentic AI: Comparing New Open-Source Frameworks — Medium</a> — 2025 新兴框架对比</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae8178b010c1267edce60f"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://medium.com/@lakkanaperera/the-5-ai-agent-orchestration-patterns-by-microsoft-9a27844eec9a">The 5 AI Agent Orchestration Patterns by Microsoft</a> — 微软总结的 5 种编排模式</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae819f93ddd47c3a6823d0"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.digitalapplied.com/blog/ai-workflow-orchestration-platforms-comparison">AI Workflow Orchestration Platforms: 2026 Comparison</a> — 工作流平台 2026 年度对比</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae815fa628f7a29aeb9b0b"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://blog.n8n.io/ai-agent-frameworks/">9 AI Agent Frameworks Battle — n8n Blog</a> — n8n 视角的框架大战</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae816cbc78d6f04bf1d52b"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://medium.com/@mohitcharan04/comprehensive-comparison-of-ai-agent-frameworks-bec7d25df8a6">Comprehensive Comparison of AI Agent Frameworks — Medium</a> — 全面的框架能力对比</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81178769d2655930fb89"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.promptingguide.ai/techniques/react">ReAct Prompting — Prompt Engineering Guide</a> — ReAct 范式的系统讲解</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81a295b2e249b3a8069b"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://arxiv.org/abs/2305.10601">Tree of Thoughts: Deliberate Problem Solving with LLMs</a> — ToT 论文原文</li></ul><hr class="notion-hr notion-block-30652c4ca1ae816f90bfcfe2da951804"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30652c4ca1ae819cb607c858aaafda5b" data-id="30652c4ca1ae819cb607c858aaafda5b"><span><div id="30652c4ca1ae819cb607c858aaafda5b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30652c4ca1ae819cb607c858aaafda5b" title="写在最后:选框架之前,先想清楚上下文怎么流"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">写在最后:选框架之前,先想清楚上下文怎么流</span></span></h2><div class="notion-text notion-block-30652c4ca1ae81b290aeda3cf882b75d">回顾全文,我们拆解了五种主流的 AI Agent 编排范式:</div><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae8117b447e426abdb8d4f"><li><b>ReAct 链式</b>:简单直接,适合快速验证</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81549629cf6afcc4e5df"><li><b>ToT 树状</b>:适合复杂问题求解</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81248303cdee57a5bf56"><li><b>工作流 DAG</b>:适合企业生产环境</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81b2ba05c35f0dd845b3"><li><b>角色协同</b>:适合需要多专业视角的任务</li></ul><ul class="notion-list notion-list-disc notion-block-30652c4ca1ae81729fa3ce6dde72ef6e"><li><b>自定义组装</b>:适合追求可靠性的生产系统</li></ul><div class="notion-callout notion-blue_background_co notion-block-30652c4ca1ae8137a051ed42e433d3b9"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🎯">🎯</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30652c4ca1ae8165a52afd5c20e7f361"><b>框架之争的本质是上下文管理之争。</b>谁能在有限的 Token 窗口里,把最正确的信息、在最正确的时间、送给最正确的 Agent,谁就能造出最强的 AI 系统。</div></div></div><div class="notion-blank notion-block-30652c4ca1ae814ba74ad268dd25c726"> </div><div class="notion-callout notion-gray_background_co notion-block-30652c4ca1ae818d80ffde787c1ad7d5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30652c4ca1ae81438212fdd2ee3b248e">欢迎您在底部评论区留言，一起交流~</div></div></div><div class="notion-blank notion-block-30652c4ca1ae81cfb2b2ca5469d20cee"> </div></main></div>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ansible 自动化运维全解析：从核心概念到 Azure K8s 实战]]></title>
            <link>https://www.lucas.hk.cn/article/30552c4c-a1ae-813c-ac6a-da331f2db2f4</link>
            <guid>https://www.lucas.hk.cn/article/30552c4c-a1ae-813c-ac6a-da331f2db2f4</guid>
            <pubDate>Wed, 12 Feb 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[本文全面解析Ansible自动化运维工具，涵盖六大核心概念（Modules、Plugins、Collections、Playbook、Inventory、Roles）、运行原理与幂等性机制、与Puppet/Chef/Terraform的横向对比，以及从安装配置到Ad-Hoc命令与Playbook实战的完整操作指南。附带使用Ansible自动化创建Azure AKS集群并部署容器化应用的真实示例（含多环境Inventory、K8s资源模板、滚动更新与销毁流程），适合希望落地IAC理念的运维工程师与开发者。]]></description>
            <content:encoded><![CDATA[<div id="notion-article" class="mx-auto overflow-hidden "><main class="notion light-mode notion-page notion-block-30552c4ca1ae813cac6ada331f2db2f4"><div class="notion-viewport"></div><div class="notion-collection-page-properties"></div><div class="notion-callout notion-gray_background_co notion-block-30552c4ca1ae817097a2fcc409ff5b4a"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="😀">😀</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae818b9f4fcf7121bb68fe">最近一直在做infrastructure相关的工作，主要包括Azure Cloud, AWS Cloud相关的部署，其中使用的是就是Ansible — 一个现代化的自动化运维工具。Ansible贯彻了IAC(Infrastructure As Code)理念,所有的资源都会定义在代码里面,还可以通过不同环境部署灵活部署不同资源,在可维护性,自动化,安全性,可扩展性上都有很多优势,今天特意写一个文章来记录一下我对于Ansible的理解</div></div></div><div class="notion-blank notion-block-30552c4ca1ae812ab9abc98cabcf0e35"> </div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30552c4ca1ae81b4a8a4d3a3a3a64070" data-id="30552c4ca1ae81b4a8a4d3a3a3a64070"><span><div id="30552c4ca1ae81b4a8a4d3a3a3a64070" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81b4a8a4d3a3a3a64070" title="什么是Ansible"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>什么是Ansible</b></span></span></h2><div class="notion-text notion-block-30552c4ca1ae8196a133e3af6480d03a"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.ansible.com/">Ansible</a> 是 Red Hat 旗下的开源自动化运维工具，用一句话概括：<b>用代码描述你的基础设施，然后让机器自己搞定剩下的事</b>。它诞生于 2012 年，名字来源于科幻小说《安德的游戏》中一种能跨越光年瞬间通信的设备——寓意很明确：无论服务器在天涯海角，Ansible 都能瞬间触达。</div><div class="notion-text notion-block-30552c4ca1ae81749a30e9317014f28b">Ansible 的核心哲学是 <b>简单</b>。不需要在目标机器上安装任何 agent，只要有 SSH 就行。Playbook 用 YAML 编写，运维工程师和开发者都能秒懂。这也是它能在 Puppet、Chef、SaltStack 等一众竞品中脱颖而出的原因——<b>低门槛 + 高天花板</b>。</div><div class="notion-callout notion-yellow_background_co notion-block-30552c4ca1ae81cdbe47fe7e5e885c54"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🤔">🤔</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae8159a00dfa436c9614ef"><b>一个灵魂拷问：</b> 如果你现在还在手动 SSH 到每台服务器上敲命令、改配置、重启服务……那你可能需要认真考虑一下 Ansible 了。想象一下，100 台服务器统一升级 JDK 版本，手动操作可能需要一个下午加一杯咖啡（和一堆 typo），而 Ansible 只需要一条命令、几秒钟。</div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae81b98c52c9f0f229c67c" data-id="30552c4ca1ae81b98c52c9f0f229c67c"><span><div id="30552c4ca1ae81b98c52c9f0f229c67c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81b98c52c9f0f229c67c" title="Ansible vs 其他自动化工具"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ansible vs 其他自动化工具</span></span></h3><table class="notion-simple-table notion-block-30552c4ca1ae81c597a6cbab7135b36f"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30552c4ca1ae813caa23fd749df1a0ca"><td class="" style="width:120px"><div class="notion-simple-table-cell">特性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>Ansible</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>Puppet</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>Chef</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>Terraform</b></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81999fb5ebe293290b6c"><td class="" style="width:120px"><div class="notion-simple-table-cell">架构</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">无Agent（Agentless）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">需要Agent</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">需要Agent</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">无Agent</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae817dbb3afb4dc3eaeadd"><td class="" style="width:120px"><div class="notion-simple-table-cell">配置语言</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">YAML</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Puppet DSL</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Ruby DSL</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">HCL</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81bb8304f8087826ecef"><td class="" style="width:120px"><div class="notion-simple-table-cell">学习曲线</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐ 低</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐⭐ 高</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐⭐ 高</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">⭐⭐ 中</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae813aa6bffef797ffcafd"><td class="" style="width:120px"><div class="notion-simple-table-cell">核心定位</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">配置管理 + 应用部署</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">配置管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">配置管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">基础设施编排</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8158a170ca828a16cfa4"><td class="" style="width:120px"><div class="notion-simple-table-cell">幂等性</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 支持</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 支持</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 支持</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">✅ 支持</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae812a8f15ed0282705db9"><td class="" style="width:120px"><div class="notion-simple-table-cell">社区生态</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Galaxy（海量 Role）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Forge</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Supermarket</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Registry</div></td></tr></tbody></table><hr class="notion-hr notion-block-30552c4ca1ae81599305d1881a10bb69"/><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae8157a4b0ebfa4c5377b6" data-id="30552c4ca1ae8157a4b0ebfa4c5377b6"><span><div id="30552c4ca1ae8157a4b0ebfa4c5377b6" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8157a4b0ebfa4c5377b6" title="运行原理"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">运行原理</span></span></h3><div class="notion-text notion-block-30552c4ca1ae81e49b68d7cb80f709fb">Ansible 的运行原理出奇地直白，核心流程可以用一张图概括：</div><div class="notion-text notion-block-30552c4ca1ae81c78967f0e0cfd730d0"><b>执行步骤拆解：</b></div><ol start="1" class="notion-list notion-list-numbered notion-block-30552c4ca1ae810c8806d523b9a9ab8f" style="list-style-type:decimal"><li><b>读取 Inventory</b>：Ansible 首先从主机清单中获取目标机器的地址、分组和连接信息</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-30552c4ca1ae8190a426f1279721f8cb" style="list-style-type:decimal"><li><b>解析 Playbook</b>：按顺序解析 YAML 中定义的 Play 和 Task</li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-30552c4ca1ae812684c8fd7e4a5a8c6f" style="list-style-type:decimal"><li><b>生成 Python 脚本</b>：根据 Task 调用的 Module，在控制节点上生成对应的 Python 脚本</li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-30552c4ca1ae81e5a43cff3f6e45c4a2" style="list-style-type:decimal"><li><b>传输到目标机器</b>：通过 SSH（Linux）或 WinRM（Windows）将脚本推送到远程主机的临时目录</li></ol><ol start="5" class="notion-list notion-list-numbered notion-block-30552c4ca1ae813ba482eb02b108d7db" style="list-style-type:decimal"><li><b>远程执行</b>：在目标机器上执行脚本，收集执行结果</li></ol><ol start="6" class="notion-list notion-list-numbered notion-block-30552c4ca1ae81f5bb8beca2d5a62250" style="list-style-type:decimal"><li><b>返回 JSON 结果</b>：模块执行完毕后，以 JSON 格式返回执行状态（changed / ok / failed）</li></ol><ol start="7" class="notion-list notion-list-numbered notion-block-30552c4ca1ae81c5b522fc8b5c06ce03" style="list-style-type:decimal"><li><b>清理临时文件</b>：删除远程主机上的临时脚本</li></ol><div class="notion-callout notion-blue_background_co notion-block-30552c4ca1ae81dc86d3da1464673cc5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae81ba9cbde4d9d3e6b9cc"><b>关键特性：幂等性（Idempotency）</b></div><div class="notion-text notion-block-30552c4ca1ae81c78823fc814ec13382">同一个 Playbook 跑 1 次和跑 100 次的最终结果是一样的。Ansible 会先检测当前状态，只有当实际状态与期望状态不一致时才执行变更。这意味着你可以放心地反复执行同一个 Playbook，不用担心把系统搞崩。</div></div></div><hr class="notion-hr notion-block-30552c4ca1ae81669421e01a7bcd3410"/><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae811fa268ec9640104fab" data-id="30552c4ca1ae811fa268ec9640104fab"><span><div id="30552c4ca1ae811fa268ec9640104fab" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae811fa268ec9640104fab" title="核心概念"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>核心概念</b></span></span></h3><div class="notion-text notion-block-30552c4ca1ae8156b802fb67e9ac5aac">理解 Ansible，本质上就是理解下面这五个核心概念。它们之间的关系就像一出戏剧：<b>Inventory 是演员表，Modules 是基本动作，Plugins 是幕后特效，Playbook 是剧本，Roles 是角色分工</b>。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81449208c4d5a711410b" data-id="30552c4ca1ae81449208c4d5a711410b"><span><div id="30552c4ca1ae81449208c4d5a711410b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81449208c4d5a711410b" title="Modules"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Modules</span></span></h4><div class="notion-text notion-block-30552c4ca1ae81519719ea4a177f65b1">Module 是 Ansible 的<b>最小执行单元</b>，每个 Module 负责完成一个具体的任务。Ansible 内置了数千个模块，覆盖了你能想到的几乎所有运维场景。</div><div class="notion-text notion-block-30552c4ca1ae8110b1c9ff4a51a8e8dd"><b>常用模块速查表：</b></div><table class="notion-simple-table notion-block-30552c4ca1ae81408d51de019052da32"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30552c4ca1ae817a8139f0111ccf66f7"><td class="" style="width:120px"><div class="notion-simple-table-cell">模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">用途</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">示例</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81838f9ac8b94ff7a008"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">command</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">执行简单命令（不经过 Shell）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">command: whoami</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae811db7d8d73f2d235b60"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">shell</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">执行 Shell 命令（支持管道、重定向）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">shell: cat /etc/hosts \| grep db</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81eca4cef1b0ff9114d3"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">copy</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">将文件从控制节点复制到目标机器</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">copy: src=app.conf dest=/etc/app/</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81a78e69cdc8d31c9c47"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">template</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">使用 Jinja2 模板渲染配置文件</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8118ae99c9048c868176"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">yum</code> / <code class="notion-inline-code">apt</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">包管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">yum: name=nginx state=present</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae816e88acddaf34febebc"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">service</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">管理系统服务</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">service: name=nginx state=started enabled=yes</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8197ba15cba92439021c"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">file</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">管理文件和目录</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">file: path=/data state=directory mode=0755</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81d1a9affb267ec2b1a9"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">user</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">管理用户账号</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">user: name=deploy state=present</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81778219cf525735d0dd"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">docker_container</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">管理 Docker 容器</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">docker_container: name=myapp image=myapp:latest</code></div></td></tr></tbody></table><div class="notion-text notion-block-30552c4ca1ae814f93dee2e6c8530aa0">所有模块返回 JSON 格式的数据，你可以用 <code class="notion-inline-code">register</code> 关键字捕获返回值，在后续的 Task 中作为条件判断或变量使用。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81f588aafd46c7b6921c" data-id="30552c4ca1ae81f588aafd46c7b6921c"><span><div id="30552c4ca1ae81f588aafd46c7b6921c" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81f588aafd46c7b6921c" title="Plugins"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Plugins</span></span></h4><div class="notion-text notion-block-30552c4ca1ae811fb00fe391545aaf5b">Plugin 是 Ansible 的<b>扩展机制</b>，用于增强或改变 Ansible 的核心行为。如果 Module 是「做什么」，那 Plugin 就是「怎么做」。</div><div class="notion-text notion-block-30552c4ca1ae81898549e222a85a1c5b"><b>常见 Plugin 类型：</b></div><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81679396c8f8a7476b34"><li><b>Connection Plugins</b>：定义如何连接到目标主机（<code class="notion-inline-code">ssh</code>、<code class="notion-inline-code">winrm</code>、<code class="notion-inline-code">docker</code>、<code class="notion-inline-code">local</code>）</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81a0b974f1786e5595ed"><li><b>Callback Plugins</b>：定义执行结果的输出格式（默认终端输出、JSON、Slack 通知等）</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81e5b518e4bb0246fc03"><li><b>Lookup Plugins</b>：从外部数据源获取数据（文件、环境变量、HashiCorp Vault 等）</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae817292afffe5f453f36f"><li><b>Filter Plugins</b>：在 Jinja2 模板中对变量进行转换（<code class="notion-inline-code">to_json</code>、<code class="notion-inline-code">regex_replace</code> 等）</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae813c8f5fc05ee9cbcec1"><li><b>Inventory Plugins</b>：动态生成主机清单（从 AWS EC2、Azure、GCP 等云平台自动发现主机）</li></ul><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81f98cc4f35ee689b36b" data-id="30552c4ca1ae81f98cc4f35ee689b36b"><span><div id="30552c4ca1ae81f98cc4f35ee689b36b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81f98cc4f35ee689b36b" title="Collections"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Collections</span></span></h4><div class="notion-text notion-block-30552c4ca1ae81c4a4dacf120250253c">Collection 是 Ansible <b>2.9+ 引入的内容分发与命名空间机制</b>，把 Modules、Plugins、Roles、Playbook 甚至文档打包成一个可版本化、可分发的单元。你可以把它理解为 Ansible 世界的 <b>npm 包 / Maven artifact</b>——有统一的命名空间（<code class="notion-inline-code">namespace.collection_name</code>）、语义化版本号，以及一键安装的体验。</div><div class="notion-text notion-block-30552c4ca1ae81239c24f952cec33359">在 Ansible 2.9 之前，所有内置模块都塞在 <code class="notion-inline-code">ansible-base</code> 里，一更新就是几千个模块一起发版，维护成本爆炸。Collection 的出现让模块和插件可以<b>独立发布、独立升级</b>，社区贡献者也能更快地迭代自己的内容。</div><div class="notion-text notion-block-30552c4ca1ae814ba315ed71c6b42f96"><b>Collection 的内部结构：</b></div><div class="notion-text notion-block-30552c4ca1ae817d9d84d08fbb7e8237"><b>常用 Collection 速查表：</b></div><table class="notion-simple-table notion-block-30552c4ca1ae81e99c31eb00a2564460"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30552c4ca1ae811997caf60501809dce"><td class="" style="width:120px"><div class="notion-simple-table-cell">Collection</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">用途</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">典型模块</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8177b0bce825e35080fa"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">ansible.builtin</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Ansible 内置核心模块</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">copy</code>、<code class="notion-inline-code">template</code>、<code class="notion-inline-code">service</code>、<code class="notion-inline-code">debug</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81d8913ae9eafa0b31a3"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">azure.azcollection</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Azure 云资源管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">azure_rm_aks</code>、<code class="notion-inline-code">azure_rm_resourcegroup</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81f4b619c092b4bbdf1c"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://amazon.aws">amazon.aws</a></code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">AWS 云资源管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">ec2_instance</code>、<code class="notion-inline-code">s3_bucket</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8147881dfec7f464057d"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">kubernetes.core</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">Kubernetes 资源编排</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">k8s</code>、<code class="notion-inline-code">k8s_info</code>、<code class="notion-inline-code">helm</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8147a52bce0448c2727c"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">community.general</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">社区通用模块集合</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">docker_container</code>、<code class="notion-inline-code">ufw</code>、<code class="notion-inline-code">nmcli</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8197b516cd456c2233d3"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">community.mysql</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">MySQL 管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">mysql_db</code>、<code class="notion-inline-code">mysql_user</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae819184e6cac0163321e9"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">community.postgresql</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">PostgreSQL 管理</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">postgresql_db</code>、<code class="notion-inline-code">postgresql_user</code></div></td></tr></tbody></table><div class="notion-text notion-block-30552c4ca1ae81efa74fea4b26bd3dfd"><b>安装与使用：</b></div><div class="notion-text notion-block-30552c4ca1ae81a3892cd998f41cea60">在 Playbook 中引用 Collection 模块时，使用<b>完全限定名称（FQCN）</b>：</div><div class="notion-callout notion-blue_background_co notion-block-30552c4ca1ae81899290ea26c50fe1ff"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae81358f62d91c5901d860"><b>FQCN vs 短名：</b> Ansible 官方推荐始终使用 FQCN（如 <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://azure.azcollection.azure">azure.azcollection.azure</a></code><code class="notion-inline-code">_rm_resourcegroup</code>），因为当多个 Collection 包含同名模块时，短名会产生歧义。本文示例中的 <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://azure.azcollection.azure">azure.azcollection.azure</a></code><code class="notion-inline-code">_rm_aks</code> 就是 FQCN 写法。</div></div></div><div class="notion-text notion-block-30552c4ca1ae8117b03dd92304938ed0">你可以在 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://galaxy.ansible.com/">Ansible Galaxy</a> 上浏览和搜索所有公开的 Collection，也可以搭建私有 Galaxy 服务器来托管企业内部的 Collection。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae8179bf97eb6badf91bc0" data-id="30552c4ca1ae8179bf97eb6badf91bc0"><span><div id="30552c4ca1ae8179bf97eb6badf91bc0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8179bf97eb6badf91bc0" title="Playbook"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Playbook</span></span></h4><div class="notion-text notion-block-30552c4ca1ae81e3a725c72b420b7ba6">Playbook 是 Ansible 的<b>核心配置文件</b>，用 YAML 编写，定义了「在哪些机器上、按什么顺序、执行哪些任务」。一个 Playbook 可以包含多个 <b>Play</b>，每个 Play 针对一组主机执行一系列 <b>Task</b>。</div><div class="notion-text notion-block-30552c4ca1ae81759dc0edd6909ecba3"><b>Play 级别的执行顺序</b>（务必记住）：</div><ol start="1" class="notion-list notion-list-numbered notion-block-30552c4ca1ae81f8b9dcefe1fed8b4e0" style="list-style-type:decimal"><li><code class="notion-inline-code">pre_tasks</code> → 2. <code class="notion-inline-code">pre_tasks 的 handlers</code> → 3. <code class="notion-inline-code">roles</code> → 4. <code class="notion-inline-code">tasks</code> → 5. <code class="notion-inline-code">tasks 的 handlers</code> → 6. <code class="notion-inline-code">post_tasks</code> → 7. <code class="notion-inline-code">post_tasks 的 handlers</code></li></ol><div class="notion-callout notion-teal_background_co notion-block-30552c4ca1ae81afb3ade068b87b7c9b"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🎯">🎯</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae81698c67c64a65b71752"><b>Playbook 完整关键字速查表：</b></div></div></div><div class="notion-text notion-block-30552c4ca1ae81ecaf65e78fb4b770ab"><b>Play 级别关键字：</b></div><table class="notion-simple-table notion-block-30552c4ca1ae8135b34bfad906ebf909"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30552c4ca1ae814ab566e9fd5ef44fb4"><td class="" style="width:120px"><div class="notion-simple-table-cell">关键字</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">说明</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">示例值</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae814db727f969d0ffe05a"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">hosts</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">目标主机或主机组</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">webservers</code>、<code class="notion-inline-code">all</code>、<code class="notion-inline-code">web1:&amp;dbservers</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae818c8ae7d1f4c0a56ef4"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">become</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">是否提权</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">yes</code> / <code class="notion-inline-code">no</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81e49050cb4337637245"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">become_user</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">提权后切换的用户</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">root</code>、<code class="notion-inline-code">postgres</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae812da07cc0af2d120204"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">vars</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">直接定义变量</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">app_port: 8080</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81ed9dc7c35614d7581d"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">vars_files</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">从 YAML 文件加载变量</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">  • vars/prod.yml</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8169ac81d2061cf5704e"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">vars_prompt</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">运行时交互式输入变量</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">密码、确认信息等</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae817996d6cdb0a3a12bff"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">environment</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">为 Task 设置系统环境变量</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">JAVA_HOME: /usr/lib/jvm/java-11</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81c0a0edc5cd012f47fc"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">serial</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">滚动更新批次</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">1</code>、<code class="notion-inline-code">&quot;30%&quot;</code>、<code class="notion-inline-code">[1, 5, &quot;100%&quot;]</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8149800cdf958bc29863"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">strategy</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">执行策略</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">linear</code>（默认，逐步）、<code class="notion-inline-code">free</code>（各主机独立推进）</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae819aa156dbc4ca8cdf64"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">max_fail_percentage</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">允许的最大失败比例</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">10</code>（超过 10% 失败则中止）</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81599cd7c3cbb666746c"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">any_errors_fatal</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">任一主机失败是否终止全部</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">true</code> / <code class="notion-inline-code">false</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae814687dfdcf80a340a90"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">gather_facts</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">是否自动收集主机 Facts</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">yes</code> / <code class="notion-inline-code">no</code>（关闭可加速执行）</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8197a1a1cc45267ddd6e"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">connection</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">连接方式</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">ssh</code>、<code class="notion-inline-code">local</code>、<code class="notion-inline-code">docker</code>、<code class="notion-inline-code">winrm</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8149ae88db0dbe6d0e2e"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">pre_tasks</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">在 roles 和 tasks 之前执行</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">前置检查、环境准备</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81c78698d186a3ef68d7"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">post_tasks</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">在 tasks 和 handlers 之后执行</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">通知、清理、验证</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81e2a00ced0471aed13d"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">roles</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">引用角色</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">  • role: nginx</code></div></td></tr></tbody></table><div class="notion-text notion-block-30552c4ca1ae81ce9f12dcdd8466f08d"><b>Task 级别关键字：</b></div><table class="notion-simple-table notion-block-30552c4ca1ae8120abbdceccce316c3f"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30552c4ca1ae8119838add6b2c259ba4"><td class="" style="width:120px"><div class="notion-simple-table-cell">关键字</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">说明</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">示例</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81da9028edc741906249"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">tags</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">给 Task 打标签，运行时用 <code class="notion-inline-code">--tags</code> / <code class="notion-inline-code">--skip-tags</code> 过滤</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">tags: [deploy, config]</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae818e9324cdfe58bffa8d"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">when</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">条件判断</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">when: ansible_os_family == &quot;RedHat&quot;</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae812c90bbd06865b65734"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">loop</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">循环遍历列表</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">loop: [&quot;nginx&quot;, &quot;redis&quot;, &quot;java&quot;]</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81369365e1909dcb31ff"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">register</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">捕获 Task 返回结果到变量</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">register: cmd_result</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81e38eafe61832411da2"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">notify</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">状态变更时触发 Handler</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">notify: restart nginx</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81d19913edd7f0856436"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">ignore_errors</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">忽略错误继续执行</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">ignore_errors: yes</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81239228cb3c8ba37c75"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">changed_when</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">自定义 changed 判断条件</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">changed_when: false</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8163a15be28b600d405d"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">failed_when</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">自定义失败判断条件</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">failed_when: result.rc != 0</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae816da83fe5af715733b3"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">retries</code> / <code class="notion-inline-code">delay</code> / <code class="notion-inline-code">until</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">重试机制</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">retries: 5</code> <code class="notion-inline-code">delay: 10</code> <code class="notion-inline-code">until: result.status == 200</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81459dbaec5d34c8b306"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">delegate_to</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">将 Task 委派到其他主机执行</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">delegate_to: </code><code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://localhost">localhost</a></code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81cd918fd5ebfbe4ee08"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">run_once</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">整个 Play 只执行一次</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">run_once: true</code>（如数据库迁移）</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8172b86df5a3dced4ea9"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">block</code> / <code class="notion-inline-code">rescue</code> / <code class="notion-inline-code">always</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">异常处理（类似 try-catch-finally）</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">见下方示例</div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae8192b249c0e73d28ff1e"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">no_log</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">隐藏日志中的敏感信息</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">no_log: true</code>（如密码传输）</div></td></tr></tbody></table><div class="notion-text notion-block-30552c4ca1ae8164bd30e9e973faf494"><b>Block 异常处理示例：</b></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81418a07e242cb49b35d" data-id="30552c4ca1ae81418a07e242cb49b35d"><span><div id="30552c4ca1ae81418a07e242cb49b35d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81418a07e242cb49b35d" title="Inventory"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Inventory</span></span></h4><div class="notion-text notion-block-30552c4ca1ae817e989ec3d3b4b0024e">Inventory（主机清单）告诉 Ansible <b>「你要管理哪些机器」</b>。它可以是一个简单的 INI 文件，也可以是动态生成的。</div><div class="notion-text notion-block-30552c4ca1ae8128b476d5c860ef14e9"><b>静态 Inventory 示例：</b></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81a39a2bda2d54c3e956" data-id="30552c4ca1ae81a39a2bda2d54c3e956"><span><div id="30552c4ca1ae81a39a2bda2d54c3e956" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81a39a2bda2d54c3e956" title="分环境 Inventory 配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">分环境 Inventory 配置</span></span></h4><div class="notion-text notion-block-30552c4ca1ae81939072f253a57c3d3b">真实项目中，你通常有 <b>dev / staging / production</b> 多套环境，每套环境的主机、变量、密钥都不同。Ansible 的最佳实践是<b>每个环境一个 Inventory 目录</b>，配合 <code class="notion-inline-code">group_vars</code> 和 <code class="notion-inline-code">host_vars</code> 实现环境隔离。</div><div class="notion-text notion-block-30552c4ca1ae81ec8d15fa2ef35d8d51"><b>推荐目录结构：</b></div><div class="notion-text notion-block-30552c4ca1ae8160be04df774333686d"><b>inventory/dev/hosts.ini</b>（开发环境，单节点）：</div><div class="notion-text notion-block-30552c4ca1ae8198ad3be3cccda2812e"><b>inventory/staging/hosts.ini</b>（预发布环境）：</div><div class="notion-text notion-block-30552c4ca1ae81d9b2afcd9c3f410ef5"><b>inventory/production/hosts.ini</b>（生产环境，多节点 + 高可用）：</div><div class="notion-text notion-block-30552c4ca1ae81e69274d8a2e6c8e3a8"><b>group_vars 分环境变量对比：</b></div><table class="notion-simple-table notion-block-30552c4ca1ae81358d38c74d28192beb"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30552c4ca1ae81dda84fec5216c1db4e"><td class="" style="width:120px"><div class="notion-simple-table-cell">变量</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>dev</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>staging</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>production</b></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81d6b095d8ee364a19e8"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">app_debug</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">true</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">true</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">false</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae816bae93ebcf840f38b5"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">app_replicas</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">1</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">2</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">4</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81b9988ff87d5a53a06f"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">jvm_heap</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">512m</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">1g</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">4g</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81ccac18db71e294beec"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">db_host</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://localhost">localhost</a></code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">staging-db1</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">prod-db-master</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81e080d3d0e99378f58f"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">ssl_enabled</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">false</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">true</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">true</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81bcb47ec8c3a115cfd7"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">log_level</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">DEBUG</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">INFO</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">WARN</code></div></td></tr></tbody></table><div class="notion-text notion-block-30552c4ca1ae819e97c2f170e0144922"><b>inventory/dev/group_vars/all.yml</b> 示例：</div><div class="notion-text notion-block-30552c4ca1ae818f933fe78c2096e9c3"><b>inventory/production/group_vars/all.yml</b> 示例：</div><div class="notion-text notion-block-30552c4ca1ae81dabc17db47ae46735a"><b>运行时通过 </b><code class="notion-inline-code"><b>-i</b></code><b> 指定环境：</b></div><div class="notion-callout notion-blue_background_co notion-block-30552c4ca1ae81e5924dee0b18b3ae4c"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae810595cdf6ef9a742a28"><b>变量优先级（从低到高）：</b></div><div class="notion-text notion-block-30552c4ca1ae81aa82d7c09d8a202166"><code class="notion-inline-code">role defaults</code> → <code class="notion-inline-code">inventory group_vars/all</code> → <code class="notion-inline-code">inventory group_vars/&lt;group&gt;</code> → <code class="notion-inline-code">inventory host_vars/&lt;host&gt;</code> → <code class="notion-inline-code">playbook vars</code> → <code class="notion-inline-code">playbook vars_files</code> → <code class="notion-inline-code">role vars</code> → <code class="notion-inline-code">extra vars (-e)</code></div><div class="notion-text notion-block-30552c4ca1ae8190a921c87403761b37">生产实践中，把通用默认值放 <code class="notion-inline-code">group_vars/all.yml</code>，环境差异放各环境目录，运行时紧急覆盖用 <code class="notion-inline-code">-e</code>。</div></div></div><div class="notion-text notion-block-30552c4ca1ae81b6a943fa1f7a768103"><b>动态 Inventory</b>：在云环境中，服务器随时会增减。Ansible 支持通过脚本或 Inventory Plugin 动态获取主机列表，例如从 AWS EC2、Azure、GCP、阿里云等平台实时拉取。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81df8c47ef9ad87a6d70" data-id="30552c4ca1ae81df8c47ef9ad87a6d70"><span><div id="30552c4ca1ae81df8c47ef9ad87a6d70" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81df8c47ef9ad87a6d70" title="Roles"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Roles</span></span></h4><div class="notion-text notion-block-30552c4ca1ae8142a9b7dd1490fec314">Role 是 Ansible 的<b>最佳实践组织方式</b>，它将 Playbook 拆分成可复用、可共享的组件。把 Role 想象成<b>乐高积木</b>——每块积木专注做一件事，拼在一起就能搭出整个系统。</div><div class="notion-text notion-block-30552c4ca1ae817cbec8f85e81922fa0"><b>标准 Role 目录结构：</b></div><div class="notion-text notion-block-30552c4ca1ae819fbfb9d433ef3b9af2"><b>在 Playbook 中调用 Role：</b></div><div class="notion-text notion-block-30552c4ca1ae81a79db6eeca052d503b">你可以在 <a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://galaxy.ansible.com/">Ansible Galaxy</a> 上找到社区贡献的数万个 Role，覆盖从 Docker 安装到 Kubernetes 集群搭建的各种场景。别重复造轮子——先看看 Galaxy 上有没有现成的。</div><hr class="notion-hr notion-block-30552c4ca1ae81d2ba61f35506acfd79"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30552c4ca1ae8104981cc12b9e0a197b" data-id="30552c4ca1ae8104981cc12b9e0a197b"><span><div id="30552c4ca1ae8104981cc12b9e0a197b" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8104981cc12b9e0a197b" title="如何使用Ansible"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>如何使用Ansible</b></span></span></h2><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae8183b5d5d6a9052d377a" data-id="30552c4ca1ae8183b5d5d6a9052d377a"><span><div id="30552c4ca1ae8183b5d5d6a9052d377a" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8183b5d5d6a9052d377a" title="安装 Ansible"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>安装 Ansible</b></span></span></h3><div class="notion-text notion-block-30552c4ca1ae81aeba6cc213e974f939">Ansible 只需要安装在<b>控制节点</b>（你的工作机或 CI/CD 服务器）上，目标机器不需要装任何东西。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae8149b0e2e28d9fa68123" data-id="30552c4ca1ae8149b0e2e28d9fa68123"><span><div id="30552c4ca1ae8149b0e2e28d9fa68123" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8149b0e2e28d9fa68123" title="Linux（推荐）"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Linux（推荐）</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae815c9019c8cf9a549422" data-id="30552c4ca1ae815c9019c8cf9a549422"><span><div id="30552c4ca1ae815c9019c8cf9a549422" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae815c9019c8cf9a549422" title="macOS"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">macOS</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81ae8bececd8cfa31cdb" data-id="30552c4ca1ae81ae8bececd8cfa31cdb"><span><div id="30552c4ca1ae81ae8bececd8cfa31cdb" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81ae8bececd8cfa31cdb" title="Windows"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Windows</span></span></h4><div class="notion-text notion-block-30552c4ca1ae81efae78f9e3131e775a">Ansible 控制节点<b>不原生支持 Windows</b>。但你可以通过以下方式曲线救国：</div><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81cbb58bdcebd0ad6c40"><li><b>WSL 2（Windows Subsystem for Linux）</b>：在 WSL 中安装 Ubuntu，再装 Ansible ✅ 推荐</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81f8921af3cbd402de73"><li><b>Docker</b>：运行一个装有 Ansible 的容器</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae819bb6f2d352ff03d3ce"><li><b>Cygwin</b>：理论上可以，但坑多，不推荐</li></ul><div class="notion-text notion-block-30552c4ca1ae817cb971efdeb24d554f"><b>验证安装：</b></div><hr class="notion-hr notion-block-30552c4ca1ae816bb964d994652edc47"/><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae8110bd39cb955e36b681" data-id="30552c4ca1ae8110bd39cb955e36b681"><span><div id="30552c4ca1ae8110bd39cb955e36b681" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8110bd39cb955e36b681" title="配置 Ansible"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title"><b>配置 Ansible</b></span></span></h3><div class="notion-text notion-block-30552c4ca1ae81aa8687c93129e0afd5">Ansible 的配置按优先级从高到低依次为：</div><ol start="1" class="notion-list notion-list-numbered notion-block-30552c4ca1ae810b85b9cf1619bcd0e8" style="list-style-type:decimal"><li><code class="notion-inline-code">ANSIBLE_*</code> 环境变量</li></ol><ol start="2" class="notion-list notion-list-numbered notion-block-30552c4ca1ae819286e2cd76e17b7766" style="list-style-type:decimal"><li>当前目录下的 <code class="notion-inline-code">ansible.cfg</code></li></ol><ol start="3" class="notion-list notion-list-numbered notion-block-30552c4ca1ae8151a02aea82a5fa64b6" style="list-style-type:decimal"><li>用户主目录下的 <code class="notion-inline-code">~/.ansible.cfg</code></li></ol><ol start="4" class="notion-list notion-list-numbered notion-block-30552c4ca1ae81088db9c14bf72bd178" style="list-style-type:decimal"><li>全局配置 <code class="notion-inline-code">/etc/ansible/ansible.cfg</code></li></ol><div class="notion-text notion-block-30552c4ca1ae81e3a45ce341fcbb8c77"><b>推荐在项目根目录放一个 </b><code class="notion-inline-code"><b>ansible.cfg</b></code><b>：</b></div><div class="notion-callout notion-orange_background_co notion-block-30552c4ca1ae8122b4abdfb507e19174"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="⚠️">⚠️</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae81caad94d8cabaa26eed"><b>安全提醒：</b> <code class="notion-inline-code">host_key_checking = False</code> 只适合开发和测试环境。生产环境请保持开启，并使用 <code class="notion-inline-code">ssh-keyscan</code> 提前收集目标主机的指纹。</div></div></div><hr class="notion-hr notion-block-30552c4ca1ae81edb1a9c15017f5e0e9"/><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae819eb1f4e9be637ee6e1" data-id="30552c4ca1ae819eb1f4e9be637ee6e1"><span><div id="30552c4ca1ae819eb1f4e9be637ee6e1" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae819eb1f4e9be637ee6e1" title="运行 Ansible"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">运行 <b>Ansible</b></span></span></h3><div class="notion-text notion-block-30552c4ca1ae8151ad5cf11687f4fcc1">Ansible 提供两种运行方式：<b>Ad-Hoc 命令</b>（一次性任务）和 <b>Playbook</b>（编排任务）。</div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae8117a0b5f4335184cae2" data-id="30552c4ca1ae8117a0b5f4335184cae2"><span><div id="30552c4ca1ae8117a0b5f4335184cae2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8117a0b5f4335184cae2" title="Ad-Hoc 命令"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Ad-Hoc 命令</span></span></h4><div class="notion-text notion-block-30552c4ca1ae810f99a0f60b7c56c154">适合快速执行简单的一次性操作，语法：</div><div class="notion-text notion-block-30552c4ca1ae810abe2af22cae57b707"><b>实用示例：</b></div><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81d2adfae169fe28028e" data-id="30552c4ca1ae81d2adfae169fe28028e"><span><div id="30552c4ca1ae81d2adfae169fe28028e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81d2adfae169fe28028e" title="Playbook 运行"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">Playbook 运行</span></span></h4><div class="notion-callout notion-purple_background_co notion-block-30552c4ca1ae81bc8537e88fb70af50c"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="🚀">🚀</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae81debd05ee36e9720b8d"><b>进阶玩法：Ansible + CI/CD</b></div><div class="notion-text notion-block-30552c4ca1ae81898a49e1af4c859b61">在真实项目中，Ansible 通常不会手动运行，而是集成到 CI/CD 流水线中：</div><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae817a8744dd4435bd85eb"><li><b>GitLab CI / GitHub Actions</b>：代码合并到 main 分支后自动触发 Ansible 部署</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae811288c5f0b73aaaf685"><li><b>Jenkins</b>：通过 Ansible Plugin 在流水线中调用 Playbook</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81378e7eec8a70894e2f"><li><b>AWX / Ansible Tower</b>：Red Hat 提供的 Web UI 管理平台，支持权限控制、任务调度、审计日志</li></ul></div></div><hr class="notion-hr notion-block-30552c4ca1ae817fa4cef5e91f36f47e"/><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30552c4ca1ae81dcbebfdd47aec43796" data-id="30552c4ca1ae81dcbebfdd47aec43796"><span><div id="30552c4ca1ae81dcbebfdd47aec43796" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81dcbebfdd47aec43796" title="示例"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">示例</span></span></h2><div class="notion-text notion-block-30552c4ca1ae81178ccee146f8f649b3">来看一个贴近实际工作的完整示例：<b>用 Ansible 自动化创建 Azure AKS 集群，并将容器化应用部署到 Kubernetes 上，支持 dev / staging / production 三套环境</b>。</div><div class="notion-text notion-block-30552c4ca1ae81ecb929dd1829742b86">这个示例覆盖了云原生部署的完整链路：<b>创建 Azure 资源（Resource Group + AKS）→ 获取 kubeconfig → 部署 K8s 资源（Namespace、Deployment、Service、Ingress）→ 健康检查 → 通知</b>。</div><div class="notion-callout notion-blue_background_co notion-block-30552c4ca1ae81c8a4acf7470993d1a5"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="📦">📦</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae81d39298fefb3c776be4"><b>前置依赖：</b> 需要安装 Azure Ansible Collection 和相关 Python 库：</div><div class="notion-text notion-block-30552c4ca1ae8165a852ee319d9d0012"><code class="notion-inline-code">ansible-galaxy collection install azure.azcollection</code></div><div class="notion-text notion-block-30552c4ca1ae81779e4df476c0254ef9"><code class="notion-inline-code">pip install azure-identity azure-mgmt-containerservice kubernetes</code></div></div></div><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae81f0a5e6f3a16fda0a9e" data-id="30552c4ca1ae81f0a5e6f3a16fda0a9e"><span><div id="30552c4ca1ae81f0a5e6f3a16fda0a9e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81f0a5e6f3a16fda0a9e" title="完整项目目录结构"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">完整项目目录结构</span></span></h3><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae81cea19bfcea902baac0" data-id="30552c4ca1ae81cea19bfcea902baac0"><span><div id="30552c4ca1ae81cea19bfcea902baac0" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81cea19bfcea902baac0" title="多环境 Inventory 配置"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">多环境 Inventory 配置</span></span></h3><div class="notion-text notion-block-30552c4ca1ae81c2b81eff3be9417b6f">由于 AKS 操作全部在控制节点通过 Azure API 完成，Inventory 只需要 <code class="notion-inline-code"><a target="_blank" rel="noopener noreferrer" class="notion-link" href="http://localhost">localhost</a></code>，环境差异全靠 <code class="notion-inline-code">group_vars</code> 区分。</div><div class="notion-text notion-block-30552c4ca1ae816abc72e69dc47a6b81"><b>inventory/dev/hosts.yml</b>：</div><div class="notion-text notion-block-30552c4ca1ae813f9bfaf392b0ab4d02"><b>inventory/dev/group_vars/all.yml</b>：</div><div class="notion-text notion-block-30552c4ca1ae811c8191d22b75105ba4"><b>inventory/staging/group_vars/all.yml</b>：</div><div class="notion-text notion-block-30552c4ca1ae810aba0de055bd09777b"><b>inventory/production/group_vars/all.yml</b>：</div><div class="notion-text notion-block-30552c4ca1ae81ccb729da92a752621f"><b>分环境关键变量对比：</b></div><table class="notion-simple-table notion-block-30552c4ca1ae8115b3b6f7ead592ef86"><tbody><tr class="notion-simple-table-row notion-simple-table-header-row notion-block-30552c4ca1ae81ec919ae987805f7037"><td class="" style="width:120px"><div class="notion-simple-table-cell">变量</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>dev</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>staging</b></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><b>production</b></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae819ca1f3c27b84f11c99"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">aks_node_count</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">1</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">2</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">3</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81e09a60e694da71ff56"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">aks_node_vm_size</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">Standard_B2s</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">Standard_D2s_v3</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">Standard_D4s_v3</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81f0a8afcd6a5f494720"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">app_replicas</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">1</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">2</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">4</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81119f7af60f5d7c9c7b"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">SPRING_PROFILES_ACTIVE</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">dev</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">staging</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">production</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81edb69fcaf1be1589f0"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">LOG_LEVEL</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">DEBUG</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">INFO</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">WARN</code></div></td></tr><tr class="notion-simple-table-row notion-block-30552c4ca1ae81e9a43eeee3191a286d"><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">aks_availability_zones</code></div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">未设置</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell">未设置</div></td><td class="" style="width:120px"><div class="notion-simple-table-cell"><code class="notion-inline-code">[1, 2, 3]</code></div></td></tr></tbody></table><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81068cd5c5e3b5179c77" data-id="30552c4ca1ae81068cd5c5e3b5179c77"><span><div id="30552c4ca1ae81068cd5c5e3b5179c77" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81068cd5c5e3b5179c77" title="site.yml —— 总入口"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">site.yml —— 总入口</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81428789c587e0ec0ad2" data-id="30552c4ca1ae81428789c587e0ec0ad2"><span><div id="30552c4ca1ae81428789c587e0ec0ad2" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81428789c587e0ec0ad2" title="playbooks/aks-provision.yml —— 创建 AKS 集群"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">playbooks/aks-provision.yml —— 创建 AKS 集群</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae818cbb11f95681a52820" data-id="30552c4ca1ae818cbb11f95681a52820"><span><div id="30552c4ca1ae818cbb11f95681a52820" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae818cbb11f95681a52820" title="roles/azure-resource-group/tasks/main.yml"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">roles/azure-resource-group/tasks/main.yml</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae8167bd26cdaa21955389" data-id="30552c4ca1ae8167bd26cdaa21955389"><span><div id="30552c4ca1ae8167bd26cdaa21955389" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8167bd26cdaa21955389" title="roles/azure-aks/tasks/main.yml"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">roles/azure-aks/tasks/main.yml</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81f6addfe6bd6e9e7946" data-id="30552c4ca1ae81f6addfe6bd6e9e7946"><span><div id="30552c4ca1ae81f6addfe6bd6e9e7946" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81f6addfe6bd6e9e7946" title="playbooks/aks-deploy.yml —— 部署应用到 AKS"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">playbooks/aks-deploy.yml —— 部署应用到 AKS</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae816182b1f0d7db6b0008" data-id="30552c4ca1ae816182b1f0d7db6b0008"><span><div id="30552c4ca1ae816182b1f0d7db6b0008" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae816182b1f0d7db6b0008" title="roles/k8s-app/tasks/main.yml —— K8s 资源部署"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">roles/k8s-app/tasks/main.yml —— K8s 资源部署</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae819f9c48e7a4d29367ec" data-id="30552c4ca1ae819f9c48e7a4d29367ec"><span><div id="30552c4ca1ae819f9c48e7a4d29367ec" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae819f9c48e7a4d29367ec" title="roles/k8s-app/templates/deployment.yml.j2"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">roles/k8s-app/templates/deployment.yml.j2</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae81df886ac4f937880707" data-id="30552c4ca1ae81df886ac4f937880707"><span><div id="30552c4ca1ae81df886ac4f937880707" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81df886ac4f937880707" title="roles/k8s-app/templates/service.yml.j2"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">roles/k8s-app/templates/service.yml.j2</span></span></h4><h4 class="notion-h notion-h3 notion-h-indent-2 notion-block-30552c4ca1ae813b8bf0f21b8c5db9ce" data-id="30552c4ca1ae813b8bf0f21b8c5db9ce"><span><div id="30552c4ca1ae813b8bf0f21b8c5db9ce" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae813b8bf0f21b8c5db9ce" title="playbooks/aks-destroy.yml —— 销毁集群"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">playbooks/aks-destroy.yml —— 销毁集群</span></span></h4><h3 class="notion-h notion-h2 notion-h-indent-1 notion-block-30552c4ca1ae81eab4a3ff49bcd579d9" data-id="30552c4ca1ae81eab4a3ff49bcd579d9"><span><div id="30552c4ca1ae81eab4a3ff49bcd579d9" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae81eab4a3ff49bcd579d9" title="执行部署"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">执行部署</span></span></h3><div class="notion-callout notion-teal_background_co notion-block-30552c4ca1ae816e9fd7c3d6163c6df8"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae810691d3ea11ec81cf3f"><b>Ansible vs Terraform 部署 AKS 的边界：</b></div><div class="notion-text notion-block-30552c4ca1ae8141b737c7d84326a05a">Terraform 更擅长「基础设施声明式管理」（创建/销毁 AKS、VNet、NSG 等），Ansible 更擅长「应用层编排」（K8s 资源部署、配置渲染、健康检查、通知）。</div><div class="notion-text notion-block-30552c4ca1ae81049d3ed476d465d8e3">生产中两者经常搭配使用：<b>Terraform 建集群 → Ansible 部署应用</b>。本示例为了演示 Ansible 的完整能力，把两部分都用 Ansible 实现了。</div></div></div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30552c4ca1ae8152b2dacfbba506152e" data-id="30552c4ca1ae8152b2dacfbba506152e"><span><div id="30552c4ca1ae8152b2dacfbba506152e" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae8152b2dacfbba506152e" title="写在最后"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">写在最后</span></span></h2><div class="notion-text notion-block-30552c4ca1ae81569500c528281c422e">Ansible 的魅力在于它把复杂的基础设施管理变成了<b>可读、可版本控制、可复用的代码</b>。IAC 不只是一个技术理念，更是一种运维文化的转变——从「手工作坊」到「工业化生产」。</div><div class="notion-text notion-block-30552c4ca1ae81768317d9047dd84abe"><b>回顾一下我们学到了什么：</b></div><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81f591a9c882d50f166b"><li>Ansible 的<b>无Agent架构</b>让它部署成本极低，SSH 就是全部</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81fc9028c76373901026"><li><b>Playbook + Role</b> 的组合让自动化任务既灵活又可复用</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81829423d5fe3dc708d9"><li><b>幂等性</b>保证了操作的安全可重复</li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81fba74bdbba22bb9fe4"><li><b>Inventory</b> 支持静态和动态，完美适配云环境</li></ul><div class="notion-text notion-block-30552c4ca1ae812e95d6df1d4aa11d9f"><b>未来展望：</b> 随着云原生和混合云架构的普及，Ansible 的角色只会越来越重要。Red Hat 正在将 AI 能力融入 Ansible——Ansible Lightspeed 借助大语言模型，能根据自然语言描述自动生成 Playbook。想象一下，未来你只需要说「帮我在三台服务器上部署 Redis 集群」，AI 就能帮你写好整个 Playbook。那一天，可能比你想象的更近。</div><h2 class="notion-h notion-h1 notion-h-indent-0 notion-block-30552c4ca1ae817f9379ea2952750d8d" data-id="30552c4ca1ae817f9379ea2952750d8d"><span><div id="30552c4ca1ae817f9379ea2952750d8d" class="notion-header-anchor"></div><a class="notion-hash-link" href="#30552c4ca1ae817f9379ea2952750d8d" title="参考文章"><svg viewBox="0 0 16 16" width="16" height="16"><path fill-rule="evenodd" d="M7.775 3.275a.75.75 0 001.06 1.06l1.25-1.25a2 2 0 112.83 2.83l-2.5 2.5a2 2 0 01-2.83 0 .75.75 0 00-1.06 1.06 3.5 3.5 0 004.95 0l2.5-2.5a3.5 3.5 0 00-4.95-4.95l-1.25 1.25zm-4.69 9.64a2 2 0 010-2.83l2.5-2.5a2 2 0 012.83 0 .75.75 0 001.06-1.06 3.5 3.5 0 00-4.95 0l-2.5 2.5a3.5 3.5 0 004.95 4.95l1.25-1.25a.75.75 0 00-1.06-1.06l-1.25 1.25a2 2 0 01-2.83 0z"></path></svg></a><span class="notion-h-title">参考文章</span></span></h2><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81258940daed01d64e37"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://docs.ansible.com/">Ansible 官方文档</a></li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81c99e8bd67bff52d594"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://galaxy.ansible.com/">Ansible Galaxy - 社区 Role 仓库</a></li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae81f9bf49f75b6feff804"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://www.redhat.com/en/topics/automation/what-is-an-ansible-module">Red Hat - What is an Ansible Module</a></li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae812caf4ec25db49fab7d"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://spacelift.io/blog/ansible-best-practices">Spacelift - 50+ Ansible Best Practices</a></li></ul><ul class="notion-list notion-list-disc notion-block-30552c4ca1ae818b979ec843ee2bcec2"><li><a target="_blank" rel="noopener noreferrer" class="notion-link" href="https://github.com/ansible/ansible">Ansible GitHub 仓库</a></li></ul><div class="notion-blank notion-block-30552c4ca1ae8153bffad23dac788a53"> </div><div class="notion-blank notion-block-30552c4ca1ae810cb966db514a36fe2a"> </div><div class="notion-callout notion-gray_background_co notion-block-30552c4ca1ae81e2b429c0b032a8cbd8"><div class="notion-page-icon-inline notion-page-icon-span"><span class="notion-page-icon" role="img" aria-label="💡">💡</span></div><div class="notion-callout-text"><div class="notion-text notion-block-30552c4ca1ae81a18d3ae2e00c3d78dc">有关Ansible安装或者使用上的问题，欢迎您在底部评论区留言，一起交流~</div></div></div></main></div>]]></content:encoded>
        </item>
    </channel>
</rss>