This commit is contained in:
team3
2026-06-22 13:44:33 +02:00
parent 0adc223c0a
commit 613a4a2b1f
4 changed files with 51 additions and 30 deletions

View File

@@ -27,7 +27,7 @@ from jsonio import read_json_file as _json_datei
from paths import bausteine_path, guide_content_path, project_dir, subbausteine_path
from pipeline import (
CANCELLED, FAILED, GenContext, _claude_error, _extra,
_fail, _gather_error, _log, _prompt, _race, _rest_schema, _runde_schema,
_fail, _gather_error, _gather_fortschritt, _log, _prompt, _race, _rest_schema, _runde_schema,
_semaphore, _set_progress, _set_step, _timeout, clear_guide_cancelled,
is_guide_cancelled, run_single_slot,
)
@@ -575,8 +575,8 @@ async def _generate_sections(
inhalt_paths = [content_path.parent / f"{content_path.stem}.inhalt-chunk-{i}.md" for i in range(1, writer_count + 1)]
offen = [i for i, p in enumerate(inhalt_paths) if not p.exists()]
if offen:
await _set_step(guide_id, 2, f"Sammle Inhalte ({writer_count} Agenten)…" if writer_count > 1 else "Sammle Inhalte")
results = await asyncio.gather(*[
async def melde(d, t): await _set_step(guide_id, 2, f"Sammle Inhalte {d}/{t}")
results = await _gather_fortschritt([
run_agent(
f"{guide_id}-inhalt-{i + 1}",
_prompt(
@@ -587,7 +587,7 @@ async def _generate_sections(
_timeout("inhalt", chunk_sizes[i]), provider=provider, role="guide", capabilities="full",
)
for i in offen
], return_exceptions=True)
], writer_count, melde, start=writer_count - len(offen))
if is_cancelled():
return None
if not any(p.exists() for p in inhalt_paths):
@@ -624,7 +624,9 @@ async def _generate_sections(
"role": "judge", "capabilities": "files",
"payload": (lambda result, p=check_paths[i]: _lese_probleme_schema(_json_datei(p))),
} for i in offen_checks]
await _race(topic, "Inhalts-Prüfung", slots, len(slots), _timeout("inhalt_check", max(chunk_sizes)), provider, cancelled=is_cancelled)
n_checks = len(slots)
upd = lambda n: asyncio.create_task(_set_step(guide_id, 3, f"Prüfe Inhalte {n}/{n_checks}"))
await _race(topic, "Inhalts-Prüfung", slots, len(slots), _timeout("inhalt_check", max(chunk_sizes)), provider, on_update=upd, cancelled=is_cancelled)
if is_cancelled():
return None
@@ -676,8 +678,8 @@ async def _generate_sections(
paths = [content_path.parent / f"{content_path.stem}.chunk-{i}.md" for i in range(1, writer_count + 1)]
offen = [i for i, p in enumerate(paths) if not p.exists()]
if offen:
await _set_step(guide_id, 4, f"Schreibe Sections ({writer_count} Writer)…" if writer_count > 1 else "Schreibe Sections")
results = await asyncio.gather(*[
async def melde(d, t): await _set_step(guide_id, 4, f"Schreibe Sections {d}/{t}")
results = await _gather_fortschritt([
run_agent(
f"{guide_id}-w{i + 1}",
_prompt(
@@ -689,7 +691,7 @@ async def _generate_sections(
_timeout("writer", chunk_sizes[i]), provider=provider, role="guide", capabilities="full",
)
for i in offen
], return_exceptions=True)
], writer_count, melde, start=writer_count - len(offen))
if is_cancelled():
return None
for i, r in zip(offen, results):
@@ -748,7 +750,9 @@ async def _generate_sections(
"role": "judge", "capabilities": "files",
"payload": (lambda result, p=check_paths[i]: _lese_probleme_schema(_json_datei(p))),
} for i in offen_checks]
res = await _race(topic, f"Lese-Prüfung r{runde}", slots, len(slots), _timeout("lese_check", max(chunk_sizes)), provider, cancelled=is_cancelled)
n_checks = len(slots)
upd = lambda n: asyncio.create_task(_set_step(guide_id, 5, f"Prüfe Lesbarkeit {n}/{n_checks}"))
res = await _race(topic, f"Lese-Prüfung r{runde}", slots, len(slots), _timeout("lese_check", max(chunk_sizes)), provider, on_update=upd, cancelled=is_cancelled)
if is_cancelled():
return None
if res is None: