Feat: make notes on caption (#544)

* add segment model

* add note model

* db handle segment & note

* add notes & segments handler

* refactor media caption components

* segment & note create

* fix type

* update note column & may sync

* display selected words for note

* refactor selected words

* auto select words when editing note

* refactor

* refactor caption component

* display notes

* refactor notes components

* fix

* refactor segment & notes into context

* destroy note

* update locale

* fix caption switch issue

* fix layout

* refactor caption layout

* remove deprecated code

* may share note

* improve UI

* fix notes list auto update after created

* remove console.log

* add notes page

* refactor note parameters

* refactor components

* mark note on transcription

* handle no notes

* improve style

* improve style

* show context menu on selection text

* fix utils
This commit is contained in:
an-lee
2024-04-26 15:05:36 +08:00
committed by GitHub
parent 5740b2635c
commit 0644c3bbd7
58 changed files with 2586 additions and 677 deletions

View File

@@ -267,4 +267,35 @@ type EnjoyAppType = {
find: (id: string) => Promise<WaveFormDataType>;
save: (id: string, data: WaveFormDataType) => Promise<void>;
};
segments: {
findAll: (params: any) => Promise<SegmentType[]>;
find: (id: string) => Promise<SegmentType>;
create: (params: {
targetId: string;
targetType: string;
segmentIndex: number;
}) => Promise<SegmentType>;
sync: (id: string) => Promise<SegmentType>;
};
notes: {
groupByTarget: (params: any) => Promise<any>;
groupBySegment: (targetId: string, targetType: string) => Promise<any>;
findAll: (params: any) => Promise<NoteType[]>;
find: (id: string) => Promise<NoteType>;
update: (
id: string,
params: {
content: string;
parameters?: any;
}
) => Promise<NoteType>;
delete: (id: string) => Promise<void>;
create: (params: {
targetId: string;
targetType: string;
content: string;
parameters?: any;
}) => Promise<NoteType>;
sync: (id: string) => Promise<NoteType>;
};
};

14
enjoy/src/types/note.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
type NoteType = {
id: string;
targetId: string;
targetType: string;
content: string;
parameters: any;
syncedAt: Date;
uploadedAt: Date;
updatedAt: Date;
createdAt: Date;
segment?: SegmentType;
isSynced?: boolean;
sync(): Promise<void>;
};

View File

@@ -1,7 +1,7 @@
type PostType = {
id: string;
metadata: {
type: "text" | "prompt" | "gpt";
type: "text" | "prompt" | "gpt" | "note";
content:
| string
| {
@@ -11,7 +11,7 @@ type PostType = {
user: UserType;
targetType?: string;
targetId?: string;
target?: MediumType | StoryType | RecordingType;
target?: MediumType | StoryType | RecordingType | NoteType;
createdAt: Date;
updatedAt: Date;
};

18
enjoy/src/types/segment.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
type SegmentType = {
id: string;
targetId: string;
targetType: string;
caption: TimelineEntry;
audio?: AudioType;
video?: VideoType;
segmentIndex: number;
md5: string;
caption: TimeLIne;
startTime: number;
endTime: number;
src: string;
syncedAt?: Date;
uploadedAt?: Date
updatedAt: Date
createdAt: Date
};

View File

@@ -2,6 +2,7 @@ type TranscriptionType = {
id: string;
targetId: string;
targetType: string;
targetMd5?: string;
state: "pending" | "processing" | "finished";
engine: string;
model: string;