修复:CI 部署环境与 ref 错配、迁移碎片化、图片意图 source_span、章节物化脏版式、会话历史与本地语音不一致
新增:TTS 上传 COS 与分片、章节 reading_segments 物化与快照、markdown 清洗、会话消息 repository、语音 store 重构与相关测试
This commit is contained in:
@@ -50,14 +50,19 @@ def segments_to_redis_history(segments: List[Segment]) -> List[Dict[str, Any]]:
|
||||
vsid = _voice_session_id_from_audio_url(seg.audio_url)
|
||||
if vsid:
|
||||
human["voiceSessionId"] = vsid
|
||||
ads = getattr(seg, "audio_duration_seconds", None)
|
||||
if ads is not None and ads > 0:
|
||||
human["durationSeconds"] = int(ads)
|
||||
history.append(human)
|
||||
if seg.agent_response and seg.agent_response.strip():
|
||||
history.append(
|
||||
{
|
||||
"role": "ai",
|
||||
"content": seg.agent_response.strip(),
|
||||
"messageType": "text",
|
||||
"timestamp": ts,
|
||||
}
|
||||
)
|
||||
ai_item: Dict[str, Any] = {
|
||||
"role": "ai",
|
||||
"content": seg.agent_response.strip(),
|
||||
"messageType": "text",
|
||||
"timestamp": ts,
|
||||
}
|
||||
tts = getattr(seg, "tts_audio_urls", None)
|
||||
if isinstance(tts, list) and tts:
|
||||
ai_item["ttsAudioUrls"] = [u for u in tts if isinstance(u, str)]
|
||||
history.append(ai_item)
|
||||
return history
|
||||
|
||||
Reference in New Issue
Block a user