<!DOCTYPE html><html lang="zh-CN"><head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>AI的"理性"迷思:从CMU最新研究看"复读机"的本质</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700;900&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"/>
<script src="https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
'serif': ['Noto Serif SC', 'serif'],
'sans': ['Inter', 'sans-serif'],
},
colors: {
primary: '#1e293b',
secondary: '#475569',
accent: '#3b82f6',
muted: '#64748b',
}
}
}
}
</script>
<style>
.mermaid-container {
display: flex;
justify-content: center;
min-height: 300px;
max-height: 800px;
background: #ffffff;
border: 2px solid #e5e7eb;
border-radius: 12px;
padding: 30px;
margin: 30px 0;
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
position: relative;
overflow: hidden;
}
<span class="mention-invalid">@media</span> (max-width: 768px) {
.mermaid-container {
padding: 15px;
}
}
.mermaid-container .mermaid {
width: 100%;
max-width: 100%;
height: 100%;
cursor: grab;
transition: transform 0.3s ease;
transform-origin: center center;
display: flex;
justify-content: center;
align-items: center;
touch-action: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.mermaid-container .mermaid svg {
max-width: 100%;
height: 100%;
display: block;
margin: 0 auto;
background: transparent;
}
.mermaid-container .mermaid:active {
cursor: grabbing;
}
.mermaid-container.zoomed .mermaid {
height: 100%;
width: 100%;
cursor: grab;
}
.mermaid-controls {
position: absolute;
top: 15px;
right: 15px;
display: flex;
gap: 10px;
z-index: 20;
background: rgba(255, 255, 255, 0.95);
padding: 8px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.mermaid-control-btn {
background: #ffffff;
border: 1px solid #d1d5db;
border-radius: 6px;
padding: 10px;
cursor: pointer;
transition: all 0.2s ease;
color: #374151;
font-size: 14px;
min-width: 36px;
height: 36px;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
.mermaid-control-btn:hover {
background: #f8fafc;
border-color: #3b82f6;
color: #3b82f6;
transform: translateY(-1px);
}
.mermaid-control-btn:active {
transform: scale(0.95);
}
.mermaid-fullscreen {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
background: rgba(255, 255, 255, 0.98);
z-index: 9999;
display: flex;
justify-content: center;
align-items: center;
}
.mermaid-fullscreen .mermaid-controls {
top: 20px;
right: 20px;
}
.back-to-top {
position: fixed;
bottom: 20px;
right: 20px;
background: #3b82f6;
color: white;
padding: 12px;
border-radius: 50%;
cursor: pointer;
opacity: 0;
transition: all 0.3s ease;
z-index: 1000;
}
.back-to-top.visible {
opacity: 1;
}
.back-to-top:hover {
background: #2563eb;
transform: translateY(-2px);
}
.toc-fixed {
position: fixed;
top: 0;
left: 0;
width: 80px;
height: 100vh;
background: #f8fafc;
border-right: 1px solid #e2e8f0;
overflow-y: auto;
z-index: 100;
padding: 2rem 1.5rem;
}
.main-content {
margin-left: 80px;
min-height: 100vh;
}
.toc-link {
display: block;
padding: 0.5rem 0;
color: #64748b;
text-decoration: none;
font-size: 0.875rem;
transition: color 0.2s ease;
border-left: 2px solid transparent;
padding-left: 1rem;
}
.toc-link:hover {
color: #3b82f6;
border-left-color: #3b82f6;
}
.toc-link.active {
color: #1e293b;
border-left-color: #1e293b;
font-weight: 500;
}
.section-divider {
height: 1px;
background: linear-gradient(to right, transparent, #e2e8f0, transparent);
margin: 4rem 0;
}
.citation-link {
color: #3b82f6;
text-decoration: none;
font-size: 0.75rem;
vertical-align: super;
margin-left: 2px;
}
.citation-link:hover {
text-decoration: underline;
}
.hero-grid {
display: grid;
grid-template-columns: 2fr 1fr;
gap: 2rem;
align-items: center;
min-height: 60vh;
}
.hero-text {
position: relative;
z-index: 2;
}
.hero-visual {
position: relative;
overflow: hidden;
border-radius: 1rem;
background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}
.quote-callout {
border-left: 4px solid #3b82f6;
background: #f8fafc;
padding: 1.5rem;
margin: 2rem 0;
font-style: italic;
border-radius: 0 0.5rem 0.5rem 0;
}
.highlight-box {
background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
border: 1px solid #bfdbfe;
border-radius: 0.75rem;
padding: 1.5rem;
margin: 1.5rem 0;
}
/* Mermaid 图表自定义样式 */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon {
stroke-width: 2px !important;
}
.mermaid .edgePath .path {
stroke-width: 2px !important;
}
.mermaid .edgeLabel {
background-color: rgba(255, 255, 255, 0.9) !important;
padding: 4px 8px !important;
border-radius: 4px !important;
font-size: 12px !important;
font-weight: 500 !important;
}
/* 改善文本对比度和统一样式 */
.mermaid text {
fill: #1f2937 !important;
font-family: 'Inter', sans-serif !important;
font-weight: 600 !important;
font-size: 13px !important;
}
/* 不同节点类型的颜色配置 - 确保高对比度 */
.mermaid .node.rational rect,
.mermaid .node.rational circle,
.mermaid .node.rational ellipse,
.mermaid .node.rational polygon {
fill: #dbeafe !important;
stroke: #2563eb !important;
}
.mermaid .node.rational text {
fill: #1e40af !important;
font-weight: 700 !important;
}
.mermaid .node.heuristic rect,
.mermaid .node.heuristic circle,
.mermaid .node.heuristic ellipse,
.mermaid .node.heuristic polygon {
fill: #fee2e2 !important;
stroke: #dc2626 !important;
}
.mermaid .node.heuristic text {
fill: #991b1b !important;
font-weight: 700 !important;
}
.mermaid .node.aibehavior rect,
.mermaid .node.aibehavior circle,
.mermaid .node.aibehavior ellipse,
.mermaid .node.aibehavior polygon {
fill: #fef3c7 !important;
stroke: #d97706 !important;
}
.mermaid .node.aibehavior text {
fill: #92400e !important;
font-weight: 700 !important;
}
.mermaid .node.pathway rect,
.mermaid .node.pathway circle,
.mermaid .node.pathway ellipse,
.mermaid .node.pathway polygon {
fill: #dcfce7 !important;
stroke: #16a34a !important;
}
.mermaid .node.pathway text {
fill: #15803d !important;
font-weight: 700 !important;
}
<span class="mention-invalid">@media</span> (max-width: 1024px) {
.toc-fixed {
display: none;
}
.main-content {
margin-left: 0;
}
.hero-grid {
grid-template-columns: 1fr;
gap: 1.5rem;
}
#hero h1 {
font-size: 2.5rem;
line-height: 1.2;
}
#hero p.text-xl {
font-size: 1rem;
}
#hero .hero-text {
padding: 0 1rem;
}
.hero-grid > .hero-text > div {
padding-left: 1rem;
padding-right: 1rem;
}
}
<span class="mention-invalid">@media</span> (max-width: 768px) {
body {
overflow-x: hidden;
}
.mermaid-container {
padding: 15px;
}
#hero h1 {
font-size: 2rem;
}
#hero .text-xl {
font-size: 1rem;
}
#hero .hero-visual img {
height: 300px;
}
}
<span class="mention-invalid">@media</span> (max-width: 640px) {
#hero h1 {
font-size: 1.8rem;
}
#hero .hero-visual img {
height: 250px;
}
#hero .hero-text {
padding: 0 0.5rem;
}
#hero .hero-text > div {
padding-left: 0.5rem;
padding-right: 0.5rem;
}
}
</style>
<base target="_blank">
</head>
<body class="bg-white text-primary font-sans">
<!-- Fixed Table of Contents -->
<nav class="toc-fixed">
<h3 class="font-serif font-bold text-lg mb-4 text-primary">目录</h3>
<div class="space-y-1">
<a href="#introduction" class="toc-link">引言</a>
<a href="#core-findings" class="toc-link">1. CMU研究核心发现</a>
<a href="#rag-systems" class="toc-link ml-4">1.1 RAG系统中的AI问答</a>
<a href="#heuristic-followers" class="toc-link ml-4">1.2 启发式跟随者</a>
<a href="#truth-effect" class="toc-link ml-8">1.2.1 幻象真理效应</a>
<a href="#primacy-effect" class="toc-link ml-8">1.2.2 首因效应</a>
<a href="#explanation-gap" class="toc-link ml-8">1.2.3 解释脱节</a>
<a href="#rational-elements" class="toc-link">2. 真正理性的核心要素</a>
<a href="#logical-rigor" class="toc-link ml-4">2.1 逻辑严谨性</a>
<a href="#evidence-weighing" class="toc-link ml-4">2.2 证据权衡</a>
<a href="#independent-thinking" class="toc-link ml-4">2.3 思维独立性</a>
<a href="#human-rationality" class="toc-link ml-4">2.4 人类理性维度</a>
<a href="#ai-limitations" class="toc-link">3. AI"复读机"的本质</a>
<a href="#technical-limits" class="toc-link ml-4">3.1 阶段性技术限制</a>
<a href="#inherent-limits" class="toc-link ml-4">3.2 固有能力局限</a>
<a href="#future-paths" class="toc-link ml-4">3.3 未来展望</a>
<a href="#conclusion" class="toc-link">结论</a>
</div>
</nav>
<!-- Main Content -->
<div class="main-content">
<!-- Introduction -->
<section id="introduction" class="px-8 py-16">
<div class="max-w-4xl mx-auto">
<div class="highlight-box">
<h2 class="font-serif text-3xl font-bold mb-6 text-primary">研究背景与核心议题</h2>
<p class="text-lg leading-relaxed mb-4">
人工智能系统是否具备真正的"理性"能力?这个问题在CMU的最新研究中得到了深刻的探讨。研究团队通过构建<strong>GroupQA数据集</strong>,包含<strong>1,635个有争议的二元问题</strong>和<strong>15,058份证据文档</strong>,系统性地评估了大型语言模型在信息整合中的表现。
</p>
<p class="text-lg leading-relaxed">
研究发现,当前最先进的LLMs在检索增强生成(RAG)范式下,行为模式更一致地表现为<strong>"启发式跟随者"</strong>而非理想的<strong>"理性整合者"</strong>。这一发现不仅对RAG系统的设计具有指导意义,更引发了关于AI"理性"本质的深刻反思。
</p>
</div>
</div>
</section>
<div class="section-divider"></div>
<!-- Section 1: Core Findings -->
<section id="core-findings" class="px-8 py-16">
<div class="max-w-6xl mx-auto">
<h2 class="font-serif text-4xl font-bold mb-12 text-center text-primary">1. CMU研究核心发现</h2>
<!-- RAG Systems -->
<div id="rag-systems" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-6 text-primary">1.1 RAG系统中的AI问答</h3>
<p class="text-lg leading-relaxed mb-6">
检索增强生成(RAG)已成为解决大型语言模型"幻觉"问题的主流范式。其核心假设是,<strong>LLM能够像一个理性的信息整合者一样,有效地权衡和综合检索到的、可能包含冲突信息的证据</strong>
<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
<div class="bg-slate-50 p-6 rounded-lg mb-6">
<h4 class="font-semibold mb-4">RAG系统的工作原理:</h4>
<ol class="list-decimal list-inside space-y-2 text-muted">
<li>接收用户查询</li>
<li>从外部知识库检索相关文档</li>
<li>将文档作为上下文提供给LLM</li>
<li>生成基于事实的回答</li>
</ol>
</div>
<p class="text-lg leading-relaxed">
然而,CMU的研究对这一核心假设提出了挑战。在现实世界的开放域问答场景中,检索到的信息往往不是简单的"一对一"冲突,而是一个复杂的<strong>"一对多"集合</strong>,包含大量重复、冗余甚至相互矛盾的观点。
</p>
</div>
<!-- Heuristic Followers -->
<div id="heuristic-followers" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-6 text-primary">1.2 关键结论:AI是"启发式跟随者"</h3>
<p class="text-lg leading-relaxed mb-6">
研究的核心结论是,<strong>当前的大型语言模型在面对一组复杂的证据时,其行为模式更贴近于"启发式跟随者",而非理想的"理性整合者"</strong>
<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
<div class="quote-callout">
"模型在整合证据时,并非如理想中那样进行深度的语义理解和逻辑推理,而是倾向于依赖一些低层次的启发式线索,例如信息的重复频率和呈现顺序。"
</div>
<p class="text-lg leading-relaxed">
这种行为模式暴露了AI系统在信息处理上的根本脆弱性,并暗示其距离真正的、类似人类的理性决策仍有相当长的路要走。
</p>
</div>
<!-- Truth Effect -->
<div id="truth-effect" class="mb-12">
<h4 class="font-serif text-xl font-bold mb-6 text-primary">1.2.1 幻象真理效应:重复信息的误导性</h4>
<p class="text-lg leading-relaxed mb-6">
CMU研究揭示的一个关键现象是大型语言模型表现出强烈的<strong>"幻象真理效应"</strong>。研究发现,<strong>信息的重复性会显著影响其判断,甚至超过信息本身的质量和独立性</strong>
<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
<div class="bg-white border border-gray-200 rounded-lg overflow-hidden mb-6">
<div class="bg-slate-100 px-6 py-4 border-b border-gray-200">
<h5 class="font-semibold">不同模型在面对多样化证据与重复证据时的表现对比</h5>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-slate-50">
<tr>
<th class="px-6 py-4 text-left font-medium text-muted">模型</th>
<th class="px-6 py-4 text-center font-medium text-muted">多样化证据翻转率</th>
<th class="px-6 py-4 text-center font-medium text-muted">重复证据翻转率</th>
<th class="px-6 py-4 text-center font-medium text-muted">变化</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
<tr>
<td class="px-6 py-4 font-medium">DeepSeek-R1-8B</td>
<td class="px-6 py-4 text-center">67.6%</td>
<td class="px-6 py-4 text-center">76.5%</td>
<td class="px-6 py-4 text-center text-red-600 font-semibold">↑ 8.9%</td>
</tr>
<tr>
<td class="px-6 py-4 font-medium">Gemini-2.5-FL</td>
<td class="px-6 py-4 text-center">63.7%</td>
<td class="px-6 py-4 text-center">75.6%</td>
<td class="px-6 py-4 text-center text-red-600 font-semibold">↑ 11.9%</td>
</tr>
</tbody>
</table>
</div>
</div>
<p class="text-lg leading-relaxed">
实验表明,向模型提供一份经过改写的、内容重复的文档,比提供一份全新的、独立的、但同样支持该观点的文档,更能有效地改变模型的决策。这意味着,在模型的"思维"过程中,信息的"数量"胜过了信息的"质量"。
</p>
</div>
<!-- Primacy Effect -->
<div id="primacy-effect" class="mb-12">
<h4 class="font-serif text-xl font-bold mb-6 text-primary">1.2.2 首因效应:信息顺序的决定性影响</h4>
<p class="text-lg leading-relaxed mb-6">
除了信息的重复性,CMU的研究还发现,大型语言模型在整合证据时表现出显著的<strong>"首因效应"</strong>,即<strong>信息在上下文中的呈现顺序对其最终决策具有决定性影响</strong>
<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
<div class="bg-blue-50 border-l-4 border-blue-400 p-6 mb-6">
<h5 class="font-semibold mb-2">首因效应的表现:</h5>
<ul class="list-disc list-inside space-y-1 text-muted">
<li>模型强烈偏爱最先呈现的证据</li>
<li>后续证据难以对初始判断产生同等修正作用</li>
<li>最初信息建立"锚点",后续处理被"锚定"</li>
</ul>
</div>
<p class="text-lg leading-relaxed">
这种行为模式对RAG系统的设计具有重要启示。在真实的RAG应用中,检索到的文档通常是按某种相关性得分排序后呈现给LLM的。然而,这种排序并不总是等同于证据的质量或重要性。
</p>
</div>
<!-- Explanation Gap -->
<div id="explanation-gap" class="mb-12">
<h4 class="font-serif text-xl font-bold mb-6 text-primary">1.2.3 模型解释与决策过程的脱节</h4>
<p class="text-lg leading-relaxed mb-6">
CMU研究的另一个令人警醒的发现是,大型语言模型为其决策提供的解释与其真实的决策过程之间存在严重的不一致性,即模型的解释是<strong>"不忠实的"</strong>
<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
<div class="bg-amber-50 border border-amber-200 rounded-lg p-6 mb-6">
<div class="flex items-center mb-4">
<i class="fas fa-exclamation-triangle text-amber-600 mr-3"></i>
<h5 class="font-semibold text-amber-800">关键发现:解释的不忠实性</h5>
</div>
<p class="text-amber-700">
在<strong>Llama-3.1-70B</strong>模型上,其<strong>自我报告的归因与真实因果情况相符的比例仅为26%</strong>。
即使在实验中使用了思维链(Chain-of-Thought)提示,也无法纠正其基于启发式的偏见。
</p>
</div>
<p class="text-lg leading-relaxed">
这一发现具有极其重要的意义,因为它直接挑战了我们对AI可解释性的信任。如果模型的解释仅仅是事后为某个由启发式规则得出的结论进行"合理化",而非真实反映其决策依据,那么这种可解释性就是一种"幻觉"。
</p>
</div>
</div>
</section>
<div class="section-divider"></div>
<!-- Section 2: Rational Elements -->
<section id="rational-elements" class="px-8 py-16 bg-slate-50">
<div class="max-w-6xl mx-auto">
<h2 class="font-serif text-4xl font-bold mb-12 text-center text-primary">2. 真正的"理性"决策:核心要素与标准</h2>
<div class="mb-16">
<p class="text-xl leading-relaxed text-center max-w-4xl mx-auto mb-12">
人类的理性决策是一个复杂而多维度的认知过程,它远不止于逻辑的正确性,更包含了对信息的深度理解、对证据的客观权衡以及对自身偏见的反思与修正。
</p>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8 mb-12">
<div class="bg-white p-8 rounded-lg shadow-sm">
<h3 class="font-serif text-xl font-bold mb-4 text-primary flex items-center">
<i class="fas fa-brain text-accent mr-3"></i>
理性决策的核心要素
</h3>
<ul class="space-y-3">
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mr-3 mt-1"></i>
<span><strong>逻辑严谨性:</strong>遵循结构化与有序的思考过程</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mr-3 mt-1"></i>
<span><strong>证据权衡:</strong>基于事实与数据的客观判断</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mr-3 mt-1"></i>
<span><strong>思维独立性:</strong>独立于信息呈现方式的判断</span>
</li>
<li class="flex items-start">
<i class="fas fa-check-circle text-green-500 mr-3 mt-1"></i>
<span><strong>偏见修正:</strong>识别并修正认知偏见的能力</span>
</li>
</ul>
</div>
<div class="bg-white p-8 rounded-lg shadow-sm">
<h3 class="font-serif text-xl font-bold mb-4 text-primary flex items-center">
<i class="fas fa-robot text-red-500 mr-3"></i>
AI的现状与挑战
</h3>
<ul class="space-y-3">
<li class="flex items-start">
<i class="fas fa-times-circle text-red-500 mr-3 mt-1"></i>
<span><strong>启发式依赖:</strong>受"幻象真理效应"影响</span>
</li>
<li class="flex items-start">
<i class="fas fa-times-circle text-red-500 mr-3 mt-1"></i>
<span><strong>顺序偏见:</strong>"首因效应"主导决策</span>
</li>
<li class="flex items-start">
<i class="fas fa-times-circle text-red-500 mr-3 mt-1"></i>
<span><strong>解释脱节:</strong>自我解释与真实决策不符</span>
</li>
<li class="flex items-start">
<i class="fas fa-times-circle text-red-500 mr-3 mt-1"></i>
<span><strong>缺乏深度:</strong>基于统计模式而非真正理解</span>
</li>
</ul>
</div>
</div>
</div>
<!-- Logical Rigor -->
<div id="logical-rigor" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-8 text-primary">2.1 逻辑严谨性与一致性</h3>
<div class="bg-white p-8 rounded-lg shadow-sm mb-8">
<h4 class="font-semibold text-lg mb-4 text-primary">理性决策的典型流程</h4>
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
<div class="bg-blue-50 p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="w-8 h-8 bg-blue-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3">1</div>
<h5 class="font-medium">识别问题</h5>
</div>
<p class="text-sm text-muted">准确定义问题,分析理想与现实的差距</p>
</div>
<div class="bg-green-50 p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="w-8 h-8 bg-green-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3">2</div>
<h5 class="font-medium">确定标准</h5>
</div>
<p class="text-sm text-muted">建立具体、可测量的评估标准</p>
</div>
<div class="bg-yellow-50 p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="w-8 h-8 bg-yellow-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3">3</div>
<h5 class="font-medium">分配权重</h5>
</div>
<p class="text-sm text-muted">根据重要性为不同标准分配权重</p>
</div>
<div class="bg-purple-50 p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="w-8 h-8 bg-purple-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3">4</div>
<h5 class="font-medium">拟定方案</h5>
</div>
<p class="text-sm text-muted">广泛搜集所有可能的解决方案</p>
</div>
<div class="bg-red-50 p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="w-8 h-8 bg-red-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3">5</div>
<h5 class="font-medium">评估方案</h5>
</div>
<p class="text-sm text-muted">基于标准和权重进行客观评估</p>
</div>
<div class="bg-indigo-50 p-4 rounded-lg">
<div class="flex items-center mb-2">
<div class="w-8 h-8 bg-indigo-500 text-white rounded-full flex items-center justify-center text-sm font-bold mr-3">6</div>
<h5 class="font-medium">选择最优</h5>
</div>
<p class="text-sm text-muted">选择能够最大化预期效用的方案</p>
</div>
</div>
</div>
<p class="text-lg leading-relaxed">
相比之下,CMU的研究揭示了LLMs在处理信息时缺乏这种结构化的思考。它们的行为更多地受到"首因效应"等启发式规则的影响,即决策在很大程度上被最先接收到的信息所锚定,而不是通过一个有序的过程来综合所有信息<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
</div>
<!-- Evidence Weighing -->
<div id="evidence-weighing" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-8 text-primary">2.2 证据的客观权衡与整合</h3>
<div class="bg-white p-8 rounded-lg shadow-sm mb-8">
<h4 class="font-semibold text-lg mb-4 text-primary">基于事实与数据的判断</h4>
<p class="leading-relaxed mb-4">
理性决策要求决策必须建立在客观事实和可靠数据的基础之上,而非情绪、直觉或"gut feelings"<a href="https://www.kdan.com/blog/rational-decision-making" class="citation-link">[45]</a>
<a href="https://aztechtraining.com/articles/rational-vs-intuitive-decision-making-models" class="citation-link">[48]</a>。
</p>
<div class="bg-green-50 border border-green-200 rounded-lg p-4 mb-4">
<div class="flex items-center mb-2">
<i class="fas fa-chart-line text-green-600 mr-3"></i>
<h5 class="font-semibold text-green-800">数据驱动决策的优势</h5>
</div>
<p class="text-green-700 text-sm">
普华永道(PwC)的调查显示,那些能够有效利用数据的公司,其决策过程获得显著改善的可能性是依赖直觉的公司的三倍。
</p>
</div>
<p class="leading-relaxed">
CMU的研究结果恰恰揭示了当前AI系统在这一方面的不足。研究发现,LLMs在整合证据时,并非基于对事实强度的客观评估,而是受到"幻象真理效应"等启发式规则的严重影响<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
</div>
</div>
<!-- Independent Thinking -->
<div id="independent-thinking" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-8 text-primary">2.3 思维的独立性与偏见修正</h3>
<div class="bg-white p-8 rounded-lg shadow-sm mb-8">
<h4 class="font-semibold text-lg mb-4 text-primary">识别并修正认知偏见</h4>
<p class="leading-relaxed mb-6">
人类思维过程并非完美无缺,而是充满了各种系统性的认知偏差。常见的认知偏见包括:
</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
<div class="bg-red-50 border border-red-200 rounded-lg p-4">
<h5 class="font-semibold text-red-800 mb-2">确认偏误</h5>
<p class="text-red-700 text-sm">倾向于寻找、解释和记住那些证实自己既有信念的信息</p>
</div>
<div class="bg-orange-50 border border-orange-200 rounded-lg p-4">
<h5 class="font-semibold text-orange-800 mb-2">可得性启发式</h5>
<p class="text-orange-700 text-sm">倾向于高估那些更容易在记忆中提取的事件的发生概率</p>
</div>
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-4">
<h5 class="font-semibold text-yellow-800 mb-2">锚定效应</h5>
<p class="text-yellow-700 text-sm">过度依赖最先接收到的信息,即使这个"锚"是随机的</p>
</div>
<div class="bg-purple-50 border border-purple-200 rounded-lg p-4">
<h5 class="font-semibold text-purple-800 mb-2">沉没成本谬误</h5>
<p class="text-purple-700 text-sm">因为已经投入资源而继续失败的项目</p>
</div>
</div>
<p class="leading-relaxed">
一个理性的决策者必须具备识别并修正这些偏见的能力。然而,正如CMU研究所示,当前LLM不仅没有修正偏见,反而在学习过程中放大了这些源于人类数据的偏见<a href="https://arxiv.org/html/2601.06189v1" class="citation-link">[4]</a>。
</p>
</div>
</div>
<!-- Human Rationality -->
<div id="human-rationality" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-8 text-primary">2.4 人类理性的独特维度</h3>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div class="bg-white p-8 rounded-lg shadow-sm">
<h4 class="font-semibold text-lg mb-4 text-primary flex items-center">
<i class="fas fa-heart text-red-500 mr-3"></i>
常识与伦理推理
</h4>
<p class="leading-relaxed mb-4">
人类的理性决策深深植根于庞大的常识知识库和内在的伦理框架。在经典的"电车难题"中,人类的决策不仅基于功利主义计算,还受到道德原则、情感反应和社会规范的影响。
</p>
<div class="bg-red-50 p-4 rounded-lg">
<p class="text-red-700 text-sm italic">
一个没有"自我模型"的系统,无法真正理解其承诺的意义,也无法在原则冲突时进行有效的道德权衡。
</p>
</div>
</div>
<div class="bg-white p-8 rounded-lg shadow-sm">
<h4 class="font-semibold text-lg mb-4 text-primary flex items-center">
<i class="fas fa-user text-blue-500 mr-3"></i>
具身认知与情境理解
</h4>
<p class="leading-relaxed mb-4">
人类的认知和理性与我们的身体以及我们与物理世界的互动紧密相连。我们的身体形态、感官系统和运动能力共同塑造了我们感知世界、形成概念和进行推理的方式。
</p>
<div class="bg-blue-50 p-4 rounded-lg">
<p class="text-blue-700 text-sm">
当前AI对情境的理解仍然是浅层的、基于文本模式的,缺乏对真实世界情境的"在场"体验。
</p>
</div>
</div>
</div>
</div>
</div>
</section>
<div class="section-divider"></div>
<!-- Section 3: AI Limitations -->
<section id="ai-limitations" class="px-8 py-16">
<div class="max-w-6xl mx-auto">
<h2 class="font-serif text-4xl font-bold mb-12 text-center text-primary">3. AI"复读机"行为的本质探源</h2>
<div class="mb-12">
<p class="text-xl leading-relaxed text-center max-w-4xl mx-auto mb-8">
CMU的研究深刻地揭示了当前LLMs表现出的"复读机"般的行为特征,这些行为既是当前技术发展的阶段性限制,也源于AI系统本质上就难以具备像人类那样的"理性"能力。
</p>
<!-- Comparison Diagram -->
<div class="bg-white p-8 rounded-lg shadow-sm mb-12">
<h3 class="font-serif text-xl font-bold mb-6 text-center text-primary">AI行为模式对比分析</h3>
<div class="mermaid-container">
<div class="mermaid-controls">
<button class="mermaid-control-btn zoom-in" title="放大">
<i class="fas fa-search-plus"></i>
</button>
<button class="mermaid-control-btn zoom-out" title="缩小">
<i class="fas fa-search-minus"></i>
</button>
<button class="mermaid-control-btn reset-zoom" title="重置">
<i class="fas fa-expand-arrows-alt"></i>
</button>
<button class="mermaid-control-btn fullscreen" title="全屏查看">
<i class="fas fa-expand"></i>
</button>
</div>
<div class="mermaid">
graph TB
A["AI信息处理方式"] --> B["启发式跟随者"]
A --> C["理性整合者理想"]
B --> D["幻象真理效应"]
B --> E["首因效应"]
B --> F["解释不忠实"]
C --> G["逻辑严谨性"]
C --> H["证据客观权衡"]
C --> I["思维独立性"]
D --> J["复读机行为"]
E --> J
F --> J
G --> K["真正理性"]
H --> K
I --> K
style B fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#991b1b
style C fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#1e40af
style J fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#92400e
style K fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#15803d
style A fill:#f8fafc,stroke:#64748b,stroke-width:2px,color:#374151
style D fill:#fef2f2,stroke:#dc2626,stroke-width:1px,color:#7f1d1d
style E fill:#fef2f2,stroke:#dc2626,stroke-width:1px,color:#7f1d1d
style F fill:#fef2f2,stroke:#dc2626,stroke-width:1px,color:#7f1d1d
style G fill:#f0f9ff,stroke:#0284c7,stroke-width:1px,color:#0c4a6e
style H fill:#f0f9ff,stroke:#0284c7,stroke-width:1px,color:#0c4a6e
style I fill:#f0f9ff,stroke:#0284c7,stroke-width:1px,color:#0c4a6e
</div>
</div>
</div>
</div>
<!-- Technical Limits -->
<div id="technical-limits" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-8 text-primary">3.1 当前技术的阶段性限制</h3>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 mb-12">
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<i class="fas fa-chart-bar text-blue-500 text-2xl mr-3"></i>
<h4 class="font-semibold text-lg text-primary">统计模式匹配</h4>
</div>
<p class="text-muted leading-relaxed mb-4">
LLMs基于统计模式匹配,学习词语之间的共现概率和统计相关性,而非真正"思考"或"推理"。
</p>
<div class="bg-blue-50 p-3 rounded text-sm text-blue-700">
AI的"复读机"行为是其基于统计模式匹配这一技术路径的直接产物
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<i class="fas fa-search text-green-500 text-2xl mr-3"></i>
<h4 class="font-semibold text-lg text-primary">缺乏语义理解</h4>
</div>
<p class="text-muted leading-relaxed mb-4">
模型缺乏真正的语义理解和深度认知,其"理解"更多体现为复杂的"查表"或"模式匹配"。
</p>
<div class="bg-green-50 p-3 rounded text-sm text-green-700">
无法进行有效的因果推理,难以理解"独立性"和"冗余"的概念
</div>
</div>
<div class="bg-white p-6 rounded-lg shadow-sm">
<div class="flex items-center mb-4">
<i class="fas fa-database text-purple-500 text-2xl mr-3"></i>
<h4 class="font-semibold text-lg text-primary">数据依赖性</h4>
</div>
<p class="text-muted leading-relaxed mb-4">
模型对训练数据高度依赖,泛化能力不足,难以处理分布外(OOD)问题。
</p>
<div class="bg-purple-50 p-3 rounded text-sm text-purple-700">
模型行为是对训练数据中人类行为的模仿和平均
</div>
</div>
</div>
</div>
<!-- Inherent Limits -->
<div id="inherent-limits" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-8 text-primary">3.2 AI系统固有的理性能力局限</h3>
<div class="bg-white p-8 rounded-lg shadow-sm mb-8">
<h4 class="font-semibold text-lg mb-6 text-primary">根本性局限的三大维度</h4>
<div class="space-y-8">
<div class="flex items-start">
<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mr-6 flex-shrink-0">
<i class="fas fa-ghost text-red-600"></i>
</div>
<div>
<h5 class="font-semibold text-lg mb-2 text-primary">缺乏意识与主观体验</h5>
<p class="text-muted leading-relaxed mb-3">
意识与主观体验是人类理性的基石,也是当前AI系统完全缺失的维度。一个没有意识的AI系统,无法拥有任何主观体验,其道德推理必然是空洞和形式化的。
</p>
<div class="bg-red-50 border-l-4 border-red-400 p-4">
<p class="text-red-700 text-sm italic">
一个没有"自我模型"的系统,无法真正理解其承诺的意义,也无法在原则冲突时进行有效的道德权衡。
</p>
</div>
</div>
</div>
<div class="flex items-start">
<div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mr-6 flex-shrink-0">
<i class="fas fa-user text-blue-600"></i>
</div>
<div>
<h5 class="font-semibold text-lg mb-2 text-primary">无法进行具身认知</h5>
<p class="text-muted leading-relaxed mb-3">
具身认知是人类理解世界的重要方式,但AI系统作为纯粹的软件实体,完全无法进行具身认知。它们被困在数字世界中,只能通过符号来"了解"物理世界。
</p>
<div class="bg-blue-50 border-l-4 border-blue-400 p-4">
<p class="text-blue-700 text-sm">
这种"无身"的状态使得AI对世界的理解必然是抽象、片面和去情境化的
</p>
</div>
</div>
</div>
<div class="flex items-start">
<div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mr-6 flex-shrink-0">
<i class="fas fa-link text-green-600"></i>
</div>
<div>
<h5 class="font-semibold text-lg mb-2 text-primary">难以实现因果推理</h5>
<p class="text-muted leading-relaxed mb-3">
真正的因果推理与常识整合是人类理性的高级形式,也是当前AI系统面临的巨大挑战。LLMs在因果推理方面表现出明显的困难,无法建立真正可操作、可干预的因果模型。
</p>
<div class="bg-green-50 border-l-4 border-green-400 p-4">
<p class="text-green-700 text-sm">
AI的"复读机"行为,在很大程度上源于其无法将零散知识整合成连贯的、具有因果结构的常识网络
</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Future Paths -->
<div id="future-paths" class="mb-16">
<h3 class="font-serif text-2xl font-bold mb-8 text-primary">3.3 未来展望:通往更"理性"AI的路径</h3>
<div class="bg-white rounded-lg shadow-sm overflow-hidden mb-8">
<div class="bg-slate-100 px-8 py-4 border-b border-gray-200">
<h4 class="font-semibold text-lg text-primary">通往更"理性"AI的潜在路径</h4>
</div>
<div class="overflow-x-auto">
<table class="w-full">
<thead class="bg-slate-50">
<tr>
<th class="px-8 py-4 text-left font-medium text-muted">路径</th>
<th class="px-8 py-4 text-left font-medium text-muted">核心思想</th>
<th class="px-8 py-4 text-left font-medium text-muted">目标</th>
<th class="px-8 py-4 text-left font-medium text-muted">挑战</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
<tr>
<td class="px-8 py-6 font-medium text-blue-600">模型规模与鲁棒性提升</td>
<td class="px-8 py-6 text-muted">通过扩大模型参数和数据量,增强模式识别和知识整合能力</td>
<td class="px-8 py-6 text-muted">提升模型对噪声和对抗性输入的抵抗力</td>
<td class="px-8 py-6 text-muted">计算成本高昂,可能引入更复杂的偏见</td>
</tr>
<tr>
<td class="px-8 py-6 font-medium text-green-600">引入因果推理与符号操作</td>
<td class="px-8 py-6 text-muted">结合深度学习与符号主义AI,构建"神经-符号"系统</td>
<td class="px-8 py-6 text-muted">赋予AI进行严谨逻辑推理和因果推断的能力</td>
<td class="px-8 py-6 text-muted">两种范式的融合技术复杂</td>
</tr>
<tr>
<td class="px-8 py-6 font-medium text-purple-600">探索具身智能与交互式学习</td>
<td class="px-8 py-6 text-muted">赋予AI物理身体,让其通过与真实世界的交互进行学习</td>
<td class="px-8 py-6 text-muted">获得基于体验的、情境化的理解</td>
<td class="px-8 py-6 text-muted">技术和理论挑战巨大</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="bg-blue-50 p-6 rounded-lg">
<h4 class="font-semibold text-lg mb-4 text-blue-800">模型规模与鲁棒性</h4>
<p class="text-blue-700 text-sm mb-4">
继续通过扩大模型规模来提升理性能力。更大的模型具有更强的模式识别和知识整合能力,可能更好地处理复杂推理任务。
</p>
<div class="bg-white p-3 rounded text-xs text-blue-600">
CMU研究观察到,更大的模型在某种程度上对呈现的证据表现出更强的"抵抗力"
</div>
</div>
<div class="bg-green-50 p-6 rounded-lg">
<h4 class="font-semibold text-lg mb-4 text-green-800">神经-符号系统</h4>
<p class="text-green-700 text-sm mb-4">
将深度学习与符号主义AI相结合,引入符号操作和因果模型,让AI系统具备更强的可解释性和可干预性。
</p>
<div class="bg-white p-3 rounded text-xs text-green-600">
构建包含实体、关系和因果规则的显式知识图谱
</div>
</div>
<div class="bg-purple-50 p-6 rounded-lg">
<h4 class="font-semibold text-lg mb-4 text-purple-800">具身智能</h4>
<p class="text-purple-700 text-sm mb-4">
通过赋予AI身体,让其通过传感器感知世界,通过执行器影响世界,获得基于体验的理解。
</p>
<div class="bg-white p-3 rounded text-xs text-purple-600">
"人在回路"的学习方式,从人类反馈中学习价值观
</div>
</div>
</div>
</div>
</div>
</section>
<div class="section-divider"></div>
<!-- Conclusion -->
<section id="conclusion" class="px-8 py-16 bg-slate-50">
<div class="max-w-4xl mx-auto">
<h2 class="font-serif text-4xl font-bold mb-8 text-center text-primary">结论</h2>
<div class="bg-white p-8 rounded-lg shadow-sm mb-8">
<p class="text-lg leading-relaxed mb-6">
CMU的最新研究《Rational Synthesizers or Heuristic Followers?》深刻揭示了当前大型语言模型在信息整合中的根本局限:<strong>它们并非"理性整合者",而是易受重复信息和顺序影响的"启发式跟随者"</strong>。
</p>
<p class="text-lg leading-relaxed mb-6">
真正的理性决策应包含逻辑严谨性、证据客观权衡、思维独立性和偏见修正能力。相比之下,AI的"复读机"行为既是其基于统计模式匹配的<strong>阶段性技术限制</strong>,也源于其缺乏意识、具身体验和真正语义理解的<strong>固有缺陷</strong>。
</p>
<div class="bg-blue-50 border-l-4 border-blue-400 p-6 mb-6">
<h4 class="font-semibold text-blue-800 mb-2">核心洞察</h4>
<p class="text-blue-700">
因此,AI系统本质上难以具备人类的"理性"能力,但通过结合因果推理、符号操作和探索具身智能等路径,未来有望构建出更趋近"理性"的AI。
</p>
</div>
<p class="text-lg leading-relaxed">
这项研究不仅对RAG系统的设计与优化具有直接的指导意义,更为我们理解AI的"理性"本质提供了重要的理论框架。它提醒我们,在追求更强大AI的道路上,需要更加深入地思考什么是真正的"理性",以及如何在技术实现中体现这些理性要素。
</p>
</div>
<div class="text-center">
<div class="inline-flex items-center space-x-4 text-sm text-muted">
<span class="flex items-center">
<i class="fas fa-calendar mr-2"></i>
2026年1月
</span>
<span class="flex items-center">
<i class="fas fa-university mr-2"></i>
基于卡内基梅隆大学研究
</span>
<span class="flex items-center">
<i class="fas fa-brain mr-2"></i>
AI理性能力分析
</span>
</div>
</div>
</div>
</section>
<!-- Back to Top Button -->
<div id="backToTop" class="back-to-top">
<i class="fas fa-arrow-up"></i>
</div>
</div>
<script>
// Initialize Mermaid
mermaid.initialize({
startOnLoad: true,
theme: 'base',
themeVariables: {
primaryColor: '#dbeafe',
primaryTextColor: '#1f2937',
primaryBorderColor: '#2563eb',
lineColor: '#6b7280',
secondaryColor: '#fee2e2',
tertiaryColor: '#fef3c7',
background: '#ffffff',
mainBkg: '#ffffff',
nodeBkg: '#ffffff',
clusterBkg: '#f8fafc',
edgeLabelBackground: '#ffffff',
nodeTextColor: '#1f2937',
textColor: '#1f2937',
fontFamily: 'Inter, sans-serif',
fontSize: '13px'
},
flowchart: {
useMaxWidth: false,
htmlLabels: true,
curve: 'basis',
padding: 20
},
securityLevel: 'loose'
});
// Initialize Mermaid Controls for zoom and pan
function initializeMermaidControls() {
const containers = document.querySelectorAll('.mermaid-container');
containers.forEach(container => {
const mermaidElement = container.querySelector('.mermaid');
let scale = 1;
let isDragging = false;
let startX, startY, translateX = 0, translateY = 0;
// 触摸相关状态
let isTouch = false;
let touchStartTime = 0;
let initialDistance = 0;
let initialScale = 1;
let isPinching = false;
// Zoom controls
const zoomInBtn = container.querySelector('.zoom-in');
const zoomOutBtn = container.querySelector('.zoom-out');
const resetBtn = container.querySelector('.reset-zoom');
const fullscreenBtn = container.querySelector('.fullscreen');
function updateTransform() {
mermaidElement.style.transform = `translate(${translateX}px, ${translateY}px) scale(${scale})`;
if (scale > 1) {
container.classList.add('zoomed');
} else {
container.classList.remove('zoomed');
}
mermaidElement.style.cursor = isDragging ? 'grabbing' : 'grab';
}
if (zoomInBtn) {
zoomInBtn.addEventListener('click', () => {
scale = Math.min(scale * 1.25, 4);
updateTransform();
});
}
if (zoomOutBtn) {
zoomOutBtn.addEventListener('click', () => {
scale = Math.max(scale / 1.25, 0.3);
if (scale <= 1) {
translateX = 0;
translateY = 0;
}
updateTransform();
});
}
if (resetBtn) {
resetBtn.addEventListener('click', () => {
scale = 1;
translateX = 0;
translateY = 0;
updateTransform();
});
}
if (fullscreenBtn) {
fullscreenBtn.addEventListener('click', () => {
if (container.requestFullscreen) {
container.requestFullscreen();
} else if (container.webkitRequestFullscreen) {
container.webkitRequestFullscreen();
} else if (container.msRequestFullscreen) {
container.msRequestFullscreen();
}
});
}
// Mouse Events
mermaidElement.addEventListener('mousedown', (e) => {
if (isTouch) return; // 如果是触摸设备,忽略鼠标事件
isDragging = true;
startX = e.clientX - translateX;
startY = e.clientY - translateY;
mermaidElement.style.cursor = 'grabbing';
updateTransform();
e.preventDefault();
});
document.addEventListener('mousemove', (e) => {
if (isDragging && !isTouch) {
translateX = e.clientX - startX;
translateY = e.clientY - startY;
updateTransform();
}
});
document.addEventListener('mouseup', () => {
if (isDragging && !isTouch) {
isDragging = false;
mermaidElement.style.cursor = 'grab';
updateTransform();
}
});
document.addEventListener('mouseleave', () => {
if (isDragging && !isTouch) {
isDragging = false;
mermaidElement.style.cursor = 'grab';
updateTransform();
}
});
// 获取两点之间的距离
function getTouchDistance(touch1, touch2) {
return Math.hypot(
touch2.clientX - touch1.clientX,
touch2.clientY - touch1.clientY
);
}
// Touch Events - 触摸事件处理
mermaidElement.addEventListener('touchstart', (e) => {
isTouch = true;
touchStartTime = Date.now();
if (e.touches.length === 1) {
// 单指拖动
isPinching = false;
isDragging = true;
const touch = e.touches[0];
startX = touch.clientX - translateX;
startY = touch.clientY - translateY;
} else if (e.touches.length === 2) {
// 双指缩放
isPinching = true;
isDragging = false;
const touch1 = e.touches[0];
const touch2 = e.touches[1];
initialDistance = getTouchDistance(touch1, touch2);
initialScale = scale;
}
e.preventDefault();
}, { passive: false });
mermaidElement.addEventListener('touchmove', (e) => {
if (e.touches.length === 1 && isDragging && !isPinching) {
// 单指拖动
const touch = e.touches[0];
translateX = touch.clientX - startX;
translateY = touch.clientY - startY;
updateTransform();
} else if (e.touches.length === 2 && isPinching) {
// 双指缩放
const touch1 = e.touches[0];
const touch2 = e.touches[1];
const currentDistance = getTouchDistance(touch1, touch2);
if (initialDistance > 0) {
const newScale = Math.min(Math.max(
initialScale * (currentDistance / initialDistance),
0.3
), 4);
scale = newScale;
updateTransform();
}
}
e.preventDefault();
}, { passive: false });
mermaidElement.addEventListener('touchend', (e) => {
// 重置状态
if (e.touches.length === 0) {
isDragging = false;
isPinching = false;
initialDistance = 0;
// 延迟重置isTouch,避免鼠标事件立即触发
setTimeout(() => {
isTouch = false;
}, 100);
} else if (e.touches.length === 1 && isPinching) {
// 从双指变为单指,切换为拖动模式
isPinching = false;
isDragging = true;
const touch = e.touches[0];
startX = touch.clientX - translateX;
startY = touch.clientY - translateY;
}
updateTransform();
});
mermaidElement.addEventListener('touchcancel', (e) => {
isDragging = false;
isPinching = false;
initialDistance = 0;
setTimeout(() => {
isTouch = false;
}, 100);
updateTransform();
});
// Enhanced wheel zoom with better center point handling
container.addEventListener('wheel', (e) => {
e.preventDefault();
const rect = container.getBoundingClientRect();
const centerX = rect.width / 2;
const centerY = rect.height / 2;
const delta = e.deltaY > 0 ? 0.9 : 1.1;
const newScale = Math.min(Math.max(scale * delta, 0.3), 4);
// Adjust translation to zoom towards center
if (newScale !== scale) {
const scaleDiff = newScale / scale;
translateX = translateX * scaleDiff;
translateY = translateY * scaleDiff;
scale = newScale;
if (scale <= 1) {
translateX = 0;
translateY = 0;
}
updateTransform();
}
});
// Initialize display
updateTransform();
});
}
// Initialize the controls when the DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
initializeMermaidControls();
});
// Table of Contents Active Link
const tocLinks = document.querySelectorAll('.toc-link');
const sections = document.querySelectorAll('section[id], div[id]');
function updateActiveLink() {
let currentSection = '';
sections.forEach(section => {
const sectionTop = section.offsetTop - 100;
if (window.scrollY >= sectionTop) {
currentSection = section.getAttribute('id');
}
});
tocLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === '#' + currentSection) {
link.classList.add('active');
}
});
}
window.addEventListener('scroll', updateActiveLink);
updateActiveLink();
// Smooth scrolling for TOC links
tocLinks.forEach(link => {
link.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetElement = document.querySelector(targetId);
if (targetElement) {
targetElement.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Back to Top functionality
const backToTopButton = document.getElementById('backToTop');
function handleScroll() {
if (window.scrollY > 300) {
backToTopButton.classList.add('visible');
} else {
backToTopButton.classList.remove('visible');
}
}
window.addEventListener('scroll', handleScroll);
backToTopButton.addEventListener('click', function() {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
</script>
</body></html>
登录后可参与表态
讨论回复
0 条回复还没有人回复,快来发表你的看法吧!