Files

139 lines
7.5 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AI 回复处理流程</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; background: #f5f5f5; color: #333; }
h1 { text-align: center; margin-bottom: 5px; }
.subtitle { text-align: center; color: #666; margin-bottom: 20px; font-size: 14px; }
.note { background: #e3f2fd; border: 1px solid #1976d2; border-radius: 6px; padding: 12px 16px; margin-bottom: 20px; }
.note-title { font-weight: 600; color: #1565c0; margin-bottom: 8px; }
.rules-list { margin: 0; padding-left: 18px; font-size: 13px; }
.rules-list li { margin-bottom: 4px; }
.flowchart { background: white; padding: 25px; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); margin-bottom: 20px; }
.flow-row { display: flex; justify-content: center; gap: 15px; margin-bottom: 10px; flex-wrap: wrap; }
.flow-col { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.flow-box { padding: 10px 16px; border-radius: 8px; text-align: center; font-size: 12px; border: 2px solid; min-width: 100px; }
.flow-box.entry { background: #e3f2fd; border-color: #1976d2; color: #1565c0; }
.flow-box.pre { background: #e8f5e9; border-color: #388e3c; color: #2e7d32; }
.flow-box.step { background: #f3e5f5; border-color: #7b1fa2; color: #6a1b9a; }
.flow-box.delay { background: #fff8e1; border-color: #ffa000; color: #f57c00; }
.flow-box.term { background: #d4edda; border-color: #28a745; color: #155724; }
.condition { font-size: 10px; padding: 2px 8px; border-radius: 10px; background: #e8f5e9; color: #2e7d32; }
.arrow { text-align: center; color: #888; font-size: 16px; margin: 2px 0; }
.branch { display: flex; gap: 20px; margin-top: 8px; }
.branch-item { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.branch-label { font-size: 10px; padding: 2px 8px; border-radius: 4px; }
.branch-yes { background: #c8e6c9; color: #2e7d32; }
.branch-no { background: #ffcdd2; color: #c62828; }
.parallel-box { background: #e8f5e9; border: 2px dashed #4caf50; border-radius: 12px; padding: 15px; margin: 10px 0; }
.parallel-title { text-align: center; font-weight: 600; color: #2e7d32; margin-bottom: 10px; }
.parallel-items { display: flex; justify-content: center; gap: 30px; font-size: 11px; color: #555; flex-wrap: wrap; }
.table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); font-size: 12px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
.table th { background: #f8f9fa; font-weight: 600; }
.tag { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; }
.tag-green { background: #d4edda; color: #155724; }
</style>
</head>
<body>
<h1>AI 回复处理流程</h1>
<p class="subtitle">IT 智能服务台 - 消息处理管线(v8.0)</p>
<div class="note">
<div class="note-title">核心逻辑:延迟前置 + 结果复用</div>
<ul class="rules-list">
<li><strong>前置处理</strong>:图片提前 Vision、前置消息图谱/Dify 预处理(与输入并行,结果缓存)</li>
<li><strong>延迟等待</strong>:合并上下文前延迟 3-5 秒(整个会话只一次)</li>
<li><strong>无新消息</strong>:直接使用缓存结果快速发送</li>
<li><strong>有新消息</strong>:合并上下文后,路由复用前置结果并补充处理</li>
</ul>
</div>
<div class="flowchart">
<!-- 用户输入 -->
<div class="flow-row">
<div class="flow-box entry">用户输入消息...</div>
</div>
<div class="arrow"></div>
<!-- 前置处理(并行) -->
<div class="flow-box pre" style="margin-bottom: 10px;">🔄 前置处理(与输入并行)</div>
<div class="parallel-box">
<div class="parallel-title">结果缓存</div>
<div class="parallel-items">
<span>🖼️ 图片:Vision 识别</span>
<span>🕸️ 前置消息:图谱预处理</span>
<span>🤖 前置消息:Dify 预处理</span>
</div>
</div>
<div class="arrow"></div>
<!-- 用户发送 -->
<div class="flow-row">
<div class="flow-box entry">用户点击发送</div>
</div>
<div class="arrow"></div>
<!-- 加载会话 -->
<div class="flow-row">
<div class="flow-box step">加载会话</div>
<div class="flow-box step">获取前置结果</div>
</div>
<div class="arrow"></div>
<!-- 延迟等待(合并前,只一次) -->
<div class="flow-box delay" style="margin-bottom: 10px;">
⏳ 延迟等待 3-5 秒(合并前,整个会话只一次)
</div>
<div class="branch">
<div class="branch-item">
<div class="branch-label branch-yes">有新消息/图片</div>
<div style="font-size:10px;color:#2e7d32;">→ 合并上下文</div>
</div>
<div class="branch-item">
<div class="branch-label branch-no">无新消息</div>
<div style="font-size:10px;color:#888;">→ 使用缓存结果</div>
</div>
</div>
<div class="arrow"></div>
<!-- 路由处理(复用前置结果) -->
<div class="flow-row">
<div class="flow-box step">通用场景</div>
<div class="flow-box step">本地路由</div>
</div>
<div class="flow-row">
<div class="flow-box step">Vision</div>
<div class="flow-box step">Neo4j图谱</div>
<div class="flow-box step">Dify推理</div>
</div>
<div class="arrow"></div>
<!-- 输出 -->
<div class="flow-row">
<div class="flow-box term">持久化 + 推送</div>
</div>
</div>
<h2>节点说明</h2>
<table class="table">
<thead>
<tr><th>节点</th><th>名称</th><th>功能</th></tr>
</thead>
<tbody>
<tr><td>1</td><td>前置处理</td><td>图片提前Vision、前置消息图谱/Dify预处理,结果缓存</td></tr>
<tr><td>2</td><td>延迟等待</td><td>合并上下文前延迟3-5秒,有新消息→合并,无→用缓存</td></tr>
<tr><td>3</td><td>获取前置结果</td><td>加载前置处理缓存结果,供路由复用</td></tr>
<tr><td>4</td><td>通用场景</td><td>打招呼/呼叫人工关键词匹配</td></tr>
<tr><td>5</td><td>本地路由</td><td>业务关键词+置信度≥70%直接返回</td></tr>
<tr><td>6</td><td>Vision增强</td><td>图片理解(复用前置Vision结果)</td></tr>
<tr><td>7</td><td>Neo4j图谱</td><td>图谱知识库匹配(复用预处理结果)</td></tr>
<tr><td>8</td><td>Dify推理</td><td>主推理+action判断(复用预处理结果)</td></tr>
</tbody>
</table>
</body>
</html>