Skip to content

Commit 0bf77f0

Browse files
committed
fix: add api_base field to model credentials and update validation logic
1 parent 546407b commit 0bf77f0

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

  • apps/models_provider/impl/aliyun_bai_lian_model_provider

apps/models_provider/impl/aliyun_bai_lian_model_provider/credential/itv.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from django.utils.translation import gettext_lazy as _, gettext
66

7+
from common import forms
78
from common.exception.app_exception import AppApiException
89
from common.forms import BaseForm, PasswordInputField, SingleSelect, SliderField, TooltipLabel
910
from common.forms.switch_field import SwitchField
@@ -40,7 +41,7 @@ class ImageToVideoModelCredential(BaseForm, BaseModelCredential):
4041
Credential class for the Qwen Image-to-Video model.
4142
Provides validation and encryption for the model credentials.
4243
"""
43-
44+
api_base = forms.TextInputField(_('API URL'), required=True, default_value='https://dashscope.aliyuncs.com/api/v1')
4445
api_key = PasswordInputField('API Key', required=True)
4546

4647
def is_valid(
@@ -70,7 +71,7 @@ def is_valid(
7071
gettext('{model_type} Model type is not supported').format(model_type=model_type)
7172
)
7273

73-
required_keys = ['api_key']
74+
required_keys = ['api_key', 'api_base']
7475
for key in required_keys:
7576
if key not in model_credential:
7677
if raise_exception:

apps/models_provider/impl/aliyun_bai_lian_model_provider/model/ttv.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,15 @@ def generate_video(self, prompt, negative_prompt=None, first_frame_url=None, las
7575
import dashscope
7676
dashscope.base_http_api_url = self.api_base
7777

78+
is_kf2v_model = 'kf2v' in self.model_name.lower()
79+
7880
# 构建基础参数
7981
params = {"api_key": self.api_key, "prompt": prompt, "model": self.model_name,
8082
"negative_prompt": negative_prompt}
81-
if first_frame_url and last_frame_url:
83+
84+
if is_kf2v_model:
8285
params['first_frame_url'] = first_frame_url
83-
params["last_frame_url"] = last_frame_url
86+
params['last_frame_url'] = last_frame_url
8487
elif first_frame_url:
8588
params['img_url'] = first_frame_url
8689

0 commit comments

Comments
 (0)