#!/usr/bin/env python3 """Run Flow 2 directly via the Langflow run API from the host.""" import json import os import sys sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) from projektmatch.config import Cfg # noqa: E402 from projektmatch.ingest import dispatch_flow2 # noqa: E402 env = dict(line.split("=", 1) for line in open( os.path.expanduser("~/.config/projekt-matching/env")) if "=" in line.strip()) cfg = Cfg(flow2_id=env["FLOW2_ID"].strip(), langflow_api_key=env["LANGFLOW_API_KEY"].strip(), langflow_base="http://127.0.0.1:8090") result = dispatch_flow2(cfg, {"canonical": sys.argv[1], "title": sys.argv[2] if len(sys.argv) > 2 else "Test"}) print(json.dumps(result, indent=2, ensure_ascii=False))