refactor
This commit is contained in:
@@ -24,7 +24,7 @@ from fsutil import atomic_write_json
|
||||
from jsonio import read_json_file as _json_file
|
||||
from kanban import Flow, Stage
|
||||
from pipeline import FAILED, GenContext, _extra, _log, _prompt, _timeout, run_single_slot
|
||||
from textkit import _norm_title, _title
|
||||
from textkit import _norm_title, _title, parse_facts
|
||||
|
||||
log = logging.getLogger("creator.board_artefacts")
|
||||
|
||||
@@ -107,6 +107,8 @@ async def _gather_cards(ctx: GenContext, flow: Flow, cards, one):
|
||||
results = await asyncio.gather(*[one(c) for c in cards], return_exceptions=True)
|
||||
errs = [r for r in results if isinstance(r, Exception)]
|
||||
if errs:
|
||||
for e in errs[1:]: # nur errs[0] wird re-raised — der Rest darf nicht stumm verschwinden
|
||||
log.error("weitere Karten-Exception im Batch: %r", e)
|
||||
raise errs[0]
|
||||
flow.wake.set()
|
||||
|
||||
@@ -316,10 +318,7 @@ async def _proc_konsolidierung(ctx: GenContext, flow: Flow, files: dict, instruc
|
||||
return
|
||||
|
||||
def _kp(r: dict) -> list:
|
||||
try:
|
||||
return (json.loads(r.get("facts") or "{}")).get("key_points") or []
|
||||
except ValueError:
|
||||
return []
|
||||
return parse_facts(r.get("facts")).get("key_points") or []
|
||||
|
||||
def _side(tag: str, r: dict) -> str:
|
||||
return f"{tag}: [Block: {r['block']}] {r['sub_title']}" + "".join(f"\n - {p}" for p in _kp(r))
|
||||
|
||||
Reference in New Issue
Block a user