|
|
@@ -260,14 +260,14 @@ class VideoGenerationController extends BaseController
|
|
|
|
|
|
// 验证基本参数
|
|
|
$baseRules = [
|
|
|
- 'model' => 'required|string|in:doubao-seedance-1-5-pro-251215,doubao-seedance-1-0-pro-250528,doubao-seedance-1-0-pro-fast-251015,doubao-seedance-1-0-lite-t2v-250428,doubao-seedance-1-0-lite-i2v-250428',
|
|
|
+ 'model' => 'required|string|in:doubao-seedance-1-5-pro-251215,doubao-seedance-1-0-pro-250528,doubao-seedance-1-0-pro-fast-251015',
|
|
|
'prompt' => 'required|max:1000',
|
|
|
// 'content' => 'required|array|min:1',
|
|
|
];
|
|
|
|
|
|
$baseMessages = [
|
|
|
'model.required' => '模型参数不能为空',
|
|
|
- 'model.in' => '模型只支持 doubao-seedance-1-5-pro-251215、doubao-seedance-1-0-pro-250528、doubao-seedance-1-0-pro-fast-251015、doubao-seedance-1-0-lite-t2v-250428、doubao-seedance-1-0-lite-i2v-250428',
|
|
|
+ 'model.in' => '模型只支持 doubao-seedance-1-5-pro-251215、doubao-seedance-1-0-pro-250528、doubao-seedance-1-0-pro-fast-251015',
|
|
|
'prompt.required' => '提示词不能为空',
|
|
|
'prompt.max' => '提示词不能超过1000个字符',
|
|
|
// 'content.required' => '内容参数不能为空',
|
|
|
@@ -373,22 +373,19 @@ class VideoGenerationController extends BaseController
|
|
|
$tailFrame = null;
|
|
|
|
|
|
// 以下首尾帧做模型兼容:
|
|
|
- // doubao-seedance-1-0-lite-t2v-250428只支持文生视频
|
|
|
// doubao-seedance-1-0-pro-fast-251015只支持文生视频、图生视频-首帧
|
|
|
// 处理首帧图片(文件上传方式)
|
|
|
if ($request->hasFile('first_frame_file')) {
|
|
|
$firstFrameFile = $request->file('first_frame_file');
|
|
|
$firstFrame = $this->processFrameFile($firstFrameFile, 'first');
|
|
|
- if (!in_array($data['model'], ['doubao-seedance-1-0-lite-t2v-250428'])) {
|
|
|
- $data['first_frame_url'] = $firstFrame['url'];
|
|
|
- $data['content'][] = [
|
|
|
- 'type' => 'image_url',
|
|
|
- 'image_url' => [
|
|
|
- 'url' => $data['first_frame_url'],
|
|
|
- ],
|
|
|
- 'role' => 'first_frame',
|
|
|
- ];
|
|
|
- }
|
|
|
+ $data['first_frame_url'] = $firstFrame['url'];
|
|
|
+ $data['content'][] = [
|
|
|
+ 'type' => 'image_url',
|
|
|
+ 'image_url' => [
|
|
|
+ 'url' => $data['first_frame_url'],
|
|
|
+ ],
|
|
|
+ 'role' => 'first_frame',
|
|
|
+ ];
|
|
|
}
|
|
|
// 处理首帧图片(URL方式)
|
|
|
elseif (isset($data['first_frame_url']) && !empty($data['first_frame_url'])) {
|
|
|
@@ -396,24 +393,20 @@ class VideoGenerationController extends BaseController
|
|
|
if (!$firstFrame) {
|
|
|
Utils::throwError('1003:首帧图片获取失败');
|
|
|
}
|
|
|
- if (!in_array($data['model'], ['doubao-seedance-1-0-lite-t2v-250428'])) {
|
|
|
- $data['content'][] = [
|
|
|
- 'type' => 'image_url',
|
|
|
- 'image_url' => [
|
|
|
- 'url' => $data['first_frame_url'],
|
|
|
- ],
|
|
|
- 'role' => 'first_frame',
|
|
|
- ];
|
|
|
- }else {
|
|
|
- $data['first_frame_url'] = '';
|
|
|
- }
|
|
|
+ $data['content'][] = [
|
|
|
+ 'type' => 'image_url',
|
|
|
+ 'image_url' => [
|
|
|
+ 'url' => $data['first_frame_url'],
|
|
|
+ ],
|
|
|
+ 'role' => 'first_frame',
|
|
|
+ ];
|
|
|
}
|
|
|
|
|
|
// 处理尾帧图片(文件上传方式)
|
|
|
if ($request->hasFile('tail_frame_file')) {
|
|
|
$tailFrameFile = $request->file('tail_frame_file');
|
|
|
$tailFrame = $this->processFrameFile($tailFrameFile, 'tail');
|
|
|
- if (!in_array($data['model'], ['doubao-seedance-1-0-lite-t2v-250428', 'doubao-seedance-1-0-pro-fast-251015'])) {
|
|
|
+ if (!in_array($data['model'], ['doubao-seedance-1-0-pro-fast-251015'])) {
|
|
|
$data['tail_frame_url'] = $tailFrame['url'];
|
|
|
$data['content'][] = [
|
|
|
'type' => 'image_url',
|
|
|
@@ -431,7 +424,7 @@ class VideoGenerationController extends BaseController
|
|
|
Utils::throwError('1003:尾帧图片获取失败');
|
|
|
}
|
|
|
|
|
|
- if (!in_array($data['model'], ['doubao-seedance-1-0-lite-t2v-250428', 'doubao-seedance-1-0-pro-fast-251015'])) {
|
|
|
+ if (!in_array($data['model'], ['doubao-seedance-1-0-pro-fast-251015'])) {
|
|
|
$data['content'][] = [
|
|
|
'type' => 'image_url',
|
|
|
'image_url' => [
|