修复:CI 部署环境与 ref 错配、迁移碎片化、图片意图 source_span、章节物化脏版式、会话历史与本地语音不一致
新增:TTS 上传 COS 与分片、章节 reading_segments 物化与快照、markdown 清洗、会话消息 repository、语音 store 重构与相关测试
This commit is contained in:
39
api/tests/test_tts_cos_keys.py
Normal file
39
api/tests/test_tts_cos_keys.py
Normal file
@@ -0,0 +1,39 @@
|
||||
"""COS key collection for conversation TTS URLs."""
|
||||
|
||||
from app.core.cos_url_keys import (
|
||||
collect_cos_keys_from_conversation_history,
|
||||
collect_cos_keys_from_tts_url_list,
|
||||
)
|
||||
|
||||
|
||||
def test_collect_from_history_empty():
|
||||
assert collect_cos_keys_from_conversation_history([]) == set()
|
||||
|
||||
|
||||
def test_collect_from_history_ai_tts_urls(monkeypatch):
|
||||
monkeypatch.setattr(
|
||||
"app.core.cos_url_keys.settings.tencent_cos_bucket",
|
||||
"bucket",
|
||||
raising=False,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
"app.core.cos_url_keys.settings.tencent_cos_region",
|
||||
"ap-guangzhou",
|
||||
raising=False,
|
||||
)
|
||||
url = "https://bucket.cos.ap-guangzhou.myqcloud.com/conversations/c1/tts/a.mp3"
|
||||
hist = [
|
||||
{"role": "human", "content": "hi", "messageType": "text"},
|
||||
{
|
||||
"role": "ai",
|
||||
"content": "hello",
|
||||
"messageType": "text",
|
||||
"ttsAudioUrls": [url],
|
||||
},
|
||||
]
|
||||
keys = collect_cos_keys_from_conversation_history(hist)
|
||||
assert keys == {"conversations/c1/tts/a.mp3"}
|
||||
|
||||
|
||||
def test_collect_from_tts_url_list_none():
|
||||
assert collect_cos_keys_from_tts_url_list(None) == set()
|
||||
Reference in New Issue
Block a user