feat: add baseline diagnosis signal store
This commit is contained in:
@@ -7,7 +7,10 @@ SkillStore / PromptStore 为同步(文件读取量小且快),RunLog 为异
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Protocol, runtime_checkable
|
||||
from typing import TYPE_CHECKING, Any, Protocol, runtime_checkable
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from core.evolution.types import DiagnosisSignalRow
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
@@ -104,3 +107,44 @@ class RunLog(Protocol):
|
||||
轨迹记录字典列表。
|
||||
"""
|
||||
...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class DiagnosisSignalStore(Protocol):
|
||||
"""逐题诊断信号存储端口。
|
||||
|
||||
隔离 SQLite 实现细节,app/core 不写裸 SQL。逐题 upsert 落盘、
|
||||
支持断点续跑(done_question_ids 查已完成集合)。
|
||||
"""
|
||||
|
||||
def upsert(self, row: DiagnosisSignalRow) -> None:
|
||||
"""写入或覆盖单题诊断信号(按主键幂等)。
|
||||
|
||||
参数:
|
||||
row: 待持久化的诊断信号行。
|
||||
"""
|
||||
...
|
||||
|
||||
def done_question_ids(self, baseline_run_id: str, diag_fingerprint: str) -> set[str]:
|
||||
"""查询指定 run 与诊断指纹下已完成的 question_id 集合。
|
||||
|
||||
参数:
|
||||
baseline_run_id: baseline run 标识。
|
||||
diag_fingerprint: 诊断口径指纹。
|
||||
|
||||
返回:
|
||||
已落盘信号的 question_id 集合,用于断点续跑跳过。
|
||||
"""
|
||||
...
|
||||
|
||||
def load(self, baseline_run_id: str, diag_fingerprint: str) -> list[DiagnosisSignalRow]:
|
||||
"""加载指定 run 与诊断指纹下的全部诊断信号行。
|
||||
|
||||
参数:
|
||||
baseline_run_id: baseline run 标识。
|
||||
diag_fingerprint: 诊断口径指纹。
|
||||
|
||||
返回:
|
||||
还原后的 DiagnosisSignalRow 列表。
|
||||
"""
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user