Skip to content

Add Cascade Prediction Feature #6

Open
rahulvalyu wants to merge 19 commits intounicodeveloper:mainfrom
rahulvalyu:main
Open

Add Cascade Prediction Feature #6
rahulvalyu wants to merge 19 commits intounicodeveloper:mainfrom
rahulvalyu:main

Conversation

@rahulvalyu
Copy link

Description:

Summary

  • Add AI-powered cascade prediction to analyze how geopolitical events ripple across regions
  • Visualize affected countries with probability-based markers and connection lines on the map
  • New sidebar panel showing cascade analysis results with impact details

Changes

  • New Zustand store for cascade state management
  • API endpoint integrating Valyu for geopolitical analysis
  • Cascade panel component displaying affected countries and probabilities
  • "Analyze Cascade Effects" button in event popups
  • Map visualization layers for cascade effects (lines, markers, labels)
  • Cascade tab in sidebar navigation

How to Test

  1. Click on any threat event marker on the map
  2. Click "Analyze Cascade Effects" button in the popup
  3. View the cascade visualization on the map and details in the Cascade tab

unicodeveloper and others added 18 commits January 23, 2026 18:54
- Add OAuth proxy route for authenticated API calls
- Update valyu.ts to support OAuth tokens with proxy fallback
- Add shared usage limits (5 event loads, 2 country clicks)
- Show sign-in modal when limits reached in valyu mode
- Self-hosted mode unchanged - uses API key with no limits
- Add loading time estimate to country conflicts modal
- Fix dialog header centering
- Update auth panel with globe icon

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rahulvalyu rahulvalyu closed this Jan 23, 2026
Comment on lines +168 to +169
console.error("Cascade analysis error:", error);
const errorMessage = error instanceof Error ? error.message : "Unknown error";
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably switch these around and log the errorMessage instead? I guess a mixture of both is fine.

Comment on lines 129 to 135
const requiresReauth = searchResultsArrays.some((r) => r.requiresReauth);
if (requiresReauth) {
return NextResponse.json(
{ error: "auth_error", message: "Session expired. Please sign in again.", requiresReauth: true },
{ status: 401 }
);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since requiresReauth isn't being used elsewhere you can place the .some statement inside of the if statement.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not return the response.status for a more preciese error code?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants