From 8dc77dd8f7b17a11d0471ded83d26626dca6047b Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Mon, 19 May 2025 14:29:24 -0700 Subject: [PATCH] Really snazzy --- .../src/NewApp/Components/CandidateInfo.tsx | 15 +++--- frontend/src/NewApp/Pages/BetaPage.tsx | 9 ++-- frontend/src/NewApp/Pages/ChatPage.tsx | 50 ++++++++++--------- src/server.py | 1 + src/utils/defines.py | 2 +- src/utils/user.py | 2 +- 6 files changed, 44 insertions(+), 35 deletions(-) diff --git a/frontend/src/NewApp/Components/CandidateInfo.tsx b/frontend/src/NewApp/Components/CandidateInfo.tsx index 7b772d6..799642c 100644 --- a/frontend/src/NewApp/Components/CandidateInfo.tsx +++ b/frontend/src/NewApp/Components/CandidateInfo.tsx @@ -2,6 +2,7 @@ import React from 'react'; import { Box, Typography, Avatar, Paper, Grid, Chip } from '@mui/material'; import { styled } from '@mui/material/styles'; import { Tunables } from '../../Components/ChatQuery'; +import { Route, Routes, useLocation, useNavigate } from 'react-router-dom'; // Define the UserInfo interface for type safety interface UserInfo { @@ -33,12 +34,13 @@ const StyledPaper = styled(Paper)(({ theme }) => ({ })); const CandidateInfo: React.FC = ({ userInfo }) => { - // Format RAG content size (e.g., if it's in bytes, convert to KB/MB) - const formatRagSize = (size: number): string => { - if (size < 1000) return `${size} RAG elements`; - if (size < 1000000) return `${(size / 1000).toFixed(1)}K RAG elements`; - return `${(size / 1000000).toFixed(1)}M RAG elements`; - }; + const navigate = useNavigate(); + // Format RAG content size (e.g., if it's in bytes, convert to KB/MB) + const formatRagSize = (size: number): string => { + if (size < 1000) return `${size} RAG elements`; + if (size < 1000000) return `${(size / 1000).toFixed(1)}K RAG elements`; + return `${(size / 1000000).toFixed(1)}M RAG elements`; + }; return ( @@ -61,6 +63,7 @@ const CandidateInfo: React.FC = ({ userInfo }) => { {userInfo.full_name} navigate('/rag-visualizer')} label={formatRagSize(userInfo.rag_content_size)} color="primary" size="small" diff --git a/frontend/src/NewApp/Pages/BetaPage.tsx b/frontend/src/NewApp/Pages/BetaPage.tsx index ef7f31e..42bca0d 100644 --- a/frontend/src/NewApp/Pages/BetaPage.tsx +++ b/frontend/src/NewApp/Pages/BetaPage.tsx @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; +import { Route, Routes, useLocation, useNavigate } from 'react-router-dom'; import { Box, Container, @@ -13,6 +14,7 @@ import { import { useTheme } from '@mui/material/styles'; import ConstructionIcon from '@mui/icons-material/Construction'; import RocketLaunchIcon from '@mui/icons-material/RocketLaunch'; +import { Navigate } from 'react-router-dom'; interface BetaPageProps { children?: React.ReactNode; @@ -28,13 +30,14 @@ export const BetaPage: React.FC = ({ title = "Coming Soon", subtitle = "This page is currently in development", returnPath = "/", - returnLabel = "Return to Dashboard", + returnLabel = "Return to Backstory", onReturn, }) => { const theme = useTheme(); const isMobile = useMediaQuery(theme.breakpoints.down('md')); const [showSparkle, setShowSparkle] = useState(false); - + const navigate = useNavigate(); + // Enhanced sparkle effect for background elements const [sparkles, setSparkles] = useState = ({ if (onReturn) { onReturn(); } else if (returnPath) { - window.location.href = returnPath; + navigate(returnPath); } }; diff --git a/frontend/src/NewApp/Pages/ChatPage.tsx b/frontend/src/NewApp/Pages/ChatPage.tsx index 2f4ba24..4d936be 100644 --- a/frontend/src/NewApp/Pages/ChatPage.tsx +++ b/frontend/src/NewApp/Pages/ChatPage.tsx @@ -71,31 +71,33 @@ What would you like to know about ${user.first_name}? fetchUserInfo(); }, [setSnack, sessionId]); - if (sessionId === undefined || user === undefined) { - return ; - } + if (sessionId === undefined || user === undefined) { + return ( + + ); + } - return ( - - - - ); + return ( + + + + ); }); export { diff --git a/src/server.py b/src/server.py index 8896c75..b1c1cc6 100644 --- a/src/server.py +++ b/src/server.py @@ -575,6 +575,7 @@ class WebServer: "first_name": user.first_name, "last_name": user.last_name, "full_name": user.full_name, + "description": user.description, "contact_info": user.contact_info, "rag_content_size": user.rag_content_size, "profile_url": user.profile_url, diff --git a/src/utils/defines.py b/src/utils/defines.py index 7638aab..ba44f60 100644 --- a/src/utils/defines.py +++ b/src/utils/defines.py @@ -42,7 +42,7 @@ logging_level = os.getenv("LOGGING_LEVEL", "INFO").upper() chunk_buffer = 5 # Number of lines before and after chunk beyond the portion used in embedding (to return to callers) # Maximum number of entries for ChromaDB to find -default_rag_top_k = 80 +default_rag_top_k = 50 # Cosine Distance Equivalent Similarity Retrieval Characteristics # 0.2 - 0.3 0.85 - 0.90 Very strict, highly precise results only diff --git a/src/utils/user.py b/src/utils/user.py index 3e53077..2c51a68 100644 --- a/src/utils/user.py +++ b/src/utils/user.py @@ -200,7 +200,7 @@ class User(BaseModel): self.first_name = info.get("first_name", self.username) self.last_name = info.get("last_name", "") self.full_name = info.get("full_name", f"{self.first_name} {self.last_name}") - self.description = info.get("first_name", self.description) + self.description = info.get("description", self.description) self.profile_url = info.get("profile_url", self.description) self.contact_info = info.get("contact_info", {}) questions = info.get("questions", [ f"Tell me about {self.first_name}.", f"What are {self.first_name}'s professional strengths?"])