feat: 语音确认、联调与运维增强
- 语音:序数解析(第一个/第二个等)、解析失败计数与 API detail.retry_remaining; 百度 ASR 固定 dev_pid 为普通话;SurgeryPipelineError 支持 extra 并入 HTTP detail。 - Demo:demo 路由与假 RTSP、客户端 index 与 README;BackendResolver 与配置调整。 - 可观测:消耗 TSV 日志、语音文件日志、终端 Markdown 辅助;相关测试与依赖更新。 - 注意:.env 仍被 gitignore,本地密钥不会进入本提交。 Made-with: Cursor
This commit is contained in:
@@ -141,6 +141,48 @@ class SurgeryVoiceStatusResponse(BaseModel):
|
||||
)
|
||||
|
||||
|
||||
class SurgeryVoiceAuditItem(BaseModel):
|
||||
"""单条 `voice_confirmation_audits` 行(追溯对账用)。"""
|
||||
|
||||
id: int
|
||||
confirmation_id: str
|
||||
status: str = Field(
|
||||
description=(
|
||||
"recognized / rejected / parse_failed / asr_failed / invalid_audio / "
|
||||
"upload_failed / client_stt_empty / client_stt_parse_failed 等"
|
||||
),
|
||||
)
|
||||
audio_object_key: str | None = None
|
||||
audio_content_type: str | None = None
|
||||
audio_size_bytes: int | None = None
|
||||
audio_sha256: str | None = None
|
||||
asr_text: str | None = None
|
||||
resolved_label: str | None = None
|
||||
options_snapshot_json: str | None = Field(
|
||||
default=None,
|
||||
description="当次候选项与置信度 JSON 快照。",
|
||||
)
|
||||
error_message: str | None = None
|
||||
created_at: datetime = Field(
|
||||
description="记录写入时间(UTC)。",
|
||||
)
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
|
||||
class SurgeryVoiceAuditsListResponse(BaseModel):
|
||||
"""按手术号分页的语音确认审计列表。"""
|
||||
|
||||
surgery_id: str
|
||||
total: int = Field(ge=0, description="该手术在表中的总条数(不受本页 limit 截断)。")
|
||||
limit: int = Field(ge=1, le=200)
|
||||
offset: int = Field(ge=0)
|
||||
items: list[SurgeryVoiceAuditItem] = Field(
|
||||
default_factory=list,
|
||||
description="按 `created_at` 降序。",
|
||||
)
|
||||
|
||||
|
||||
class PendingConfirmationOption(BaseModel):
|
||||
label: str
|
||||
confidence: float
|
||||
@@ -158,6 +200,16 @@ class SurgeryPendingConfirmationResponse(BaseModel):
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class SurgeryPendingResolveTextRequest(BaseModel):
|
||||
"""由浏览器 Web Speech 等客户端本地识别后提交的文本,语义与经百度 ASR 得到的文本相同。"""
|
||||
|
||||
recognized_text: str = Field(
|
||||
min_length=1,
|
||||
max_length=2000,
|
||||
description="识别文本;服务端用与语音接口相同的规则解析候选项。",
|
||||
)
|
||||
|
||||
|
||||
class SurgeryPendingConfirmationResolveResponse(BaseModel):
|
||||
surgery_id: str
|
||||
confirmation_id: str
|
||||
|
||||
Reference in New Issue
Block a user