Add author detail, idea detail, and gap-draft reverse link pages
- Author detail page (/authors/<person_id>): shows author info, all drafts with ratings, and co-authors with shared draft counts. Public route. - Idea detail page (/ideas/<idea_id>): shows idea metadata, source draft, and top-5 most similar ideas via embedding cosine similarity. Admin route. - Gap detail page: added "Related Drafts" section that finds drafts by extracting draft names from evidence text and searching by topic keywords. - Updated author links across templates to use /authors/<person_id> URLs. - Added DB methods: get_author_by_id, get_author_drafts, get_coauthors. - Extended top_authors to include person_id (5th tuple element). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
111
src/webui/templates/author_detail.html
Normal file
111
src/webui/templates/author_detail.html
Normal file
@@ -0,0 +1,111 @@
|
||||
{% extends "base.html" %}
|
||||
{% set active_page = "authors" %}
|
||||
|
||||
{% block title %}{{ author.name }} — IETF Draft Analyzer{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Breadcrumb -->
|
||||
<div class="mb-6">
|
||||
<a href="/authors" class="inline-flex items-center gap-1.5 text-sm text-slate-500 hover:text-slate-300 transition group">
|
||||
<svg class="w-4 h-4 group-hover:-translate-x-0.5 transition-transform" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7"/>
|
||||
</svg>
|
||||
Back to Authors
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Author Header -->
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-6 mb-6">
|
||||
<div class="flex items-start gap-4">
|
||||
<div class="w-14 h-14 rounded-full bg-slate-800 border border-slate-700 flex items-center justify-center flex-shrink-0">
|
||||
<span class="text-xl font-bold text-slate-400">{{ author.name[0]|upper if author.name else '?' }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-white">{{ author.name }}</h1>
|
||||
{% if author.affiliation %}
|
||||
<p class="text-sm text-slate-400 mt-1">{{ author.affiliation }}</p>
|
||||
{% endif %}
|
||||
<div class="flex items-center gap-4 mt-3">
|
||||
<span class="text-xs text-slate-500">{{ author.drafts|length }} draft{{ 's' if author.drafts|length != 1 }}</span>
|
||||
<span class="text-xs text-slate-500">{{ author.coauthors|length }} co-author{{ 's' if author.coauthors|length != 1 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
||||
<!-- Left column: Drafts -->
|
||||
<div class="lg:col-span-2 space-y-6">
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-6">
|
||||
<h2 class="text-sm font-semibold text-slate-300 mb-4 flex items-center gap-2">
|
||||
<svg class="w-4 h-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
||||
Authored Drafts <span class="text-slate-600 font-normal">({{ author.drafts|length }})</span>
|
||||
</h2>
|
||||
<div class="space-y-3">
|
||||
{% for d in author.drafts %}
|
||||
<a href="/drafts/{{ d.name }}" class="block bg-slate-800/30 rounded-lg border border-slate-800/50 hover:border-slate-700 p-4 transition group">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-sm font-medium text-slate-200 group-hover:text-blue-400 transition truncate">{{ d.title }}</h3>
|
||||
<div class="flex items-center gap-2 mt-1">
|
||||
<span class="text-xs text-slate-500 font-mono">{{ d.name }}</span>
|
||||
{% if d.date %}
|
||||
<span class="text-xs text-slate-600">{{ d.date }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if d.categories %}
|
||||
<div class="flex flex-wrap gap-1 mt-2">
|
||||
{% for cat in d.categories[:3] %}
|
||||
<span class="px-2 py-0.5 rounded-full text-[10px] bg-slate-800/60 text-slate-400 border border-slate-700">{{ cat }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if d.score is not none %}
|
||||
<span class="flex-shrink-0 px-2 py-1 rounded text-sm font-bold
|
||||
{% if d.score >= 3.5 %}text-green-400
|
||||
{% elif d.score >= 2.5 %}text-amber-400
|
||||
{% else %}text-red-400{% endif %}">
|
||||
{{ d.score }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
{% if not author.drafts %}
|
||||
<p class="text-sm text-slate-500">No drafts found.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Right column: Co-authors -->
|
||||
<div class="space-y-6">
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-5">
|
||||
<h2 class="text-sm font-semibold text-slate-300 mb-3 flex items-center gap-2">
|
||||
<svg class="w-4 h-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0z"/></svg>
|
||||
Co-Authors <span class="text-slate-600 font-normal">({{ author.coauthors|length }})</span>
|
||||
</h2>
|
||||
<ul class="space-y-2.5">
|
||||
{% for ca in author.coauthors %}
|
||||
<li class="flex items-start gap-2">
|
||||
<div class="w-7 h-7 rounded-full bg-slate-800 border border-slate-700 flex items-center justify-center flex-shrink-0 mt-0.5">
|
||||
<span class="text-xs font-semibold text-slate-400">{{ ca.name[0]|upper if ca.name else '?' }}</span>
|
||||
</div>
|
||||
<div class="min-w-0">
|
||||
<a href="/authors/{{ ca.person_id }}" class="text-sm text-blue-400 hover:text-blue-300 transition">{{ ca.name }}</a>
|
||||
{% if ca.affiliation %}
|
||||
<div class="text-xs text-slate-500 truncate">{{ ca.affiliation }}</div>
|
||||
{% endif %}
|
||||
<div class="text-[10px] text-slate-600">{{ ca.shared_drafts }} shared draft{{ 's' if ca.shared_drafts != 1 }}</div>
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
{% if not author.coauthors %}
|
||||
<p class="text-sm text-slate-500">No co-authors found.</p>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -211,7 +211,7 @@
|
||||
<tr class="hover:bg-slate-800/50 transition author-row" data-name="{{ a.name }}" data-org="{{ a.affiliation }}" data-count="{{ a.draft_count }}">
|
||||
<td class="px-4 py-2.5 text-slate-500 text-xs">{{ loop.index }}</td>
|
||||
<td class="px-4 py-2.5">
|
||||
<a href="/drafts?q={{ a.name | urlencode }}" class="text-blue-400 hover:text-blue-300 transition">{{ a.name }}</a>
|
||||
<a href="/authors/{{ a.person_id }}" class="text-blue-400 hover:text-blue-300 transition">{{ a.name }}</a>
|
||||
</td>
|
||||
<td class="px-4 py-2.5 text-slate-500 text-xs truncate max-w-[200px]" title="{{ a.affiliation }}">{{ a.affiliation }}</td>
|
||||
<td class="px-4 py-2.5 text-right">
|
||||
|
||||
@@ -331,7 +331,7 @@
|
||||
<span class="text-xs font-semibold text-slate-400">{{ a.name[0]|upper if a.name else '?' }}</span>
|
||||
</div>
|
||||
<div>
|
||||
<a href="/drafts?q={{ a.name | urlencode }}" class="text-sm text-blue-400 hover:text-blue-300 transition">{{ a.name }}</a>
|
||||
<a href="/authors/{{ a.person_id }}" class="text-sm text-blue-400 hover:text-blue-300 transition">{{ a.name }}</a>
|
||||
{% if a.affiliation %}
|
||||
<div class="text-xs text-slate-500">{{ a.affiliation }}</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -86,6 +86,51 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Related Drafts -->
|
||||
{% if related_drafts %}
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-6 mb-6">
|
||||
<h2 class="text-lg font-semibold text-white mb-4 flex items-center gap-2">
|
||||
<svg class="w-5 h-5 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
|
||||
Related Drafts <span class="text-sm text-slate-500 font-normal">({{ related_drafts|length }})</span>
|
||||
</h2>
|
||||
<div class="space-y-3">
|
||||
{% for d in related_drafts[:15] %}
|
||||
<a href="/drafts/{{ d.name }}" class="block bg-slate-800/50 rounded-lg border border-slate-700 hover:border-slate-600 p-4 transition group">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-sm font-semibold text-white group-hover:text-blue-400 transition truncate">{{ d.title }}</h3>
|
||||
<div class="flex items-center gap-2 mt-1">
|
||||
<span class="text-xs text-slate-500 font-mono">{{ d.name }}</span>
|
||||
{% if d.date %}
|
||||
<span class="text-xs text-slate-600">{{ d.date }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if d.categories %}
|
||||
<div class="flex flex-wrap gap-1 mt-2">
|
||||
{% for cat in d.categories[:3] %}
|
||||
<span class="px-2 py-0.5 rounded-full text-[10px] bg-slate-700/60 text-slate-400 border border-slate-600">{{ cat }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if d.score is not none %}
|
||||
<span class="flex-shrink-0 px-2 py-1 rounded text-sm font-bold
|
||||
{% if d.score >= 3.5 %}text-green-400
|
||||
{% elif d.score >= 2.5 %}text-amber-400
|
||||
{% else %}text-red-400{% endif %}">
|
||||
{{ d.score }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if related_drafts|length > 15 %}
|
||||
<p class="text-xs text-slate-500 mt-3">Showing 15 of {{ related_drafts|length }} related drafts.</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Linked Proposals -->
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-6 mb-6">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
|
||||
123
src/webui/templates/idea_detail.html
Normal file
123
src/webui/templates/idea_detail.html
Normal file
@@ -0,0 +1,123 @@
|
||||
{% extends "base.html" %}
|
||||
{% set active_page = "ideas" %}
|
||||
|
||||
{% block title %}{{ idea.title }} — Idea Detail{% endblock %}
|
||||
|
||||
{% block extra_head %}
|
||||
<style>
|
||||
.idea-type-protocol { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); }
|
||||
.idea-type-mechanism { background: rgba(168, 85, 247, 0.15); color: #c084fc; border-color: rgba(168, 85, 247, 0.3); }
|
||||
.idea-type-framework { background: rgba(34, 197, 94, 0.15); color: #4ade80; border-color: rgba(34, 197, 94, 0.3); }
|
||||
.idea-type-architecture { background: rgba(234, 179, 8, 0.15); color: #facc15; border-color: rgba(234, 179, 8, 0.3); }
|
||||
.idea-type-default { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border-color: rgba(100, 116, 139, 0.3); }
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Breadcrumb -->
|
||||
<nav class="mb-6 text-sm">
|
||||
<a href="/idea-analysis" class="text-blue-400 hover:text-blue-300 transition">Idea Analysis</a>
|
||||
<span class="text-slate-600 mx-2">/</span>
|
||||
<span class="text-slate-400">{{ idea.title[:60] }}{% if idea.title|length > 60 %}...{% endif %}</span>
|
||||
</nav>
|
||||
|
||||
<!-- Idea Header -->
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-6 mb-6">
|
||||
<div class="flex items-start justify-between gap-4 mb-4">
|
||||
<h1 class="text-xl font-bold text-white">{{ idea.title }}</h1>
|
||||
<div class="flex items-center gap-2 flex-shrink-0">
|
||||
{% if idea.type %}
|
||||
{% set type_lower = idea.type|lower %}
|
||||
<span class="px-2.5 py-1 rounded-full text-xs font-medium border
|
||||
{% if type_lower == 'protocol' %}idea-type-protocol
|
||||
{% elif type_lower == 'mechanism' %}idea-type-mechanism
|
||||
{% elif type_lower == 'framework' %}idea-type-framework
|
||||
{% elif type_lower == 'architecture' %}idea-type-architecture
|
||||
{% else %}idea-type-default{% endif %}">
|
||||
{{ idea.type }}
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if idea.novelty_score is not none and idea.novelty_score %}
|
||||
<span class="px-2 py-1 rounded text-xs font-mono
|
||||
{% if idea.novelty_score >= 4 %}bg-green-500/20 text-green-400
|
||||
{% elif idea.novelty_score >= 3 %}bg-amber-500/20 text-amber-400
|
||||
{% elif idea.novelty_score >= 2 %}bg-orange-500/20 text-orange-400
|
||||
{% else %}bg-red-500/20 text-red-400{% endif %}"
|
||||
title="Novelty score">N:{{ idea.novelty_score }}</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if idea.description %}
|
||||
<div class="mb-4">
|
||||
<h3 class="text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2">Description</h3>
|
||||
<p class="text-sm text-slate-300 leading-relaxed">{{ idea.description }}</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Source Draft -->
|
||||
<div class="bg-slate-800/50 rounded-lg p-4">
|
||||
<h3 class="text-xs font-semibold text-slate-500 uppercase tracking-wider mb-2">Source Draft</h3>
|
||||
<a href="/drafts/{{ idea.draft_name }}" class="text-sm text-blue-400 hover:text-blue-300 transition">
|
||||
{{ idea.draft_title or idea.draft_name }}
|
||||
</a>
|
||||
<span class="text-xs text-slate-500 font-mono ml-2">{{ idea.draft_name }}</span>
|
||||
{% if idea.draft_date %}
|
||||
<span class="text-xs text-slate-600 ml-2">{{ idea.draft_date }}</span>
|
||||
{% endif %}
|
||||
{% if idea.categories %}
|
||||
<div class="flex flex-wrap gap-1 mt-2">
|
||||
{% for cat in idea.categories[:3] %}
|
||||
<span class="px-2 py-0.5 rounded-full text-[10px] bg-slate-700/60 text-slate-400 border border-slate-600">{{ cat }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Similar Ideas -->
|
||||
{% if idea.similar %}
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-6">
|
||||
<h2 class="text-sm font-semibold text-slate-300 mb-4 flex items-center gap-2">
|
||||
<svg class="w-4 h-4 text-slate-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"/></svg>
|
||||
Most Similar Ideas <span class="text-slate-600 font-normal">(by embedding cosine similarity)</span>
|
||||
</h2>
|
||||
<div class="space-y-3">
|
||||
{% for sim in idea.similar %}
|
||||
<a href="/ideas/{{ sim.id }}" class="block bg-slate-800/30 rounded-lg border border-slate-800/50 hover:border-slate-700 p-4 transition group">
|
||||
<div class="flex items-start justify-between gap-3">
|
||||
<div class="min-w-0">
|
||||
<h3 class="text-sm font-medium text-slate-200 group-hover:text-blue-400 transition">{{ sim.title }}</h3>
|
||||
<div class="flex items-center gap-2 mt-1">
|
||||
<span class="text-xs text-slate-500 font-mono">{{ sim.draft_name }}</span>
|
||||
{% if sim.type %}
|
||||
{% set st = sim.type|lower %}
|
||||
<span class="px-1.5 py-0.5 rounded-full text-[10px] font-medium border
|
||||
{% if st == 'protocol' %}idea-type-protocol
|
||||
{% elif st == 'mechanism' %}idea-type-mechanism
|
||||
{% elif st == 'framework' %}idea-type-framework
|
||||
{% elif st == 'architecture' %}idea-type-architecture
|
||||
{% else %}idea-type-default{% endif %}">
|
||||
{{ sim.type }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<span class="flex-shrink-0 px-2 py-1 rounded text-xs font-mono
|
||||
{% if sim.similarity >= 0.9 %}bg-green-500/20 text-green-400
|
||||
{% elif sim.similarity >= 0.8 %}bg-emerald-500/20 text-emerald-400
|
||||
{% elif sim.similarity >= 0.7 %}bg-amber-500/20 text-amber-400
|
||||
{% else %}bg-slate-500/20 text-slate-400{% endif %}"
|
||||
title="Cosine similarity">{{ sim.similarity }}</span>
|
||||
</div>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="bg-slate-900 rounded-xl border border-slate-800 p-6">
|
||||
<h2 class="text-sm font-semibold text-slate-300 mb-2">Similar Ideas</h2>
|
||||
<p class="text-sm text-slate-500">No embeddings available for this idea. Run the embedding pipeline to enable similarity search.</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user