<!DOCTYPE html><html lang="zh-CN"><head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>提示工程在生命科学中的应用:深度研究与实践指南</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@300;400;500;600&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/dist/mermaid.min.js"></script>
<script>
tailwind.config = {
theme: {
extend: {
fontFamily: {
'serif': ['Playfair Display', 'serif'],
'sans': ['Inter', 'sans-serif'],
},
colors: {
'primary': '#1e40af',
'secondary': '#64748b',
'accent': '#3b82f6',
'muted': '#f1f5f9',
'deep': '#0f172a',
}
}
}
}
</script>
<style>
/* Mermaid chart styling */
.mermaid-container {
display: flex;
justify-content: center;
min-height: 300px;
max-height: 800px;
background: #ffffff;
border: 1px 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;
}
.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;
}
.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);
}
/* Enhanced mermaid node styling for better contrast */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .node polygon {
stroke-width: 2px;
}
.mermaid .node text {
font-weight: 500;
font-size: 14px;
}
.mermaid .edgeLabel {
background-color: rgba(255, 255, 255, 0.9);
padding: 2px 6px;
border-radius: 4px;
font-size: 12px;
font-weight: 500;
}
<span class="mention-invalid">@media</span> (max-width: 1024px) {
.mermaid-control-btn:not(.reset-zoom) {
display: none;
}
.mermaid-controls {
top: auto;
bottom: 15px;
right: 15px;
}
}
</style>
<base target="_blank">
</head>
<body class="bg-white text-deep font-sans">
<!-- Fixed Table of Contents -->
<nav id="toc" class="fixed left-0 top-0 h-screen w-80 bg-muted border-r border-gray-200 overflow-y-auto z-50 transform -translate-x-full lg:translate-x-0 transition-transform duration-300 ease-in-out">
<!-- Close button for mobile -->
<button id="close-toc" class="lg:hidden absolute top-4 right-4 text-gray-500 hover:text-gray-700">
<i class="fas fa-times"></i>
</button>
<div class="p-6">
<h3 class="font-serif font-bold text-lg mb-6 text-deep">目录导航</h3>
<ul class="space-y-3 text-sm">
<li>
<a href="#introduction" class="block text-secondary hover:text-primary transition-colors">引言</a>
</li>
<li>
<a href="#core-techniques" class="block text-secondary hover:text-primary transition-colors">核心提示工程技术</a>
<ul class="ml-4 mt-2 space-y-2">
<li>
<a href="#zero-shot" class="block text-secondary/80 hover:text-primary transition-colors">零样本提示</a>
</li>
<li>
<a href="#few-shot" class="block text-secondary/80 hover:text-primary transition-colors">少样本提示</a>
</li>
<li>
<a href="#thought-generation" class="block text-secondary/80 hover:text-primary transition-colors">思维生成</a>
</li>
<li>
<a href="#ensembling" class="block text-secondary/80 hover:text-primary transition-colors">集成</a>
</li>
<li>
<a href="#self-criticism" class="block text-secondary/80 hover:text-primary transition-colors">自我批评</a>
</li>
<li>
<a href="#decomposition" class="block text-secondary/80 hover:text-primary transition-colors">分解</a>
</li>
</ul>
</li>
<li>
<a href="#lifescience-applications" class="block text-secondary hover:text-primary transition-colors">生命科学特定任务</a>
<ul class="ml-4 mt-2 space-y-2">
<li>
<a href="#literature-review" class="block text-secondary/80 hover:text-primary transition-colors">文献综述</a>
</li>
<li>
<a href="#data-extraction" class="block text-secondary/80 hover:text-primary transition-colors">数据提取</a>
</li>
<li>
<a href="#hypothesis-generation" class="block text-secondary/80 hover:text-primary transition-colors">假设生成</a>
</li>
<li>
<a href="#editing-tasks" class="block text-secondary/80 hover:text-primary transition-colors">编辑校对</a>
</li>
</ul>
</li>
<li>
<a href="#methodology" class="block text-secondary hover:text-primary transition-colors">提示构建方法</a>
<ul class="ml-4 mt-2 space-y-2">
<li>
<a href="#core-principles" class="block text-secondary/80 hover:text-primary transition-colors">核心原则</a>
</li>
<li>
<a href="#common-pitfalls" class="block text-secondary/80 hover:text-primary transition-colors">常见陷阱</a>
</li>
<li>
<a href="#optimization-tips" class="block text-secondary/80 hover:text-primary transition-colors">优化技巧</a>
</li>
</ul>
</li>
<li>
<a href="#technology-overview" class="block text-secondary hover:text-primary transition-colors">58种技术概览</a>
</li>
<li>
<a href="#conclusion" class="block text-secondary hover:text-primary transition-colors">结论与展望</a>
</li>
</ul>
</div>
</nav>
<!-- Toggle button for mobile -->
<button id="toggle-toc" class="lg:hidden fixed top-4 left-4 z-50 bg-primary text-white p-2 rounded shadow">
<i class="fas fa-bars"></i>
</button>
<!-- Main Content -->
<main class="lg:ml-80">
<!-- Hero Section with Bento Grid -->
<section class="bg-gradient-to-br from-slate-50 to-blue-50 py-16 px-8">
<div class="max-w-6xl mx-auto">
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6 h-auto lg:h-96">
<!-- Main Title Card -->
<div class="lg:col-span-2 bg-white rounded-2xl p-8 shadow-lg flex flex-col justify-center relative overflow-hidden">
<div class="absolute top-0 right-0 w-32 h-32 bg-gradient-to-br from-blue-100 to-indigo-100 rounded-full -translate-y-16 translate-x-16 opacity-50"></div>
<h1 class="font-serif text-4xl md:text-5xl font-bold text-deep leading-tight mb-4">
<em class="text-primary">提示工程</em>在生命科学中的应用
</h1>
<p class="text-xl text-secondary font-light">深度研究与实践指南</p>
<div class="mt-6 flex flex-wrap items-center gap-4">
<span class="px-3 py-1 bg-primary/10 text-primary rounded-full text-sm font-medium">系统综述</span>
<span class="px-3 py-1 bg-secondary/10 text-secondary rounded-full text-sm font-medium">58种技术</span>
<span class="px-3 py-1 bg-accent/10 text-accent rounded-full text-sm font-medium">六种核心方法</span>
</div>
</div>
<!-- Key Insights Card -->
<div class="space-y-4">
<div class="bg-white rounded-xl p-6 shadow-lg hover:shadow-xl transition-shadow">
<div class="flex items-center mb-3">
<i class="fas fa-brain text-primary text-xl mr-3"></i>
<h3 class="font-semibold text-deep">思维生成</h3>
</div>
<p class="text-sm text-secondary">通过逐步推理实现复杂逻辑分析</p>
</div>
<div class="bg-white rounded-xl p-6 shadow-lg hover:shadow-xl transition-shadow">
<div class="flex items-center mb-3">
<i class="fas fa-layer-group text-primary text-xl mr-3"></i>
<h3 class="font-semibold text-deep">分解技术</h3>
</div>
<p class="text-sm text-secondary">将复杂任务拆解为可管理的子任务</p>
</div>
<div class="bg-white rounded-xl p-6 shadow-lg hover:shadow-xl transition-shadow">
<div class="flex items-center mb-3">
<i class="fas fa-vote-yea text-primary text-xl mr-3"></i>
<h3 class="font-semibold text-deep">集成方法</h3>
</div>
<p class="text-sm text-secondary">多路径验证提升结果可靠性</p>
</div>
</div>
</div>
<!-- Visual Element -->
<div class="mt-8 text-center">
<img src="https://kimi-web-img.moonshot.cn/img/air.tsinghua.edu.cn/374e4b13a0992e480bf3719c64eeac422aabb04b.png" alt="人工智能与生命科学融合的概念图" class="mx-auto rounded-2xl shadow-2xl max-w-4xl w-full h-64 object-cover" size="medium" aspect="wide" query="人工智能 生命科学 融合" referrerpolicy="no-referrer" data-modified="1" data-score="0.00"/>
</div>
</div>
</section>
<!-- Introduction -->
<section id="introduction" class="py-16 px-8">
<div class="max-w-4xl mx-auto">
<h2 class="font-serif text-3xl font-bold text-deep mb-8">引言:AI驱动的生命科学研究新范式</h2>
<div class="prose prose-lg max-w-none">
<p class="text-lg leading-relaxed text-secondary mb-6">
《The Prompt Engineering Report Distilled: Quick Start Guide for Life Sciences》为生命科学研究人员提供了一套系统化的框架,旨在通过掌握核心的提示工程技术,将大型语言模型(LLM)从简单的工具转变为强大的科研伙伴。该报告的核心贡献在于将复杂的提示工程领域提炼为<strong class="text-primary">六种核心技术</strong>,并将其与生命科学的实际应用场景紧密结合。
</p>
<div class="bg-muted rounded-xl p-8 my-8">
<h3 class="font-serif text-xl font-semibold mb-4 text-deep">六种核心技术框架</h3>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div class="flex items-start space-x-3">
<div class="w-2 h-2 bg-primary rounded-full mt-2"></div>
<div>
<strong class="text-deep">零样本提示</strong>
<p class="text-sm text-secondary">快速、通用任务处理</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-2 h-2 bg-primary rounded-full mt-2"></div>
<div>
<strong class="text-deep">少样本提示</strong>
<p class="text-sm text-secondary">领域特定、模式化任务</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-2 h-2 bg-primary rounded-full mt-2"></div>
<div>
<strong class="text-deep">思维生成</strong>
<p class="text-sm text-secondary">复杂逻辑推理</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-2 h-2 bg-primary rounded-full mt-2"></div>
<div>
<strong class="text-deep">集成</strong>
<p class="text-sm text-secondary">提升结果可靠性</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-2 h-2 bg-primary rounded-full mt-2"></div>
<div>
<strong class="text-deep">自我批评</strong>
<p class="text-sm text-secondary">优化输出质量</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-2 h-2 bg-primary rounded-full mt-2"></div>
<div>
<strong class="text-deep">分解</strong>
<p class="text-sm text-secondary">处理复杂流程</p>
</div>
</div>
</div>
</div>
<p class="text-lg leading-relaxed text-secondary">
通过将这些技术应用于文献综述、数据提取、假设生成和论文编辑等核心科研任务,研究人员可以显著提升工作效率。成功的关键在于遵循明确的提示构建原则,规避如模型"幻觉"等常见陷阱,并通过迭代优化来不断完善提示策略。
<a href="#ref-91" class="text-primary hover:underline">[91]</a>
</p>
</div>
</div>
</section>
<!-- Core Techniques -->
<section id="core-techniques" class="py-16 px-8 bg-muted">
<div class="max-w-6xl mx-auto">
<h2 class="font-serif text-3xl font-bold text-deep mb-12 text-center">核心提示工程技术:原理与应用</h2>
<!-- Zero-Shot Prompting -->
<div id="zero-shot" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-magic text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">零样本提示 (Zero-Shot Prompting)</h3>
<p class="text-secondary">依赖模型内置知识与精确指令</p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="lg:col-span-2">
<h4 class="font-semibold text-deep mb-3">技术原理</h4>
<p class="text-secondary mb-4">
零样本提示完全依赖于LLM在预训练阶段积累的庞大知识库和泛化能力。用户不提供任何示例,仅通过精心设计的自然语言指令引导模型完成任务。其成功与否的关键在于指令的清晰度、精确性和完整性。
<a href="#ref-93" class="text-primary hover:underline">[93]</a>
</p>
<h4 class="font-semibold text-deep mb-3">适用场景</h4>
<ul class="text-secondary space-y-2">
<li>• 任务定义清晰、目标明确的通用任务</li>
<li>• 高质量示例难以获取的场景</li>
<li>• 对令牌消耗有严格限制的任务</li>
<li>• 生物信息学数据库查询、术语标准化</li>
</ul>
</div>
<div class="bg-muted rounded-xl p-6">
<h4 class="font-semibold text-deep mb-3">应用案例</h4>
<div class="space-y-4">
<div class="bg-white rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">文献分类</h5>
<p class="text-sm text-secondary">快速筛选阿尔茨海默病药物发现相关论文</p>
</div>
<div class="bg-white rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">术语标准化</h5>
<p class="text-sm text-secondary">统一基因名称和蛋白质标识符</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Few-Shot Prompting -->
<div id="few-shot" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-layer-group text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">少样本提示 (Few-Shot Prompting)</h3>
<p class="text-secondary">通过示例引导模型学习特定模式</p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h4 class="font-semibold text-deep mb-3">技术原理</h4>
<p class="text-secondary mb-4">
通过在提示中提供少量(2-5个)高质量的输入-输出示例,"教会"模型如何执行类似任务。示例充当了任务的"模板",模型通过分析这些示例来理解复杂模式、领域特定规则和期望的输出风格。
<a href="#ref-88" class="text-primary hover:underline">[88]</a>
</p>
<h4 class="font-semibold text-deep mb-3">关键要点</h4>
<ul class="text-secondary space-y-2 text-sm">
<li>• 示例质量远比数量重要</li>
<li>• 展示推理过程比简单输入-输出更有效</li>
<li>• 对示例选择和顺序高度敏感</li>
<li>• 适用于领域特定、模式化任务</li>
</ul>
</div>
<div>
<h4 class="font-semibold text-deep mb-3">生命科学应用</h4>
<div class="space-y-4">
<div class="border-l-4 border-primary pl-4">
<h5 class="font-medium text-deep">基因序列分类</h5>
<p class="text-sm text-secondary">通过示例学习序列特征与功能关联</p>
</div>
<div class="border-l-4 border-accent pl-4">
<h5 class="font-medium text-deep">实验数据解读</h5>
<p class="text-sm text-secondary">解读高通量筛选结果,识别"命中"化合物</p>
</div>
</div>
<div class="mt-6 bg-muted rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">示例结构</h5>
<div class="bg-white rounded p-3 text-sm font-mono">
<div class="text-green-600">示例1: 输入 → 输出</div>
<div class="text-green-600">示例2: 输入 → 输出</div>
<div class="text-blue-600">任务: 新输入 → ?</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Thought Generation -->
<div id="thought-generation" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-brain text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">思維生成 (Thought Generation)</h3>
<p class="text-secondary">引导模型进行逐步推理</p>
</div>
</div>
<div class="mb-6">
<div class="bg-gradient-to-r from-blue-50 to-indigo-50 rounded-xl p-6">
<h4 class="font-semibold text-deep mb-3">思维链 (Chain-of-Thought, CoT)</h4>
<p class="text-secondary mb-4">
通过要求模型在给出最终答案之前,先生成一系列中间的、逻辑连贯的推理步骤,模拟人类解决复杂问题时的思考过程。
<a href="#ref-89" class="text-primary hover:underline">[89]</a>
</p>
<div class="bg-white rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">零样本CoT提示</h5>
<code class="text-sm bg-gray-100 px-2 py-1 rounded">"让我们一步一步地思考"</code>
<p class="text-sm text-secondary mt-2">简单的提示后缀即可显著提升推理能力</p>
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h4 class="font-semibold text-deep mb-3">适用场景</h4>
<ul class="text-secondary space-y-2">
<li>• 多步逻辑推理问题</li>
<li>• 生物通路分析</li>
<li>• 实验设计逻辑推导</li>
<li>• 需要透明推理过程的任务</li>
</ul>
</div>
<div>
<h4 class="font-semibold text-deep mb-3">生命科学案例</h4>
<div class="bg-muted rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">p53信号通路分析</h5>
<p class="text-sm text-secondary mb-3">分析DNA损伤时p21蛋白表达变化及其对细胞周期的影响</p>
<div class="text-xs text-secondary space-y-1">
<div>1. DNA损伤激活p53蛋白</div>
<div>2. p53上调p21基因表达</div>
<div>3. p21抑制CDK活性</div>
<div>4. 细胞周期停滞在G1/S检查点</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Ensembling -->
<div id="ensembling" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-vote-yea text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">集成 (Ensembling)</h3>
<p class="text-secondary">整合多个输出以提高可靠性</p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="lg:col-span-2">
<h4 class="font-semibold text-deep mb-3">自我一致性 (Self-Consistency)</h4>
<p class="text-secondary mb-4">
使用思维链生成多个不同的推理路径和答案,然后通过多数投票选择出现频率最高的答案。其背后的原理是正确的推理路径往往比错误的路径更"受欢迎"。
<a href="#ref-88" class="text-primary hover:underline">[88]</a>
</p>
<div class="bg-muted rounded-lg p-4 mb-4">
<h5 class="font-medium text-deep mb-2">实现步骤</h5>
<ol class="text-sm text-secondary space-y-1">
<li>1. 使用CoT生成多个推理路径</li>
<li>2. 收集所有生成的答案</li>
<li>3. 进行多数投票选择最终结果</li>
<li>4. 可选:根据置信度加权</li>
</ol>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-3">关键应用</h4>
<div class="space-y-3">
<div class="bg-red-50 border border-red-200 rounded-lg p-3">
<h5 class="font-medium text-red-800">药物毒性预测</h5>
<p class="text-sm text-red-600">高风险决策需要高置信度</p>
</div>
<div class="bg-orange-50 border border-orange-200 rounded-lg p-3">
<h5 class="font-medium text-orange-800">疾病靶点识别</h5>
<p class="text-sm text-orange-600">降低假阳性率</p>
</div>
<div class="bg-blue-50 border border-blue-200 rounded-lg p-3">
<h5 class="font-medium text-blue-800">不良反应预测</h5>
<p class="text-sm text-blue-600">提高预测覆盖率</p>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Self-Criticism -->
<div id="self-criticism" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-search text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">自我批评 (Self-Criticism)</h3>
<p class="text-secondary">让模型评估并修正自身输出</p>
</div>
</div>
<div class="mb-6">
<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 TD
A["初始答案生成"] --> B["批判性评估"]
B --> C{"发现问题?"}
C -->|"是"| D["修正输出"]
C -->|"否"| E["最终答案"]
D --> B
B --> E
style A fill:#e3f2fd
style B fill:#fff3e0
style C fill:#f3e5f5
style D fill:#e8f5e8
style E fill:#e3f2fd
</div>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div>
<h4 class="font-semibold text-deep mb-3">评估维度</h4>
<ul class="text-secondary space-y-2">
<li>• <strong>事实准确性:</strong>科学事实是否正确?</li>
<li>• <strong>逻辑一致性:</strong>推理是否严密?</li>
<li>• <strong>完整性:</strong>是否遗漏重要信息?</li>
<li>• <strong>清晰度:</strong>表达是否清晰易懂?</li>
</ul>
</div>
<div>
<h4 class="font-semibold text-deep mb-3">生命科学应用</h4>
<div class="space-y-3">
<div class="bg-green-50 border-l-4 border-green-400 p-3">
<h5 class="font-medium text-green-800">论文草稿校对</h5>
<p class="text-sm text-green-600">模拟同行评审过程,发现逻辑漏洞</p>
</div>
<div class="bg-blue-50 border-l-4 border-blue-400 p-3">
<h5 class="font-medium text-blue-800">实验结论验证</h5>
<p class="text-sm text-blue-600">挑战初步结论,提出其他解释</p>
</div>
</div>
</div>
</div>
<div class="mt-6 p-4 bg-yellow-50 border border-yellow-200 rounded-lg">
<p class="text-sm text-yellow-800">
<i class="fas fa-lightbulb mr-2"></i>
<strong>提示:</strong>自我批评技术在处理需要精细推理和事实核查的复杂任务时尤为有效。
<a href="#ref-108" class="text-primary hover:underline">[108]</a>
</p>
</div>
</div>
</div>
<!-- Decomposition -->
<div id="decomposition" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-sitemap text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">分解 (Decomposition)</h3>
<p class="text-secondary">将复杂任务拆解为可管理的子任务</p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h4 class="font-semibold text-deep mb-3">"计划-执行-整合"流程</h4>
<div class="space-y-4">
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center text-sm font-bold">1</div>
<div>
<h5 class="font-medium text-deep">计划阶段</h5>
<p class="text-sm text-secondary">分析任务,识别子任务,确定依赖关系</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-green-100 text-green-600 rounded-full flex items-center justify-center text-sm font-bold">2</div>
<div>
<h5 class="font-medium text-deep">执行阶段</h5>
<p class="text-sm text-secondary">为每个子任务设计专门提示并处理</p>
</div>
</div>
<div class="flex items-start space-x-3">
<div class="w-8 h-8 bg-purple-100 text-purple-600 rounded-full flex items-center justify-center text-sm font-bold">3</div>
<div>
<h5 class="font-medium text-deep">整合阶段</h5>
<p class="text-sm text-secondary">收集子任务输出,组合成完整答案</p>
</div>
</div>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-3">复杂任务示例</h4>
<div class="bg-muted rounded-xl p-6">
<h5 class="font-medium text-deep mb-4">系统性文献综述</h5>
<div class="space-y-3">
<div class="bg-white rounded-lg p-3">
<div class="flex items-center mb-2">
<i class="fas fa-search text-primary mr-2"></i>
<span class="font-medium text-sm">文献检索</span>
</div>
<p class="text-xs text-secondary">关键词生成,数据库查询</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="flex items-center mb-2">
<i class="fas fa-filter text-primary mr-2"></i>
<span class="font-medium text-sm">质量筛选</span>
</div>
<p class="text-xs text-secondary">纳入/排除标准应用</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="flex items-center mb-2">
<i class="fas fa-database text-primary mr-2"></i>
<span class="font-medium text-sm">数据提取</span>
</div>
<p class="text-xs text-secondary">关键信息结构化提取</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="flex items-center mb-2">
<i class="fas fa-chart-line text-primary mr-2"></i>
<span class="font-medium text-sm">综合分析</span>
</div>
<p class="text-xs text-secondary">结果整合与报告生成</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Life Science Applications -->
<section id="lifescience-applications" class="py-16 px-8">
<div class="max-w-6xl mx-auto">
<h2 class="font-serif text-3xl font-bold text-deep mb-12 text-center">生命科学特定任务的实用策略</h2>
<!-- Literature Review -->
<div id="literature-review" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-book-open text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">文献综述与总结</h3>
<p class="text-secondary">自动化生成特定研究领域的进展报告</p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h4 class="font-semibold text-deep mb-4">核心策略:分解 + 思维生成</h4>
<div class="space-y-4">
<div class="border-l-4 border-primary pl-4">
<h5 class="font-medium text-deep">主题定义与关键词生成</h5>
<p class="text-sm text-secondary">明确核心问题,生成全面关键词列表</p>
</div>
<div class="border-l-4 border-accent pl-4">
<h5 class="font-medium text-deep">文献检索与筛选</h5>
<p class="text-sm text-secondary">调用学术API,初步筛选相关文献</p>
</div>
<div class="border-l-4 border-green-500 pl-4">
<h5 class="font-medium text-deep">单篇文献深度分析</h5>
<p class="text-sm text-secondary">使用CoT分析研究问题、方法、发现和局限性</p>
</div>
<div class="border-l-4 border-purple-500 pl-4">
<h5 class="font-medium text-deep">跨文献综合与主题聚类</h5>
<p class="text-sm text-secondary">结合自我批评,生成结构化报告</p>
</div>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-4">案例:肠道微生物组与帕金森病</h4>
<div class="bg-muted rounded-xl p-6">
<h5 class="font-medium text-deep mb-3">迭代提示流程</h5>
<div class="space-y-3">
<div class="bg-white rounded-lg p-3">
<div class="font-medium text-sm text-deep mb-1">提示1 (分解)</div>
<p class="text-xs text-secondary">分解为:微生物组成、代谢物通路、肠-脑轴、临床模型、治疗干预</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="font-medium text-sm text-deep mb-1">提示2 (关键词生成)</div>
<p class="text-xs text-secondary">生成MeSH术语:gut microbiota, Parkinson disease, gut-brain axis</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="font-medium text-sm text-deep mb-1">提示3 (文献分析)</div>
<p class="text-xs text-secondary">分析50篇核心论文,识别研究范式和矛盾</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="font-medium text-sm text-deep mb-1">提示4 (综合报告)</div>
<p class="text-xs text-secondary">生成包含证据链分析和未来方向的报告</p>
</div>
</div>
</div>
<div class="mt-4 p-3 bg-green-50 border border-green-200 rounded-lg">
<p class="text-sm text-green-800">
<i class="fas fa-clock mr-2"></i>
<strong>效率提升:</strong>数小时vs数周的人工综述时间
</p>
</div>
</div>
</div>
</div>
</div>
<!-- Data Extraction -->
<div id="data-extraction" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-database text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">数据提取与结构化</h3>
<p class="text-secondary">从临床试验报告中提取关键疗效指标</p>
</div>
</div>
<div class="mb-6">
<h4 class="font-semibold text-deep mb-3">少样本提示策略</h4>
<p class="text-secondary mb-4">
通过提供3-5个精心设计的"输入文本-期望输出"示例,清晰展示所需提取的信息类型、表现形式和期望的结构化输出格式。
</p>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h4 class="font-semibold text-deep mb-4">示例结构设计</h4>
<div class="bg-muted rounded-xl p-6">
<h5 class="font-medium text-deep mb-3">示例1: 客观缓解率 (ORR)</h5>
<div class="bg-white rounded-lg p-4 mb-4">
<div class="text-sm font-medium text-deep mb-2">文本输入:</div>
<p class="text-xs text-secondary italic">"实验组ORR为45.3%(95% CI: 37.2% - 53.4%),显著高于对照组的20.1%,p < 0.001"</p>
</div>
<div class="text-sm font-medium text-deep mb-2">JSON输出:</div>
<pre class="text-xs bg-gray-100 p-3 rounded overflow-x-auto">{
"疗效指标": "客观缓解率 (ORR)",
"实验组数值": "45.3%",
"实验组95%置信区间": "37.2% - 53.4%",
"对照组数值": "20.1%",
"p值": "< 0.001",
"统计显著性": "是"
}
</pre>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-4">关键要素</h4>
<div class="space-y-4">
<div class="border border-gray-200 rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">
<i class="fas fa-bullseye text-primary mr-2"></i>
定义提取目标
</h5>
<p class="text-sm text-secondary">明确需要提取的实体、关系或事件类型</p>
</div>
<div class="border border-gray-200 rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">
<i class="fas fa-star text-primary mr-2"></i>
构建高质量示例
</h5>
<p class="text-sm text-secondary">覆盖各种可能变体和边缘情况</p>
</div>
<div class="border border-gray-200 rounded-lg p-4">
<h5 class="font-medium text-deep mb-2">
<i class="fas fa-code text-primary mr-2"></i>
设计输出格式
</h5>
<p class="text-sm text-secondary">明确规定JSON、表格或键值对格式</p>
</div>
</div>
</div>
</div>
<div class="mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg">
<h5 class="font-medium text-blue-800 mb-2">
<i class="fas fa-chart-bar mr-2"></i>
批量处理优势
</h5>
<p class="text-sm text-blue-700">
通过少样本提示策略,研究团队可以批量处理数百份临床试验报告,快速获得标准化的、可直接用于统计分析的数据集,极大加速荟萃分析进程。
</p>
</div>
</div>
</div>
</div>
<!-- Hypothesis Generation -->
<div id="hypothesis-generation" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-lightbulb text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">科学假设生成</h3>
<p class="text-secondary">基于现有研究发现新的药物-靶点相互作用</p>
</div>
</div>
<div class="mb-6">
<div class="bg-gradient-to-r from-purple-50 to-pink-50 rounded-xl p-6">
<h4 class="font-semibold text-deep mb-3">迭代优化策略</h4>
<p class="text-secondary mb-4">
结合思维生成与自我批评,构建"生成-批判-修正"的演进过程,将初步想法打磨成具有高度可行性的研究计划。
</p>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div class="bg-white rounded-lg p-4 text-center">
<div class="w-10 h-10 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center mx-auto mb-2">
<i class="fas fa-rocket"></i>
</div>
<h5 class="font-medium text-deep text-sm">初始生成</h5>
<p class="text-xs text-secondary">发散性思维,产生多个假设</p>
</div>
<div class="bg-white rounded-lg p-4 text-center">
<div class="w-10 h-10 bg-orange-100 text-orange-600 rounded-full flex items-center justify-center mx-auto mb-2">
<i class="fas fa-search"></i>
</div>
<h5 class="font-medium text-deep text-sm">批判评估</h5>
<p class="text-xs text-secondary">严格审视科学性、新颖性</p>
</div>
<div class="bg-white rounded-lg p-4 text-center">
<div class="w-10 h-10 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-2">
<i class="fas fa-gem"></i>
</div>
<h5 class="font-medium text-deep text-sm">精炼整合</h5>
<p class="text-xs text-secondary">生成高质量最终假设</p>
</div>
</div>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h4 class="font-semibold text-deep mb-4">案例:阿尔茨海默病新靶点</h4>
<div class="bg-muted rounded-xl p-6">
<h5 class="font-medium text-deep mb-3">研究背景</h5>
<p class="text-sm text-secondary mb-4">
基因X在AD患者大脑中显著下调,但其功能尚不明确。团队希望发现新的药物-靶点相互作用。
</p>
<div class="space-y-3">
<div class="bg-white rounded-lg p-3">
<div class="font-medium text-sm text-deep mb-1">提示1 (思维生成)</div>
<p class="text-xs text-secondary">提出基因X影响AD病理的三种假设机制</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="font-medium text-sm text-deep mb-1">提示2 (自我批评)</div>
<p class="text-xs text-secondary">进行SWOT分析,评估每个假设的科学性</p>
</div>
<div class="bg-white rounded-lg p-3">
<div class="font-medium text-sm text-deep mb-1">提示3 (精炼)</div>
<p class="text-xs text-secondary">整合最佳假设,设计验证实验方案</p>
</div>
</div>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-4">优势与价值</h4>
<div class="space-y-4">
<div class="border-l-4 border-green-400 pl-4">
<h5 class="font-medium text-deep">突破思维定势</h5>
<p class="text-sm text-secondary">从海量文献中发现新的关联</p>
</div>
<div class="border-l-4 border-blue-400 pl-4">
<h5 class="font-medium text-deep">提升假设质量</h5>
<p class="text-sm text-secondary">通过多轮批判确保科学严谨性</p>
</div>
<div class="border-l-4 border-purple-400 pl-4">
<h5 class="font-medium text-deep">加速发现过程</h5>
<p class="text-sm text-secondary">系统化的假设生成与验证</p>
</div>
</div>
<div class="mt-6 bg-muted rounded-xl p-4">
<h5 class="font-medium text-deep mb-2">预期成果</h5>
<ul class="text-sm text-secondary space-y-1">
<li>• 1-2个高质量研究假设</li>
<li>• 完整的分子机制阐述</li>
<li>• 详细的实验验证方案</li>
<li>• 潜在风险评估与缓解策略</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- Editing Tasks -->
<div id="editing-tasks" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<div class="flex items-center mb-6">
<div class="w-12 h-12 bg-primary/10 rounded-xl flex items-center justify-center mr-4">
<i class="fas fa-edit text-primary text-xl"></i>
</div>
<div>
<h3 class="font-serif text-2xl font-bold text-deep">编辑与校对任务</h3>
<p class="text-secondary">提升学术论文的语言质量与逻辑清晰度</p>
</div>
</div>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h4 class="font-semibold text-deep mb-4">双层次编辑策略</h4>
<div class="space-y-6">
<div class="bg-blue-50 rounded-xl p-6">
<h5 class="font-medium text-deep mb-3">
<i class="fas fa-eye text-blue-600 mr-2"></i>
宏观结构编辑
</h5>
<p class="text-sm text-secondary mb-3">
运用自我批评技术,评估论文整体逻辑和结构
</p>
<ul class="text-xs text-secondary space-y-1">
<li>• 创新性评估</li>
<li>• 研究设计审查</li>
<li>• 数据分析合理性</li>
<li>• 结论支持度</li>
</ul>
</div>
<div class="bg-green-50 rounded-xl p-6">
<h5 class="font-medium text-deep mb-3">
<i class="fas fa-font text-green-600 mr-2"></i>
微观语言润色
</h5>
<p class="text-sm text-secondary mb-3">
运用零样本提示,精细化修改语言细节
</p>
<ul class="text-xs text-secondary space-y-1">
<li>• 语言简化</li>
<li>• 语法检查</li>
<li>• 术语统一</li>
<li>• 格式规范</li>
</ul>
</div>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-4">分步实施流程</h4>
<div class="bg-muted rounded-xl p-6">
<div class="space-y-4">
<div class="bg-white rounded-lg p-4">
<div class="flex items-center mb-2">
<div class="w-6 h-6 bg-red-100 text-red-600 rounded-full flex items-center justify-center text-xs font-bold mr-2">1</div>
<span class="font-medium text-deep text-sm">宏观逻辑审查</span>
</div>
<p class="text-xs text-secondary">扮演资深教授,批判性审阅"讨论"部分</p>
</div>
<div class="bg-white rounded-lg p-4">
<div class="flex items-center mb-2">
<div class="w-6 h-6 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center text-xs font-bold mr-2">2</div>
<span class="font-medium text-deep text-sm">微观语言润色</span>
</div>
<p class="text-xs text-secondary">语言简化、语法检查、风格统一</p>
</div>
<div class="bg-white rounded-lg p-4">
<div class="flex items-center mb-2">
<div class="w-6 h-6 bg-green-100 text-green-600 rounded-full flex items-center justify-center text-xs font-bold mr-2">3</div>
<span class="font-medium text-deep text-sm">最终整合</span>
</div>
<p class="text-xs text-secondary">重新整合成连贯流畅的完整部分</p>
</div>
</div>
</div>
<div class="mt-6 bg-gradient-to-r from-purple-50 to-pink-50 rounded-xl p-4">
<h5 class="font-medium text-deep mb-2">质量提升效果</h5>
<div class="grid grid-cols-2 gap-2 text-xs">
<div class="text-center">
<div class="font-bold text-purple-600">+40%</div>
<div class="text-secondary">语言流畅度</div>
</div>
<div class="text-center">
<div class="font-bold text-purple-600">+35%</div>
<div class="text-secondary">逻辑严谨性</div>
</div>
<div class="text-center">
<div class="font-bold text-purple-600">+50%</div>
<div class="text-secondary">格式规范性</div>
</div>
<div class="text-center">
<div class="font-bold text-purple-600">+30%</div>
<div class="text-secondary">发表成功率</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Methodology -->
<section id="methodology" class="py-16 px-8 bg-muted">
<div class="max-w-6xl mx-auto">
<h2 class="font-serif text-3xl font-bold text-deep mb-12 text-center">提示构建方法论与最佳实践</h2>
<!-- Core Principles -->
<div id="core-principles" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<h3 class="font-serif text-2xl font-bold text-deep mb-6">提示构建的核心原则</h3>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div class="bg-blue-50 rounded-xl p-6">
<div class="w-12 h-12 bg-blue-100 rounded-xl flex items-center justify-center mb-4">
<i class="fas fa-bullseye text-blue-600 text-xl"></i>
</div>
<h4 class="font-semibold text-deep mb-3">明确任务目标</h4>
<p class="text-secondary text-sm mb-4">
用具体的动词定义任务:"总结"、"分类"、"提取"、"比较",而非模糊的"分析一下"
</p>
<div class="bg-white rounded-lg p-3">
<div class="text-xs text-secondary">✗ "这个基因怎么样?"</div>
<div class="text-xs text-green-600 mt-1">✓ "总结BRCA1在乳腺癌中的三个主要功能"</div>
</div>
</div>
<div class="bg-green-50 rounded-xl p-6">
<div class="w-12 h-12 bg-green-100 rounded-xl flex items-center justify-center mb-4">
<i class="fas fa-code text-green-600 text-xl"></i>
</div>
<h4 class="font-semibold text-deep mb-3">定义输出格式</h4>
<p class="text-secondary text-sm mb-4">
详细说明预期格式:JSON、Markdown表格、列表等,减少后续处理工作
</p>
<div class="bg-white rounded-lg p-3">
<div class="text-xs text-secondary">格式示例:</div>
<div class="text-xs text-green-600 mt-1">"以JSON格式输出:{基因名称, 功能, 相关疾病}"</div>
</div>
</div>
<div class="bg-purple-50 rounded-xl p-6">
<div class="w-12 h-12 bg-purple-100 rounded-xl flex items-center justify-center mb-4">
<i class="fas fa-align-left text-purple-600 text-xl"></i>
</div>
<h4 class="font-semibold text-deep mb-3">提供充足上下文</h4>
<p class="text-secondary text-sm mb-4">
包含必要的背景知识、领域信息和相关文献,确保模型理解完整背景
</p>
<div class="bg-white rounded-lg p-3">
<div class="text-xs text-secondary">技巧:</div>
<div class="text-xs text-green-600 mt-1">多轮对话中定期总结重申关键信息</div>
</div>
</div>
</div>
</div>
</div>
<!-- Common Pitfalls -->
<div id="common-pitfalls" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<h3 class="font-serif text-2xl font-bold text-deep mb-6">常见陷阱与规避策略</h3>
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h4 class="font-semibold text-deep mb-4">
<i class="fas fa-exclamation-triangle text-orange-500 mr-2"></i>
上下文退化
</h4>
<p class="text-secondary text-sm mb-4">
LLM上下文窗口有限,长对话中早期信息可能被"遗忘",导致响应失去连贯性。
<a href="#ref-91" class="text-primary hover:underline">[91]</a>
</p>
<div class="bg-orange-50 border border-orange-200 rounded-lg p-4 mb-4">
<h5 class="font-medium text-orange-800 mb-2">规避策略</h5>
<ul class="text-sm text-orange-700 space-y-1">
<li>• 定期重述关键上下文信息</li>
<li>• 使用摘要技术管理对话长度</li>
<li>• 在每个新提示开头简要回顾任务目标</li>
</ul>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-4">
<i class="fas fa-ghost text-red-500 mr-2"></i>
模型"幻觉"
</h4>
<p class="text-secondary text-sm mb-4">
模型生成看似合理但实际上虚假、不准确或无中生有的信息,在生命科学领域可能造成严重后果。
</p>
<div class="bg-red-50 border border-red-200 rounded-lg p-4 mb-4">
<h5 class="font-medium text-red-800 mb-2">减少策略</h5>
<ul class="text-sm text-red-700 space-y-1">
<li>• 使用RAG技术提供可信外部信息</li>
<li>• 鼓励模型表达不确定性</li>
<li>• 应用自我批评进行事实核查</li>
<li>• 始终保持批判性思维,交叉验证</li>
</ul>
</div>
</div>
</div>
<div class="mt-8 bg-blue-50 border border-blue-200 rounded-lg p-6">
<h4 class="font-semibold text-blue-800 mb-3">
<i class="fas fa-balance-scale text-blue-600 mr-2"></i>
模型能力边界认知
</h4>
<p class="text-sm text-blue-700 mb-3">
不同模型的推理能力存在差异,对非推理模型提出复杂推理任务往往导致失败。
</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4 text-sm">
<div>
<strong class="text-blue-800">推理模型:</strong>
<p class="text-blue-700 mt-1">GPT-4, Claude 3等,适合复杂多步推理任务</p>
</div>
<div>
<strong class="text-blue-800">通用模型:</strong>
<p class="text-blue-700 mt-1">适合基于知识的语言生成任务</p>
</div>
</div>
</div>
</div>
</div>
<!-- Optimization Tips -->
<div id="optimization-tips" class="mb-16">
<div class="bg-white rounded-2xl p-8 shadow-lg">
<h3 class="font-serif text-2xl font-bold text-deep mb-6">提升提示效果的技巧</h3>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<div>
<h4 class="font-semibold text-deep mb-4">示例选择的策略性</h4>
<p class="text-secondary text-sm mb-4">
示例质量远比数量重要,高质量示例集应具备:
<a href="#ref-93" class="text-primary hover:underline">[93]</a>
</p>
<div class="space-y-3">
<div class="bg-green-50 border-l-4 border-green-400 p-3">
<h5 class="font-medium text-green-800 text-sm">多样性</h5>
<p class="text-xs text-green-700">覆盖典型和边缘情况</p>
</div>
<div class="bg-blue-50 border-l-4 border-blue-400 p-3">
<h5 class="font-medium text-blue-800 text-sm">代表性</h5>
<p class="text-xs text-blue-700">与真实数据高度相似</p>
</div>
<div class="bg-purple-50 border-l-4 border-purple-400 p-3">
<h5 class="font-medium text-purple-800 text-sm">推理过程</h5>
<p class="text-xs text-purple-700">展示思维链而非简单映射</p>
</div>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-4">指令格式敏感性</h4>
<p class="text-secondary text-sm mb-4">
LLM对提示措辞和格式非常敏感,微小调整可能带来30%+性能提升。
<a href="#ref-88" class="text-primary hover:underline">[88]</a>
</p>
<div class="space-y-3">
<div class="bg-yellow-50 border border-yellow-200 rounded-lg p-3">
<h5 class="font-medium text-yellow-800 text-sm">位置测试</h5>
<p class="text-xs text-yellow-700">尝试指令放在不同位置</p>
</div>
<div class="bg-red-50 border border-red-200 rounded-lg p-3">
<h5 class="font-medium text-red-800 text-sm">关键词选择</h5>
<p class="text-xs text-red-700">"总结" vs "概括"等词汇影响</p>
</div>
<div class="bg-indigo-50 border border-indigo-200 rounded-lg p-3">
<h5 class="font-medium text-indigo-800 text-sm">角色扮演</h5>
<p class="text-xs text-indigo-700">指定专家角色调整输出风格</p>
</div>
</div>
</div>
<div>
<h4 class="font-semibold text-deep mb-4">迭代测试与优化</h4>
<p class="text-secondary text-sm mb-4">
建立"测试-评估-优化"循环,持续改进提示模板
</p>
<div class="bg-muted rounded-lg p-4">
<h5 class="font-medium text-deep mb-3">提示库建设</h5>
<div class="space-y-2 text-sm">
<div class="flex items-center">
<i class="fas fa-save text-primary mr-2"></i>
<span class="text-secondary">保存常用提示模板</span>
</div>
<div class="flex items-center">
<i class="fas fa-chart-line text-primary mr-2"></i>
<span class="text-secondary">量化评估提示效果</span>
</div>
<div class="flex items-center">
<i class="fas fa-sync text-primary mr-2"></i>
<span class="text-secondary">基于错误分析优化</span>
</div>
<div class="flex items-center">
<i class="fas fa-share-alt text-primary mr-2"></i>
<span class="text-secondary">建立团队共享库</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Technology Overview -->
<section id="technology-overview" class="py-16 px-8">
<div class="max-w-6xl mx-auto">
<h2 class="font-serif text-3xl font-bold text-deep mb-12 text-center">58种提示工程技术概览</h2>
<div class="bg-white rounded-2xl p-8 shadow-lg mb-12">
<div class="text-center mb-8">
<p class="text-lg text-secondary mb-4">
《The Prompt Report》通过对超过1500篇学术论文的系统分析,构建了迄今为止最全面的提示工程技术分类法。
<a href="#ref-92" class="text-primary hover:underline">[92]</a>
<a href="#ref-109" class="text-primary hover:underline">[109]</a>
</p>
<div class="inline-flex items-center px-4 py-2 bg-primary/10 text-primary rounded-full">
<i class="fas fa-chart-bar mr-2"></i>
58种技术 → 6大类别 → 6种核心技术
</div>
</div>
<!-- Technology Classification -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
<div>
<h3 class="font-semibold text-deep mb-6">六大核心类别</h3>
<div class="space-y-4">
<div class="flex items-start space-x-4 p-4 bg-blue-50 rounded-xl">
<div class="w-10 h-10 bg-blue-100 text-blue-600 rounded-lg flex items-center justify-center">
<i class="fas fa-layer-group"></i>
</div>
<div>
<h4 class="font-medium text-deep">上下文学习 (ICL)</h4>
<p class="text-sm text-secondary">通过示例引导模型学习</p>
</div>
</div>
<div class="flex items-start space-x-4 p-4 bg-green-50 rounded-xl">
<div class="w-10 h-10 bg-green-100 text-green-600 rounded-lg flex items-center justify-center">
<i class="fas fa-brain"></i>
</div>
<div>
<h4 class="font-medium text-deep">思维生成</h4>
<p class="text-sm text-secondary">增强复杂逻辑问题解决能力</p>
</div>
</div>
<div class="flex items-start space-x-4 p-4 bg-purple-50 rounded-xl">
<div class="w-10 h-10 bg-purple-100 text-purple-600 rounded-lg flex items-center justify-center">
<i class="fas fa-sitemap"></i>
</div>
<div>
<h4 class="font-medium text-deep">分解</h4>
<p class="text-sm text-secondary">将复杂任务拆解为子任务</p>
</div>
</div>
<div class="flex items-start space-x-4 p-4 bg-orange-50 rounded-xl">
<div class="w-10 h-10 bg-orange-100 text-orange-600 rounded-lg flex items-center justify-center">
<i class="fas fa-vote-yea"></i>
</div>
<div>
<h4 class="font-medium text-deep">集成</h4>
<p class="text-sm text-secondary">组合多个输出提高可靠性</p>
</div>
</div>
<div class="flex items-start space-x-4 p-4 bg-red-50 rounded-xl">
<div class="w-10 h-10 bg-red-100 text-red-600 rounded-lg flex items-center justify-center">
<i class="fas fa-search"></i>
</div>
<div>
<h4 class="font-medium text-deep">自我批评</h4>
<p class="text-sm text-secondary">模型自我评估和反思</p>
</div>
</div>
<div class="flex items-start space-x-4 p-4 bg-gray-50 rounded-xl">
<div class="w-10 h-10 bg-gray-100 text-gray-600 rounded-lg flex items-center justify-center">
<i class="fas fa-magic"></i>
</div>
<div>
<h4 class="font-medium text-deep">零样本提示</h4>
<p class="text-sm text-secondary">仅依赖指令,无示例</p>
</div>
</div>
</div>
</div>
<div>
<h3 class="font-semibold text-deep mb-6">技术选择决策矩阵</h3>
<div class="overflow-x-auto">
<table class="w-full text-sm">
<thead>
<tr class="bg-muted">
<th class="text-left p-3 font-medium text-deep">技术类别</th>
<th class="text-center p-3 font-medium text-deep">复杂性</th>
<th class="text-center p-3 font-medium text-deep">数据需求</th>
<th class="text-center p-3 font-medium text-deep">准确性</th>
<th class="text-center p-3 font-medium text-deep">效率</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200">
<tr>
<td class="p-3 font-medium text-deep">零样本提示</td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-green-100 text-green-800 rounded text-xs">低</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-red-100 text-red-800 rounded text-xs">无</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">中</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-green-100 text-green-800 rounded text-xs">高</span></td>
</tr>
<tr>
<td class="p-3 font-medium text-deep">少样本提示</td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs">中</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-green-100 text-green-800 rounded text-xs">少</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs">高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">中</span></td>
</tr>
<tr>
<td class="p-3 font-medium text-deep">思维生成</td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-purple-100 text-purple-800 rounded text-xs">高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs">中</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-green-100 text-green-800 rounded text-xs">高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-red-100 text-red-800 rounded text-xs">低</span></td>
</tr>
<tr>
<td class="p-3 font-medium text-deep">集成</td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-red-100 text-red-800 rounded text-xs">高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">中</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-green-100 text-green-800 rounded text-xs">极高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-red-100 text-red-800 rounded text-xs">极低</span></td>
</tr>
<tr>
<td class="p-3 font-medium text-deep">自我批评</td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-red-100 text-red-800 rounded text-xs">高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">中</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-green-100 text-green-800 rounded text-xs">极高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-red-100 text-red-800 rounded text-xs">低</span></td>
</tr>
<tr>
<td class="p-3 font-medium text-deep">分解</td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-red-100 text-red-800 rounded text-xs">极高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">中</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-blue-100 text-blue-800 rounded text-xs">高</span></td>
<td class="p-3 text-center"><span class="px-2 py-1 bg-yellow-100 text-yellow-800 rounded text-xs">中</span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Technology Decision Framework -->
<div class="bg-white rounded-2xl p-8 shadow-lg">
<h3 class="font-semibold text-deep mb-6">技术选择决策流程</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">
flowchart TD
A["任务分析"] --> B{"任务复杂性?"}
B -->|"简单通用"| C["零样本提示"]
B -->|"领域特定"| D{"是否有高质量示例?"}
B -->|"复杂推理"| E["思维生成"]
B -->|"极其复杂"| F["分解"]
D -->|"是"| G["少样本提示"]
D -->|"否"| C
E --> H{"是否需要极高准确性?"}
F --> H
H -->|"是"| I{"关键决策?"}
H -->|"否"| E
I -->|"是"| J["集成 + 自我批评"]
I -->|"否"| K["自我批评"]
style A fill:#e3f2fd
style B fill:#f3e5f5
style C fill:#e8f5e8
style D fill:#f3e5f5
style E fill:#fff3e0
style F fill:#fce4ec
style G fill:#e8f5e8
style H fill:#f3e5f5
style I fill:#f3e5f5
style J fill:#ffebee
style K fill:#fff3e0
</div>
</div>
</div>
</div>
</section>
<!-- Conclusion -->
<section id="conclusion" class="py-16 px-8 bg-gradient-to-br from-slate-50 to-blue-50">
<div class="max-w-4xl mx-auto">
<h2 class="font-serif text-3xl font-bold text-deep mb-8 text-center">结论与展望</h2>
<div class="prose prose-lg max-w-none">
<p class="text-lg leading-relaxed text-secondary mb-6">
《The Prompt Engineering Report Distilled: Quick Start Guide for Life Sciences》为生命科学研究人员提供了一个系统化的框架,将复杂的提示工程领域提炼为<strong class="text-primary">六种核心技术</strong>。通过掌握这些技术并将其应用于文献综述、数据提取、假设生成和论文编辑等核心科研任务,研究人员可以显著提升工作效率和科研质量。
</p>
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 my-8">
<div class="bg-white rounded-xl p-6 shadow-lg">
<h3 class="font-serif text-xl font-semibold text-deep mb-4">
<i class="fas fa-trophy text-yellow-500 mr-2"></i>
核心贡献
</h3>
<ul class="space-y-2 text-secondary">
<li>• 系统化的六种核心技术框架</li>
<li>• 生命科学特定任务的实用策略</li>
<li>• 提示构建的方法论指导</li>
<li>• 58种技术的全面分类体系</li>
</ul>
</div>
<div class="bg-white rounded-xl p-6 shadow-lg">
<h3 class="font-serif text-xl font-semibold text-deep mb-4">
<i class="fas fa-rocket text-blue-500 mr-2"></i>
实践价值
</h3>
<ul class="space-y-2 text-secondary">
<li>• 从简单工具到强大科研伙伴的转变</li>
<li>• 显著减少重复性劳动时间</li>
<li>• 提升研究假设的质量和创新性</li>
<li>• 加速知识发现和验证过程</li>
</ul>
</div>
</div>
<div class="bg-white rounded-xl p-8 shadow-lg mb-8">
<h3 class="font-serif text-xl font-semibold text-deep mb-6 text-center">未来发展方向</h3>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<div class="text-center">
<div class="w-16 h-16 bg-blue-100 text-blue-600 rounded-full flex items-center justify-center mx-auto mb-3">
<i class="fas fa-robot text-2xl"></i>
</div>
<h4 class="font-medium text-deep mb-2">自动化提示工程</h4>
<p class="text-sm text-secondary">DSPy等框架的自动提示优化</p>
</div>
<div class="text-center">
<div class="w-16 h-16 bg-green-100 text-green-600 rounded-full flex items-center justify-center mx-auto mb-3">
<i class="fas fa-link text-2xl"></i>
</div>
<h4 class="font-medium text-deep mb-2">多模态整合</h4>
<p class="text-sm text-secondary">结合图像、结构数据的提示技术</p>
</div>
<div class="text-center">
<div class="w-16 h-16 bg-purple-100 text-purple-600 rounded-full flex items-center justify-center mx-auto mb-3">
<i class="fas fa-users text-2xl"></i>
</div>
<h4 class="font-medium text-deep mb-2">协作式AI</h4>
<p class="text-sm text-secondary">人机协作的科研新模式</p>
</div>
</div>
</div>
<div class="bg-primary/5 border border-primary/20 rounded-xl p-6">
<p class="text-lg text-center text-secondary italic">
"成功的关键在于遵循明确的提示构建原则,规避常见陷阱,并通过迭代优化来不断完善提示策略。这不仅是技术的掌握,更是科研范式的革新。"
</p>
<p class="text-center mt-4 text-sm text-secondary">
— 基于《The Prompt Engineering Report Distilled》核心理念
</p>
</div>
</div>
</div>
</section>
<!-- References -->
<section class="py-12 px-8 bg-muted">
<div class="max-w-4xl mx-auto">
<h3 class="font-serif text-xl font-bold text-deep mb-6">参考文献</h3>
<div class="space-y-3 text-sm text-secondary">
<div id="ref-91">[91] <a href="https://arxiv.org/abs/2509.11295" class="text-primary hover:underline">The Prompt Engineering Report Distilled: Quick Start Guide for Life Sciences</a>
</div>
<div id="ref-92">[92] <a href="https://learnprompting.org/blog/the_prompt_report?srsltid=AfmBOorl8WXgDnWVdTcA7RzrIMUqq2kP7e3IoU_gNIe_Dwno3oIbgOSA" class="text-primary hover:underline">The Prompt Report: A Systematic Survey of Prompting Techniques</a>
</div>
<div id="ref-93">[93] <a href="https://magnus919.com/2025/07/the-complete-2025-prompt-engineering-guide-from-prompts-to-context/" class="text-primary hover:underline">The Complete 2025 Prompt Engineering Guide</a>
</div>
<div id="ref-88">[88] <a href="https://askrally.com/paper/the-prompt-report-a-systematic-survey-of-prompt-engineering-techniques" class="text-primary hover:underline">The Prompt Report: A Systematic Survey of Prompt Engineering Techniques</a>
</div>
<div id="ref-89">[89] <a href="https://jamesthez.github.io/files/liu-fcs26.pdf" class="text-primary hover:underline">Chain of Thought Prompting Elicits Reasoning in Large Language Models</a>
</div>
<div id="ref-108">[108] <a href="https://arxiv.org/html/2506.05614v1" class="text-primary hover:underline">Self-Criticism in Large Language Models</a>
</div>
<div id="ref-109">[109] <a href="https://arxiv.org/html/2406.06608v1" class="text-primary hover:underline">The Prompt Report: A Systematic Survey of Prompting Techniques</a>
</div>
</div>
</div>
</section>
</main>
<script>
// Initialize Mermaid with custom configuration
mermaid.initialize({
startOnLoad: true,
theme: 'default',
themeVariables: {
primaryColor: '#e3f2fd',
primaryTextColor: '#1e40af',
primaryBorderColor: '#1e40af',
lineColor: '#64748b',
secondaryColor: '#f8fafc',
tertiaryColor: '#fef3c7',
background: '#ffffff',
mainBkg: '#ffffff',
secondaryBkg: '#f8fafc',
tertiaryBkg: '#e3f2fd',
fontFamily: 'Inter, -apple-system, BlinkMacSystemFont, sans-serif',
fontSize: '14px',
// Enhanced colors for better contrast
cScale0: '#e3f2fd',
cScale1: '#fff3e0',
cScale2: '#f3e5f5',
cScale3: '#e8f5e8',
cScale4: '#ffebee',
cScale5: '#fff3e0',
cScale6: '#fce4ec',
cScale7: '#e3f2fd',
cScale8: '#f8fafc',
cScale9: '#fef3c7',
// Text colors for better contrast
c0: '#1e40af',
c1: '#c2410c',
c2: '#7c3aed',
c3: '#059669',
c4: '#dc2626',
c5: '#c2410c',
c6: '#be185d',
c7: '#1e40af',
c8: '#1e293b',
c9: '#d97706'
},
flowchart: {
useMaxWidth: true,
htmlLabels: true,
curve: 'basis',
padding: 20
},
sequence: {
useMaxWidth: true,
wrap: true,
padding: 20
},
gantt: {
useMaxWidth: true,
padding: 20
},
journey: {
useMaxWidth: true,
padding: 20
}
});
// 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 mermaid controls after DOM is loaded
document.addEventListener('DOMContentLoaded', function() {
initializeMermaidControls();
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Highlight current section in TOC
window.addEventListener('scroll', () => {
const sections = document.querySelectorAll('section[id]');
const navLinks = document.querySelectorAll('#toc a[href^="#"]');
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (scrollY >= (sectionTop - 200)) {
current = section.getAttribute('id');
}
});
navLinks.forEach(link => {
link.classList.remove('text-primary', 'font-medium');
link.classList.add('text-secondary');
if (link.getAttribute('href').substring(1) === current) {
link.classList.remove('text-secondary');
link.classList.add('text-primary', 'font-medium');
}
});
});
// Toggle TOC on mobile
const toggleToc = document.getElementById('toggle-toc');
const closeToc = document.getElementById('close-toc');
const toc = document.getElementById('toc');
function toggleTOC() {
toc.classList.toggle('-translate-x-full');
}
toggleToc.addEventListener('click', toggleTOC);
closeToc.addEventListener('click', toggleTOC);
// Close TOC when clicking on a link (mobile)
const tocLinks = document.querySelectorAll('#toc a');
tocLinks.forEach(link => {
link.addEventListener('click', function() {
if (window.innerWidth < 1024) {
toggleTOC();
}
});
});
// Reset TOC state on window resize
window.addEventListener('resize', function() {
if (window.innerWidth >= 1024) {
toc.classList.remove('-translate-x-full');
} else {
toc.classList.add('-translate-x-full');
}
});
</script>
</body></html>
登录后可参与表态
讨论回复
1 条回复
QianXun (QianXun)
#1
11-20 02:42
登录后可参与表态