fix: 第 16 章补充零 import 与死配置两处核对事实;移除 subagent 临时脚本
This commit is contained in:
@@ -121,7 +121,9 @@
|
||||
建 provider / toolRouter / 三个 factory(<code>:52-58</code>)、跑 Armory 装配(<code>:70</code>)、
|
||||
建 chatService 与 Gin 路由(<code>:74-77</code>)。<code>Engine</code> 结构体(<code>:26-33</code>)里也没有
|
||||
<code>*gorm.DB</code> 或 <code>*redis.Client</code> 字段。换句话说,这两个连接函数是<b>孤岛</b>:
|
||||
编译得过、测试得过、被人 import 过,但运行时永远不会被走到。</p>
|
||||
包本身能通过 <code>go build</code>,但整个仓库里没有任何文件 import
|
||||
<code>infrastructure/persistence</code> 或 <code>infrastructure/cache</code>——连测试都没有。
|
||||
它们的代码永远只会被阅读,不会被执行。</p>
|
||||
|
||||
<p>那么会话存在哪里?<code>ports.SessionStore</code>(<code>ports.go:104-107</code>)只有两个方法
|
||||
<code>Get(userID, agentID string) (string, bool)</code> 与 <code>Set(userID, agentID, sessionID string) error</code>,
|
||||
@@ -441,7 +443,7 @@ flag.Parse()</pre>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>鉴权</td>
|
||||
<td>五个端点没有任何 middleware,<code>userID</code> 由客户端在请求体里传</td>
|
||||
<td>五个端点没有鉴权 middleware(只有 Recovery / CORS / 开发档访问日志),<code>userID</code> 由客户端在请求体里自报</td>
|
||||
<td>加 Auth middleware,<code>userID</code> 从 token claim 取,禁止客户端自报身份</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<button class="btn" id="expandAll">展开全部小节</button>
|
||||
<button class="btn" id="resetBtn">清空进度</button>
|
||||
<button class="btn" id="printBtn">打印</button>
|
||||
<!-- AUTO:prog -->
|
||||
<!-- AUTO:prog -->
|
||||
<div class="progwrap" data-chapters="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22">
|
||||
<span>已读</span><div class="bar"><i></i></div><b>0%</b>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<span>·</span>
|
||||
<span>篇 <b class="pos">0</b> / 6</span>
|
||||
</p>
|
||||
<!-- AUTO:hero -->
|
||||
<!-- AUTO:hero -->
|
||||
<div class="modhero">
|
||||
<span class="mh-no">篇 0 / 6</span>
|
||||
<h1>前言 · 先建立地图</h1>
|
||||
@@ -56,7 +56,7 @@
|
||||
<button class="btn" id="expandAll">展开全部小节</button>
|
||||
<button class="btn" id="resetBtn">清空进度</button>
|
||||
<button class="btn" id="printBtn">打印</button>
|
||||
<!-- AUTO:prog -->
|
||||
<!-- AUTO:prog -->
|
||||
<div class="progwrap" data-chapters="1,2">
|
||||
<span>已读</span><div class="bar"><i></i></div><b>0%</b>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<span>·</span>
|
||||
<span>篇 <b class="pos">1</b> / 6</span>
|
||||
</p>
|
||||
<!-- AUTO:hero -->
|
||||
<!-- AUTO:hero -->
|
||||
<div class="modhero">
|
||||
<span class="mh-no">篇 1 / 6</span>
|
||||
<h1>知识学习 · 补齐前置</h1>
|
||||
@@ -56,7 +56,7 @@
|
||||
<button class="btn" id="expandAll">展开全部小节</button>
|
||||
<button class="btn" id="resetBtn">清空进度</button>
|
||||
<button class="btn" id="printBtn">打印</button>
|
||||
<!-- AUTO:prog -->
|
||||
<!-- AUTO:prog -->
|
||||
<div class="progwrap" data-chapters="3,4">
|
||||
<span>已读</span><div class="bar"><i></i></div><b>0%</b>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<span>·</span>
|
||||
<span>篇 <b class="pos">2</b> / 6</span>
|
||||
</p>
|
||||
<!-- AUTO:hero -->
|
||||
<!-- AUTO:hero -->
|
||||
<div class="modhero">
|
||||
<span class="mh-no">篇 2 / 6</span>
|
||||
<h1>项目拆解 · 追源码</h1>
|
||||
@@ -56,7 +56,7 @@
|
||||
<button class="btn" id="expandAll">展开全部小节</button>
|
||||
<button class="btn" id="resetBtn">清空进度</button>
|
||||
<button class="btn" id="printBtn">打印</button>
|
||||
<!-- AUTO:prog -->
|
||||
<!-- AUTO:prog -->
|
||||
<div class="progwrap" data-chapters="5,6,7,8,9,10,11,12,13,14,15,16">
|
||||
<span>已读</span><div class="bar"><i></i></div><b>0%</b>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<span>·</span>
|
||||
<span>篇 <b class="pos">3</b> / 6</span>
|
||||
</p>
|
||||
<!-- AUTO:hero -->
|
||||
<!-- AUTO:hero -->
|
||||
<div class="modhero">
|
||||
<span class="mh-no">篇 3 / 6</span>
|
||||
<h1>缺陷与演进</h1>
|
||||
@@ -56,7 +56,7 @@
|
||||
<button class="btn" id="expandAll">展开全部小节</button>
|
||||
<button class="btn" id="resetBtn">清空进度</button>
|
||||
<button class="btn" id="printBtn">打印</button>
|
||||
<!-- AUTO:prog -->
|
||||
<!-- AUTO:prog -->
|
||||
<div class="progwrap" data-chapters="17,18,19">
|
||||
<span>已读</span><div class="bar"><i></i></div><b>0%</b>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<span>·</span>
|
||||
<span>篇 <b class="pos">4</b> / 6</span>
|
||||
</p>
|
||||
<!-- AUTO:hero -->
|
||||
<!-- AUTO:hero -->
|
||||
<div class="modhero">
|
||||
<span class="mh-no">篇 4 / 6</span>
|
||||
<h1>场景还原 · 端到端</h1>
|
||||
@@ -56,7 +56,7 @@
|
||||
<button class="btn" id="expandAll">展开全部小节</button>
|
||||
<button class="btn" id="resetBtn">清空进度</button>
|
||||
<button class="btn" id="printBtn">打印</button>
|
||||
<!-- AUTO:prog -->
|
||||
<!-- AUTO:prog -->
|
||||
<div class="progwrap" data-chapters="20,21">
|
||||
<span>已读</span><div class="bar"><i></i></div><b>0%</b>
|
||||
</div>
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<span>·</span>
|
||||
<span>篇 <b class="pos">5</b> / 6</span>
|
||||
</p>
|
||||
<!-- AUTO:hero -->
|
||||
<!-- AUTO:hero -->
|
||||
<div class="modhero">
|
||||
<span class="mh-no">篇 5 / 6</span>
|
||||
<h1>收尾 · 速查与自测</h1>
|
||||
@@ -56,7 +56,7 @@
|
||||
<button class="btn" id="expandAll">展开全部小节</button>
|
||||
<button class="btn" id="resetBtn">清空进度</button>
|
||||
<button class="btn" id="printBtn">打印</button>
|
||||
<!-- AUTO:prog -->
|
||||
<!-- AUTO:prog -->
|
||||
<div class="progwrap" data-chapters="22">
|
||||
<span>已读</span><div class="bar"><i></i></div><b>0%</b>
|
||||
</div>
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const h = fs.readFileSync('15-frontend.html', 'utf8');
|
||||
let art = (h.match(/<article>([\s\S]*)<\/article>/) || [, ''])[1];
|
||||
art = art.replace(/<pre[\s\S]*?<\/pre>/g, ' ')
|
||||
.replace(/<nav class="pager">[\s\S]*?<\/nav>/g, ' ')
|
||||
.replace(/<p class="foot">[\s\S]*?<\/p>/g, ' ')
|
||||
.replace(/<p class="chapnav">[\s\S]*?<\/p>/g, ' ');
|
||||
art = art.replace(/<[^>]+>/g, '').replace(/\s+/g, '');
|
||||
let cjk = 0, ascii = 0, punct = 0, other = 0;
|
||||
for (const ch of art) {
|
||||
const c = ch.codePointAt(0);
|
||||
if (c >= 0x4e00 && c <= 0x9fff) cjk++;
|
||||
else if (c >= 0x20 && c <= 0x7e) ascii++;
|
||||
else punct++;
|
||||
}
|
||||
console.log({ total: art.length, cjk, ascii, punct });
|
||||
@@ -1,17 +0,0 @@
|
||||
const fs = require('fs');
|
||||
const p = '15-frontend.html';
|
||||
let h = fs.readFileSync(p, 'utf8');
|
||||
|
||||
// 1) 全文件:数字实体 -> 命名实体
|
||||
h = h.replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&');
|
||||
|
||||
// 2) 代码块内:补齐 & 与 > 的转义(< 已全部处理)
|
||||
h = h.replace(/<pre([^>]*)>([\s\S]*?)<\/pre>/g, (m, attrs, body) => {
|
||||
let b = body;
|
||||
b = b.replace(/&(?!(amp|lt|gt|quot|#\d+);)/g, '&');
|
||||
b = b.replace(/>/g, '>');
|
||||
return `<pre${attrs}>${b}</pre>`;
|
||||
});
|
||||
|
||||
fs.writeFileSync(p, h);
|
||||
console.log('done, bytes', h.length);
|
||||
Reference in New Issue
Block a user