feat: 消费停录汇总与查结果同口径,并更新分类与 TSV
- 停录时由 details 经 build_consumption_summary 写 TSV/终端汇总,移除 consumption_log_totals 与时间窗累加 - 更新 consumable_classifier 权重、YAML 标签与 consumable_vision_algorithm - 扩展 consumption TSV 相关测试与配置注释 Made-with: Cursor
This commit is contained in:
@@ -22,8 +22,7 @@ from app.services.consumable_vision_algorithm import (
|
||||
_norm_product_name,
|
||||
)
|
||||
from app.services.consumption_tsv_log import (
|
||||
append_consumption_voice_resolution_line,
|
||||
resolve_consumption_ids,
|
||||
replace_pending_line_with_voice_resolution,
|
||||
resolve_consumption_item_id,
|
||||
)
|
||||
from app.services.voice_confirm import build_prompt_text
|
||||
@@ -74,8 +73,6 @@ class SurgerySessionState:
|
||||
last_asr_text: str | None = None
|
||||
#: 最近一次语音确认错误说明(ASR/解析失败等)。
|
||||
last_voice_error: str | None = None
|
||||
#: 视觉时间窗落盘用量累计,供停录时写汇总(item_id -> 首次名称, 次数)。
|
||||
consumption_log_totals: dict[str, tuple[str, int]] = field(default_factory=dict)
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -281,6 +278,7 @@ class SurgerySessionRegistry:
|
||||
self._finalize_voice_confirmed_consumption_log(
|
||||
state=st,
|
||||
surgery_id=surgery_id,
|
||||
confirmation_id=confirmation_id,
|
||||
chosen_label=label,
|
||||
)
|
||||
try:
|
||||
@@ -295,20 +293,16 @@ class SurgerySessionRegistry:
|
||||
*,
|
||||
state: SurgerySessionState,
|
||||
surgery_id: str,
|
||||
confirmation_id: str,
|
||||
chosen_label: str,
|
||||
) -> None:
|
||||
"""待确认流程在语音落锤后:汇总 +1 最终耗材,并追加 TSV 正式行。"""
|
||||
"""待确认流程在语音落锤后:将 TSV 中原 pending 行替换为最终真值。停录汇总与 HTTP 一致,由 details 经 ``build_consumption_summary`` 得到。"""
|
||||
cl = (chosen_label or "").strip()
|
||||
if not cl:
|
||||
return
|
||||
_, key_chosen = resolve_consumption_ids(cl, "", state.name_to_code)
|
||||
tot = state.consumption_log_totals
|
||||
if key_chosen not in tot:
|
||||
tot[key_chosen] = (cl, 0)
|
||||
nm, q = tot[key_chosen]
|
||||
tot[key_chosen] = (nm, q + 1)
|
||||
append_consumption_voice_resolution_line(
|
||||
replace_pending_line_with_voice_resolution(
|
||||
surgery_id=surgery_id,
|
||||
confirmation_id=confirmation_id,
|
||||
name_to_code=state.name_to_code,
|
||||
chosen_label=cl,
|
||||
doctor_id=self._s.video_voice_confirm_doctor_id,
|
||||
|
||||
Reference in New Issue
Block a user