Add X-VC voice conversion mode

This commit is contained in:
Mikei386
2026-09-09 16:14:10 +02:00
parent 17f1a08d7d
commit 87a2ae5704
15 changed files with 544 additions and 28 deletions
+9
View File
@@ -61,6 +61,15 @@ class DashboardModeTests(unittest.TestCase):
request = urlopen.call_args.args[0]
self.assertEqual(json.loads(request.data), {"mode": "voice"})
def test_voice_change_mode_is_forwarded_to_router(self):
with patch.object(self.dashboard.urllib.request, "urlopen", return_value=_Response()) as urlopen:
status, body = self.dashboard.change_mode("voicechange")
self.assertEqual(status, 202)
self.assertEqual(body, {"status": "accepted"})
request = urlopen.call_args.args[0]
self.assertEqual(json.loads(request.data), {"mode": "voicechange"})
def test_unknown_mode_is_rejected_without_router_request(self):
with patch.object(self.dashboard.urllib.request, "urlopen") as urlopen:
status, body = self.dashboard.change_mode("unknown")
+39
View File
@@ -51,7 +51,46 @@ def voice_item(state="exited"):
"Labels": {controller.VOICE_LABEL_KEY: "vevo2"}}
def voice_change_item(state="exited"):
return {"Id": "id-xvc", "State": state,
"Labels": {controller.VOICE_CHANGE_LABEL_KEY: "xvc"}}
class ProfileControllerTests(unittest.TestCase):
def test_voice_change_start_exclusively_stops_gpu_workers(self):
profiles = {name: item(name) for name in controller.ALLOWED}
profiles["medium"] = item("medium", "running")
calls = []
def request(method, path):
calls.append((method, path))
return 204, b""
with patch.object(controller, "VOICE_CHANGE_WORKER", "xvc"), \
patch.object(controller, "VOICE_WORKER", "vevo2"), \
patch.object(controller, "MUSIC_WORKER", "acestep"), \
patch.object(controller, "SEPARATOR_WORKER", "bs-roformer"), \
patch.object(controller, "containers", return_value=profiles), \
patch.object(controller, "voice_change_container", return_value=voice_change_item()), \
patch.object(controller, "voice_container", return_value=voice_item("running")), \
patch.object(controller, "music_container", return_value=music_item("running")), \
patch.object(controller, "separator_container", return_value=separator_item("running")), \
patch.object(controller, "image_containers", return_value=[image_item("running")]), \
patch.object(controller, "tts_container", return_value=tts_item()), \
patch.object(controller, "docker_request", side_effect=request):
result = controller.set_voice_change_worker(True)
self.assertEqual(result, {"voice_change_worker": "xvc", "state": "running"})
self.assertEqual(calls, [
("POST", "/containers/id-medium/stop?t=120"),
("POST", "/containers/id-flux/stop?t=20"),
("POST", "/containers/id-tts/stop?t=30"),
("POST", "/containers/id-music/stop?t=30"),
("POST", "/containers/id-separator/stop?t=30"),
("POST", "/containers/id-voice/stop?t=30"),
("POST", "/containers/id-xvc/start"),
])
def test_voice_start_exclusively_stops_gpu_workers(self):
profiles = {name: item(name) for name in controller.ALLOWED}
profiles["medium"] = item("medium", "running")