fix: pass through paragraph=true empty-text terminator in subv handler
All checks were successful
Build and Deploy LTY / build-and-deploy (push) Successful in 9m27s
All checks were successful
Build and Deploy LTY / build-and-deploy (push) Successful in 9m27s
火山 SubtitleMode=1 下,paragraph=true 的事件 text 字段是空字符串, 作为段落终止的独立信号;之前 strategy B 的 `if not text.strip(): continue` 直接吞掉了这个信号,导致 buffer 永远 flush 不出来、AI 字幕全部丢失。 只在文本空且非 paragraph 终止时跳过;终止信号本身不进 buffer,但触发 已累积分片的拼接落库。Mode=0 行为不变(其 paragraph=true 事件 text 非空)。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
c85f6f2f9e
commit
0330124b19
@ -1347,13 +1347,16 @@ class VolcEngineTokenViewSet(viewsets.ViewSet):
|
||||
# 中间识别结果不入库
|
||||
if not item.get('definite'):
|
||||
continue
|
||||
if not text.strip():
|
||||
continue
|
||||
|
||||
user_id_in_subtitle = item.get('userId') or ''
|
||||
sequence = item.get('sequence', 0)
|
||||
is_paragraph_end = bool(item.get('paragraph'))
|
||||
|
||||
# Mode=1 下 paragraph=True 是独立的空文本终止信号,必须放过去触发 flush
|
||||
# 仅当文本空 + 又不是终止信号时才跳过
|
||||
if not text.strip() and not is_paragraph_end:
|
||||
continue
|
||||
|
||||
# 解析 ParadiseUser 归属
|
||||
paradise_user_id = None
|
||||
if user_id_in_subtitle == 'bot01':
|
||||
@ -1383,9 +1386,10 @@ class VolcEngineTokenViewSet(viewsets.ViewSet):
|
||||
user_id_in_subtitle, webhook_task_id, sequence)
|
||||
continue
|
||||
|
||||
# 累积到 buffer
|
||||
# 累积到 buffer(仅在文本非空时;空文本是 Mode=1 的 paragraph 终止信号,不入 buffer 但要触发 flush)
|
||||
buffer_key = f"rtc_subv_buffer:{sender}:{paradise_user_id}"
|
||||
buf = cache.get(buffer_key) or []
|
||||
if text.strip():
|
||||
buf.append({'seq': sequence, 'text': text})
|
||||
|
||||
force_flush = len(buf) > MAX_BUFFER_SEGMENTS
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user