[文档、验收与归档]:完成真实运行说明和OpenSpec归档,包含README、最终门禁和主规范更新

This commit is contained in:
mkbk
2026-06-17 20:17:04 +08:00
parent 4b7cd18a0f
commit 445eebeaec
15 changed files with 320 additions and 143 deletions
+1 -1
View File
@@ -72,7 +72,7 @@ class ModelsConfigTests(unittest.TestCase):
self.assertEqual(config.speech_provider, "cloud")
self.assertEqual(config.asr_model, "mimo-v2.5-asr")
self.assertEqual(config.tts_model, "mimo-v2.5-tts")
self.assertEqual(config.tts_voice, "alloy")
self.assertEqual(config.tts_voice, "mimo_default")
self.assertEqual(str(config.speech_models_dir), "models")
self.assertTrue(config.llm_stream)
self.assertEqual(config.validate_basic(), [])
+18 -4
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
import io
import base64
import json
import unittest
@@ -75,7 +76,17 @@ class PipelineLlmTtsTests(unittest.TestCase):
return None
def read(self) -> bytes:
return b"fake-mp3"
return json.dumps(
{
"choices": [
{
"message": {
"audio": {"data": base64.b64encode(b"fake-wav").decode("ascii")}
}
}
]
}
).encode()
requests = []
@@ -90,11 +101,14 @@ class PipelineLlmTtsTests(unittest.TestCase):
provider.load()
segment = provider.synthesize("你好")
self.assertEqual(segment.metadata["format"], "mp3")
self.assertEqual(segment.pcm, b"fake-mp3")
self.assertEqual(segment.metadata["format"], "wav")
self.assertEqual(segment.pcm, b"fake-wav")
body = json.loads(requests[0].data.decode())
self.assertEqual(body["model"], "mimo-v2.5-tts")
self.assertIn("/v1/audio/speech", requests[0].full_url)
self.assertEqual(body["messages"][0]["role"], "assistant")
self.assertEqual(body["messages"][0]["content"], "你好")
self.assertEqual(body["audio"]["format"], "wav")
self.assertIn("/v1/chat/completions", requests[0].full_url)
def test_pipeline_runs_from_wake_to_playback(self) -> None:
frames = [
+10 -3
View File
@@ -113,7 +113,10 @@ class WakeVadSttTests(unittest.TestCase):
return None
def read(self) -> bytes:
return json.dumps({"text": "你好小杰", "language": "zh"}, ensure_ascii=False).encode()
return json.dumps(
{"choices": [{"message": {"content": "你好小杰"}}]},
ensure_ascii=False,
).encode()
requests = []
@@ -129,8 +132,12 @@ class WakeVadSttTests(unittest.TestCase):
transcript = provider.transcribe(AudioSegment(b"\x00\x00\x01\x00", 16000, 1, 0, 100))
self.assertEqual(transcript.text, "你好小杰")
self.assertIn("/v1/audio/transcriptions", requests[0].full_url)
self.assertIn(b'mimo-v2.5-asr', requests[0].data)
self.assertIn("/v1/chat/completions", requests[0].full_url)
body = json.loads(requests[0].data.decode())
self.assertEqual(body["model"], "mimo-v2.5-asr")
content = body["messages"][0]["content"][0]
self.assertEqual(content["type"], "input_audio")
self.assertTrue(content["input_audio"]["data"].startswith("data:audio/wav;base64,"))
if __name__ == "__main__":