Skip to content

Research in Chat, Paywall Restructure#46

Merged
vishakh merged 6 commits into
mainfrom
feature/v4.1
Jun 12, 2026
Merged

Research in Chat, Paywall Restructure#46
vishakh merged 6 commits into
mainfrom
feature/v4.1

Conversation

@vishakh

@vishakh vishakh commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds an agentic Research feature to DNA Chat (premium gated)
  • Restructures the paywall: Health Insights Report is now free, Research in Chat is gated
  • Removes per-page Premium branding in favor of per-feature labeling
  • Improves the home page CTA and mobile nav legibility

Research pipeline (new)

lib/research-service.ts exports runResearchPipeline, an async generator that runs a three-phase pipeline:

  1. Keyword extraction — sends the user's query plus their personalization summary to the LLM and asks for 10 research angles (one keyword per line). The prompt explicitly prevents the model from anchoring on the user's health conditions unless the question is directly about those conditions.
  2. Sequential RAG + analysis — for each keyword, fetches up to 100 top results via getTopResultsByRelevance, then calls the LLM for a focused ~150-word analysis. Runs sequentially rather than in parallel to avoid nilAI 429 rate-limit cascades.
  3. Streaming synthesis — feeds all 10 analyses back to the LLM and streams a comprehensive 600-900 word answer. Yields chunks to the caller as they arrive.

The function accepts an onMeta callback that receives ResearchAngle[] (keyword + results count per angle) after the analysis phase, before synthesis begins.

DNA Chat integration (app/components/LLMChatInline.tsx):

  • handleResearch() calls requirePremium() (same gate pattern as Analyze reports) then streams from the pipeline into the assistant message bubble
  • buildUserContext() helper extracted from handleSendMessage and shared with handleResearch to avoid duplication
  • Message type gains researchMeta?: ResearchAngle[], used to render a collapsible "Researched N angles" panel below each research response
  • Research button sits next to Send in the input footer; both share isLoading so only one can run at a time
  • Loading status cycles through "Extracting research angles...", "Angle N/10: keyword...", "Synthesizing findings..."

Paywall restructure

Health Insights Report is now free. handleGenerateHealthReport no longer calls requirePremium().

Analyze page (app/overview-report/page.tsx):

  • Removed page-level "Premium" labeling from the h2 heading
  • Added per-report <span className="premium-tab-badge">Premium</span> to Healthspan, Top Traits, and Comprehensive Overview headings
  • PremiumFeatureHeader copy updated to reflect mixed free/premium content: "Health Insights is free. Healthspan, Top Traits, and Overview reports require a subscription."

DNA Chat page (app/dna-chat/page.tsx):

  • Added PremiumFeatureHeader with Research-specific gate copy: "Research requires a subscription."

PremiumFeatureHeader component:

  • Added optional gateTitle and gateDescription props so callers can override the default "premium tab" messaging without duplicating the component

MenuBar (app/components/MenuBar.tsx):

  • Removed nav-premium-link class and nav-premium-badge span from the Analyze link

NilAI consent modal removed

NilAIConsentModal is no longer shown before the first DNA Chat message. The consent gate has been replaced by the premium subscription check. All related state (showConsentModal, hasConsent, CONSENT_STORAGE_KEY), analytics calls (trackAIConsentGiven, trackAIConsentDeclined, trackAIConsentModalShown), and handler functions have been removed from LLMChatInline.


Home page CTA

app/landing-client.tsx:

  • "Try with sample data" button promoted from secondary-button to primary-button with larger padding
  • Added subheading: "Upload your DNA file or try it now with sample data, free."
  • Added reassurance copy below the button: "No DNA file needed. Your data never leaves your device."
  • Feature list entry for Analyze updated to note which reports are free vs. premium

Mobile nav legibility

  • getNavLinkStyle in MenuBar.tsx: inactive links bumped from fontWeight: 400 to 500; active from 600 to 700
  • Mobile CSS for .nav-link: font-size raised from 0.75rem to 0.875rem; font-weight: 500 added explicitly; horizontal padding increased slightly so links breathe without overflowing the row

@vishakh vishakh self-assigned this Jun 12, 2026
@vishakh vishakh added the enhancement New feature or request label Jun 12, 2026
@vishakh vishakh merged commit e8e7de2 into main Jun 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant