diff --git a/src/interface/web/app/components/appSidebar/appSidebar.tsx b/src/interface/web/app/components/appSidebar/appSidebar.tsx
index 97b7664a..6916a621 100644
--- a/src/interface/web/app/components/appSidebar/appSidebar.tsx
+++ b/src/interface/web/app/components/appSidebar/appSidebar.tsx
@@ -17,23 +17,44 @@ import {
KhojLogoType,
KhojSearchLogo,
} from "../logo/khojLogo";
-import { Gear } from "@phosphor-icons/react/dist/ssr";
-import { Plus } from "@phosphor-icons/react";
+import { Plus, Gear, HouseSimple } from "@phosphor-icons/react";
import { useEffect, useState } from "react";
import AllConversations from "../allConversations/allConversations";
import FooterMenu from "../navMenu/navMenu";
import { useSidebar } from "@/components/ui/sidebar";
import { useIsMobileWidth } from "@/app/common/utils";
import { UserPlusIcon } from "lucide-react";
-import { useAuthenticatedData } from "@/app/common/auth";
+import { useAuthenticatedData, UserProfile } from "@/app/common/auth";
import LoginPrompt from "../loginPrompt/loginPrompt";
+async function openChat(userData: UserProfile | null | undefined) {
+ const unauthenticatedRedirectUrl = `/login?redirect=${encodeURIComponent(window.location.pathname)}`;
+ if (!userData) {
+ window.location.href = unauthenticatedRedirectUrl;
+ return;
+ }
+
+ const response = await fetch(`/api/chat/sessions`, {
+ method: "POST",
+ });
+
+ const data = await response.json();
+ if (response.status == 200) {
+ window.location.href = `/chat?conversationId=${data.conversation_id}`;
+ } else if (response.status == 403 || response.status == 401) {
+ window.location.href = unauthenticatedRedirectUrl;
+ } else {
+ alert("Failed to start chat session");
+ }
+}
+
+
// Menu items.
const items = [
{
- title: "New",
+ title: "Home",
url: "/",
- icon: Plus,
+ icon: HouseSimple
},
{
title: "Agents",
@@ -125,6 +146,20 @@ export function AppSidebar(props: AppSidebarProps) {
)}
+ {
+
+ openChat(data)}
+ >
+
+
+
+ }
{items.map((item) => (
diff --git a/src/khoj/database/migrations/0082_merge_20250121_1842.py b/src/khoj/database/migrations/0082_merge_20250121_1842.py
new file mode 100644
index 00000000..2f1dbaab
--- /dev/null
+++ b/src/khoj/database/migrations/0082_merge_20250121_1842.py
@@ -0,0 +1,12 @@
+# Generated by Django 5.0.10 on 2025-01-21 18:42
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("database", "0081_agent_is_hidden_chatmodel_description_and_more"),
+ ("database", "0081_merge_20250120_1633"),
+ ]
+
+ operations = []