diff --git a/frontend/src/pages/AudiotrackManager/AudiotrackEditor.tsx b/frontend/src/pages/AudiotrackManager/AudiotrackEditor.tsx index 57029f1..5247489 100644 --- a/frontend/src/pages/AudiotrackManager/AudiotrackEditor.tsx +++ b/frontend/src/pages/AudiotrackManager/AudiotrackEditor.tsx @@ -18,7 +18,7 @@ import { } from '@fluentui/react-icons'; import { Button, Card, DialogTrigger, Slider, Text, Tooltip } from '@fluentui/react-components'; import { useWindowSize } from 'usehooks-ts'; -import commonStore from '../../stores/commonStore'; +import commonStore, { ModelStatus } from '../../stores/commonStore'; import classnames from 'classnames'; import { InstrumentType, @@ -420,6 +420,7 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
: } size="small" shape="circular" appearance="subtle" onClick={() => { @@ -481,6 +482,7 @@ const AudiotrackEditor: FC<{ setPrompt: (prompt: string) => void }> = observer((
+ } />
} onClick={() => { diff --git a/frontend/src/utils/web-file-operations.ts b/frontend/src/utils/web-file-operations.ts index 872305b..1d6f224 100644 --- a/frontend/src/utils/web-file-operations.ts +++ b/frontend/src/utils/web-file-operations.ts @@ -1,12 +1,17 @@ import { getDocument, GlobalWorkerOptions, PDFDocumentProxy } from 'pdfjs-dist'; import { TextItem } from 'pdfjs-dist/types/src/display/api'; -export function webOpenOpenFileDialog({ filterPattern, fnStartLoading }: { filterPattern: string, fnStartLoading: Function | null }): Promise<{ blob: Blob, content?: string }> { +export function webOpenOpenFileDialog(filterPattern: string, fnStartLoading: Function | undefined): Promise<{ + blob: Blob, + content?: string +}> { return new Promise((resolve, reject) => { const input = document.createElement('input'); input.type = 'file'; input.accept = filterPattern .replaceAll('*.txt', 'text/plain') + .replace('*.midi', 'audio/midi') + .replace('*.mid', 'audio/midi') .replaceAll('*.', 'application/') .replaceAll(';', ','); @@ -15,7 +20,7 @@ export function webOpenOpenFileDialog({ filterPattern, fnStartLoading }: { filte const file: Blob = e.target?.files[0]; if (fnStartLoading && typeof fnStartLoading === 'function') fnStartLoading(); - if (!GlobalWorkerOptions.workerSrc) + if (!GlobalWorkerOptions.workerSrc && file.type === 'application/pdf') // @ts-ignore GlobalWorkerOptions.workerSrc = await import('pdfjs-dist/build/pdf.worker.min.mjs'); if (file.type === 'text/plain') {