Restore Video workspace and route native video API through shared endpoint

This commit is contained in:
Mikei386
2026-09-29 16:58:36 +02:00
parent badc7701fa
commit 67cf57a5b7
15 changed files with 166 additions and 20 deletions
+10 -2
View File
@@ -77,10 +77,18 @@ class EndpointTests(unittest.TestCase):
self.assertFalse(any(p['kind']=='video' for p in self.ep.rows()))
with self.assertRaises(ValueError):self.ep.enable({'id':'video-old','enabled':True})
def test_video_mode_rejects_chat_without_starting_llama(self):
self.ep.video=Mock();self.ep.scheduler.gpu_mode='video'
self.ep.video=Mock();self.ep.video.status.return_value={'service':{'ready':False}};self.ep.scheduler.gpu_mode='video'
code,body=self.request('/v1/chat/completions',dict(model='alpha',messages=[dict(role='user',content='synthetic')]))
self.assertEqual(code,503);self.assertEqual(body['error']['code'],'video_mode_active');self.assertFalse(self.worker.started)
self.assertEqual(code,503);self.assertEqual(body['error']['code'],'video_not_ready');self.assertFalse(self.worker.started)
self.ep.video=None
def test_video_mode_routes_original_api_even_on_models_path(self):
from unittest.mock import patch
self.ep.video=Mock();self.ep.video.status.return_value={'service':{'ready':True},'selected':'ltx'};self.ep.scheduler.gpu_mode='video'
def forward(handler,service):
self.assertEqual(service,'ltx');handler.send({'ltx_native':handler.path},207)
with patch('endpoint.relay',side_effect=forward):
code,body=self.request('/v1/models');self.assertEqual(code,207);self.assertEqual(body,{'ltx_native':'/v1/models'})
self.ep.scheduler.gpu_mode='llm';self.ep.video=None
def test_video_api_redirect_is_explicit_not_translation(self):
code,body=self.request('/v1/videos',{'prompt':'synthetic'})
self.assertEqual(code,410);self.assertEqual(body['error']['code'],'use_ltx_api')