fix(ui): 修复 Banner 封面图不显示

MarkdownViewer 的 baseURL 去掉了 /api 前缀,导致
image_proxy 请求路径错误。改为组件内部直接读取
VITE_API_BASE_URL,与 NoteHistory 保持一致。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
huangjianwu
2026-03-23 15:59:02 +08:00
parent c46c971e64
commit 795615f0f7
2 changed files with 3 additions and 4 deletions

View File

@@ -233,7 +233,6 @@ const MarkdownViewer: FC<MarkdownViewerProps> = ({ status }) => {
<VideoBanner
audioMeta={currentTask?.audioMeta}
videoUrl={currentTask?.formData?.video_url}
baseURL={baseURL}
/>
</div>
<div className={'markdown-body w-full px-2'}>

View File

@@ -4,7 +4,6 @@ import type { AudioMeta } from '@/store/taskStore'
interface VideoBannerProps {
audioMeta?: AudioMeta
videoUrl?: string
baseURL?: string
}
/** 平台 label 映射 */
@@ -15,13 +14,14 @@ const platformLabel: Record<string, string> = {
xiaohongshu: '小红书',
}
export default function VideoBanner({ audioMeta, videoUrl, baseURL = '' }: VideoBannerProps) {
export default function VideoBanner({ audioMeta, videoUrl }: VideoBannerProps) {
if (!audioMeta) return null
const rawCover = audioMeta.cover_url
// 通过后端代理加载封面,避免跨域/Referrer 限制
const apiBase = String(import.meta.env.VITE_API_BASE_URL || 'api').replace(/\/$/, '')
const coverUrl = rawCover
? `${baseURL}/image_proxy?url=${encodeURIComponent(rawCover)}`
? `${apiBase}/image_proxy?url=${encodeURIComponent(rawCover)}`
: ''
const title = audioMeta.title
const uploader = audioMeta.raw_info?.uploader || ''