Really snazzy
This commit is contained in:
parent
142c2baac4
commit
8dc77dd8f7
@ -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<CandidateInfoProps> = ({ 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 (
|
||||
<StyledPaper>
|
||||
@ -61,6 +63,7 @@ const CandidateInfo: React.FC<CandidateInfoProps> = ({ userInfo }) => {
|
||||
{userInfo.full_name}
|
||||
</Typography>
|
||||
<Chip
|
||||
onClick={() => navigate('/rag-visualizer')}
|
||||
label={formatRagSize(userInfo.rag_content_size)}
|
||||
color="primary"
|
||||
size="small"
|
||||
|
@ -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<BetaPageProps> = ({
|
||||
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<boolean>(false);
|
||||
|
||||
const navigate = useNavigate();
|
||||
|
||||
// Enhanced sparkle effect for background elements
|
||||
const [sparkles, setSparkles] = useState<Array<{
|
||||
id: number;
|
||||
@ -72,7 +75,7 @@ export const BetaPage: React.FC<BetaPageProps> = ({
|
||||
if (onReturn) {
|
||||
onReturn();
|
||||
} else if (returnPath) {
|
||||
window.location.href = returnPath;
|
||||
navigate(returnPath);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -71,31 +71,33 @@ What would you like to know about ${user.first_name}?
|
||||
fetchUserInfo();
|
||||
}, [setSnack, sessionId]);
|
||||
|
||||
if (sessionId === undefined || user === undefined) {
|
||||
return <LoadingComponent
|
||||
loadingText="Fetching user information..."
|
||||
loaderType="linear"
|
||||
withFade={true}
|
||||
fadeDuration={1200} />;
|
||||
}
|
||||
if (sessionId === undefined || user === undefined) {
|
||||
return (<Box>
|
||||
<LoadingComponent
|
||||
loadingText="Fetching user information..."
|
||||
loaderType="linear"
|
||||
withFade={true}
|
||||
fadeDuration={1200} />
|
||||
</Box>);
|
||||
}
|
||||
|
||||
return (
|
||||
<Box>
|
||||
<CandidateInfo userInfo={user}/>
|
||||
<Conversation
|
||||
ref={ref}
|
||||
{...{
|
||||
multiline: true,
|
||||
type: "chat",
|
||||
placeholder: `What would you like to know about ${user.first_name}?`,
|
||||
resetLabel: "chat",
|
||||
sessionId,
|
||||
setSnack,
|
||||
// preamble: preamble,
|
||||
defaultPrompts: questions,
|
||||
submitQuery,
|
||||
}}/>
|
||||
</Box>);
|
||||
return (
|
||||
<Box>
|
||||
<CandidateInfo userInfo={user} />
|
||||
<Conversation
|
||||
ref={ref}
|
||||
{...{
|
||||
multiline: true,
|
||||
type: "chat",
|
||||
placeholder: `What would you like to know about ${user.first_name}?`,
|
||||
resetLabel: "chat",
|
||||
sessionId,
|
||||
setSnack,
|
||||
// preamble: preamble,
|
||||
defaultPrompts: questions,
|
||||
submitQuery,
|
||||
}} />
|
||||
</Box>);
|
||||
});
|
||||
|
||||
export {
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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?"])
|
||||
|
Loading…
x
Reference in New Issue
Block a user