diff --git a/src/App.jsx b/src/App.jsx index 88549d2..721fed3 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -131,6 +131,7 @@ export function App() { phase: "", }); const [avatarPanelOpen, setAvatarPanelOpen] = useState(false); + const [smartMode, setSmartMode] = useState("auto-edit"); const [avatarJob, setAvatarJob] = useState({ running: false, progress: 0, phase: "" }); const lastSaved = useAutosaveTimestamp([ script, imageSrc, visualType, imageDuration, captionPlacement, selectedVoiceId, speed, @@ -452,7 +453,7 @@ export function App() { imageDuration, imageSrc, notify, selectedSegmentId, selectedSegmentIndex, selectedSticker, selectedStickerSegmentId, selectedTrack, selectedVisualSegmentId, selectedVisualSegmentIndex, stickerSegments, - trackLocks, visualSegments, + t, trackLocks, visualSegments, }); const adjustSelectedSegmentWeight = createTimelineDurationActions({ @@ -699,7 +700,7 @@ export function App() { estimatedDuration, fileInputRef, generateCaptionsFromSourceAudio, handleAssetClick, handleAssetPointerDown, handleCaptionPositionChange, handleFiles, handleStickerClick, imageSrc, isDragging, mediaTab, musicBlob, musicDuration, musicName, musicVolume, - notify, openAvatarPanel, previewVisionAnalysis, previewVisionKey, + notify, openAvatarPanel, previewVisionAnalysis, previewVisionKey, smartMode, setSmartMode, previewVisionOptions, previewVisualSrc, previewVisualType, progress, script, seekTo, segments, selectTool, selectedCaptionSegment, selectedFilterId, selectedLibraryAssetId, selectedSegmentId, selectedStickerId, selectedTransitionId, @@ -838,6 +839,17 @@ export function App() { isGeneratingCaptions={status === "captioning"} automaticCaptionProgress={status === "captioning" ? progress : 0} avatarPanelOpen={avatarPanelOpen} + smartMode={smartMode} + uiLanguage={activeLanguage} + visionAnalysis={previewVisionAnalysis} + visionOptions={previewVisionOptions} + visionRunning={visionJob.running && visionJob.key === previewVisionKey} + visionProgress={visionJob.key === previewVisionKey ? visionJob.progress : 0} + visionPhase={visionJob.key === previewVisionKey ? visionJob.phase : ""} + analyzeCurrentVisual={analyzeCurrentVisual} + toggleVisionOption={toggleVisionOption} + clearVisionAnalysis={clearVisionAnalysis} + downloadVisionCutout={downloadVisionCutout} hasVisual={Boolean(previewVisualSrc)} visualType={previewVisualType} audioDuration={audioDuration} @@ -864,6 +876,7 @@ export function App() { {avatarJob?.running ? t("avatarGenerating") : t("avatarGenerate")} -
{t("avatarPortingStatus")}{t("avatarServiceHint")}
); } @@ -338,6 +338,17 @@ export function VoicePanel({ isGeneratingCaptions, automaticCaptionProgress, avatarPanelOpen, + smartMode = "auto-edit", + uiLanguage, + visionAnalysis, + visionOptions, + visionRunning, + visionProgress, + visionPhase, + analyzeCurrentVisual, + toggleVisionOption, + clearVisionAnalysis, + downloadVisionCutout, hasVisual, visualType, audioDuration, @@ -363,13 +374,16 @@ export function VoicePanel({ const [captionPanelTab, setCaptionPanelTab] = useState("caption"); const panelRef = useRef(null); const isCaptionContext = activeTool === "caption"; - const isAvatarContext = activeTool === "smart" && avatarPanelOpen; + const isSmartContext = activeTool === "smart"; + const isAvatarContext = isSmartContext && smartMode === "avatar" && avatarPanelOpen; + const isSmartAutoContext = isSmartContext && smartMode === "auto-edit"; + const isSmartFrameContext = isSmartContext && smartMode === "smart-frame"; const isAudioClipContext = selectedTrack === "audio" && Boolean(selectedAudioSegment); - const isVisualContext = selectedTrack === "image"; + const isVisualContext = !isSmartContext && selectedTrack === "image"; const isStickerContext = selectedTrack === "sticker" && Boolean(selectedStickerSegment); const selectedCaptionAudioSegment = getCaptionVoiceSegment(audioSegments, selectedCaptionSegment); - const title = isStickerContext ? t("stickerProperties") : isVisualContext ? t("visualPanelTitle") : isAvatarContext ? t("avatarTitle") : isCaptionContext ? t("caption") : isAudioClipContext ? t("audioClipProperties") : t("aiVoice"); - const panelStatusText = isCaptionContext + const title = isSmartAutoContext ? t("smartAutoEdit") : isSmartFrameContext ? t("smartFrame") : isAvatarContext ? t("avatarTitle") : isStickerContext ? t("stickerProperties") : isVisualContext ? t("visualPanelTitle") : isCaptionContext ? t("caption") : isAudioClipContext ? t("audioClipProperties") : t("aiVoice"); + const panelStatusText = isSmartAutoContext ? t("smartComingSoon") : isSmartFrameContext ? (hasVisual ? t("smartVisualReady") : t("smartWaitingVisual")) : isCaptionContext ? captionSegments.length ? `${captionSegments.length} ${t("captionSegmentsUnit", "条字幕")}` : t("noCaptionSegments") @@ -407,7 +421,7 @@ export function VoicePanel({ - {!isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext ? ( + {!isSmartContext && !isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext ? (
{[ ["synthesis", t("voiceSynthesis")], @@ -450,6 +464,8 @@ export function VoicePanel({ ) : null}
+ {isSmartAutoContext ?
{t("smartAutoWorkspace")}{t("smartAutoWorkspaceEmpty")}
: null} + {isSmartFrameContext ? : null} {isStickerContext ? : null} {isVisualContext && selectedVisualSegment ? ( : null} - {!isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext && voiceTab === "synthesis" ? ( + {!isSmartContext && !isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext && voiceTab === "synthesis" ? ( ) : null} - {!isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext && voiceTab === "mine" ? ( + {!isSmartContext && !isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext && voiceTab === "mine" ? ( ) : null} - {!isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext && voiceTab === "history" ? ( + {!isSmartContext && !isCaptionContext && !isAvatarContext && !isAudioClipContext && !isVisualContext && !isStickerContext && voiceTab === "history" ? ( +
+
+ {[ + ["auto-edit", Scissors, t("smartAutoEdit"), t("smartAutoEditHint")], + ["smart-frame", FrameCorners, t("smartFrame"), t("smartFrameHint")], + ["avatar", PersonSimpleRun, t("smartAvatar"), t("smartAvatarHint")], + ].map(([id, Icon, title, hint]) => ( + + ))} +
+
); } @@ -698,7 +702,7 @@ function getDisplaySubjectLabel(label, language) { return language === "zh" ? SUBJECT_LABELS_ZH[normalized.toLowerCase()] ?? normalized : normalized; } -function SmartVisionPanel({ +export function SmartVisionPanel({ t, language = "zh", hasVisual, @@ -712,7 +716,6 @@ function SmartVisionPanel({ onToggle, onClear, onDownloadCutout, - onOpenAvatarPanel, }) { const subject = analysis?.subject ?? null; const detections = Array.isArray(analysis?.detections) ? analysis.detections : []; @@ -873,23 +876,6 @@ function SmartVisionPanel({

{t("smartVisionImageOnly")}

-
-
- -
{t("avatarKicker")}{t("avatarTitle")}
- {t("avatarWebPort")} -
-

{t("avatarDescription")}

-
- {t("avatarPortrait")} - {t("avatarWebgpu")} - {t("avatarAudio")} -
- -
- {analysis ? (