refactor(eval+memoir):精简内部评测路由与服务,composite/对话摘要与 judge 能力补强
- 访谈:新增 interview_state_hints,联动 orchestrator 与提示词 - 回忆录:story_pipeline_sync/state/memory/post_commit 与 Celery 任务调整 - 基建:开发用 celery broker、compose/development 脚本、依赖注入 - eval-web:移除数据集/实验/版本等页面与流式轮询,突出 Playground - 文档与单测同步
This commit is contained in:
@@ -43,6 +43,7 @@ class PostCommitResult:
|
||||
enqueued_story_image_count: int = 0
|
||||
enqueued_chapter_recompose_count: int = 0
|
||||
compaction_scheduled: bool = False
|
||||
quality_pass_scheduled: bool = False
|
||||
errors: list[str] = field(default_factory=list)
|
||||
|
||||
|
||||
@@ -55,10 +56,13 @@ def enqueue_story_post_commit_effects(
|
||||
need_image: bool = True,
|
||||
need_recompose: bool = True,
|
||||
need_compaction: bool = False,
|
||||
need_quality_pass: bool = False,
|
||||
compaction_extra: dict[str, Any] | None = None,
|
||||
memoir_correlation_id: str | None = None,
|
||||
) -> PostCommitResult:
|
||||
"""
|
||||
story_ids 为空则跳过 image;chapter_ids 为空则跳过 recompose。
|
||||
Unified post-commit fan-out: story images, chapter recompose, compaction,
|
||||
and quality pass. story_ids 为空则跳过 image;chapter_ids 为空则跳过 recompose。
|
||||
need_compaction=True 时仅按 user_id 调度 compaction(不依赖 story/chapter 集合)。
|
||||
"""
|
||||
result = PostCommitResult()
|
||||
@@ -145,4 +149,26 @@ def enqueue_story_post_commit_effects(
|
||||
)
|
||||
result.errors.append(f"compaction:{exc}")
|
||||
|
||||
if need_quality_pass and settings.memoir_quality_pass_enabled and story_ids:
|
||||
try:
|
||||
from app.tasks.memoir_quality_pass_tasks import (
|
||||
memoir_quality_pass as quality_pass_task,
|
||||
)
|
||||
|
||||
cd = int(settings.memoir_quality_pass_delay_seconds)
|
||||
cast(Any, quality_pass_task).apply_async(
|
||||
args=[user_id, sorted(story_ids), sorted(chapter_ids)],
|
||||
kwargs={"memoir_correlation_id": memoir_correlation_id},
|
||||
countdown=max(0, cd),
|
||||
)
|
||||
result.quality_pass_scheduled = True
|
||||
except Exception as exc:
|
||||
logger.warning(
|
||||
"memoir_quality_pass enqueue failed user_id={} trigger={}: {}",
|
||||
user_id,
|
||||
trigger_source,
|
||||
exc,
|
||||
)
|
||||
result.errors.append(f"quality_pass:{exc}")
|
||||
|
||||
return result
|
||||
|
||||
Reference in New Issue
Block a user