able to process audio with different model; new project button
This commit is contained in:
@ -23,6 +23,7 @@ interface EditorState {
|
||||
cutRanges: CutRange[];
|
||||
muteRanges: MuteRange[];
|
||||
silenceTrimGroups: SilenceTrimGroup[];
|
||||
transcriptionModel: string | null;
|
||||
language: string;
|
||||
|
||||
currentTime: number;
|
||||
@ -45,6 +46,7 @@ interface EditorActions {
|
||||
setBackendUrl: (url: string) => void;
|
||||
loadVideo: (path: string) => void;
|
||||
setExportedAudioPath: (path: string | null) => void;
|
||||
setTranscriptionModel: (model: string | null) => void;
|
||||
saveProject: () => ProjectFile;
|
||||
setTranscription: (result: TranscriptionResult) => void;
|
||||
setCurrentTime: (time: number) => void;
|
||||
@ -85,6 +87,7 @@ const initialState: EditorState = {
|
||||
cutRanges: [],
|
||||
muteRanges: [],
|
||||
silenceTrimGroups: [],
|
||||
transcriptionModel: null,
|
||||
language: '',
|
||||
currentTime: 0,
|
||||
duration: 0,
|
||||
@ -136,8 +139,10 @@ export const useEditorStore = create<EditorState & EditorActions>()(
|
||||
|
||||
setExportedAudioPath: (path) => set({ exportedAudioPath: path }),
|
||||
|
||||
setTranscriptionModel: (model) => set({ transcriptionModel: model }),
|
||||
|
||||
saveProject: (): ProjectFile => {
|
||||
const { videoPath, words, segments, deletedRanges, cutRanges, muteRanges, silenceTrimGroups, language, exportedAudioPath } = get();
|
||||
const { videoPath, words, segments, deletedRanges, cutRanges, muteRanges, silenceTrimGroups, transcriptionModel, language, exportedAudioPath } = get();
|
||||
if (!videoPath) throw new Error('No video loaded');
|
||||
const now = new Date().toISOString();
|
||||
// Strip globalStartIndex (runtime-only field) before persisting
|
||||
@ -146,6 +151,7 @@ export const useEditorStore = create<EditorState & EditorActions>()(
|
||||
version: 1,
|
||||
videoPath,
|
||||
exportedAudioPath: exportedAudioPath ?? undefined,
|
||||
transcriptionModel: transcriptionModel ?? undefined,
|
||||
words,
|
||||
segments: persistSegments as unknown as Segment[],
|
||||
deletedRanges,
|
||||
@ -410,6 +416,7 @@ export const useEditorStore = create<EditorState & EditorActions>()(
|
||||
cutRanges: data.cutRanges || [],
|
||||
muteRanges: data.muteRanges || [],
|
||||
silenceTrimGroups: data.silenceTrimGroups || [],
|
||||
transcriptionModel: data.transcriptionModel ?? null,
|
||||
language: data.language || '',
|
||||
exportedAudioPath: data.exportedAudioPath ?? null,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user