解决已发现问题

This commit is contained in:
Azmat@qq.com
2026-09-17 15:00:15 +08:00
parent f3c49b36be
commit 5df038c635
24 changed files with 1913 additions and 94 deletions
@@ -24,6 +24,19 @@ function withCurrent(values: string[], current: string) {
return current && !values.includes(current) ? [current, ...values] : values;
}
/** 同一秒数允许「8秒 / 8 秒」等历史格式共存,不因展示格式触发参数变更。 */
export function normalizeDurationValue(value: string): string {
const raw = String(value || "").trim();
const seconds = raw.match(/\d+(?:\.\d+)?/)?.[0];
if (seconds) return `seconds:${Number(seconds)}`;
return `label:${raw.replace(/\s+/g, "").toLowerCase()}`;
}
function includesDuration(values: string[], current: string): boolean {
const normalized = normalizeDurationValue(current);
return values.some((value) => normalizeDurationValue(value) === normalized);
}
function modelOptionLabel(config: ModelConfig): string {
return (config.display_name || config.name || "").trim();
}
@@ -187,7 +200,7 @@ export function OmniParamBar({
const seconds = Number(String(duration || "").replace(/\D/g, ""));
const isPlannedSegmentedDuration = seconds > 30 && seconds <= 60 && canCreateSegmentedVideo(selected, model);
// 60 秒是总时长,生成时会拆段;不要因为单段目录最高 30 秒就把它偷偷改回 8 秒/智能时长。
if (duration && duration !== "智能时长" && !nextDur.includes(duration) && !isPlannedSegmentedDuration) {
if (duration && duration !== "智能时长" && !includesDuration(nextDur, duration) && !isPlannedSegmentedDuration) {
onDuration(nextDur.includes("8 秒") ? "8 秒" : (nextDur.find((x) => x !== "智能时长") || "智能时长"));
}
// eslint-disable-next-line react-hooks/exhaustive-deps