684a6b53fac1e8c7801995a81630f006fbd29f7d
Implemented the node editor page with AI-powered link suggestions using vector similarity search. This feature allows users to create and edit nodes while discovering semantically related content from their existing nodes. **Node Editor Page** (`app/editor/[id]/page.tsx`): - Full-featured form with title and body fields using Mantine forms - Pre-fill support from query parameters (for AI chat redirects) - "Find Related" button to discover similar nodes via vector search - "Publish Node" button to save nodes to ATproto + SurrealDB - Real-time suggestions display with similarity scores - Mantine notifications for user feedback **Link Suggestion API** (`app/api/suggest-links/route.ts`): - Authenticates using SurrealDB JWT from cookies - Generates embeddings for draft text using Google AI (gemini-embedding-001) - Performs vector similarity search using SurrealDB's cosine similarity - Returns top 5 most similar nodes with scores - Enforces row-level security (users can only search their own nodes) - Comprehensive error handling with detailed logging **UI Enhancements** (`app/layout.tsx`): - Added @mantine/notifications package for toast notifications - Integrated Notifications component into root layout - Imported notifications styles for proper rendering **Testing** (`tests/magnitude/10-linking.mag.ts`): - Editor page rendering verification - Pre-filled form from query params test - Full publish workflow test (happy path) - Form validation test (unhappy path) **Technical Implementation**: - Vector embeddings: 768-dimension vectors from gemini-embedding-001 - Similarity metric: Cosine similarity via SurrealDB vector functions - Authentication: JWT-based with automatic row-level security - Error handling: Proper HTTP status codes and user notifications - Cookie domain: Uses 127.0.0.1 to match OAuth redirect URI **Note**: Tests may fail if GOOGLE_AI_API_KEY is invalid. Update the key in .env to enable full AI functionality. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Description
No description provided