fix(*): MiniMax 视频能力 - 放行参考素材视频生成并统一操作推导
This commit is contained in:
1 parent
11ee5aafec
commit
87ff997020
5 files changed
+23
-7
No files matched your search
@@ -229,6 +229,7 @@ func DefaultModelCapabilityConfigForModel(protocol string, modelName string) *Mo
|
|||||||
video.Resolutions = []string{"1080p"}
|
video.Resolutions = []string{"1080p"}
|
||||||
video.DefaultResolution = "1080p"
|
video.DefaultResolution = "1080p"
|
||||||
case model.ChannelInterfaceMiniMaxVideo:
|
case model.ChannelInterfaceMiniMaxVideo:
|
||||||
|
video.Operations = append(video.Operations, "reference_to_video")
|
||||||
video.References.MaxImages = 9
|
video.References.MaxImages = 9
|
||||||
video.References.MaxImageBytes = 30 * 1024 * 1024
|
video.References.MaxImageBytes = 30 * 1024 * 1024
|
||||||
video.References.MaxVideos = 3
|
video.References.MaxVideos = 3
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ func TestDefaultVideoCapabilityUsesProtocolSpecificResolutionTiers(t *testing.T)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDefaultMiniMaxVideoCapabilitySupportsReferenceGeneration(t *testing.T) {
|
||||||
|
profile := DefaultModelCapabilityConfigForModel("minimax-video", "MiniMax-H3")
|
||||||
|
if profile == nil || profile.Video == nil {
|
||||||
|
t.Fatal("MiniMax video profile = nil")
|
||||||
|
}
|
||||||
|
if !containsCapabilityString(profile.Video.Operations, "reference_to_video") {
|
||||||
|
t.Fatalf("operations = %v, want reference_to_video", profile.Video.Operations)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestCapabilitySpecFromModelCapabilityConfigRestoresLegacyWildcardImageSizes(t *testing.T) {
|
func TestCapabilitySpecFromModelCapabilityConfigRestoresLegacyWildcardImageSizes(t *testing.T) {
|
||||||
config := &ModelCapabilityConfig{
|
config := &ModelCapabilityConfig{
|
||||||
Version: 1,
|
Version: 1,
|
||||||
|
|||||||
@@ -315,6 +315,7 @@ export function defaultModelCapabilityConfig(protocol?: ModelProtocol, model = "
|
|||||||
video.resolutions = ["768P", "2K"];
|
video.resolutions = ["768P", "2K"];
|
||||||
video.defaultResolution = "768P";
|
video.defaultResolution = "768P";
|
||||||
video.watermark = { supported: true, default: false };
|
video.watermark = { supported: true, default: false };
|
||||||
|
video.operations.push("reference_to_video");
|
||||||
}
|
}
|
||||||
return { version: 1, text, image: defaultImageCapabilityConfig(protocol, model), video };
|
return { version: 1, text, image: defaultImageCapabilityConfig(protocol, model), video };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -312,14 +312,13 @@ export function modelGroupReferenceLimits(config: AiConfig, selected: string, ca
|
|||||||
|
|
||||||
export function inferVideoOperation(input: ModelInputSummary) {
|
export function inferVideoOperation(input: ModelInputSummary) {
|
||||||
const visualInputCount = input.imageCount + input.characterCount;
|
const visualInputCount = input.imageCount + input.characterCount;
|
||||||
if (input.audioCount > 0 && visualInputCount === 0 && input.videoCount === 0) return "audio_to_video";
|
if (input.audioCount > 0 || input.videoCount > 0 || visualInputCount > 2) return "reference_to_video";
|
||||||
if (input.videoCount > 0) return "extend";
|
|
||||||
if (visualInputCount > 0) return "image_to_video";
|
if (visualInputCount > 0) return "image_to_video";
|
||||||
return "text_to_video";
|
return "text_to_video";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function resolveVideoOperation(input: ModelInputSummary, storedOperation?: string) {
|
export function resolveVideoOperation(input: ModelInputSummary, storedOperation?: string) {
|
||||||
if (storedOperation && !["text_to_video", "image_to_video", "audio_to_video", "extend"].includes(storedOperation)) return storedOperation;
|
if (storedOperation && !["text_to_video", "image_to_video", "audio_to_video", "extend", "reference_to_video"].includes(storedOperation)) return storedOperation;
|
||||||
return inferVideoOperation(input);
|
return inferVideoOperation(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,6 +326,7 @@ function videoOperationLabel(operation: string) {
|
|||||||
if (operation === "text_to_video") return "文生视频";
|
if (operation === "text_to_video") return "文生视频";
|
||||||
if (operation === "image_to_video") return "图生视频";
|
if (operation === "image_to_video") return "图生视频";
|
||||||
if (operation === "audio_to_video") return "音频生视频";
|
if (operation === "audio_to_video") return "音频生视频";
|
||||||
|
if (operation === "reference_to_video") return "参考素材生视频";
|
||||||
if (operation === "extend") return "视频续写";
|
if (operation === "extend") return "视频续写";
|
||||||
return "当前生成模式";
|
return "当前生成模式";
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ import { LOCAL_DREAMINA_WAIT_STOPPED_CODE, LocalDreaminaGenerationClientError, r
|
|||||||
import { isLocalDreaminaBackgroundTask, localDreaminaTaskId, projectLocalDreaminaTask, stripLocalDreaminaTaskPrefix } from "@/services/local-dreamina-task-projection";
|
import { isLocalDreaminaBackgroundTask, localDreaminaTaskId, projectLocalDreaminaTask, stripLocalDreaminaTaskPrefix } from "@/services/local-dreamina-task-projection";
|
||||||
import { modelCapabilityConfigFor } from "@/lib/model-capabilities";
|
import { modelCapabilityConfigFor } from "@/lib/model-capabilities";
|
||||||
import { grokImagePromptLimitError } from "@/lib/grok-image-prompt-limit";
|
import { grokImagePromptLimitError } from "@/lib/grok-image-prompt-limit";
|
||||||
|
import { resolveVideoOperation } from "@/lib/model-selection";
|
||||||
import { modelOptionName, resolveModelChannel, resolveModelRequestConfig, type AiConfig } from "@/stores/use-config-store";
|
import { modelOptionName, resolveModelChannel, resolveModelRequestConfig, type AiConfig } from "@/stores/use-config-store";
|
||||||
import { useLocalDreaminaModelStore } from "@/stores/use-local-dreamina-model-store";
|
import { useLocalDreaminaModelStore } from "@/stores/use-local-dreamina-model-store";
|
||||||
import type { ReferenceImage } from "@/types/image";
|
import type { ReferenceImage } from "@/types/image";
|
||||||
@@ -268,10 +269,13 @@ async function runLocalDreaminaGeneration(options: BackendGenerationTaskOptions,
|
|||||||
|
|
||||||
function generationOperation(options: BackendGenerationTaskOptions) {
|
function generationOperation(options: BackendGenerationTaskOptions) {
|
||||||
if (options.mode !== "video") return options.mode;
|
if (options.mode !== "video") return options.mode;
|
||||||
const imageCount = options.referenceImages?.length ?? 0;
|
return resolveVideoOperation({
|
||||||
if ((options.referenceVideos?.length ?? 0) > 0 || (options.referenceAudios?.length ?? 0) > 0 || imageCount > 2) return "reference_to_video";
|
textCount: 0,
|
||||||
if (imageCount > 0) return "image_to_video";
|
imageCount: options.referenceImages?.length ?? 0,
|
||||||
return "text_to_video";
|
videoCount: options.referenceVideos?.length ?? 0,
|
||||||
|
audioCount: options.referenceAudios?.length ?? 0,
|
||||||
|
characterCount: 0,
|
||||||
|
}, options.metadata?.videoEditOperation as string | undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isGenerationTaskCancelled(error: unknown, signal?: AbortSignal) {
|
export function isGenerationTaskCancelled(error: unknown, signal?: AbortSignal) {
|
||||||
|
|||||||
Reference in new issue
Block a user