Skip to content

Commit 84cf66c

Browse files
author
mose-x.zm
committed
support wan30
1 parent ea3aaf7 commit 84cf66c

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

‎dashscope/aigc/video_synthesis.py‎

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ class MediaType:
4747
REFERENCE_IMAGE = "reference_image"
4848
REFERENCE_VIDEO = "reference_video"
4949
REFERENCE_VOICE = "reference_voice"
50+
REFERENCE_AUDIO = "reference_audio"
5051
VIDEO = "video"
5152
FIRST_CLIP = "first_clip"
5253
DRIVING_AUDIO = "driving_audio"
54+
FILE = "file"
55+
LINK = "link"
5356

5457
@classmethod
5558
def call( # type: ignore[override]
@@ -84,6 +87,7 @@ def call( # type: ignore[override]
8487
ratio: Optional[str] = None,
8588
shot_type: Optional[str] = None,
8689
audio_setting: Optional[str] = None,
90+
enable_thinking: Optional[bool] = None,
8791
**kwargs,
8892
) -> VideoSynthesisResponse:
8993
"""Call video synthesis service and get result.
@@ -126,6 +130,7 @@ def call( # type: ignore[override]
126130
shot_type (str, optional): Shot type for video generation.
127131
audio_setting (str, optional): Audio setting for video,
128132
"auto" or "origin".
133+
enable_thinking (bool, optional): Whether to use Agentic PE.
129134
**kwargs: Additional parameters passed to the API.
130135
131136
Raises:
@@ -152,6 +157,8 @@ def call( # type: ignore[override]
152157
kwargs["shot_type"] = shot_type
153158
if audio_setting is not None:
154159
kwargs["audio_setting"] = audio_setting
160+
if enable_thinking is not None:
161+
kwargs["enable_thinking"] = enable_thinking
155162
return super().call( # type: ignore[return-value]
156163
model,
157164
prompt,
@@ -263,7 +270,8 @@ def _get_input( # pylint: disable=too-many-branches
263270
if media:
264271
for i, m_file in enumerate(media):
265272
if isinstance(m_file, dict):
266-
if m_file.get("url"):
273+
# exclude when media is a link
274+
if m_file.get("url") and m_file.get("type") != "link":
267275
tasks.append(
268276
{
269277
"type": "media",
@@ -397,6 +405,7 @@ def async_call( # pylint: disable=arguments-renamed # type: ignore[override] #
397405
ratio: Optional[str] = None,
398406
shot_type: Optional[str] = None,
399407
audio_setting: Optional[str] = None,
408+
enable_thinking: Optional[bool] = None,
400409
**kwargs,
401410
) -> VideoSynthesisResponse:
402411
"""Create a video synthesis task, and return task information.
@@ -435,6 +444,7 @@ def async_call( # pylint: disable=arguments-renamed # type: ignore[override] #
435444
shot_type (str, optional): Shot type for video generation.
436445
audio_setting (str, optional): Audio setting for video,
437446
"auto" or "origin".
447+
enable_thinking (bool, optional): Whether to use Agentic PE.
438448
**kwargs: Additional parameters passed to the API.
439449
440450
Raises:
@@ -462,6 +472,8 @@ def async_call( # pylint: disable=arguments-renamed # type: ignore[override] #
462472
kwargs["shot_type"] = shot_type
463473
if audio_setting is not None:
464474
kwargs["audio_setting"] = audio_setting
475+
if enable_thinking is not None:
476+
kwargs["enable_thinking"] = enable_thinking
465477
task_group, function = _get_task_group_and_task(__name__)
466478

467479
inputs, kwargs, task = cls._get_input(
@@ -656,6 +668,7 @@ async def call( # type: ignore[override] # pylint: disable=arguments-renamed #
656668
ratio: str = None,
657669
shot_type: str = None,
658670
audio_setting: str = None,
671+
enable_thinking: bool = None,
659672
**kwargs,
660673
) -> VideoSynthesisResponse:
661674
"""Call video synthesis service and get result.
@@ -694,6 +707,7 @@ async def call( # type: ignore[override] # pylint: disable=arguments-renamed #
694707
shot_type (str, optional): Shot type for video generation.
695708
audio_setting (str, optional): Audio setting for video,
696709
"auto" or "origin".
710+
enable_thinking (bool, optional): Whether to use Agentic PE.
697711
**kwargs: Additional parameters passed to the API.
698712
699713
Raises:
@@ -720,6 +734,8 @@ async def call( # type: ignore[override] # pylint: disable=arguments-renamed #
720734
kwargs["shot_type"] = shot_type
721735
if audio_setting is not None:
722736
kwargs["audio_setting"] = audio_setting
737+
if enable_thinking is not None:
738+
kwargs["enable_thinking"] = enable_thinking
723739
task_group, f = _get_task_group_and_task(__name__)
724740
# pylint: disable=protected-access
725741
inputs, kwargs, task = VideoSynthesis._get_input(
@@ -792,6 +808,8 @@ async def async_call( # type: ignore[override] # pylint: disable=arguments-rena
792808
resolution: str = None,
793809
ratio: str = None,
794810
shot_type: str = None,
811+
audio_setting: str = None,
812+
enable_thinking: bool = None,
795813
**kwargs,
796814
) -> VideoSynthesisResponse:
797815
"""Create a video synthesis task, and return task information.
@@ -828,6 +846,8 @@ async def async_call( # type: ignore[override] # pylint: disable=arguments-rena
828846
resolution (str, optional): Output resolution.
829847
ratio (str, optional): Aspect ratio, e.g. "16:9".
830848
shot_type (str, optional): Shot type for video generation.
849+
enable_thinking (bool, optional): Whether to use Agentic PE.
850+
audio_setting (str, optional): Audio setting for video,
831851
**kwargs: Additional parameters passed to the API.
832852
833853
Raises:
@@ -853,6 +873,10 @@ async def async_call( # type: ignore[override] # pylint: disable=arguments-rena
853873
kwargs["ratio"] = ratio
854874
if shot_type is not None:
855875
kwargs["shot_type"] = shot_type
876+
if audio_setting is not None:
877+
kwargs["audio_setting"] = audio_setting
878+
if enable_thinking is not None:
879+
kwargs["enable_thinking"] = enable_thinking
856880
task_group, function = _get_task_group_and_task(__name__)
857881

858882
# pylint: disable=protected-access

0 commit comments

Comments
 (0)