mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 00:39:47 +08:00
Add rich text and learning blocks, media uploads, page trees, and revisioned notebook storage. Present AI suggestions at their target blocks with durable accept and dismiss actions. Unify saved outputs as Favorites with typed expandable blocks, stable source links, atomic batch insertion, nesting, dragging, and undo/redo. Validation: 99 frontend tests and 99 backend tests pass in an isolated snapshot, along with TypeScript, scoped ESLint, dependency architecture, and locale parity checks.
16 lines
598 B
TypeScript
16 lines
598 B
TypeScript
export const noteMediaAccept =
|
|
'image/png,image/jpeg,image/gif,image/webp,audio/mpeg,audio/wav,video/mp4,application/pdf'
|
|
export function noteMediaType(file: Pick<File, 'type' | 'size'>) {
|
|
if (!noteMediaAccept.split(',').includes(file.type))
|
|
throw new Error('Unsupported attachment type')
|
|
if (!file.size || file.size > 25 * 1024 * 1024)
|
|
throw new Error('Attachments must be between 1 byte and 25 MB')
|
|
return file.type.startsWith('image/')
|
|
? 'image'
|
|
: file.type.startsWith('audio/')
|
|
? 'audio'
|
|
: file.type.startsWith('video/')
|
|
? 'video'
|
|
: 'file'
|
|
}
|