diff --git a/README.md b/README.md index a67b5c5..637587f 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ docker-compose up -d > > 1. **`.env` 文件挂载**: `docker-compose.yml` 会自动将 `.env` 挂载到容器,确保文件存在 > 2. **数据库初始化**: `init_postgres.sql` 会在首次启动时自动执行,安装必要的PostgreSQL扩展 -> 3. **自行构建**: 如需从源码构建,请先下载 embedding 模型文件([加群获取](https://linux.do/t/topic/1100112)) +> 3. **自行构建**: 如需从源码构建,请先下载 embedding 模型文件([加群获取](frontend\public\qq.jpg)) ### 使用 Docker Hub 镜像(推荐新手) diff --git a/frontend/src/pages/Chapters.tsx b/frontend/src/pages/Chapters.tsx index dcf3bde..3f6589f 100644 --- a/frontend/src/pages/Chapters.tsx +++ b/frontend/src/pages/Chapters.tsx @@ -1,6 +1,6 @@ import { useState, useEffect, useRef, useMemo } from 'react'; -import { List, Button, Modal, Form, Input, Select, message, Empty, Space, Badge, Tag, Card, Tooltip, InputNumber, Progress, Alert, Radio, Descriptions, Collapse } from 'antd'; -import { EditOutlined, FileTextOutlined, ThunderboltOutlined, LockOutlined, DownloadOutlined, SettingOutlined, FundOutlined, SyncOutlined, CheckCircleOutlined, CloseCircleOutlined, RocketOutlined, StopOutlined, InfoCircleOutlined, CaretRightOutlined } from '@ant-design/icons'; +import { List, Button, Modal, Form, Input, Select, message, Empty, Space, Badge, Tag, Card, Tooltip, InputNumber, Progress, Alert, Radio, Descriptions, Collapse, Popconfirm } from 'antd'; +import { EditOutlined, FileTextOutlined, ThunderboltOutlined, LockOutlined, DownloadOutlined, SettingOutlined, FundOutlined, SyncOutlined, CheckCircleOutlined, CloseCircleOutlined, RocketOutlined, StopOutlined, InfoCircleOutlined, CaretRightOutlined, DeleteOutlined } from '@ant-design/icons'; import { useStore } from '../store'; import { useChapterSync } from '../store/hooks'; import { projectApi, writingStyleApi } from '../services/api'; @@ -59,6 +59,7 @@ export default function Chapters() { const { refreshChapters, updateChapter, + deleteChapter, generateChapterContentStream } = useChapterSync(); @@ -827,6 +828,26 @@ export default function Chapters() { } }; + // 删除章节处理函数 + const handleDeleteChapter = async (chapterId: string) => { + try { + await deleteChapter(chapterId); + + // 刷新章节列表 + await refreshChapters(); + + // 刷新项目信息以更新总字数统计 + if (currentProject) { + const updatedProject = await projectApi.getProject(currentProject.id); + setCurrentProject(updatedProject); + } + + message.success('章节删除成功'); + } catch (error: any) { + message.error('删除章节失败:' + (error.message || '未知错误')); + } + }; + return (