refactor: form-core wiring, JWT sessions, slowapi, packaging, frontend rewrite, test declutter
This commit is contained in:
parent
06ab25fb47
commit
03af41e837
74 changed files with 6089 additions and 5183 deletions
|
|
@ -7,11 +7,11 @@ Usage:
|
|||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
|
||||
import httpx
|
||||
import typer
|
||||
|
||||
|
||||
def post(api: str, path: str, body: dict) -> dict:
|
||||
|
|
@ -26,23 +26,22 @@ def post(api: str, path: str, body: dict) -> dict:
|
|||
return {"status": 0, "body": str(exc)[:2000]}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument("--api", default="http://localhost:8000")
|
||||
parser.add_argument("--langflow-id", required=True)
|
||||
parser.add_argument("--name", default=None)
|
||||
parser.add_argument("--author", default="")
|
||||
parser.add_argument("--no-deploy", action="store_true")
|
||||
args = parser.parse_args()
|
||||
|
||||
def main(
|
||||
langflow_id: str = typer.Option(..., "--langflow-id"),
|
||||
api: str = typer.Option("http://localhost:8000", "--api"),
|
||||
name: str | None = typer.Option(None, "--name"),
|
||||
author: str = typer.Option("", "--author"),
|
||||
no_deploy: bool = typer.Option(False, "--no-deploy"),
|
||||
) -> int:
|
||||
"""Import a flow from Langflow via the running API (post() stays importable)."""
|
||||
result = post(
|
||||
args.api,
|
||||
api,
|
||||
"/api/flows/import",
|
||||
{
|
||||
"langflow_flow_id": args.langflow_id,
|
||||
"name": args.name,
|
||||
"author": args.author,
|
||||
"deploy": not args.no_deploy,
|
||||
"langflow_flow_id": langflow_id,
|
||||
"name": name,
|
||||
"author": author,
|
||||
"deploy": not no_deploy,
|
||||
},
|
||||
)
|
||||
print(json.dumps(result, indent=2, ensure_ascii=False))
|
||||
|
|
@ -50,4 +49,4 @@ def main() -> int:
|
|||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
sys.exit(typer.run(main))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue