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