From 9373590e2ae16436b78bade7608e4c1bba8f52a5 Mon Sep 17 00:00:00 2001 From: za-ek <1@zaek.eu> Date: Fri, 25 Sep 2026 19:54:01 +0300 Subject: [PATCH] POST req --- .gitignore | 3 ++- .idea/Agents.iml | 14 -------------- main.py | 16 ++++++++++------ 3 files changed, 12 insertions(+), 21 deletions(-) delete mode 100644 .idea/Agents.iml diff --git a/.gitignore b/.gitignore index ad421e8..c0fcdd7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .env projects role_id -wrapped_secret_id \ No newline at end of file +wrapped_secret_id +.idea \ No newline at end of file diff --git a/.idea/Agents.iml b/.idea/Agents.iml deleted file mode 100644 index e0d6de8..0000000 --- a/.idea/Agents.iml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/main.py b/main.py index 7d5b414..60ffa92 100644 --- a/main.py +++ b/main.py @@ -3,6 +3,7 @@ import os from contextlib import asynccontextmanager from fastapi import FastAPI, HTTPException, Depends +from pydantic import BaseModel from agents.coders.BaseCoder import CoderAgent from agents.issue_triage.IssueTriageAgent import IssueTriageAgent @@ -85,17 +86,20 @@ async def say_hello(name: str): return {"message": f"Hello {name}"} -@app.get("/consume_task") -async def decomposing_issue(issue: str, agent: IssueTriageAgent = Depends(get_agent)): +class IncomingTask(BaseModel): + issue: str + +@app.post("/consume_task") +async def decomposing_issue(body: IncomingTask, agent: IssueTriageAgent = Depends(get_agent)): try: - logger.info(f"Received an issue: {issue}") - plan = await agent.plan_issue(issue) + logger.info(f"Received an issue: {body.issue}") + plan = await agent.plan_issue(body.issue) logger.info("Task planning successful.") logger.info(plan.render()) return {"plan": plan} except IssueNotFound: - logger.error(f"Issue {issue} not found.") - raise HTTPException(status_code=404, detail=f"Issue {issue} not found") + logger.error(f"Issue {body.issue} not found.") + raise HTTPException(status_code=404, detail=f"Issue {body.issue} not found") except Exception as e: logger.exception("An unexpected error occurred") return {"error": str(e)}