Files
daily-paper/app/templates/detail.html
T

330 lines
11 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{% extends "base.html" %} {% block title %}{{ page_title }} — HF Daily Papers{%
endblock %} {% block content %}
<article class="paper-detail">
<a href="/day/{{ paper.paper_date.isoformat() }}" class="back-link"
>← 返回 {{ paper.paper_date.isoformat() }}</a
>
{# 标题 #}
<h1 class="detail-title">
{{ paper.title_zh or paper.title_en }} {% if paper.title_zh and
paper.title_en != paper.title_zh %}
<small class="title-en">{{ paper.title_en }}</small>
{% endif %}
</h1>
{# 元信息 #}
<div class="detail-meta">
<span class="detail-authors"
>{{ paper.authors|map(attribute='name')|join(', ') }}</span
>
<span class="detail-date"
>📅 {{ paper.published_at or paper.paper_date }}</span
>
<span class="detail-upvotes">👍 {{ paper.upvotes }}</span>
{% if paper.crawled_at %}
<span class="detail-upvote-time" title="投票数据更新时间">{{ paper.crawled_at.strftime('%Y-%m-%d %H:%M') }}</span>
{% endif %}
</div>
{# 标签 #} {% if paper.tags %}
<div class="detail-tags">
{% for tag in paper.tags %}
<span class="tag">{{ tag.tag }}</span>
{% endfor %}
</div>
{% endif %} {# 链接 #}
<div class="detail-links">
{% if paper.arxiv_url %}<a
href="{{ paper.arxiv_url }}"
target="_blank"
class="ext-link"
>arXiv</a
>{% endif %} {% if paper.hf_url %}<a
href="{{ paper.hf_url }}"
target="_blank"
class="ext-link"
>HuggingFace</a
>{% endif %} {% if paper.pdf_url %}<a
href="{{ paper.pdf_url }}"
target="_blank"
class="ext-link"
>PDF</a
>{% endif %}
</div>
{# 总结内容 — 按状态降级 #} {% if summary_state == 'done' and paper.summary %}
{% if paper.summary_status and paper.summary_status.quality == 'low' %}
<div class="quality-warning">⚠️ AI 总结质量较低,仅供参考</div>
{% elif paper.summary_status and paper.summary_status.quality == 'degraded' %}
<div class="quality-warning">📝 总结部分字段不完整</div>
{% endif %} {% if paper.summary.one_line %}
<section class="summary-section">
<p class="one-line">{{ paper.summary.one_line | safe }}</p>
</section>
{% endif %}
{# ── 前置知识 ── #}
{% if prereqs and prereqs.concepts %}
<section class="summary-section">
<h2>前置知识</h2>
<div class="prerequisites-list">
{% for c in prereqs.concepts %}
<div class="concept-card">
<h3>{{ c.term }}</h3>
<p>{{ c.explanation | safe }}</p>
{% if c.why_matters %}
<p class="concept-why">{{ c.why_matters | safe }}</p>
{% endif %}
</div>
{% endfor %}
</div>
</section>
{% endif %}
{# ── 研究动机 ── #}
{% if paper.summary.motivation_problem %}
<section class="summary-section">
<h2>研究动机</h2>
<div class="motivation-block">
{% if paper.summary.motivation_problem %}
<p>{{ paper.summary.motivation_problem | safe }}</p>
{% endif %}
{% if paper.summary.motivation_goal %}
<p>本文的目标是{{ paper.summary.motivation_goal | safe }}</p>
{% endif %}
{% if paper.summary.motivation_gap %}
<p>与已有工作不同的是,{{ paper.summary.motivation_gap | safe }}</p>
{% endif %}
</div>
</section>
{% endif %}
{# ── 核心方法 ── #}
{% if paper.summary.method_key_idea %}
<section class="summary-section">
<h2>核心方法</h2>
{% if paper.summary.method_overview %}
<p>{{ paper.summary.method_overview | safe }}</p>
{% endif %}
<div class="key-idea">
<p>{{ paper.summary.method_key_idea | safe }}</p>
</div>
{% if paper.summary.method_steps_json %}
<details>
<summary>方法步骤详情</summary>
<p>{{ paper.summary.method_steps_json | safe }}</p>
</details>
{% endif %}
{% if paper.summary.method_novelty %}
<details>
<summary>技术新颖性</summary>
<p>{{ paper.summary.method_novelty | safe }}</p>
</details>
{% endif %}
{% if method_figures and method_figures|length > 0 %}
{% for fig in method_figures %}
<figure class="inline-figure">
<img src="{{ fig.image_url }}" alt="{{ fig.caption or fig.id }}" loading="lazy" />
<figcaption>
<strong>{{ fig.id }}</strong>{% if fig.caption %}: {{ fig.caption }}{% endif %}
</figcaption>
</figure>
{% endfor %}
{% endif %}
</section>
{% endif %}
{# ── 实验结果 ── #}
{% if paper.summary.results_main_json %}
<section class="summary-section">
<h2>实验结果</h2>
<p>{{ paper.summary.results_main_json | safe }}</p>
{% if (table_figures and table_figures|length > 0) or (results_figures and results_figures|length > 0) %}
{# 展示表格截图 + 实验结果图 #}
{% for tf in table_figures %}
<figure class="inline-figure table-screenshot">
<img src="{{ tf.image_url }}" alt="{{ tf.caption or tf.id }}" loading="lazy" />
<figcaption>
<strong>{{ tf.id }}</strong>{% if tf.caption %}: {{ tf.caption }}{% endif %}
</figcaption>
</figure>
{% endfor %}
{% for fig in results_figures %}
<figure class="inline-figure">
<img src="{{ fig.image_url }}" alt="{{ fig.caption or fig.id }}" loading="lazy" />
<figcaption>
<strong>{{ fig.id }}</strong>{% if fig.caption %}: {{ fig.caption }}{% endif %}
</figcaption>
</figure>
{% endfor %}
{% if benchmarks and benchmarks|length > 0 %}
<details>
<summary>查看结构化数据</summary>
<table class="benchmarks-table">
<thead>
<tr><th>任务</th><th>指标</th><th>本文</th><th>基线</th><th>提升</th></tr>
</thead>
<tbody>
{% for b in benchmarks %}
{% if b is mapping %}
<tr>
<td>{{ b.get('task','') }}</td>
<td>{{ b.get('metric','') }}</td>
<td><strong>{{ b.get('this_work','') }}</strong></td>
<td>{{ b.get('baseline','') }}</td>
<td class="improvement">{{ b.get('improvement','') }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
</details>
{% endif %}
{% elif benchmarks and benchmarks|length > 0 %}
{# 无截图时回退到 HTML 表格 #}
<table class="benchmarks-table">
<thead>
<tr><th>任务</th><th>指标</th><th>本文</th><th>基线</th><th>提升</th></tr>
</thead>
<tbody>
{% for b in benchmarks %}
{% if b is mapping %}
<tr>
<td>{{ b.get('task','') }}</td>
<td>{{ b.get('metric','') }}</td>
<td><strong>{{ b.get('this_work','') }}</strong></td>
<td>{{ b.get('baseline','') }}</td>
<td class="improvement">{{ b.get('improvement','') }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
{% endif %}
</section>
{% endif %}
{# ── 局限与改进 ── #}
{% if paper.summary.limitations_json or paper.summary.weaknesses_json or paper.summary.future_work_json %}
<section class="summary-section">
<h2>局限与改进</h2>
{% if paper.summary.limitations_json %}
<p>{{ paper.summary.limitations_json | safe }}</p>
{% endif %}
{% if paper.summary.weaknesses_json %}
<details>
<summary>独立分析的弱点</summary>
<p>{{ paper.summary.weaknesses_json | safe }}</p>
</details>
{% endif %}
{% if paper.summary.future_work_json %}
<details>
<summary>未来方向</summary>
<p>{{ paper.summary.future_work_json | safe }}</p>
</details>
{% endif %}
{% if paper.summary.reproducibility %}
<details>
<summary>复现评估</summary>
<p>{{ paper.summary.reproducibility | safe }}</p>
</details>
{% endif %}
</section>
{% endif %} {% elif summary_state == 'processing' %}
<div class="summary-placeholder processing">
<p>🔄 正在生成 AI 总结,请稍后刷新页面</p>
</div>
{% elif summary_state in ('failed', 'permanent_failure') %}
<div class="summary-placeholder failed">
<p>
❌ 总结生成失败{% if paper.summary_status and
paper.summary_status.error_type %}{{ paper.summary_status.error_type
}}{% endif %}
</p>
{% if paper.summary_status and paper.summary_status.error %}
<p class="error-detail">{{ paper.summary_status.error }}</p>
{% endif %}
</div>
{% else %}
<div class="summary-placeholder none">
<p>📝 AI 总结尚未生成</p>
</div>
{% endif %} {# 英文摘要 — 始终显示 #} {% if paper.abstract %}
<section class="summary-section abstract-section">
<h2>Abstract</h2>
<p class="abstract-en">{{ paper.abstract }}</p>
</section>
{% endif %}
{# ── 论文图表(关联 figures 元数据)── #}
{% if figures or paper_images %}
<section class="image-gallery">
<h2>论文图表</h2>
{% for fig in figures %}
<figure class="inline-figure">
{% if fig.image_url %}
<img src="{{ fig.image_url }}" alt="{{ fig.caption or fig.id }}" loading="lazy" />
{% endif %}
<figcaption>
<strong>{{ fig.id }}</strong>{% if fig.caption %}: {{ fig.caption }}{% endif %}
{% if fig.description %}
<p>{{ fig.description }}</p>
{% endif %}
{% if fig.reason %}
<p class="concept-why">{{ fig.reason }}</p>
{% endif %}
</figcaption>
</figure>
{% endfor %}
{# 如果有图片但没有对应的 figures 元数据,仍然展示 #}
{% if not figures and paper_images %}
<div class="gallery-grid">
{% for img in paper_images %}
<div class="gallery-item">
<img src="{{ img.url }}" alt="{{ img.name }}" loading="lazy" />
<div class="gallery-caption">{{ img.name }}</div>
</div>
{% endfor %}
</div>
{% endif %}
</section>
{% endif %} {% if similar_papers %}
<section class="similar-papers">
<h2>相似论文推荐</h2>
{% for sp in similar_papers %}
<div class="similar-paper-item">
<span class="similar-paper-title">
<a href="/paper/{{ sp.arxiv_id }}">{{ sp.title_zh }}</a>
</span>
<span class="similar-paper-dist"
>🎯 {{ "%.3f"|format(sp.distance) }}</span
>
</div>
{% endfor %}
</section>
{% endif %}
</article>
{% endblock %}
{% block scripts %}
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function () {
if (typeof renderMathInElement === 'function') {
renderMathInElement(document.querySelector('.paper-detail'), {
delimiters: [
{ left: '$$', right: '$$', display: true },
{ left: '$', right: '$', display: false }
],
throwOnError: false
});
}
});
</script>
<script src="/static/js/lightbox.js"></script>
{% endblock %}