mirror of
https://github.com/eigent-ai/eigent.git
synced 2026-05-12 14:11:07 +00:00
fix: avoid task not found bug (#121)
This commit is contained in:
commit
09ffb21f2d
2 changed files with 5 additions and 4 deletions
|
|
@ -16,6 +16,7 @@ from app.service.task import (
|
|||
ActionInstallMcpData,
|
||||
ActionStopData,
|
||||
ActionSupplementData,
|
||||
create_task_lock,
|
||||
get_task_lock,
|
||||
)
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ router = APIRouter(tags=["chat"])
|
|||
|
||||
@router.post("/chat", name="start chat")
|
||||
def post(data: Chat, request: Request):
|
||||
task_lock = create_task_lock(data.task_id)
|
||||
load_dotenv(dotenv_path=data.env_path)
|
||||
|
||||
# logger.debug(f"start chat: {data.model_dump_json()}")
|
||||
|
|
@ -43,7 +45,7 @@ def post(data: Chat, request: Request):
|
|||
|
||||
if data.is_cloud():
|
||||
os.environ["cloud_api_key"] = data.api_key
|
||||
return StreamingResponse(step_solve(data, request), media_type="text/event-stream")
|
||||
return StreamingResponse(step_solve(data, request, task_lock), media_type="text/event-stream")
|
||||
|
||||
|
||||
@router.post("/chat/{id}", name="improve chat")
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ from app.service.task import (
|
|||
ActionImproveData,
|
||||
ActionInstallMcpData,
|
||||
ActionNewAgent,
|
||||
create_task_lock,
|
||||
TaskLock,
|
||||
delete_task_lock,
|
||||
)
|
||||
from camel.toolkits import AgentCommunicationToolkit, ToolkitMessageIntegration
|
||||
|
|
@ -43,14 +43,13 @@ from camel.models import ModelProcessingError
|
|||
|
||||
|
||||
@sync_step
|
||||
async def step_solve(options: Chat, request: Request):
|
||||
async def step_solve(options: Chat, request: Request, task_lock: TaskLock):
|
||||
# if True:
|
||||
# import faulthandler
|
||||
|
||||
# faulthandler.enable()
|
||||
# for second in [5, 10, 20, 30, 60, 120, 240]:
|
||||
# faulthandler.dump_traceback_later(second)
|
||||
task_lock = create_task_lock(options.task_id)
|
||||
|
||||
start_event_loop = True
|
||||
question_agent = question_confirm_agent(options)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue