()
| 75 | |
| 76 | @knowledge_bp.route("/read", methods=["POST"]) |
| 77 | def knowledge_read(): |
| 78 | data = request.get_json(silent=True) or {} |
| 79 | category = _require_json_field(data, "category") |
| 80 | path = _require_json_field(data, "path") |
| 81 | |
| 82 | store = _get_store() |
| 83 | try: |
| 84 | content = store.read(category, path) |
| 85 | except ValueError as exc: |
| 86 | raise AppError(ErrorCode.INVALID_REQUEST, str(exc)) from exc |
| 87 | except FileNotFoundError: |
| 88 | raise AppError(ErrorCode.TABLE_NOT_FOUND, "Knowledge file not found") |
| 89 | |
| 90 | return json_ok({"content": content, "category": category, "path": path}) |
| 91 | |
| 92 | |
| 93 | # ── write ───────────────────────────────────────────────────────────────── |
nothing calls this directly
no test coverage detected