Skip to content

Commit 4a4d59a

Browse files
committed
Merge branch 'main' into stream_mode
2 parents 218523a + 300ccc3 commit 4a4d59a

42 files changed

Lines changed: 812 additions & 170 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,13 +317,10 @@ For more information please contact info@eigent.ai
317317

318318
- **X (Twitter):** Follow for updates, AI insights, and key announcements. [Follow us][social-x-link]
319319

320-
- **WeChat Community:** Scan the QR codes below to join our WeChat community groups.
320+
- **WeChat Community:** Scan the QR code below to add our WeChat assistant, and join our WeChat community group.
321321

322322
<div align="center">
323-
<img src="./src/assets/wechat_qr_1.jpg" width="200" style="display: inline-block; margin: 10px;">
324-
<img src="./src/assets/wechat_qr_2.jpg" width="200" style="display: inline-block; margin: 10px;">
325-
<img src="./src/assets/wechat_qr_3.jpg" width="200" style="display: inline-block; margin: 10px;">
326-
<img src="./src/assets/wechat_qr_4.jpg" width="200" style="display: inline-block; margin: 10px;">
323+
<img src="./src/assets/wechat_qr.jpg" width="200" style="display: inline-block; margin: 10px;">
327324
</div>
328325

329326

README_CN.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,13 +310,10 @@ Eigent 基于 [CAMEL-AI.org][camel-ai-org-github] 的研究和基础设施构建
310310

311311
- **X (Twitter):** 关注更新、AI 见解和重要公告。[关注我们][social-x-link]
312312

313-
- **微信社区:** 扫描下方二维码加入我们的微信社区群
313+
- **微信社区:** 扫描下方二维码添加我们的微信助手,加入我们的微信社区群
314314

315315
<div align="center">
316-
<img src="./src/assets/wechat_qr_1.jpg" width="200" style="display: inline-block; margin: 10px;">
317-
<img src="./src/assets/wechat_qr_2.jpg" width="200" style="display: inline-block; margin: 10px;">
318-
<img src="./src/assets/wechat_qr_3.jpg" width="200" style="display: inline-block; margin: 10px;">
319-
<img src="./src/assets/wechat_qr_4.jpg" width="200" style="display: inline-block; margin: 10px;">
316+
<img src="./src/assets/wechat_qr.jpg" width="200" style="display: inline-block; margin: 10px;">
320317
</div>
321318

322319

backend/app/controller/chat_controller.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -204,14 +204,19 @@ def supplement(id: str, data: SupplementChat):
204204
@traceroot.trace()
205205
def stop(id: str):
206206
"""stop the task"""
207-
chat_logger.warning("Stopping chat session", extra={"task_id": id})
207+
chat_logger.info("=" * 80)
208+
chat_logger.info("🛑 [STOP-BUTTON] DELETE /chat/{id} request received from frontend")
209+
chat_logger.info(f"[STOP-BUTTON] project_id/task_id: {id}")
210+
chat_logger.info("=" * 80)
208211
try:
209212
task_lock = get_task_lock(id)
213+
chat_logger.info(f"[STOP-BUTTON] Task lock retrieved, task_lock.id: {task_lock.id}, task_lock.status: {task_lock.status}")
214+
chat_logger.info(f"[STOP-BUTTON] Queueing ActionStopData(Action.stop) to task_lock queue")
210215
asyncio.run(task_lock.put_queue(ActionStopData(action=Action.stop)))
211-
chat_logger.info("Chat stop signal sent", extra={"task_id": id})
216+
chat_logger.info(f"[STOP-BUTTON] ✅ ActionStopData queued successfully, this will trigger workforce.stop_gracefully()")
212217
except Exception as e:
213218
# Task lock may not exist if task is already finished or never started
214-
chat_logger.info("Task lock not found or already stopped", extra={"task_id": id, "error": str(e)})
219+
chat_logger.warning(f"[STOP-BUTTON] ⚠️ Task lock not found or already stopped, task_id: {id}, error: {str(e)}")
215220
return Response(status_code=204)
216221

217222

@@ -282,18 +287,33 @@ def remove_task(project_id: str, task_id: str):
282287
@router.post("/chat/{project_id}/skip-task", name="skip task in workforce")
283288
@traceroot.trace()
284289
def skip_task(project_id: str):
285-
"""Skip a task in the workforce"""
286-
chat_logger.info(f"Skipping task in workforce for project_id: {project_id}")
290+
"""
291+
Skip/Stop current task execution while preserving context.
292+
This endpoint is called when user clicks the Stop button.
293+
294+
Behavior:
295+
- Stops workforce gracefully
296+
- Marks task as done
297+
- Preserves conversation_history and last_task_result in task_lock
298+
- Sends 'end' event to frontend
299+
- Keeps SSE connection alive for multi-turn conversation
300+
"""
301+
chat_logger.info("=" * 80)
302+
chat_logger.info(f"🛑 [STOP-BUTTON] SKIP-TASK request received from frontend (User clicked Stop)")
303+
chat_logger.info(f"[STOP-BUTTON] project_id: {project_id}")
304+
chat_logger.info("=" * 80)
287305
task_lock = get_task_lock(project_id)
306+
chat_logger.info(f"[STOP-BUTTON] Task lock retrieved, task_lock.id: {task_lock.id}, task_lock.status: {task_lock.status}")
288307

289308
try:
290-
# Queue the skip task action
309+
# Queue the skip task action - this will preserve context for multi-turn
291310
skip_task_action = ActionSkipTaskData(project_id=project_id)
311+
chat_logger.info(f"[STOP-BUTTON] Queueing ActionSkipTaskData (preserves context, marks as done)")
292312
asyncio.run(task_lock.put_queue(skip_task_action))
293313

294-
chat_logger.info(f"Task skip request queued for project_id: {project_id}")
314+
chat_logger.info(f"[STOP-BUTTON] ✅ Skip request queued - task will stop gracefully and preserve context")
295315
return Response(status_code=201)
296316

297317
except Exception as e:
298-
chat_logger.error(f"Error skipping task for project_id: {project_id}: {e}")
318+
chat_logger.error(f"[STOP-BUTTON] ❌ Error skipping task for project_id: {project_id}: {e}")
299319
raise UserException(code.error, f"Failed to skip task: {str(e)}")

0 commit comments

Comments
 (0)