DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
fix(media): use the real DashScope image/video submit endpoints
wumajiehechuan-labe9655d579a3c
diff --git a/deeptutor/services/imagegen/adapters/dashscope.py b/deeptutor/services/imagegen/adapters/dashscope.pyindex 85e306590..461ec7db4 100644--- a/deeptutor/services/imagegen/adapters/dashscope.py+++ b/deeptutor/services/imagegen/adapters/dashscope.py@@ -20,7 +20,10 @@ from deeptutor.services.imagegen.config import ImagegenConfiglogger = logging.getLogger(__name__)-_SUBMIT_PATH = "services/aigc/image-synthesis"+# The prompt-style image API lives under the ``text2image`` namespace; dropping+# that segment falls through to a generic async route that answers+# 400 "task can not be null" for every model.+_SUBMIT_PATH = "services/aigc/text2image/image-synthesis"class DashScopeImagegenAdapter(BaseImagegenAdapter):diff --git a/deeptutor/services/videogen/adapters/dashscope.py b/deeptutor/services/videogen/adapters/dashscope.pyindex 4719accc2..7156c4df1 100644--- a/deeptutor/services/videogen/adapters/dashscope.py+++ b/deeptutor/services/videogen/adapters/dashscope.py@@ -20,7 +20,10 @@ from deeptutor.services.videogen.config import VideogenConfiglogger = logging.getLogger(__name__)-_SUBMIT_PATH = "services/aigc/video-generation"+# Same shape as the image adapter: the submit route is+# ``video-generation/video-synthesis``. Without the trailing segment the+# gateway answers 400 "task can not be null".+_SUBMIT_PATH = "services/aigc/video-generation/video-synthesis"class DashScopeVideogenAdapter(BaseVideogenAdapter):diff --git a/tests/services/test_media_gen.py b/tests/services/test_media_gen.pyindex b71c22beb..f0345fcf2 100644--- a/tests/services/test_media_gen.py+++ b/tests/services/test_media_gen.py@@ -199,7 +199,9 @@ async def test_dashscope_imagegen_task_polls_and_downloads(monkeypatch: pytest.MonkeyPatch,) -> None:def post_router(url: str, _kwargs: Any) -> httpx.Response:- assert url == "https://dashscope.aliyuncs.com/api/v1/services/aigc/image-synthesis"+ assert (+ url == "https://dashscope.aliyuncs.com/api/v1/services/aigc/text2image/image-synthesis"+ )return httpx.Response(200, json={"output": {"task_id": "image-task"}})def get_router(url: str, _kwargs: Any) -> httpx.Response:@@ -347,7 +349,10 @@ async def test_dashscope_videogen_task_polls_and_downloads(progress_messages.append(message)def post_router(url: str, kwargs: Any) -> httpx.Response:- assert url == "https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation"+ assert (+ url+ == "https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-synthesis"+ )assert kwargs["headers"]["X-DashScope-Async"] == "enable"assert kwargs["json"] == {"model": "wanx2.1-t2v-turbo",