From 3997809acbfc868275c275f38df6d86c81e184ba Mon Sep 17 00:00:00 2001 From: "z.zhang" Date: Tue, 11 Aug 2026 09:42:05 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E6=B8=85=E7=90=86=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=92=8C=E4=B8=B4=E6=97=B6=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除已跟踪的 Codex/Uvicorn/Vite 历史日志\n- 删除无外部引用的一次性 E2E 与文档提取脚本\n- 清理本机临时目录、构建日志、备份文件和重复数据副本 --- .codex-uvicorn.err.log | 22 ------- .codex-uvicorn.out.log | 2 - .codex-vite.err.log | 0 .codex-vite.out.log | 22 ------- scripts/_e2e_m2.py | 88 --------------------------- scripts/_e2e_m3.py | 82 ------------------------- scripts/_extract_juzhiyun.py | 71 --------------------- scripts/_extract_juzhiyun_chapters.py | 32 ---------- 8 files changed, 319 deletions(-) delete mode 100644 .codex-uvicorn.err.log delete mode 100644 .codex-uvicorn.out.log delete mode 100644 .codex-vite.err.log delete mode 100644 .codex-vite.out.log delete mode 100644 scripts/_e2e_m2.py delete mode 100644 scripts/_e2e_m3.py delete mode 100644 scripts/_extract_juzhiyun.py delete mode 100644 scripts/_extract_juzhiyun_chapters.py diff --git a/.codex-uvicorn.err.log b/.codex-uvicorn.err.log deleted file mode 100644 index eef20ff..0000000 --- a/.codex-uvicorn.err.log +++ /dev/null @@ -1,22 +0,0 @@ -INFO: Will watch for changes in these directories: ['D:\\ItemSpace\\14.¹¤ҵÖǺË\\aps-agent'] -INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit) -INFO: Started reloader process [20096] using WatchFiles -INFO: Started server process [31504] -INFO: Waiting for application startup. -INFO: Application startup complete. -WARNING: WatchFiles detected changes in 'server\agent_core\harness.py', 'tests\golden\test_mrp.py', 'server\gateway\app.py', 'server\aps_domain\mrp.py', 'server\state\seed.py', 'server\aps_domain\workflow.py', 'server\aps_domain\masterdata.py', 'server\agent_core\intent.py', 'tests\golden\test_master_data.py', 'server\engines\rule_engine.py', 'server\engines\queries.py', 'server\state\store.py'. Reloading... -INFO: Shutting down -INFO: Waiting for application shutdown. -INFO: Application shutdown complete. -INFO: Finished server process [31504] -INFO: Started server process [24520] -INFO: Waiting for application startup. -INFO: Application startup complete. -WARNING: WatchFiles detected changes in 'server\agent_core\harness.py', 'tests\golden\test_mrp.py', 'server\gateway\app.py', 'server\aps_domain\mrp.py', 'server\state\seed.py', 'server\aps_domain\workflow.py', 'server\aps_domain\masterdata.py', 'server\agent_core\intent.py', 'tests\golden\test_master_data.py', 'server\engines\rule_engine.py', 'server\engines\queries.py', 'server\state\store.py'. Reloading... -INFO: Shutting down -INFO: Waiting for application shutdown. -INFO: Application shutdown complete. -INFO: Finished server process [24520] -INFO: Started server process [49944] -INFO: Waiting for application startup. -INFO: Application startup complete. diff --git a/.codex-uvicorn.out.log b/.codex-uvicorn.out.log deleted file mode 100644 index 3640273..0000000 --- a/.codex-uvicorn.out.log +++ /dev/null @@ -1,2 +0,0 @@ -INFO: 127.0.0.1:64901 - "GET /api/world/summary HTTP/1.1" 200 OK - \ No newline at end of file diff --git a/.codex-vite.err.log b/.codex-vite.err.log deleted file mode 100644 index e69de29..0000000 diff --git a/.codex-vite.out.log b/.codex-vite.out.log deleted file mode 100644 index 3666e45..0000000 --- a/.codex-vite.out.log +++ /dev/null @@ -1,22 +0,0 @@ - -> aps-agent-web@0.1.0 dev -> vite --host 127.0.0.1 - - - VITE v6.4.3 ready in 561 ms - - ➜ Local: http://127.0.0.1:5173/ -13:53:38 [vite] (client) hmr update /src/chat/ChatPanel.tsx -13:53:38 [vite] (client) hmr update /src/styles.css -13:53:38 [vite] (client) hmr update /src/master/MasterPanel.tsx -13:53:38 [vite] (client) hmr update /src/orders/OrderPanel.tsx -13:53:38 [vite] (client) hmr update /src/App.tsx, /src/timeline/TimelineRail.tsx, /src/orders/OrderPanel.tsx, /src/gov/GovConsole.tsx, /src/chat/ChatPanel.tsx, /src/master/MasterPanel.tsx -13:53:38 [vite] (client) hmr update /src/projects/ProjectPanel.tsx -13:53:38 [vite] (client) hmr update /src/App.tsx -12:46:23 [vite] (client) hmr update /src/chat/ChatPanel.tsx -12:46:23 [vite] (client) hmr update /src/styles.css -12:46:23 [vite] (client) hmr update /src/master/MasterPanel.tsx -12:46:23 [vite] (client) hmr update /src/orders/OrderPanel.tsx -12:46:23 [vite] (client) hmr update /src/App.tsx, /src/timeline/TimelineRail.tsx, /src/orders/OrderPanel.tsx, /src/gov/GovConsole.tsx, /src/chat/ChatPanel.tsx, /src/master/MasterPanel.tsx -12:46:23 [vite] (client) hmr update /src/projects/ProjectPanel.tsx -12:46:23 [vite] (client) hmr update /src/App.tsx diff --git a/scripts/_e2e_m2.py b/scripts/_e2e_m2.py deleted file mode 100644 index c09cee9..0000000 --- a/scripts/_e2e_m2.py +++ /dev/null @@ -1,88 +0,0 @@ -"""临时 E2E:对比 → 采用 → 存档 → 回滚。跑完可删。""" -from __future__ import annotations - -import json -import sys -import urllib.request - -# Windows 控制台避免 ✅ 等字符触发 GBK 编码错误 -sys.stdout.reconfigure(encoding="utf-8", errors="replace") - - -def chat(text: str, sid: str | None = None) -> list[dict]: - body = json.dumps({"text": text, "sessionId": sid}).encode() - req = urllib.request.Request( - "http://localhost:8000/api/chat", - data=body, - headers={"Content-Type": "application/json"}, - ) - events: list[dict] = [] - with urllib.request.urlopen(req, timeout=60) as resp: - buf = "" - for chunk in resp: - buf += chunk.decode() - while "\n\n" in buf: - frame, buf = buf.split("\n\n", 1) - if frame.startswith("data: "): - events.append(json.loads(frame[6:])) - return events - - -def get(url: str) -> dict: - with urllib.request.urlopen(url, timeout=30) as r: - return json.loads(r.read()) - - -def post(url: str, data: dict) -> dict: - body = json.dumps(data).encode() - req = urllib.request.Request(url, data=body, headers={"Content-Type": "application/json"}) - with urllib.request.urlopen(req, timeout=60) as r: - return json.loads(r.read()) - - -def main() -> None: - # 1) compare - ev = chat("对比几种策略", "e2e-m2") - blocks = [e for e in ev if e.get("type") == "block"] - assert any(b["block"]["type"] == "scenario-cards" for b in blocks), blocks - cards = next(b["block"]["props"]["cards"] for b in blocks if b["block"]["type"] == "scenario-cards") - print("compare OK", len(cards), "cards:", [c["label"] for c in cards]) - tl0 = get("http://localhost:8000/api/timeline") - v0 = len(tl0["versions"]) - - # 2) apply best - best = min(cards, key=lambda c: (c["kpi"]["totalTardiness"], c["kpi"]["conflictCount"])) - r = post( - "http://localhost:8000/api/actions/scenario/apply", - {"sessionId": "e2e-m2", "strategy": best["strategy"], "engine": best["engine"]}, - ) - print("apply OK", (r.get("message") or "")[:80]) - tl1 = get("http://localhost:8000/api/timeline") - assert len(tl1["versions"]) >= v0, (v0, len(tl1["versions"])) - print("versions", v0, "->", len(tl1["versions"])) - - # 3) checkpoint create - ev2 = chat("存个档 叫 e2e基线", "e2e-m2") - text = "".join(e.get("text", "") for e in ev2 if e.get("type") == "token") - print("checkpoint create:", text[:100]) - tl2 = get("http://localhost:8000/api/timeline") - assert tl2["checkpoints"], tl2 - pair = tl2["checkpoints"][-1] - print("pair", pair["pairId"], pair["label"]) - - # 4) rollback stage + approve - ev3 = chat(f"回滚到检查点 {pair['pairId']}", "e2e-m2") - blocks3 = [e for e in ev3 if e.get("type") == "block"] - assert any(b["block"]["type"] == "confirm-card" for b in blocks3), blocks3 - cid = next(b["block"]["props"]["confirmId"] for b in blocks3 if b["block"]["type"] == "confirm-card") - print("rollback staged", cid) - r2 = post( - "http://localhost:8000/api/actions/confirm", - {"sessionId": "e2e-m2", "confirmId": cid, "approve": True}, - ) - print("rollback OK", (r2.get("message") or "")[:100]) - print("E2E M2 PASS") - - -if __name__ == "__main__": - main() diff --git a/scripts/_e2e_m3.py b/scripts/_e2e_m3.py deleted file mode 100644 index 3d37d2d..0000000 --- a/scripts/_e2e_m3.py +++ /dev/null @@ -1,82 +0,0 @@ -"""临时 E2E(M3):知识检索→报告生成→偏好个性化。跑完可删。""" -from __future__ import annotations - -import json -import sys -import urllib.request - -# Windows 控制台 UTF-8 -sys.stdout.reconfigure(encoding="utf-8", errors="replace") - - -def chat(text: str, sid: str | None = None) -> list[dict]: - body = json.dumps({"text": text, "sessionId": sid}).encode() - req = urllib.request.Request("http://localhost:8000/api/chat", data=body, - headers={"Content-Type": "application/json"}) - events: list[dict] = [] - with urllib.request.urlopen(req, timeout=60) as resp: - buf = "" - for chunk in resp: - buf += chunk.decode() - while "\n\n" in buf: - frame, buf = buf.split("\n\n", 1) - if frame.startswith("data: "): - events.append(json.loads(frame[6:])) - return events - - -def text_of(events: list[dict]) -> str: - return "".join(e.get("text", "") for e in events if e.get("type") == "token") - - -def blocks_of(events: list[dict]) -> list[dict]: - return [e["block"] for e in events if e.get("type") == "block"] - - -def get(url: str): - with urllib.request.urlopen(url, timeout=30) as r: - return r.read() - - -def main() -> None: - sid = "e2e-m3" - # 1) 知识检索:带出处 - ev = chat("换线有什么规定", sid) - t = text_of(ev) - assert "出处" in t and "换线标准SOP" in t, t[:200] - assert any(b["type"] == "evidence" for b in blocks_of(ev)), "缺 evidence 块" - print("K1 知识检索带出处 OK") - # 1b) @知识 直达 - ev = chat("@知识:插单审批流程", sid) - assert "插单审批流程" in text_of(ev), text_of(ev)[:120] - print("K1b @知识 引用 OK") - # 2) 试排两版(第二版不点名策略 → 偏好个性化生效) - chat("试排一版交期优先", sid) - ev = chat("再试排一版", sid) - t = text_of(ev) - assert "排产完成" in t, t[:200] - print("K3 偏好个性化:", "使用偏好" in t or "偏好" in t) - # 3) 日报 - ev = chat("生成日报", sid) - rblocks = [b for b in blocks_of(ev) if b["type"] == "report"] - assert rblocks and "排产日报" in rblocks[0]["props"]["title"], blocks_of(ev) - print("K2 日报 OK:", rblocks[0]["props"]["title"]) - # 4) 版本对比 - ev = chat("生成版本对比报告", sid) - rblocks = [b for b in blocks_of(ev) if b["type"] == "report"] - assert rblocks, text_of(ev)[:200] - print("K2 版本对比 OK:", rblocks[0]["props"]["title"]) - # 5) 导出端点 - md = get("http://localhost:8000/api/reports/daily").decode("utf-8") - assert md.startswith("# 排产日报"), md[:60] - print("导出端点 OK") - # 6) 知识资产清单(报告应已入库) - assets = json.loads(get("http://localhost:8000/api/knowledge/assets"))["assets"] - kinds = {a["kind"] for a in assets} - assert "report" in kinds and "sop" in kinds, kinds - print(f"知识库资产 {len(assets)} 条(含 report)") - print("E2E M3 PASS") - - -if __name__ == "__main__": - main() diff --git a/scripts/_extract_juzhiyun.py b/scripts/_extract_juzhiyun.py deleted file mode 100644 index 47fd83b..0000000 --- a/scripts/_extract_juzhiyun.py +++ /dev/null @@ -1,71 +0,0 @@ -# Extract Juzhiyun manual: TOC + master-data / order / schedule chapters -from __future__ import annotations -import glob, os, re, fitz - -ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -pdf = glob.glob(os.path.join(ROOT, "demand", "*.pdf"))[0] -out_dir = os.path.join(ROOT, "demand", "_extracted") -os.makedirs(out_dir, exist_ok=True) - -doc = fitz.open(pdf) -print(f"pages={doc.page_count} file={os.path.basename(pdf)}") - -toc = doc.get_toc() -toc_path = os.path.join(out_dir, "juzhiyun_toc.txt") -with open(toc_path, "w", encoding="utf-8") as f: - for lv, title, page in toc: - f.write(f"{' ' * (lv - 1)}{title}\tp{page}\n") -print(f"toc entries={len(toc)} -> {toc_path}") - -# Keywords to pull relevant pages -KEYS = [ - "主数据", "物料", "BOM", "工艺路线", "工艺", "工序", "工厂", "车间", "产线", - "设备", "班次", "日历", "库存", "订单", "分解", "MRP", "排产", "计划", - "负荷", "甘特", "齐套", "采购", "委外", "生产订单", "工单", -] - -# Build page index from TOC titles matching keys -interesting_pages: set[int] = set() -for lv, title, page in toc: - if any(k in title for k in KEYS): - # include this page and next few for section body - for p in range(max(1, page), min(doc.page_count, page + 4) + 1): - interesting_pages.add(p) - -# Also scan first 30 pages of text for section headers if TOC sparse -if len(interesting_pages) < 20: - for i in range(min(80, doc.page_count)): - text = doc[i].get_text("text") - if any(k in text for k in ("主数据维护", "工艺路线", "物料管理", "订单管理", "生产计划", "排产")): - interesting_pages.add(i + 1) - -print(f"interesting pages={len(interesting_pages)}") - -# Extract full text of interesting pages + nearby -chunks = [] -for pno in sorted(interesting_pages): - text = doc[pno - 1].get_text("text") - # compress blank lines - text = re.sub(r"\n{3,}", "\n\n", text).strip() - if text: - chunks.append(f"\n\n===== PAGE {pno} =====\n{text}") - -body_path = os.path.join(out_dir, "juzhiyun_master_schedule.txt") -with open(body_path, "w", encoding="utf-8") as f: - f.write("".join(chunks)) -print(f"extracted chars={sum(len(c) for c in chunks)} -> {body_path}") - -# Also dump ALL page texts that look like menus / module names (shorter summary) -summary_lines = [] -for i in range(doc.page_count): - text = doc[i].get_text("text") - hits = [k for k in KEYS if k in text] - if hits: - # first non-empty lines as context - lines = [ln.strip() for ln in text.splitlines() if ln.strip()][:8] - summary_lines.append(f"p{i+1} hits={hits[:6]} | {' | '.join(lines[:4])}") - -sum_path = os.path.join(out_dir, "juzhiyun_page_hits.txt") -with open(sum_path, "w", encoding="utf-8") as f: - f.write("\n".join(summary_lines)) -print(f"hit pages={len(summary_lines)} -> {sum_path}") diff --git a/scripts/_extract_juzhiyun_chapters.py b/scripts/_extract_juzhiyun_chapters.py deleted file mode 100644 index 287c0bd..0000000 --- a/scripts/_extract_juzhiyun_chapters.py +++ /dev/null @@ -1,32 +0,0 @@ -# Extract key chapters from Juzhiyun manual for master data + plan chain -from __future__ import annotations -import glob, os, re, fitz - -ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -pdf = glob.glob(os.path.join(ROOT, "demand", "*.pdf"))[0] -out = os.path.join(ROOT, "demand", "_extracted", "juzhiyun_key_chapters.txt") -doc = fitz.open(pdf) - -# Manual page numbers (printed) → PDF page index from hits: -# printed p40 = PDF p46 for 主数据管理 -# We'll extract by PDF page ranges from page_hits -RANGES = [ - ("4.4 主数据管理总述+生产模型", 46, 62), - ("4.4.2 设备模型", 63, 75), - ("4.4.5 工艺模型(物料/BOM/工序/工艺路线)", 105, 130), - ("4.8 工艺设计", 155, 163), - ("4.9 计划管理(订单/采购/外协/排产)", 163, 184), - ("4.11/4.13 备料与库存", 199, 226), -] - -chunks = [] -for title, start, end in RANGES: - chunks.append(f"\n\n########## {title} PDF {start}-{end} ##########\n") - for pno in range(start, min(end, doc.page_count) + 1): - text = doc[pno - 1].get_text("text") - text = re.sub(r"\n{3,}", "\n\n", text).strip() - chunks.append(f"\n----- PDF p{pno} -----\n{text}\n") - -with open(out, "w", encoding="utf-8") as f: - f.write("".join(chunks)) -print(f"wrote {out} chars={sum(len(c) for c in chunks)}")