阶段3(下):RAG、向量数据库专题;接入 BOSS直聘调研(research/、岗位对照和延伸技术栈);新增 cs 领域和 12 个技术栈骨架;面试题全部补齐追问并加入校验

This commit is contained in:
Shikui Wang committed 2026-10-23 15:56:03 +08:00
1 parent 7f52513ffc
commit 6650f7eb6d
52 files changed
+2777 -38

No files matched your search

+19 -7
View File
@@ -17,11 +17,11 @@ import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
CONTENT_DIRS = ["plan", "topics", "scenarios"]
CONTENT_DIRS = ["plan", "topics", "scenarios", "research"]
SCHEMA_VERSION = 1
TYPES = {"index", "lesson", "scenario", "interview", "project", "week"}
DOMAINS = {"backend", "devops", "python", "ai", "frontend", "cross", "plan"}
TYPES = {"index", "lesson", "scenario", "interview", "project", "week", "research"}
DOMAINS = {"backend", "devops", "python", "ai", "frontend", "cs", "cross", "plan"}
LEVELS = {"basic", "intermediate", "advanced"}
QUESTION_LEVELS = ["基础", "进阶", "场景题"]
ID_RE = re.compile(r"^[a-z0-9]+(?:\.[a-z0-9-]+)+$")
@@ -79,11 +79,12 @@ def parse_frontmatter(text: str) -> tuple[dict | None, str, list[str]]:
return meta, text[end + 5:], errs
def scan_body(body: str) -> tuple[bool, list[str], list[str], dict[str, int]]:
"""返回:围栏是否闭合、二级标题、链接目标、按级别统计的面试题数。"""
def scan_body(body: str) -> tuple[bool, list[str], list[str], dict[str, int], list[str]]:
"""返回:围栏是否闭合、二级标题、链接目标、按级别统计的面试题数、缺少参考答案或追问的题目。"""
in_fence, fence_mark = False, ""
headings, links = [], []
counts = {k: 0 for k in QUESTION_LEVELS}
questions: list[list] = [] # [标题, 有参考答案, 有追问]
for line in body.splitlines():
m = FENCE_RE.match(line)
if m:
@@ -99,8 +100,17 @@ def scan_body(body: str) -> tuple[bool, list[str], list[str], dict[str, int]]:
q = QUESTION_RE.match(line)
if q:
counts[q.group(1)] += 1
questions.append([line[4:].strip(), False, False])
elif line.startswith("#"):
if questions and line.startswith(("# ", "## ", "### ")):
questions.append([None, True, True]) # 题目之后的其他标题,结束上一题
elif questions:
questions[-1][1] |= line.startswith("**参考答案**")
questions[-1][2] |= line.startswith("**追问**")
links += LINK_RE.findall(line)
return not in_fence, headings, links, counts
incomplete = [f"{t}(缺少{'“**参考答案**”' if not a else ''}{'“**追问**”' if not f else ''})"
for t, a, f in questions if t and not (a and f)]
return not in_fence, headings, links, counts, incomplete
def main() -> int:
@@ -136,7 +146,9 @@ def main() -> int:
for w in meta.get("week", []) if isinstance(meta.get("week"), list) else []:
if not isinstance(w, int) or not 1 <= w <= 16:
errors.append(f"{rel}: week 取值 {w!r} 必须是 1~16 的整数")
closed, headings, links, counts = scan_body(body)
closed, headings, links, counts, incomplete = scan_body(body)
if t == "interview":
errors += [f"{rel}: 面试题 {q}" for q in incomplete]
if not closed:
errors.append(f"{rel}: 代码块围栏没有闭合")
for sec in REQUIRED_SECTIONS.get(t, []):