How syedamehakzahra/flyrank_capstone_sitepulseai works
SitePulse AI is a conversational website-metadata analyzer. A user enters or selects a URL; the chat page sends messages to the streaming API, which selects a free OpenRouter model and provides a server-side website-analysis tool. The tool fetches and extracts metadata, and the streamed tool result and assistant response are rendered in the chat. The graph preserves the documented analysis, fallback, and UI branches; some detailed wiring is supported only by README or SOURCE INDEX references, as noted by evidence paths.
Main entry points: page.jsx Chat page · route.js Streaming chat API · ChatInput.jsx URL input · WelcomeScreen.jsx Suggestions
Components 15
Chat interface
- Chat page
app/page.jsx - URL input
components/ChatInput.jsx - Suggestions
components/WelcomeScreen.jsx - Message renderer
components/ChatMessage.jsx - Analysis result card
components/ToolInvocation.jsx - Loading skeleton
components/ChatSkeleton.jsx - Error banner
components/ErrorBanner.jsx - Auto-scroll control
components/ScrollToBottomButton.jsx
Chat orchestration
- Streaming chat API
app/api/chat/route.js
Website analysis
- Metadata tool
lib/tools.js
Model and errors
- Model selection
lib/ai.js - Error classification
lib/errorMessages.js
Other components
- Visitor
- OpenRouter
- Target website
Connections 18
- Visitor → Chat page: uses
README.md - Chat page → URL input: renders
app/page.jsx - Chat page → Suggestions: renders
app/page.jsx - Suggestions → Chat page: sends suggestion
components/WelcomeScreen.jsx - URL input → Chat page: submits URL
app/page.jsx - Chat page → Streaming chat API: sends messages
app/page.jsx - Streaming chat API → Model selection: selects and falls back
app/api/chat/route.js - Model selection → OpenRouter: configures provider
lib/ai.js - Streaming chat API → OpenRouter: streams model response
README.md - Streaming chat API → Metadata tool: provides tool
app/api/chat/route.js - Metadata tool → Target website: fetches HTML
lib/tools.js - Chat page → Message renderer: renders messages
app/page.jsx - Message renderer → Analysis result card: renders tool parts
components/ChatMessage.jsx - Chat page → Loading skeleton: renders loading state
app/page.jsx - Chat page → Error banner: renders errors
app/page.jsx - Error banner → Error classification: classifies errors
components/ErrorBanner.jsx - Streaming chat API → Error classification: sanitizes errors
app/api/chat/route.js - Chat page → Auto-scroll control: controls scrolling
app/page.jsx