feat: desk ia
This commit is contained in:
@@ -806,6 +806,7 @@ def init_db():
|
||||
("sub_type", "TEXT DEFAULT NULL"),
|
||||
("origin", "TEXT DEFAULT NULL"),
|
||||
("source_refs", "TEXT DEFAULT '[]'"),
|
||||
("template_id", "INTEGER DEFAULT NULL"),
|
||||
]:
|
||||
try:
|
||||
c.execute(f"ALTER TABLE market_events ADD COLUMN {_col} {_def}")
|
||||
|
||||
@@ -1654,4 +1654,21 @@ def check_new_market_events(
|
||||
results["total_created"] = sum(len(results[s]) for s in ALL_SOURCES)
|
||||
counts = " ".join(f"{s}={len(results[s])}" for s in ALL_SOURCES)
|
||||
logger.info(f"[check_events] Done — {results['total_created']} new events: {counts}")
|
||||
|
||||
# Auto-assign or auto-create causal templates for eco events
|
||||
if "eco" in sources and bool(eco_cfg.get("auto_template", False)):
|
||||
eco_events = results.get("eco", [])
|
||||
if eco_events:
|
||||
try:
|
||||
from routers.causal_lab import auto_assign_template
|
||||
for ev in eco_events:
|
||||
eid = ev.get("event_id")
|
||||
if eid:
|
||||
res = auto_assign_template(eid)
|
||||
action = res.get("action", "error")
|
||||
name = res.get("name", "")
|
||||
logger.info(f"[check_events/auto_template] event #{eid} → {action}: '{name}'")
|
||||
except Exception as e:
|
||||
logger.warning(f"[check_events/auto_template] failed: {e}")
|
||||
|
||||
return results
|
||||
|
||||
Reference in New Issue
Block a user