From 9ba895fa8dad4df8b72c2a81b0f812320e05dd3c Mon Sep 17 00:00:00 2001 From: userName Date: Sat, 6 Sep 2025 16:10:42 +0800 Subject: [PATCH 1/2] Fixed the problem of abnormal display of front-end page pictures in docker deployment --- .env.example | 24 ------------------- .../HomePage/components/MarkdownViewer.tsx | 13 +++++----- .../pages/HomePage/components/NoteHistory.tsx | 5 ++-- 3 files changed, 10 insertions(+), 32 deletions(-) delete mode 100644 .env.example diff --git a/.env.example b/.env.example deleted file mode 100644 index 4687929..0000000 --- a/.env.example +++ /dev/null @@ -1,24 +0,0 @@ -# 通用端口配置 -BACKEND_PORT=8483 # 后端端口 -FRONTEND_PORT=3015 -BACKEND_HOST=0.0.0.0 # 默认为 0.0.0.0,表示监听所有 IP 地址 不建议动 -APP_PORT= 3015 # docker 部署时用 -# 前端访问后端用 (开发环境使用) -VITE_API_BASE_URL=http://127.0.0.1:8483 -VITE_SCREENSHOT_BASE_URL=http://127.0.0.1:8483/static/screenshots -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 配置 -FFMPEG_BIN_PATH= - -# transcriber 相关配置 -TRANSCRIBER_TYPE=fast-whisper # fast-whisper/bcut/kuaishou/mlx-whisper(仅Apple平台)/groq -WHISPER_MODEL_SIZE=base - -GROQ_TRANSCRIBER_MODEL=whisper-large-v3-turbo # groq提供的faster-whisper 默认为 whisper-large-v3-turbo diff --git a/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx b/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx index 9c1e1f0..b61e916 100644 --- a/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx +++ b/BillNote_frontend/src/pages/HomePage/components/MarkdownViewer.tsx @@ -52,7 +52,8 @@ const MarkdownViewer: FC = ({ status }) => { const [modelName, setModelName] = useState('') const [style, setStyle] = useState('') const [createTime, setCreateTime] = useState('') - const baseURL = String(import.meta.env.VITE_API_BASE_URL).replace('/api','') || '' + // 确保baseURL没有尾部斜杠 + const baseURL = (String(import.meta.env.VITE_API_BASE_URL || '').replace('/api','') || '').replace(/\/$/, '') const getCurrentTask = useTaskStore.getState().getCurrentTask const currentTask = useTaskStore(state => state.getCurrentTask()) const taskStatus = currentTask?.status || 'PENDING' @@ -307,14 +308,14 @@ const MarkdownViewer: FC = ({ status }) => { // Enhanced image with zoom capability img: ({ node, ...props }) =>{ - - let src = baseURL +props.src + // Fix the URL by removing the 'undefined' prefix if it exists + let src = props.src + if (src.startsWith('/')) { + src = baseURL + src + } props.src = src - return( - -
= ({ onSelect, selectedId }) => { const tasks = useTaskStore(state => state.tasks) const removeTask = useTaskStore(state => state.removeTask) - const baseURL = import.meta.env.VITE_API_BASE_URL || 'api/' + // 确保baseURL没有尾部斜杠 + const baseURL = (String(import.meta.env.VITE_API_BASE_URL || 'api')).replace(/\/$/, '') const [rawSearch, setRawSearch] = useState('') const [search, setSearch] = useState('') const fuse = new Fuse(tasks, { @@ -101,7 +102,7 @@ const NoteHistory: FC = ({ onSelect, selectedId }) => { src={ task.audioMeta.cover_url - ? baseURL+`/image_proxy?url=${encodeURIComponent(task.audioMeta.cover_url)}` + ? `${baseURL}/image_proxy?url=${encodeURIComponent(task.audioMeta.cover_url)}` : '/placeholder.png' } alt="封面" From 6e385b8d7592bdaebaff9503c945bd8e5b6a95b7 Mon Sep 17 00:00:00 2001 From: userName Date: Sat, 6 Sep 2025 16:17:32 +0800 Subject: [PATCH 2/2] Fixed the problem of abnormal display of front-end page pictures in docker deployment --- .env.example | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..4687929 --- /dev/null +++ b/.env.example @@ -0,0 +1,24 @@ +# 通用端口配置 +BACKEND_PORT=8483 # 后端端口 +FRONTEND_PORT=3015 +BACKEND_HOST=0.0.0.0 # 默认为 0.0.0.0,表示监听所有 IP 地址 不建议动 +APP_PORT= 3015 # docker 部署时用 +# 前端访问后端用 (开发环境使用) +VITE_API_BASE_URL=http://127.0.0.1:8483 +VITE_SCREENSHOT_BASE_URL=http://127.0.0.1:8483/static/screenshots +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 配置 +FFMPEG_BIN_PATH= + +# transcriber 相关配置 +TRANSCRIBER_TYPE=fast-whisper # fast-whisper/bcut/kuaishou/mlx-whisper(仅Apple平台)/groq +WHISPER_MODEL_SIZE=base + +GROQ_TRANSCRIBER_MODEL=whisper-large-v3-turbo # groq提供的faster-whisper 默认为 whisper-large-v3-turbo