auto-coder-web 0.1.32__py3-none-any.whl → 0.1.34__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- auto_coder_web/routers/todo_router.py +43 -45
- auto_coder_web/version.py +1 -1
- auto_coder_web/web/asset-manifest.json +3 -3
- auto_coder_web/web/index.html +1 -1
- auto_coder_web/web/static/js/{main.1ce477bc.js → main.99a7408f.js} +3 -3
- auto_coder_web/web/static/js/{main.1ce477bc.js.map → main.99a7408f.js.map} +1 -1
- {auto_coder_web-0.1.32.dist-info → auto_coder_web-0.1.34.dist-info}/METADATA +2 -2
- {auto_coder_web-0.1.32.dist-info → auto_coder_web-0.1.34.dist-info}/RECORD +12 -12
- /auto_coder_web/web/static/js/{main.1ce477bc.js.LICENSE.txt → main.99a7408f.js.LICENSE.txt} +0 -0
- {auto_coder_web-0.1.32.dist-info → auto_coder_web-0.1.34.dist-info}/WHEEL +0 -0
- {auto_coder_web-0.1.32.dist-info → auto_coder_web-0.1.34.dist-info}/entry_points.txt +0 -0
- {auto_coder_web-0.1.32.dist-info → auto_coder_web-0.1.34.dist-info}/top_level.txt +0 -0
@@ -307,21 +307,7 @@ async def update_task_status(todo_id: str, task_index: int, new_status: str, eve
|
|
307
307
|
todos[todo_index].tasks[task_index].status = new_status
|
308
308
|
if event_file_id:
|
309
309
|
todos[todo_index].tasks[task_index].event_file_id = event_file_id
|
310
|
-
|
311
|
-
# 如果当前任务完成,且有下一个任务,则自动开始下一个任务
|
312
|
-
if new_status == "completed" and task_index + 1 < len(todos[todo_index].tasks):
|
313
|
-
next_task = todos[todo_index].tasks[task_index + 1]
|
314
|
-
if next_task.status == "pending":
|
315
|
-
# 任务完成后,启动下一个任务(通过API)
|
316
|
-
# 注意:这里不直接执行,而是记录一个标志,由前端轮询检测并触发
|
317
|
-
todos[todo_index].tasks[task_index].next_task_ready = True
|
318
|
-
|
319
|
-
# 检查所有任务状态,更新整体状态
|
320
|
-
all_completed = all(
|
321
|
-
task.status == "completed" for task in todos[todo_index].tasks)
|
322
|
-
if all_completed:
|
323
|
-
todos[todo_index].status = "done"
|
324
|
-
|
310
|
+
|
325
311
|
# 保存更新后的待办事项
|
326
312
|
await save_todos(todos)
|
327
313
|
|
@@ -481,20 +467,22 @@ async def execute_todo_tasks(todo_id: str, project_path: str = Depends(get_proje
|
|
481
467
|
|
482
468
|
# 定义执行单个任务的函数
|
483
469
|
async def execute_single_task(task_index: int):
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
470
|
+
# 获取最新的todos数据
|
471
|
+
current_todos = await load_todos()
|
472
|
+
current_todo_index = next((i for i, t in enumerate(current_todos) if t.id == todo_id), None)
|
473
|
+
|
474
|
+
if current_todo_index is None or task_index >= len(current_todos[current_todo_index].tasks):
|
475
|
+
raise Exception(f"Todo {todo_id} or task {task_index} not found")
|
476
|
+
|
477
|
+
task = current_todos[current_todo_index].tasks[task_index]
|
488
478
|
|
489
479
|
# 生成事件文件路径
|
490
480
|
event_file, file_id = gengerate_event_file_path()
|
491
481
|
|
492
|
-
#
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
# 保存更新后的待办事项
|
497
|
-
await save_todos(todos)
|
482
|
+
# 更新任务状态为执行中
|
483
|
+
current_todos[current_todo_index].tasks[task_index].status = "executing"
|
484
|
+
current_todos[current_todo_index].tasks[task_index].event_file_id = file_id
|
485
|
+
await save_todos(current_todos)
|
498
486
|
|
499
487
|
return task, event_file, file_id
|
500
488
|
|
@@ -515,23 +503,24 @@ async def execute_todo_tasks(todo_id: str, project_path: str = Depends(get_proje
|
|
515
503
|
command = generate_command_from_task(current_task, todo)
|
516
504
|
result = wrapper.coding_wapper(command)
|
517
505
|
|
506
|
+
# 更新任务状态为已完成 - 获取最新的todos数据
|
507
|
+
current_todos = asyncio.run(load_todos())
|
508
|
+
current_todo_index = next((idx for idx, t in enumerate(current_todos) if t.id == todo_id), None)
|
509
|
+
|
510
|
+
if current_todo_index is not None and i < len(current_todos[current_todo_index].tasks):
|
511
|
+
current_todos[current_todo_index].tasks[i].status = "completed"
|
512
|
+
current_todos[current_todo_index].tasks[i].event_file_id = file_id
|
513
|
+
asyncio.run(save_todos(current_todos))
|
514
|
+
|
515
|
+
logger.info(
|
516
|
+
f"Task {i+1}/{len(todo.tasks)} (ID: {file_id}) for todo {todo_id} completed successfully")
|
517
|
+
|
518
518
|
# 标记任务完成
|
519
519
|
get_event_manager(event_file).write_completion(
|
520
520
|
EventContentCreator.create_completion(
|
521
521
|
"200", "completed", result).to_dict()
|
522
522
|
)
|
523
|
-
|
524
|
-
# 更新任务状态
|
525
|
-
asyncio.run(update_task_status(
|
526
|
-
todo_id, i, "completed", file_id))
|
527
|
-
|
528
|
-
# 如果还有下一个任务,标记它准备好执行
|
529
|
-
if i < len(todo.tasks) - 1:
|
530
|
-
asyncio.run(mark_next_task_ready(todo_id, i))
|
531
|
-
|
532
|
-
logger.info(
|
533
|
-
f"Task {i+1}/{len(todo.tasks)} (ID: {file_id}) for todo {todo_id} completed successfully")
|
534
|
-
|
523
|
+
|
535
524
|
# 添加到结果列表
|
536
525
|
task_execution_results.append({
|
537
526
|
"task_index": i,
|
@@ -551,10 +540,15 @@ async def execute_todo_tasks(todo_id: str, project_path: str = Depends(get_proje
|
|
551
540
|
"500", "error", str(e)).to_dict()
|
552
541
|
)
|
553
542
|
|
554
|
-
# 更新任务状态为失败
|
543
|
+
# 更新任务状态为失败 - 获取最新的todos数据
|
555
544
|
if 'file_id' in locals():
|
556
|
-
asyncio.run(
|
557
|
-
|
545
|
+
current_todos = asyncio.run(load_todos())
|
546
|
+
current_todo_index = next((idx for idx, t in enumerate(current_todos) if t.id == todo_id), None)
|
547
|
+
|
548
|
+
if current_todo_index is not None and i < len(current_todos[current_todo_index].tasks):
|
549
|
+
current_todos[current_todo_index].tasks[i].status = "failed"
|
550
|
+
current_todos[current_todo_index].tasks[i].event_file_id = file_id
|
551
|
+
asyncio.run(save_todos(current_todos))
|
558
552
|
|
559
553
|
# 添加到结果列表
|
560
554
|
task_execution_results.append({
|
@@ -567,11 +561,15 @@ async def execute_todo_tasks(todo_id: str, project_path: str = Depends(get_proje
|
|
567
561
|
# 如果一个任务失败,停止执行后续任务
|
568
562
|
break
|
569
563
|
|
570
|
-
# 所有任务执行完成后,更新todo状态
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
564
|
+
# 所有任务执行完成后,更新todo状态 - 获取最新的todos数据
|
565
|
+
current_todos = asyncio.run(load_todos())
|
566
|
+
current_todo_index = next((idx for idx, t in enumerate(current_todos) if t.id == todo_id), None)
|
567
|
+
|
568
|
+
if current_todo_index is not None:
|
569
|
+
all_completed = all(result.get("status") == "completed" for result in task_execution_results)
|
570
|
+
final_status = "testing" if all_completed else "pending"
|
571
|
+
current_todos[current_todo_index].status = final_status
|
572
|
+
asyncio.run(save_todos(current_todos))
|
575
573
|
|
576
574
|
# 记录状态变更
|
577
575
|
logger.info(
|
auto_coder_web/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "0.1.
|
1
|
+
__version__ = "0.1.34"
|
@@ -1,15 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"files": {
|
3
3
|
"main.css": "/static/css/main.307a74c8.css",
|
4
|
-
"main.js": "/static/js/main.
|
4
|
+
"main.js": "/static/js/main.99a7408f.js",
|
5
5
|
"static/js/453.d855a71b.chunk.js": "/static/js/453.d855a71b.chunk.js",
|
6
6
|
"index.html": "/index.html",
|
7
7
|
"main.307a74c8.css.map": "/static/css/main.307a74c8.css.map",
|
8
|
-
"main.
|
8
|
+
"main.99a7408f.js.map": "/static/js/main.99a7408f.js.map",
|
9
9
|
"453.d855a71b.chunk.js.map": "/static/js/453.d855a71b.chunk.js.map"
|
10
10
|
},
|
11
11
|
"entrypoints": [
|
12
12
|
"static/css/main.307a74c8.css",
|
13
|
-
"static/js/main.
|
13
|
+
"static/js/main.99a7408f.js"
|
14
14
|
]
|
15
15
|
}
|
auto_coder_web/web/index.html
CHANGED
@@ -1 +1 @@
|
|
1
|
-
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.
|
1
|
+
<!doctype html><html lang="en"><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><link rel="apple-touch-icon" href="/logo192.png"/><link rel="manifest" href="/manifest.json"/><title>React App</title><script defer="defer" src="/static/js/main.99a7408f.js"></script><link href="/static/css/main.307a74c8.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
|