diff --git a/frontend/src/_locales/ja/main.json b/frontend/src/_locales/ja/main.json index 44cd26d..07c04ad 100644 --- a/frontend/src/_locales/ja/main.json +++ b/frontend/src/_locales/ja/main.json @@ -320,5 +320,6 @@ "Play With External Player": "外部プレーヤーで再生", "Core API URL": "コアAPI URL", "Override core API URL(/chat/completions and /completions). If you don't know what this is, leave it blank.": "コアAPI URLを上書きします(/chat/completions と /completions)。何であるかわからない場合は空白のままにしてください。", - "Please change Strategy to CPU (rwkv.cpp) to use ggml format": "StrategyをCPU (rwkv.cpp)に変更して、ggml形式を使用してください" + "Please change Strategy to CPU (rwkv.cpp) to use ggml format": "StrategyをCPU (rwkv.cpp)に変更して、ggml形式を使用してください", + "Only Auto Play Generated Content": "生成されたコンテンツのみ自動再生" } \ No newline at end of file diff --git a/frontend/src/_locales/zh-hans/main.json b/frontend/src/_locales/zh-hans/main.json index 1e4a20f..59f778b 100644 --- a/frontend/src/_locales/zh-hans/main.json +++ b/frontend/src/_locales/zh-hans/main.json @@ -320,5 +320,6 @@ "Play With External Player": "使用外部播放器播放", "Core API URL": "核心 API URL", "Override core API URL(/chat/completions and /completions). If you don't know what this is, leave it blank.": "覆盖核心的 API URL (/chat/completions 和 /completions)。如果你不知道这是什么,请留空", - "Please change Strategy to CPU (rwkv.cpp) to use ggml format": "请将Strategy改为CPU (rwkv.cpp)以使用ggml格式" + "Please change Strategy to CPU (rwkv.cpp) to use ggml format": "请将Strategy改为CPU (rwkv.cpp)以使用ggml格式", + "Only Auto Play Generated Content": "仅自动播放新生成的内容" } \ No newline at end of file diff --git a/frontend/src/pages/Composition.tsx b/frontend/src/pages/Composition.tsx index 3a164ae..285d124 100644 --- a/frontend/src/pages/Composition.tsx +++ b/frontend/src/pages/Composition.tsx @@ -152,10 +152,14 @@ const CompositionPanel: FC = observer(() => { if (autoPlay) { if (commonStore.compositionParams.externalPlay) externalPlayListener(); - else + else { + if (commonStore.compositionParams.playOnlyGeneratedContent && playerRef.current) { + playerRef.current.currentTime = Math.max(commonStore.compositionParams.generationStartTime - 1, 0); + } setTimeout(() => { playerRef.current?.start(); }); + } } }); }); @@ -314,6 +318,14 @@ const CompositionPanel: FC = observer(() => { autoPlay: data.checked as boolean }); }} /> + { + setParams({ + autoPlay: data.checked as boolean || commonStore.compositionParams.autoPlay, + playOnlyGeneratedContent: data.checked as boolean + }); + }} /> { contentText={t('Are you sure you want to reset this page? It cannot be undone.')} onConfirm={() => { commonStore.setCompositionSubmittedPrompt(defaultCompositionPrompt); + setParams({ + generationStartTime: 0 + }); setPrompt(defaultCompositionPrompt); }} /> diff --git a/frontend/src/stores/commonStore.ts b/frontend/src/stores/commonStore.ts index b33cb2d..aa74e7e 100644 --- a/frontend/src/stores/commonStore.ts +++ b/frontend/src/stores/commonStore.ts @@ -96,7 +96,9 @@ class CommonStore { useLocalSoundFont: false, externalPlay: false, midi: null, - ns: null + ns: null, + generationStartTime: 0, + playOnlyGeneratedContent: true }; compositionGenerating: boolean = false; compositionSubmittedPrompt: string = defaultCompositionPrompt; diff --git a/frontend/src/types/composition.ts b/frontend/src/types/composition.ts index 64dfc2b..f574881 100644 --- a/frontend/src/types/composition.ts +++ b/frontend/src/types/composition.ts @@ -11,7 +11,9 @@ export type CompositionParams = { useLocalSoundFont: boolean, externalPlay: boolean, midi: ArrayBuffer | null, - ns: NoteSequence | null + ns: NoteSequence | null, + generationStartTime: number, + playOnlyGeneratedContent: boolean, } export type Track = { id: string;