refactor: 统一耗材视觉算法并扩展语音确认至全量候选清单
- 以 ConsumableVisionAlgorithmService 替代 consumable_classifier 与 tear_action; 可选手部检测权重,未配置时全帧分类;时间窗众数与 Excel 白名单配置。 - 语音待确认:ASR 先匹配 pending topk,再匹配本台 candidate_consumables; 记账 item_id 与 vision 一致使用 name_to_code。 - 更新 config、Compose、.env.example、依赖(pandas/openpyxl)与测试。 Made-with: Cursor
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
from app.services.voice_confirm import build_prompt_text, parse_voice_choice
|
||||
from app.services.voice_confirm import (
|
||||
build_prompt_text,
|
||||
match_voice_choice_against_candidates,
|
||||
parse_voice_choice,
|
||||
)
|
||||
|
||||
|
||||
def test_parse_voice_choice_substring() -> None:
|
||||
@@ -17,3 +21,23 @@ def test_build_prompt_contains_options() -> None:
|
||||
text = build_prompt_text([("纱布", 0.4), ("缝线", 0.3)])
|
||||
assert "纱布" in text
|
||||
assert "缝线" in text
|
||||
|
||||
|
||||
def test_match_voice_against_full_candidate_list() -> None:
|
||||
assert (
|
||||
match_voice_choice_against_candidates(
|
||||
"刚才用的是止血钳",
|
||||
["纱布", "缝线", "止血钳"],
|
||||
)
|
||||
== "止血钳"
|
||||
)
|
||||
|
||||
|
||||
def test_match_voice_longest_candidate_first() -> None:
|
||||
assert (
|
||||
match_voice_choice_against_candidates(
|
||||
"拿的一次性止血钳",
|
||||
["止血钳", "一次性止血钳"],
|
||||
)
|
||||
== "一次性止血钳"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user