Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
259 changes: 146 additions & 113 deletions README.md

Large diffs are not rendered by default.

55 changes: 47 additions & 8 deletions src/interface/app/chat/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import IconGoogleSlides from "@components/icons/IconGoogleSlides" // Icon for Google Slides command
import IconGoogleMail from "@components/icons/IconGoogleMail" // Icon for Google Mail command
import IconGoogleDrive from "@components/icons/IconGoogleDrive" // Icon for Google Drive command
import ReminderWidget from "@components/agents/Reminder"

/**
* Chat component for the main chat interface.
Expand Down Expand Up @@ -59,6 +60,7 @@
const [showCommands, setShowCommands] = useState(false) // showCommands: boolean
// State to hold the filtered slash commands based on user input.
const [filteredCommands, setFilteredCommands] = useState([]) // filteredCommands: { text: string, value: string, icon: React.ReactNode }[]
const [currentModel, setCurrentModel] = useState("")

/**
* Array of available slash commands.
Expand Down Expand Up @@ -265,6 +267,21 @@
}
}

const fetchCurrentModel = async () => {
try {
const response = await window.electron?.invoke("get-db-data")
if (response.status === 200 && response.data) {
const selectedModel = response.data.selectedModel
setCurrentModel(selectedModel || "llama3.2:3b")
} else {
setCurrentModel("llama3.2:3b") // Fallback if no data
}
} catch (error) {
toast.error("Error fetching user data.")
setCurrentModel("llama3.2:3b") // Fallback on error
}
}

/**
* Initializes the chat session with the backend for the given chatId.
*/
Expand Down Expand Up @@ -310,6 +327,7 @@
*/
useEffect(() => {
fetchUserDetails()
fetchCurrentModel()
}, [])

/**
Expand Down Expand Up @@ -638,14 +656,18 @@
"absolute flex flex-col justify-center items-center w-full h-full"
}
/>
<div className="w-3/5 flex flex-col font-Poppins justify-center items-center h-full bg-matteblack">
<h1
className="text-8xl text-white font-bold mb-8"
style={{ zIndex: 10 }}
>
what&apos;s on your mind?
</h1>
<AiButton onClick={() => setShowCreateChatOverlay(true)} />
<div className="w-3/5 flex flex-col font-Poppins items-center h-full relative">
<div className="flex flex-col items-center justify-center flex-grow">
<h1
className="text-8xl text-white font-bold mb-8"
style={{ zIndex: 10 }}
>
what's on your mind?

Check failure on line 665 in src/interface/app/chat/page.js

View workflow job for this annotation

GitHub Actions / Code Linting & Formatting

`'` can be escaped with `&apos;`, `&lsquo;`, `&#39;`, `&rsquo;`
</h1>
<AiButton
onClick={() => setShowCreateChatOverlay(true)}
/>
</div>
{showCreateChatOverlay && (
<ModalDialog
title="Create a New Chat"
Expand All @@ -661,6 +683,15 @@
showInput={true}
/>
)}
<div className="absolute bottom-16 left-0 right-0 flex flex-col items-center justify-center">
<p className="text-white text-sm mb-5">
Widgets are coming here soon! πŸ‘‡
</p>
<div className="flex flex-row gap-8">
<ReminderWidget />
{/* Add more widgets here in the future, e.g., <AnotherWidget /> */}
</div>
</div>
</div>
</div>
)
Expand Down Expand Up @@ -796,6 +827,14 @@

<div ref={chatEndRef} />
</div>
<p className="text-gray-400 font-Poppins text-sm">
You can change now your model from the{" "}
<a href="/settings" className="underline">
Settings
</a>{" "}
page! Current Model:{" "}
<span className="text-lightblue">{currentModel}</span>
</p>
<div className="relative mb-5 flex flex-row gap-4 w-full px-4 py-1 bg-matteblack border-[1px] border-white rounded-lg z-30">
<textarea
ref={textareaRef}
Expand Down
8 changes: 4 additions & 4 deletions src/interface/app/integrations/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const AppIntegration = () => {
<AppCard
logo="/images/linkedin-logo.png" // LinkedIn logo image path
name="LinkedIn" // App name - LinkedIn
description="Connect your LinkedIn account to pull in your professional profile and enhance your experience." // Description for LinkedIn card
description="Connect your LinkedIn account to add your professional information to Sentient's context." // Description for LinkedIn card
onClick={() => {
// OnClick handler for LinkedIn card
if (!isConnecting && !connectedApps.LinkedIn) {
Expand All @@ -287,7 +287,7 @@ const AppIntegration = () => {
<AppCard
logo="/images/reddit-logo.png" // Reddit logo image path
name="Reddit" // App name - Reddit
description="Connect your Reddit account to analyze your subreddit activity and identify topics of interest." // Description for Reddit card
description="Connect your Reddit account to let Sentient analyze your subreddit activity and identify topics of interest." // Description for Reddit card
onClick={() => {
// OnClick handler for Reddit card
if (
Expand Down Expand Up @@ -319,7 +319,7 @@ const AppIntegration = () => {
<AppCard
logo="/images/twitter-logo.png" // Twitter logo image path
name="Twitter" // App name - Twitter
description="Connect your Twitter account to analyze your tweets and identify topics of interest." // Description for Twitter card
description="Connect your Twitter account to let Sentient analyze your tweets and identify topics of interest." // Description for Twitter card
onClick={() => {
// OnClick handler for Twitter card
if (
Expand Down Expand Up @@ -358,7 +358,7 @@ const AppIntegration = () => {
</ShiningButton>
<div
data-tooltip-id="integrations" // Tooltip ID for integrations info
data-tooltip-content="You can always connect or disconnect the apps from the settings page later" // Tooltip content
data-tooltip-content="You can always connect or disconnect the apps from the Settings page later. All data stays local." // Tooltip content
className="absolute top-4 right-4" // Positioning classes
>
<button className="text-gray-300 hover-button p-2 rounded-[50%] text-sm cursor-default">
Expand Down
25 changes: 20 additions & 5 deletions src/interface/app/personality-test/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import ShiningButton from "@components/ShiningButton" // Custom button component with a shining effect
import AnimatedBeam from "@components/AnimatedBeam" // Component for animated beam effect
import ShinyCard from "@components/ShinyCard" // Custom card component with a shiny effect
import ModelSelection from "@components/ModelSelection"
import toast from "react-hot-toast" // Library for displaying toast notifications

/**
Expand All @@ -21,7 +22,7 @@
* @param {function} props.onSubmit - Callback function to handle form submission with basic info data.
* @returns {React.ReactNode} - The BasicInfoForm component UI.
*/
const BasicInfoForm = ({ onSubmit }) => {

Check failure on line 25 in src/interface/app/personality-test/page.js

View workflow job for this annotation

GitHub Actions / Code Linting & Formatting

'onSubmit' is missing in props validation
// State to manage basic information input fields
const [basicInfo, setBasicInfo] = useState({
// basicInfo: { name: string, location: string, dateOfBirth: string }
Expand Down Expand Up @@ -169,6 +170,7 @@
const [isReferred, setIsReferred] = useState(null) // isReferred: boolean | null
// State to store the referral code entered by the user.
const [referralCode, setReferralCode] = useState("") // referralCode: string
const [showModelSelection, setShowModelSelection] = useState(false)

/**
* useEffect hook to fetch existing personality data on component mount.
Expand Down Expand Up @@ -415,17 +417,17 @@
const handleBasicInfoSubmit = async (basicInfo) => {
try {
const response = await window.electron?.invoke("set-db-data", {
// Invoke electron to set data in database
data: { personalInfo: basicInfo } // Data to set is the basicInfo object
data: { personalInfo: basicInfo }
})

if (response.status === 200) {
setShowBasicInfoForm(false) // Hide BasicInfoForm on successful submission
setShowBasicInfoForm(false)
setShowModelSelection(true) // Show model selection after basic info
} else {
throw new Error("Error saving basic information") // Throw error if response status is not 200
throw new Error("Error saving basic information")
}
} catch (error) {
toast.error(`Error saving basic information: ${error}`) // Show error toast if any error occurs
toast.error(`Error saving basic information: ${error}`)
}
}

Expand Down Expand Up @@ -559,7 +561,7 @@
* @param {function} props.onProceed - Callback function to handle proceeding after viewing results.
* @returns {React.ReactNode} - The PersonalityResults component UI.
*/
const PersonalityResults = ({ personalityType, onProceed }) => {

Check failure on line 564 in src/interface/app/personality-test/page.js

View workflow job for this annotation

GitHub Actions / Code Linting & Formatting

'personalityType' is missing in props validation

Check failure on line 564 in src/interface/app/personality-test/page.js

View workflow job for this annotation

GitHub Actions / Code Linting & Formatting

'onProceed' is missing in props validation
// Descriptions for each personality trait letter
const descriptions = {
E: "Extroverts are outgoing and gain energy from being around others.",
Expand All @@ -579,7 +581,7 @@
</h2>
<div className="flex justify-between flex-wrap gap-4">
{/* Map over each letter of the personality type to display trait cards */}
{personalityType.split("").map((char, index) => (

Check failure on line 584 in src/interface/app/personality-test/page.js

View workflow job for this annotation

GitHub Actions / Code Linting & Formatting

'personalityType.split' is missing in props validation
<div
key={index}
className="flex flex-col items-center bg-matteblack hover-button p-6 rounded-lg shadow-lg w-1/5 min-w-[150px] grow"
Expand Down Expand Up @@ -728,6 +730,19 @@
*
* @returns {React.ReactNode} - The main UI for the PersonalityTest component.
*/

if (showModelSelection) {
return (
<AnimatedBeam className={"w-screen h-screen"}>
<div className="min-h-screen flex justify-center items-center">
<ModelSelection
onProceed={() => setShowModelSelection(false)}
/>
</div>
</AnimatedBeam>
)
}

return (
<AnimatedBeam className={"w-screen h-screen"}>
<div className="relative overflow-hidden">
Expand Down
Loading
Loading