新增跨 worker 进度绑定表与显式 hxops_turn_id 链路;Dify Start 仅注入 agent_runtime_context,task_id/turn_id 写入 refs 供画布解析后回传 Tool。 Co-authored-by: Cursor <cursoragent@cursor.com>
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
"""Export Dify-compatible OpenAPI for File Check tools paste/import."""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
sys.path.insert(0, str(ROOT / "backend"))
|
|
|
|
from app.services.file_check_tools.openapi_spec import build_file_check_openapi_spec
|
|
|
|
|
|
def main() -> None:
|
|
# 仓库内静态 JSON 使用占位地址;各环境请用 URL 导入 GET /api/file-check/tools/openapi.json
|
|
# 或导出前设置 HXOPS_TOOLS_API_BASE。勿将个人/测试机 IP 提交进 docs/openapi/。
|
|
base = (
|
|
os.getenv("HXOPS_TOOLS_API_BASE")
|
|
or os.getenv("PUBLIC_BASE_URL")
|
|
or "http://127.0.0.1:5052"
|
|
).rstrip("/")
|
|
spec = build_file_check_openapi_spec(base)
|
|
out_dir = ROOT / "docs" / "openapi"
|
|
out_dir.mkdir(parents=True, exist_ok=True)
|
|
json_path = out_dir / "file_check_tools_openapi.json"
|
|
json_path.write_text(json.dumps(spec, ensure_ascii=False, indent=2), encoding="utf-8")
|
|
print(f"Wrote {json_path}")
|
|
print(f"Import URL: {base}/api/file-check/tools/openapi.json")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|