diff --git a/.env.example b/.env.example index d701482..d09593c 100644 --- a/.env.example +++ b/.env.example @@ -11,6 +11,7 @@ VITE_FRONTEND_PORT=3015 ENV=production STATIC=/static OUT_DIR=./static/screenshots +NOTE_OUTPUT_DIR=note_results IMAGE_BASE_URL=/static/screenshots DATA_DIR=data # FFMPEG 配置 diff --git a/BillNote_frontend/src/components/Form/DownloaderForm/Form.tsx b/BillNote_frontend/src/components/Form/DownloaderForm/Form.tsx index 66fcdc7..dd1bb08 100644 --- a/BillNote_frontend/src/components/Form/DownloaderForm/Form.tsx +++ b/BillNote_frontend/src/components/Form/DownloaderForm/Form.tsx @@ -36,7 +36,7 @@ const DownloaderForm = () => { setLoading(true) // 🔁 切换平台时显示 loading try { const res = await getDownloaderCookie(id) - const cookie = res?.data?.data?.cookie || '' + const cookie = res?.cookie || '' form.reset({ cookie }) // ✅ 正确重置表单值 } catch (e) { toast.error('加载 Cookie 失败: ' + e) diff --git a/BillNote_frontend/src/components/Form/modelForm/Form.tsx b/BillNote_frontend/src/components/Form/modelForm/Form.tsx index 4c1b7e6..2a17193 100644 --- a/BillNote_frontend/src/components/Form/modelForm/Form.tsx +++ b/BillNote_frontend/src/components/Form/modelForm/Form.tsx @@ -129,11 +129,10 @@ const ProviderForm = ({ isCreate = false }: { isCreate?: boolean }) => { try { const res = await deleteModelById(modelId) - if (res.data.code === 0) { - toast.success('删除成功') - } else { - toast.error(res.data.msg || '删除失败') - } + console.log('🔧 删除结果:', res) + + toast.success('删除成功') + } catch (e) { toast.error('删除异常') } @@ -151,16 +150,16 @@ const ProviderForm = ({ isCreate = false }: { isCreate?: boolean }) => { return } setTesting(true) - const data = await testConnection({ - id - }) - if (data.data.code === 0) { + await testConnection({ + id + }) + toast.success('测试连通性成功 🎉') - } else { - toast.error(`连接失败: ${data.data.msg || '未知错误'}`) - } + } catch (error) { - toast.error('测试连通性异常') + + toast.error(`连接失败: ${data.data.msg || '未知错误'}`) + // toast.error('测试连通性异常') } finally { setTesting(false) } diff --git a/BillNote_frontend/src/hooks/useTaskPolling.ts b/BillNote_frontend/src/hooks/useTaskPolling.ts index 412c6af..8bdd976 100644 --- a/BillNote_frontend/src/hooks/useTaskPolling.ts +++ b/BillNote_frontend/src/hooks/useTaskPolling.ts @@ -26,11 +26,11 @@ export const useTaskPolling = (interval = 3000) => { try { console.log('🔄 正在轮询任务:', task.id) const res = await get_task_status(task.id) - const { status } = res.data + const { status } = res if (status && status !== task.status) { if (status === 'SUCCESS') { - const { markdown, transcript, audio_meta } = res.data.result + const { markdown, transcript, audio_meta } = res.result toast.success('笔记生成成功') updateTaskContent(task.id, { status, @@ -47,7 +47,7 @@ export const useTaskPolling = (interval = 3000) => { } } catch (e) { console.error('❌ 任务轮询失败:', e) - toast.error(`生成失败 ${e.message || e}`) + // toast.error(`生成失败 ${e.message || e}`) updateTaskContent(task.id, { status: 'FAILED' }) // removeTask(task.id) } diff --git a/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx b/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx index fbcf2bc..b287736 100644 --- a/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx +++ b/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx @@ -173,6 +173,7 @@ const MarkdownViewer: FC = ({ status }) => {

笔记生成失败

请检查后台或稍后再试

+ diff --git a/BillNote_frontend/src/pages/HomePage/components/NoteForm.tsx b/BillNote_frontend/src/pages/HomePage/components/NoteForm.tsx index 65a1aaa..d9f21b3 100644 --- a/BillNote_frontend/src/pages/HomePage/components/NoteForm.tsx +++ b/BillNote_frontend/src/pages/HomePage/components/NoteForm.tsx @@ -37,6 +37,7 @@ import { import { Input } from '@/components/ui/input.tsx' import { Textarea } from '@/components/ui/textarea.tsx' import { noteStyles, noteFormats, videoPlatforms } from '@/constant/note.ts' +import { fetchModels } from '@/services/model.ts' /* -------------------- 校验 Schema -------------------- */ const formSchema = z @@ -206,7 +207,7 @@ const NoteForm = () => { } message.success('已提交任务') - const { data } = await generateNote(payload) + const data = await generateNote(payload) addPendingTask(data.task_id, values.platform, payload) } const onInvalid = (errors: FieldErrors) => { @@ -355,6 +356,9 @@ const NoteForm = () => {