30 lines
777 B
Python
30 lines
777 B
Python
from pathlib import Path
|
|
import json
|
|
|
|
ROOT = Path(r"Q:/agentProject/ai-robot-core/docs/kb/result/课程知识库_入库包")
|
|
|
|
INFO_TYPE_CN = {
|
|
"schedule": "课表",
|
|
"objective": "课程目标",
|
|
"benefit": "课程收获",
|
|
"feature": "课程特色",
|
|
"overview": "课程概述",
|
|
}
|
|
|
|
|
|
def main():
|
|
count = 0
|
|
for fp in ROOT.rglob("metadata.json"):
|
|
data = json.loads(fp.read_text(encoding="utf-8"))
|
|
data.pop("source_markdown", None)
|
|
it = data.get("info_type")
|
|
if isinstance(it, str):
|
|
data["info_type"] = INFO_TYPE_CN.get(it, it)
|
|
fp.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
|
|
count += 1
|
|
print(f"updated: {count} files")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|