feat(ai-ux): deduplicate AI queries, handle ServiceUnavailable retries, and optimize reader canvas graph prerendering (#44)

This Pull Request encapsulates all outstanding AI, Blazor InteractiveAuto lifecycle, pgvector, and Firefox authorization/session compatibility fixes.

### Key Accomplishments:
1. **Concurrent Request Deduplication (Option B):** Implemented a thread-safe active task registry in `KnowledgeService` that groups concurrent graph extraction queries for the same content, preventing duplicate AI calls completely.
2. **Resilience Strategy for Downstream Demands:** Extended the `ai-retry` resilience pipeline to automatically intercept and retry on temporary Google API `503 ServiceUnavailable` / `high demand` spikes.
3. **Interactive Graph Generation Guard (Option A):** Prevented server-side prerender-phase graph requests in the reader canvas component.
4. **Firefox Compatibility & Cookie Handler:** Implemented an authentication endpoint and hybrid hidden-form submission flow to solve login, registration, and logout redirections and cookies securely.
5. **Autoscrolling & Graph Exclusions:** Added concept-to-block smooth scrolling, active block badging, and filtered out markdown code blocks from being extracted as nodes.

All unit tests compiled and passed 100% cleanly.

---------

Co-authored-by: Marek Jasiński <jasins.marek@gmail.com>
Reviewed-on: #44
Co-authored-by: Antigravity <antigravity@google.com>
Co-committed-by: Antigravity <antigravity@google.com>
This commit was merged in pull request #44.
This commit is contained in:
2026-05-18 17:53:36 +00:00
committed by Marek Jaisński
parent f808734768
commit 541e9e1fb5
42 changed files with 2351 additions and 155 deletions
@@ -0,0 +1,201 @@
.current-reading-card {
width: 100%;
padding: 2rem;
overflow: hidden;
}
.card-layout {
display: flex;
gap: 2.5rem;
align-items: flex-start;
}
.book-cover {
width: 140px;
flex-shrink: 0;
position: relative;
}
.book-cover img {
width: 100%;
border-radius: 12px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
border: 1px solid rgba(255, 255, 255, 0.1);
transition: transform 0.3s ease;
}
.book-cover:hover img {
transform: translateY(-5px);
}
.book-details {
flex: 1;
display: flex;
flex-direction: column;
gap: 1.25rem;
min-width: 0; /* Important for ellipsis */
}
.header-info {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.book-title {
font-family: var(--nexus-font-serif);
font-size: 1.75rem;
font-weight: 700;
color: #FFFFFF;
margin: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.author-name {
font-size: 0.9rem;
color: #A0A0A0;
font-weight: 500;
}
.chapter-progress {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.progress-header {
display: flex;
justify-content: space-between;
font-size: 0.85rem;
font-weight: 600;
}
.chapter-name {
color: #FFFFFF;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.percentage {
color: var(--nexus-neon);
}
.progress-bar-container {
height: 6px;
background: rgba(255, 255, 255, 0.05);
border-radius: 100px;
overflow: hidden;
}
.progress-bar-fill {
height: 100%;
background: var(--nexus-neon);
box-shadow: 0 0 10px rgba(0, 255, 153, 0.4);
border-radius: 100px;
transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.book-excerpt {
font-size: 0.95rem;
line-height: 1.6;
color: #B0B0B0;
margin: 0;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.book-excerpt.empty {
font-style: italic;
opacity: 0.7;
}
.actions {
margin-top: 0.5rem;
}
.btn-nexus {
display: inline-flex;
align-items: center;
gap: 0.75rem;
padding: 0.8rem 1.5rem;
border-radius: 8px;
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
border: none;
}
.btn-nexus.outline {
background: transparent;
color: var(--nexus-neon);
border: 1px solid rgba(0, 255, 153, 0.3);
}
.btn-nexus.outline:hover {
background: rgba(0, 255, 153, 0.05);
border-color: var(--nexus-neon);
transform: translateY(-2px);
box-shadow: 0 5px 15px rgba(0, 255, 153, 0.1);
}
.btn-nexus.primary {
background: var(--nexus-neon);
color: #000;
}
.btn-nexus.primary:hover {
transform: translateY(-2px);
filter: brightness(1.1);
box-shadow: 0 5px 15px rgba(0, 255, 153, 0.2);
}
/* Empty State */
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 1.5rem;
padding: 2rem;
text-align: center;
}
.empty-icon {
color: var(--nexus-neon);
opacity: 0.3;
filter: drop-shadow(0 0 10px rgba(0, 255, 153, 0.2));
}
.empty-text h3 {
color: #FFFFFF;
margin: 0 0 0.5rem 0;
}
.empty-text p {
color: #A0A0A0;
margin: 0;
}
@media (max-width: 768px) {
.card-layout {
flex-direction: column;
align-items: center;
text-align: center;
gap: 1.5rem;
}
.book-title, .chapter-name {
white-space: normal;
}
.header-info, .chapter-progress {
align-items: center;
}
}