fix(detail): 中文源头 RSS 文章不显示译文板块
之前 commit 3/4 只针对 is_short_news 隐藏译文,
中文 RSS 长新闻(原文就是中文)走的是 TMT 中翻中,
详情页仍显示"文章译文"和"文章原文"两个冗余板块。
新规则:isChineseSource = isShort || lang_src.startsWith('zh')
- 短新闻 -> 显示"短讯正文"卡(原有)
- 中文 RSS 长新闻 -> 显示"文章正文"卡(新增,只一张卡,无译文)
- 其他长新闻 -> 显示"文章译文" + 可切换"文章原文"(原有)
隐藏规则(对所有中文源头):
- 翻译状态/引擎 tag
- 重译按钮(commit 4 的 guard 已拒绝;前端再次隐藏)
- 原文链接按钮
- AI 插图卡片(中文源头不需配图)
- "文章原文"卡片(在"文章正文"已经显示了)
后端不拦截(中翻中不出错,只是浪费一点配额) --
影响:腾讯 TMT 月配额可能略快用完,可下次单独优化
(在 translation_loop 加 lang_src=zh 跳过)。
范围:仅 ArticleDetail.vue 一个文件,+25/-6 行。
This commit is contained in:
@@ -167,6 +167,16 @@ const originalBody = computed(() => {
|
||||
// - 隐藏"原文链接"(合成 url,打开无意义)
|
||||
const isShort = computed(() => !!article.value?.is_short_news)
|
||||
|
||||
// 中文源头 = 短新闻 OR lang_src 以 zh 开头(中文 RSS 源,原文就是中文)
|
||||
// 中文源头的文章不显示"译文"板块(原文本就是中文,翻译无意义);
|
||||
// 后端不做拦截(中翻中虽然浪费配额但不出错),仅前端隐藏。
|
||||
const isChineseSource = computed(() => {
|
||||
if (!article.value) return false
|
||||
if (isShort.value) return true
|
||||
const lang = (article.value.lang_src || '').toLowerCase()
|
||||
return lang.startsWith('zh')
|
||||
})
|
||||
|
||||
// 短新闻正文:用 body_zh_text(ingest 时已 = body_text),按段落切分
|
||||
const shortBody = computed(() => {
|
||||
const a = article.value
|
||||
@@ -229,10 +239,10 @@ onMounted(load)
|
||||
<NTag v-if="article.lang_src" :bordered="false" round>{{ article.lang_src.toUpperCase() }}</NTag>
|
||||
<NTag v-if="isShort" type="info" :bordered="false" round>📰 短讯</NTag>
|
||||
<NTag v-if="article.source_ref" :bordered="false" round>{{ article.source_ref }}</NTag>
|
||||
<NTag v-if="!isShort && article.translation_status !== 'ok'" size="small" type="warning" :bordered="false" round>
|
||||
<NTag v-if="!isChineseSource && article.translation_status !== 'ok'" size="small" type="warning" :bordered="false" round>
|
||||
翻译:{{ article.translation_status }}
|
||||
</NTag>
|
||||
<NTag v-if="!isShort && article.translation_engine" size="small" :bordered="false" round>
|
||||
<NTag v-if="!isChineseSource && article.translation_engine" size="small" :bordered="false" round>
|
||||
{{ article.translation_engine }}
|
||||
</NTag>
|
||||
<NTag v-for="c in categories" :key="c" type="success" size="small" :bordered="false" round>
|
||||
@@ -283,13 +293,13 @@ onMounted(load)
|
||||
<NButton text @click="showTranslation = !showTranslation" round>
|
||||
{{ showTranslation ? '隐藏译文' : '显示译文' }}
|
||||
</NButton>
|
||||
<NButton v-if="isOwner && !isShort" type="error" ghost @click="rerunTranslation" round>
|
||||
<NButton v-if="isOwner && !isChineseSource" type="error" ghost @click="rerunTranslation" round>
|
||||
重译
|
||||
</NButton>
|
||||
<NButton v-if="isOwner" type="info" ghost :loading="enriching" @click="triggerEnrich" round>
|
||||
跑 LLM 增强
|
||||
</NButton>
|
||||
<NButton v-if="!isShort" tag="a" :href="article.url" target="_blank" rel="noopener" ghost round>
|
||||
<NButton v-if="!isChineseSource" tag="a" :href="article.url" target="_blank" rel="noopener" ghost round>
|
||||
原文链接 ↗
|
||||
</NButton>
|
||||
</NSpace>
|
||||
@@ -418,6 +428,15 @@ onMounted(load)
|
||||
<NText v-else :depth="3">暂无正文</NText>
|
||||
</NCard>
|
||||
|
||||
<!-- 2) 中文 RSS 长新闻(原文就是中文,跳过译文板块;只显示原文) -->
|
||||
<NCard v-else-if="isChineseSource && !isShort" class="detail-card" style="margin-top: 16px">
|
||||
<template #header>
|
||||
<span class="card-header-title">📄 文章正文</span>
|
||||
</template>
|
||||
<div v-if="originalBody" class="article-body-fallback" v-html="originalBody" />
|
||||
<NText v-else :depth="3">暂无正文</NText>
|
||||
</NCard>
|
||||
|
||||
<!-- 2) 译文(长新闻,优先 LLM 排版版) -->
|
||||
<div v-else-if="showTranslation" style="margin-top: 16px">
|
||||
<NCard v-if="article.body_zh_formatted" class="detail-card">
|
||||
@@ -448,7 +467,7 @@ onMounted(load)
|
||||
</div>
|
||||
|
||||
<!-- AI 插图(长新闻) -->
|
||||
<NCard v-if="!isShort && article.image_ai_url" class="detail-card" style="margin-top: 16px">
|
||||
<NCard v-if="!isChineseSource && article.image_ai_url" class="detail-card" style="margin-top: 16px">
|
||||
<template #header>
|
||||
<span class="card-header-title">🎨 AI 插图</span>
|
||||
</template>
|
||||
@@ -456,7 +475,7 @@ onMounted(load)
|
||||
</NCard>
|
||||
|
||||
<!-- 3) 原文(长新闻) -->
|
||||
<div v-if="!isShort && showOriginal" style="margin-top: 16px">
|
||||
<div v-if="!isChineseSource && showOriginal" style="margin-top: 16px">
|
||||
<NCard class="detail-card">
|
||||
<template #header>
|
||||
<span class="card-header-title">📄 文章原文</span>
|
||||
|
||||
Reference in New Issue
Block a user