From 2c647711fd102c2df82d0a7df0f11d6c3d914800 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 16 Nov 2026 13:42:06 +0800 Subject: [PATCH] refactor: update user account identifiers in translations and improve media handling logic --- apps/locales/en_US/LC_MESSAGES/django.po | 9 ++++++--- apps/locales/zh_CN/LC_MESSAGES/django.po | 9 ++++++--- apps/locales/zh_Hant/LC_MESSAGES/django.po | 9 ++++++--- .../tencent_model_provider.py | 15 ++++++++++++++ .../tests/test_tencent_provider.py | 20 +++++++++++++++++++ 5 files changed, 53 insertions(+), 9 deletions(-) diff --git a/apps/locales/en_US/LC_MESSAGES/django.po b/apps/locales/en_US/LC_MESSAGES/django.po index 2749cbd177b..91b9184385f 100644 --- a/apps/locales/en_US/LC_MESSAGES/django.po +++ b/apps/locales/en_US/LC_MESSAGES/django.po @@ -14758,12 +14758,15 @@ msgstr "Please analyze the content of the video." msgid "Please analyze the content of the file." msgstr "Please analyze the content of the file." -#: apps/xpack/serializers/channel/aibot/bot_manager.py:548 -#: apps/xpack/serializers/channel/wecom.py:270 -#: apps/xpack/serializers/channel/wecomBot.py:122 +#: apps/xpack/serializers/channel/wecom.py:302 msgid "Enterprise WeChat user: " msgstr "Enterprise WeChat user: " +#: apps/xpack/serializers/channel/aibot/bot_manager.py:493 +#: apps/xpack/serializers/channel/wecomBot.py:132 +msgid "AI bot user: " +msgstr "AI bot user: " + #: apps/xpack/serializers/channel/chat_manage.py:149 msgid "The user is not authorized to access this application" msgstr "The user is not authorized to access this application" diff --git a/apps/locales/zh_CN/LC_MESSAGES/django.po b/apps/locales/zh_CN/LC_MESSAGES/django.po index 6b0375f7418..ba9017b5092 100644 --- a/apps/locales/zh_CN/LC_MESSAGES/django.po +++ b/apps/locales/zh_CN/LC_MESSAGES/django.po @@ -14541,12 +14541,15 @@ msgstr "请分析视频内容。" msgid "Please analyze the content of the file." msgstr "请分析文件内容。" -#: apps/xpack/serializers/channel/aibot/bot_manager.py:548 -#: apps/xpack/serializers/channel/wecom.py:270 -#: apps/xpack/serializers/channel/wecomBot.py:122 +#: apps/xpack/serializers/channel/wecom.py:302 msgid "Enterprise WeChat user: " msgstr "企业微信用户: " +#: apps/xpack/serializers/channel/aibot/bot_manager.py:493 +#: apps/xpack/serializers/channel/wecomBot.py:132 +msgid "AI bot user: " +msgstr "智能机器人用户: " + #: apps/xpack/serializers/channel/chat_manage.py:149 msgid "The user is not authorized to access this application" msgstr "用户无权访问该智能体" diff --git a/apps/locales/zh_Hant/LC_MESSAGES/django.po b/apps/locales/zh_Hant/LC_MESSAGES/django.po index a0971a0ccc3..b4c697d03b3 100644 --- a/apps/locales/zh_Hant/LC_MESSAGES/django.po +++ b/apps/locales/zh_Hant/LC_MESSAGES/django.po @@ -14541,12 +14541,15 @@ msgstr "請分析視頻內容。" msgid "Please analyze the content of the file." msgstr "請分析文件內容。" -#: apps/xpack/serializers/channel/aibot/bot_manager.py:548 -#: apps/xpack/serializers/channel/wecom.py:270 -#: apps/xpack/serializers/channel/wecomBot.py:122 +#: apps/xpack/serializers/channel/wecom.py:302 msgid "Enterprise WeChat user: " msgstr "企業微信用戶: " +#: apps/xpack/serializers/channel/aibot/bot_manager.py:493 +#: apps/xpack/serializers/channel/wecomBot.py:132 +msgid "AI bot user: " +msgstr "智能機器人用戶: " + #: apps/xpack/serializers/channel/chat_manage.py:149 msgid "The user is not authorized to access this application" msgstr "使用者無權訪問該智慧體" diff --git a/apps/models_provider/impl/tencent_model_provider/tencent_model_provider.py b/apps/models_provider/impl/tencent_model_provider/tencent_model_provider.py index c7ea17ab3d6..2a03a14636e 100644 --- a/apps/models_provider/impl/tencent_model_provider/tencent_model_provider.py +++ b/apps/models_provider/impl/tencent_model_provider/tencent_model_provider.py @@ -9,6 +9,7 @@ ModelInfo, ModelTypeConst, ModelInfoManage, + classify_dynamic_model_id, ) from models_provider.impl.tencent_model_provider.credential.embedding import TencentEmbeddingCredential from models_provider.impl.tencent_model_provider.credential.image import TencentVisionModelCredential @@ -232,6 +233,20 @@ def __init__(self): def get_model_info_manage(self): return self._model_info_manage + @staticmethod + def classify_dynamic_model(model_id): + """TokenHub 的 /models 不带模态元数据,按官方命名规则补齐判型。 + + YT-Video 系列为图生视频/首尾帧(ITV);含 vision 的多数为视觉多模态 + 理解模型(IMAGE),但带 video/t2v/i2v 的仍按视频处理,避免误判。 + """ + model_id = str(model_id).lower() + if "yt-video" in model_id: + return ModelTypeConst.ITV + if "vision" in model_id and not any(k in model_id for k in ("video", "t2v", "i2v")): + return ModelTypeConst.IMAGE + return classify_dynamic_model_id(model_id) + def get_model(self, model_type, model_name, model_credential, **model_kwargs): # STT 模型:模型名不以 asr- 开头的一律走 Tencent Tokenhub WAND 识别 if model_type == ModelTypeConst.STT.name and not model_name.startswith("asr-"): diff --git a/apps/models_provider/tests/test_tencent_provider.py b/apps/models_provider/tests/test_tencent_provider.py index 8a788e44b8f..176ec9143b3 100644 --- a/apps/models_provider/tests/test_tencent_provider.py +++ b/apps/models_provider/tests/test_tencent_provider.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from django.test import SimpleTestCase +from models_provider.base_model_provider import ModelTypeConst from models_provider.impl.tencent_model_provider.tencent_model_provider import TencentModelProvider @@ -30,3 +31,22 @@ def test_wand_asr_v1_uses_tokenhub_credential(self): self.assertIsInstance(credential, TencentTokenhubSTTModelCredential) fields = {item.get("field") for item in credential.to_form_list()} self.assertIn("api_key", fields) + + def test_dynamic_classify_vision_as_image(self): + # TokenHub 的 /models 不带模态元数据,含 vision 的多模态理解模型应收敛到 IMAGE。 + for model_id in ( + "hy-vision-2.0-instruct", + "hunyuan-t1-vision-20250916", + "deepseek/deepseek-v4-flash-vision-exp", + ): + self.assertEqual(TencentModelProvider.classify_dynamic_model(model_id), ModelTypeConst.IMAGE) + + def test_dynamic_classify_yt_video_as_itv(self): + self.assertEqual(TencentModelProvider.classify_dynamic_model("yt-video-humanactor"), ModelTypeConst.ITV) + + def test_dynamic_classify_vision_video_stays_ttv(self): + # 带 video 的视觉模型仍是视频生成任务,不应被误判为视觉模型。 + self.assertEqual( + TencentModelProvider.classify_dynamic_model("hunyuan-turbos-vision-video-20250728"), + ModelTypeConst.TTV, + )