2026-04-08 21:36:12 +08:00
|
|
|
"""
|
2026-04-30 16:22:55 +08:00
|
|
|
Memory pipeline Celery tasks — retry embedding and enrichment after durable ingest.
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
|
|
|
|
|
Tasks are routed to ``settings.celery_memory_enrichment_queue`` (default ``memory_idle``);
|
|
|
|
|
run workers with ``-Q celery,memory_idle`` or a dedicated low-priority worker for that queue.
|
2026-04-08 21:36:12 +08:00
|
|
|
"""
|
|
|
|
|
|
2026-04-30 14:11:46 +08:00
|
|
|
import asyncio
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
import time
|
2026-04-30 16:22:55 +08:00
|
|
|
from typing import Any, cast
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
|
2026-04-08 21:36:12 +08:00
|
|
|
from celery import shared_task
|
|
|
|
|
|
feat: OpenTelemetry LGTM observability, dev tooling, and memoir UX fixes (#31) (#32)
* add staging ios app build script
* feat(api): add OpenTelemetry LGTM stack for local observability
Wire OTel traces, metrics, and logs through a collector to Tempo,
Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay,
Grafana provisioning, env templates, and development.sh auto-start.
* feat: expand observability, harden dev tooling, and fix expo staging UX
Add business and LLM Prometheus metrics with Grafana dashboards, alerting,
and a metrics verification script. Wire telemetry through adapters and core
LLM paths, and document the local LGTM workflow.
Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome,
and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge
internal-eval into the main dev script with improved compose handling.
Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs,
show memoir empty state instead of load errors when no chapters exist, and
add jest env setup plus chapter list response normalization.
* chore: enable Grafana Assistant Cursor plugin
* fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp
Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019.
---------
Co-authored-by: Kevin <kevin@brighteng.org>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 15:14:13 +08:00
|
|
|
from app.core.business_telemetry import business_span
|
2026-04-08 21:36:12 +08:00
|
|
|
from app.core.config import settings
|
2026-04-30 14:11:46 +08:00
|
|
|
from app.core.db import AsyncSessionLocal
|
2026-04-30 16:22:55 +08:00
|
|
|
from app.core.dependencies import get_embedding_provider
|
2026-04-08 21:36:12 +08:00
|
|
|
from app.core.logging import get_logger
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
from app.core.memoir_pipeline_progress import merge_fanout_item
|
2026-04-30 14:11:46 +08:00
|
|
|
from app.features.memory.service import MemoryService
|
2026-04-08 21:36:12 +08:00
|
|
|
|
|
|
|
|
logger = get_logger(__name__)
|
|
|
|
|
|
|
|
|
|
|
2026-04-30 14:11:46 +08:00
|
|
|
async def _enrich_memory_source_async(
|
|
|
|
|
user_id: str,
|
|
|
|
|
source_id: str,
|
|
|
|
|
) -> None:
|
|
|
|
|
async with AsyncSessionLocal() as db:
|
|
|
|
|
service = MemoryService(db)
|
|
|
|
|
await service.enrich_source(user_id, source_id, llm=None)
|
|
|
|
|
await db.commit()
|
|
|
|
|
|
|
|
|
|
|
2026-04-30 16:22:55 +08:00
|
|
|
async def _embed_memory_source_async(
|
|
|
|
|
user_id: str,
|
|
|
|
|
source_id: str,
|
|
|
|
|
) -> dict:
|
|
|
|
|
async with AsyncSessionLocal() as db:
|
|
|
|
|
service = MemoryService(db, embedding_provider=get_embedding_provider())
|
|
|
|
|
result = await service.embed_source(
|
|
|
|
|
user_id,
|
|
|
|
|
source_id,
|
|
|
|
|
raise_on_failure=True,
|
|
|
|
|
)
|
|
|
|
|
await db.commit()
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def schedule_memory_embedding(
|
|
|
|
|
user_id: str,
|
|
|
|
|
source_id: str,
|
|
|
|
|
*,
|
|
|
|
|
memoir_correlation_id: str | None = None,
|
|
|
|
|
) -> str | None:
|
|
|
|
|
"""Enqueue embedding retry for a persisted memory source."""
|
|
|
|
|
uid = (user_id or "").strip()
|
|
|
|
|
sid = (source_id or "").strip()
|
|
|
|
|
if not uid or not sid:
|
|
|
|
|
return None
|
|
|
|
|
q = (settings.celery_memory_enrichment_queue or "").strip() or "memory_idle"
|
|
|
|
|
try:
|
|
|
|
|
task = cast(Any, embed_memory_source)
|
|
|
|
|
ar = task.apply_async(
|
|
|
|
|
args=[uid, sid],
|
|
|
|
|
kwargs={"memoir_correlation_id": memoir_correlation_id},
|
|
|
|
|
queue=q,
|
|
|
|
|
)
|
|
|
|
|
emb_id = getattr(ar, "id", None)
|
|
|
|
|
if not emb_id:
|
|
|
|
|
return None
|
|
|
|
|
cid = (memoir_correlation_id or "").strip()
|
|
|
|
|
if cid:
|
|
|
|
|
merge_fanout_item(
|
|
|
|
|
cid,
|
|
|
|
|
list_name="memory_embedding",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=sid,
|
|
|
|
|
task_id=str(emb_id),
|
|
|
|
|
status="enqueued",
|
|
|
|
|
)
|
|
|
|
|
return str(emb_id)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
logger.warning(
|
|
|
|
|
"event=memory_embedding_schedule_failed user_id={} source_id={} exc={} exc_type={}",
|
|
|
|
|
uid,
|
|
|
|
|
sid,
|
|
|
|
|
e,
|
|
|
|
|
type(e).__name__,
|
|
|
|
|
)
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
def schedule_memory_enrichment(
|
|
|
|
|
user_id: str,
|
|
|
|
|
source_id: str,
|
|
|
|
|
*,
|
|
|
|
|
memoir_correlation_id: str | None = None,
|
|
|
|
|
) -> str | None:
|
|
|
|
|
"""
|
|
|
|
|
Enqueue post-ingest LLM enrichment on the memory idle queue.
|
|
|
|
|
|
|
|
|
|
When ``memoir_correlation_id`` is set, records ``fanout.memory_enrichment`` as enqueued
|
|
|
|
|
for eval / pipeline progress (same as the former Phase1 loop).
|
|
|
|
|
"""
|
|
|
|
|
if not settings.memory_enrichment_enabled:
|
|
|
|
|
return None
|
|
|
|
|
uid = (user_id or "").strip()
|
|
|
|
|
sid = (source_id or "").strip()
|
|
|
|
|
if not uid or not sid:
|
|
|
|
|
return None
|
|
|
|
|
q = (settings.celery_memory_enrichment_queue or "").strip() or "memory_idle"
|
|
|
|
|
try:
|
2026-04-30 16:22:55 +08:00
|
|
|
task = cast(Any, enrich_memory_source)
|
|
|
|
|
ar = task.apply_async(
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
args=[uid, sid],
|
|
|
|
|
kwargs={"memoir_correlation_id": memoir_correlation_id},
|
|
|
|
|
queue=q,
|
|
|
|
|
)
|
|
|
|
|
enr_id = getattr(ar, "id", None)
|
|
|
|
|
if not enr_id:
|
|
|
|
|
return None
|
|
|
|
|
cid = (memoir_correlation_id or "").strip()
|
|
|
|
|
if cid:
|
|
|
|
|
merge_fanout_item(
|
|
|
|
|
cid,
|
|
|
|
|
list_name="memory_enrichment",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=sid,
|
|
|
|
|
task_id=str(enr_id),
|
|
|
|
|
status="enqueued",
|
|
|
|
|
)
|
|
|
|
|
return str(enr_id)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
logger.warning(
|
|
|
|
|
"event=memory_enrichment_schedule_failed user_id={} source_id={} exc={} exc_type={}",
|
|
|
|
|
uid,
|
|
|
|
|
sid,
|
|
|
|
|
e,
|
|
|
|
|
type(e).__name__,
|
|
|
|
|
)
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
2026-04-30 16:22:55 +08:00
|
|
|
@shared_task(bind=True, max_retries=3, default_retry_delay=30)
|
|
|
|
|
def embed_memory_source(
|
|
|
|
|
self,
|
|
|
|
|
user_id: str,
|
|
|
|
|
source_id: str,
|
|
|
|
|
memoir_correlation_id: str | None = None,
|
|
|
|
|
):
|
|
|
|
|
"""Post-ingest embedding retry for persisted chunks."""
|
|
|
|
|
tid = str(self.request.id)
|
|
|
|
|
t0 = time.perf_counter()
|
|
|
|
|
logger.info(
|
|
|
|
|
"event=memory_embedding_start user_id={} source_id={} task_id={} msg=开始记忆向量化",
|
|
|
|
|
user_id,
|
|
|
|
|
source_id,
|
|
|
|
|
tid,
|
|
|
|
|
)
|
|
|
|
|
merge_fanout_item(
|
|
|
|
|
memoir_correlation_id,
|
|
|
|
|
list_name="memory_embedding",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=source_id,
|
|
|
|
|
task_id=tid,
|
|
|
|
|
status="running",
|
|
|
|
|
)
|
|
|
|
|
try:
|
feat: OpenTelemetry LGTM observability, dev tooling, and memoir UX fixes (#31) (#32)
* add staging ios app build script
* feat(api): add OpenTelemetry LGTM stack for local observability
Wire OTel traces, metrics, and logs through a collector to Tempo,
Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay,
Grafana provisioning, env templates, and development.sh auto-start.
* feat: expand observability, harden dev tooling, and fix expo staging UX
Add business and LLM Prometheus metrics with Grafana dashboards, alerting,
and a metrics verification script. Wire telemetry through adapters and core
LLM paths, and document the local LGTM workflow.
Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome,
and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge
internal-eval into the main dev script with improved compose handling.
Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs,
show memoir empty state instead of load errors when no chapters exist, and
add jest env setup plus chapter list response normalization.
* chore: enable Grafana Assistant Cursor plugin
* fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp
Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019.
---------
Co-authored-by: Kevin <kevin@brighteng.org>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 15:14:13 +08:00
|
|
|
with business_span("memory.embed_source"):
|
|
|
|
|
result = asyncio.run(_embed_memory_source_async(user_id, source_id))
|
2026-04-30 16:22:55 +08:00
|
|
|
ms = (time.perf_counter() - t0) * 1000
|
|
|
|
|
logger.info(
|
|
|
|
|
"event=memory_embedding_done user_id={} source_id={} duration_ms={:.1f} status={} vectors_written={} msg=记忆向量化完成",
|
|
|
|
|
user_id,
|
|
|
|
|
source_id,
|
|
|
|
|
ms,
|
|
|
|
|
result.get("status"),
|
|
|
|
|
result.get("vectors_written", 0),
|
|
|
|
|
)
|
|
|
|
|
merge_fanout_item(
|
|
|
|
|
memoir_correlation_id,
|
|
|
|
|
list_name="memory_embedding",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=source_id,
|
|
|
|
|
task_id=tid,
|
|
|
|
|
status="success",
|
|
|
|
|
extra=result,
|
|
|
|
|
)
|
|
|
|
|
return {"source_id": source_id, **result}
|
|
|
|
|
except Exception as e:
|
|
|
|
|
ms = (time.perf_counter() - t0) * 1000
|
|
|
|
|
logger.warning(
|
|
|
|
|
"event=memory_embedding_failed user_id={} source_id={} duration_ms={:.1f} "
|
|
|
|
|
"exc={} exc_type={} msg=记忆向量化失败",
|
|
|
|
|
user_id,
|
|
|
|
|
source_id,
|
|
|
|
|
ms,
|
|
|
|
|
e,
|
|
|
|
|
type(e).__name__,
|
|
|
|
|
)
|
|
|
|
|
merge_fanout_item(
|
|
|
|
|
memoir_correlation_id,
|
|
|
|
|
list_name="memory_embedding",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=source_id,
|
|
|
|
|
task_id=tid,
|
|
|
|
|
status="failure",
|
|
|
|
|
extra={"error": str(e)},
|
|
|
|
|
)
|
|
|
|
|
raise self.retry(exc=e) from e
|
|
|
|
|
|
|
|
|
|
|
2026-04-08 21:36:12 +08:00
|
|
|
@shared_task(bind=True, max_retries=2, default_retry_delay=30)
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
def enrich_memory_source(
|
|
|
|
|
self,
|
|
|
|
|
user_id: str,
|
|
|
|
|
source_id: str,
|
|
|
|
|
memoir_correlation_id: str | None = None,
|
|
|
|
|
):
|
2026-04-08 21:36:12 +08:00
|
|
|
"""
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
Post-ingest enrichment: one LLM call → session summary + structured facts.
|
2026-04-08 21:36:12 +08:00
|
|
|
Runs outside the memoir Phase1 hot path so narrative generation isn't blocked.
|
|
|
|
|
"""
|
|
|
|
|
if not settings.memory_enrichment_enabled:
|
|
|
|
|
return {"status": "disabled"}
|
|
|
|
|
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
tid = str(self.request.id)
|
|
|
|
|
t0 = time.perf_counter()
|
|
|
|
|
logger.info(
|
|
|
|
|
"event=memory_enrichment_start user_id={} source_id={} task_id={} "
|
|
|
|
|
"msg=开始记忆富化(会话摘要+事实)",
|
|
|
|
|
user_id,
|
|
|
|
|
source_id,
|
|
|
|
|
tid,
|
|
|
|
|
)
|
|
|
|
|
merge_fanout_item(
|
|
|
|
|
memoir_correlation_id,
|
|
|
|
|
list_name="memory_enrichment",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=source_id,
|
|
|
|
|
task_id=tid,
|
|
|
|
|
status="running",
|
|
|
|
|
)
|
2026-04-08 21:36:12 +08:00
|
|
|
try:
|
feat: OpenTelemetry LGTM observability, dev tooling, and memoir UX fixes (#31) (#32)
* add staging ios app build script
* feat(api): add OpenTelemetry LGTM stack for local observability
Wire OTel traces, metrics, and logs through a collector to Tempo,
Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay,
Grafana provisioning, env templates, and development.sh auto-start.
* feat: expand observability, harden dev tooling, and fix expo staging UX
Add business and LLM Prometheus metrics with Grafana dashboards, alerting,
and a metrics verification script. Wire telemetry through adapters and core
LLM paths, and document the local LGTM workflow.
Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome,
and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge
internal-eval into the main dev script with improved compose handling.
Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs,
show memoir empty state instead of load errors when no chapters exist, and
add jest env setup plus chapter list response normalization.
* chore: enable Grafana Assistant Cursor plugin
* fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp
Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019.
---------
Co-authored-by: Kevin <kevin@brighteng.org>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 15:14:13 +08:00
|
|
|
with business_span("memory.enrich_source"):
|
|
|
|
|
asyncio.run(_enrich_memory_source_async(user_id, source_id))
|
2026-04-30 14:11:46 +08:00
|
|
|
ms = (time.perf_counter() - t0) * 1000
|
|
|
|
|
logger.info(
|
|
|
|
|
"event=memory_enrichment_done user_id={} source_id={} duration_ms={:.1f} "
|
|
|
|
|
"msg=记忆富化完成",
|
|
|
|
|
user_id,
|
|
|
|
|
source_id,
|
|
|
|
|
ms,
|
|
|
|
|
)
|
|
|
|
|
merge_fanout_item(
|
|
|
|
|
memoir_correlation_id,
|
|
|
|
|
list_name="memory_enrichment",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=source_id,
|
|
|
|
|
task_id=tid,
|
|
|
|
|
status="success",
|
|
|
|
|
)
|
|
|
|
|
return {"status": "success", "source_id": source_id}
|
2026-04-08 21:36:12 +08:00
|
|
|
except Exception as e:
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
ms = (time.perf_counter() - t0) * 1000
|
2026-04-08 21:36:12 +08:00
|
|
|
logger.warning(
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
"event=memory_enrichment_failed user_id={} source_id={} duration_ms={:.1f} "
|
|
|
|
|
"exc={} exc_type={} msg=记忆富化失败",
|
2026-04-08 21:36:12 +08:00
|
|
|
user_id,
|
|
|
|
|
source_id,
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
ms,
|
2026-04-08 21:36:12 +08:00
|
|
|
e,
|
|
|
|
|
type(e).__name__,
|
|
|
|
|
)
|
feat(eval): memoir A/B chapter judging and eval-web parity with dialogue
- Judge baseline excerpt and library chapter separately; build_memoir_compare_summary for gate, nine-dim and leaf deltas.
- Memoir SSE chapter payload: baseline_judge, compare_summary, baseline_judge_error.
- MemoirJudgeOutput: loose score coercion and post-validate clamp; memoir judge prompt caps from settings.
- app-eval-web: two-column MemoirScoreCard layout, MemoirCompareSummary, chapter blocks and CSS.
- Add memoir_compare_summary, log_events, celery_log_context, memoir_pipeline_progress; tests and migration 0014.
- Misc: memory/evidence and enrichment paths, task/orchestrator updates, internal-eval docs, env examples.
2026-04-10 10:23:43 +08:00
|
|
|
merge_fanout_item(
|
|
|
|
|
memoir_correlation_id,
|
|
|
|
|
list_name="memory_enrichment",
|
|
|
|
|
id_field="source_id",
|
|
|
|
|
item_id=source_id,
|
|
|
|
|
task_id=tid,
|
|
|
|
|
status="failure",
|
|
|
|
|
extra={"error": str(e)},
|
|
|
|
|
)
|
2026-04-08 21:36:12 +08:00
|
|
|
raise self.retry(exc=e) from e
|