refactor: tighten backend, flows, frontend, tests; push flows to Langflow

This commit is contained in:
Jonas Miederer 2026-09-28 15:58:00 +02:00
parent 6688fb08c6
commit 06ab25fb47
31 changed files with 783 additions and 358 deletions

View file

@ -42,8 +42,28 @@ async def run_sync(flows_dir: Path) -> SyncReport:
session.close()
async def run_full_pass(flows_dir: Path) -> SyncReport:
"""Single orchestration: Langflow pull + file sync (shared with API)."""
reset_engine()
session = Session(get_engine())
try:
lfx = LfxClient(settings.lfx_url, api_key=settings.lfx_api_key or None)
langflow = LangflowClient(settings.langflow_url, api_key=settings.langflow_api_key)
return await sync.sync_full_pass(session, lfx, langflow, flows_dir)
finally:
session.close()
async def main_async(args) -> int:
flows_dir = Path(args.dir or settings.flows_dir)
if args.pull and args.sync:
try:
report = await run_full_pass(flows_dir)
except FileNotFoundError as exc:
print(f"ERROR: {exc}", file=sys.stderr)
return 2
print(report.model_dump_json(indent=2))
return 1 if report.errors else 0
if args.pull:
pulled = await pull_from_langflow(flows_dir)
print(json.dumps(pulled, indent=2, ensure_ascii=False))