Repository navigation
refactor: update user account identifiers in translations and improve media handling logic #7930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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, | ||
| ) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The added tests are generally reasonable and do not introduce network calls or obvious runtime/performance concerns. Main points to verify: Potential issues
Optimization suggestions
for model_id in (
"hy-vision-2.0-instruct",
"hunyuan-t1-vision-20250916",
"deepseek/deepseek-v4-flash-vision-exp",
):
with self.subTest(model_id=model_id):
self.assertEqual(
TencentModelProvider.classify_dynamic_model(model_id),
ModelTypeConst.IMAGE,
)
Minor style note
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's my review of the diff:
Potential Issues
Type inference may be fragile / over-broad
if "vision" in model_id: any future model containing "vision" that is not an image-understanding model will be misclassified asIMAGE. String matching on model IDs is brittle; consider a whitelist/prefix map or config-driven mapping instead."video", "t2v", "i2v") is likely incomplete. Common video conventions like"vid","i2v","t2v","itv","ti2v","s2v"(speech-to-video) should be enumerated if you keep this approach.Ordering dependency
yt-videocheck happens beforevision, soyt-video-visionwould go toITV. If such a model can exist, ensure this is intentional and documented.Name collision confusion
classify_dynamic_modelwhile it delegates to the importedclassify_dynamic_model_id. Similar names can cause confusion; consider renaming to something like_classify_tokenhub_modelto signal that this is provider-specific logic.Staticmethod placement
get_model_info_manageandget_model— fine, but since it's pure (noself), you could also move it near other factory/helper methods for readability.Case handling
str(model_id).lower()is safe, but ifmodel_idis everNone, you'd get"none"— for consistency withclassify_dynamic_model_id, confirm its expectations so behavior stays aligned.Missing tests
yt-video-*,*-vision,*-vision-t2v,*-vision-i2v, unknown IDs falling back, and mixed-case inputs.Optimization Suggestions
model_id.startswith("yt-video")) — more explicit and cheaper thanin.classify_dynamic_model_id, to help diagnose misclassifications in production.typefield in/models), prefer that over name heuristics and deprecate this shim.Style