Skip to content

Commit cd5cd03

Browse files
committed
fix: removing redundant code from electron app, changing API endpoints and fixing circular imports
1 parent 724652d commit cd5cd03

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1295
-4028
lines changed

src/client/.env.template

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
ELECTRON_APP_URL=
44
APP_SERVER_URL=
5-
APP_SERVER_LOADED=
6-
APP_SERVER_INITIATED=
7-
NEO4J_SERVER_URL=
8-
NEO4J_SERVER_STARTED=
95
BASE_MODEL_REPO_ID=
106
AUTH0_DOMAIN=
117
AUTH0_CLIENT_ID=

src/client/app/chat/page.js

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -276,29 +276,6 @@ const Chat = () => {
276276
}
277277
}
278278

279-
const reinitiateServer = async () => {
280-
setServerStatus(false)
281-
toast.loading("Restarting server...")
282-
try {
283-
const response = await window.electron?.invoke("reinitiate-server")
284-
if (response.status === 200) {
285-
toast.dismiss()
286-
toast.success("Server restarted. Fetching history...")
287-
if (chatMode === "text") {
288-
await fetchChatHistory()
289-
}
290-
} else {
291-
toast.dismiss()
292-
toast.error("Failed to restart server.")
293-
}
294-
} catch (error) {
295-
toast.dismiss()
296-
toast.error("Error restarting the server.")
297-
} finally {
298-
setServerStatus(true)
299-
}
300-
}
301-
302279
// --- Effects ---
303280
// Initial setup effect
304281
useEffect(() => {
@@ -448,7 +425,11 @@ const Chat = () => {
448425
{/* Top Right Buttons */}
449426
<div className="absolute top-5 right-5 z-20 flex gap-3">
450427
<button
451-
onClick={reinitiateServer}
428+
onClick={() =>
429+
toast.error(
430+
"Server restart from client is deprecated."
431+
)
432+
}
452433
className="p-3 hover-button rounded-full text-white cursor-pointer"
453434
title="Restart Server"
454435
>

src/client/app/layout.js

Lines changed: 15 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import "@styles/globals.css" // Import global styles for the application
22
import { Toaster } from "react-hot-toast" // Import Toaster component for displaying toast notifications
33
import React from "react"
4+
import ClientHeartbeat from "@components/ClientHeartbeat"
45

56
/**
67
* Metadata for the RootLayout component.
@@ -24,42 +25,17 @@ export const metadata = {
2425
* @returns {React.ReactNode} - The RootLayout component UI.
2526
*/
2627
export default async function RootLayout({ children }) {
27-
useEffect(() => {
28-
let intervalId;
29-
const sendHeartbeat = () => {
30-
if (document.hasFocus() && window.electron && typeof window.electron.sendUserActivityHeartbeat === 'function') {
31-
console.log("Client: Sending activity heartbeat...");
32-
window.electron.sendUserActivityHeartbeat().catch(err => console.error("Heartbeat IPC error:", err));
33-
}
34-
};
35-
36-
// Send heartbeat immediately on mount (if focused) and then every 5 minutes
37-
sendHeartbeat();
38-
intervalId = setInterval(sendHeartbeat, 5 * 60 * 1000); // 5 minutes
39-
40-
// Also send on window focus
41-
const handleFocus = () => {
42-
console.log("Client: Window focused, sending heartbeat.");
43-
sendHeartbeat();
44-
};
45-
window.addEventListener('focus', handleFocus);
46-
47-
return () => {
48-
clearInterval(intervalId);
49-
window.removeEventListener('focus', handleFocus);
50-
};
51-
}, []); // Empty dependency array means this runs once on mount and cleans up on unmount
52-
53-
return (
54-
<html lang="en" suppressHydrationWarning>
55-
{/* Root html element with language set to English and hydration warning suppressed */}
56-
<body className="bg-black">
57-
{/* Body element with a black background using global styles */}
58-
<Toaster position="bottom-right" />
59-
{/* Toaster component for displaying notifications, positioned at the bottom-right */}
60-
{children}
61-
{/* Render the child components, which is the main content of the application */}
62-
</body>
63-
</html>
64-
)
65-
}
28+
return (
29+
<html lang="en" suppressHydrationWarning>
30+
{/* Root html element with language set to English and hydration warning suppressed */}
31+
<body className="bg-black">
32+
{/* Body element with a black background using global styles */}
33+
<Toaster position="bottom-right" />
34+
{/* Toaster component for displaying notifications, positioned at the bottom-right */}
35+
{children}
36+
<ClientHeartbeat />
37+
{/* Render the child components, which is the main content of the application */}
38+
</body>
39+
</html>
40+
)
41+
}

src/client/components/AnimatedBeam.js

Lines changed: 0 additions & 162 deletions
This file was deleted.

src/client/components/AppCard.js

Lines changed: 0 additions & 113 deletions
This file was deleted.

0 commit comments

Comments
 (0)