Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

migrate assistant screen into setting

Faisal Amir9aaea328685a
diff --git a/web-app/src/constants/routes.ts b/web-app/src/constants/routes.ts
index f92a18486..7df00aee5 100644
--- a/web-app/src/constants/routes.ts
+++ b/web-app/src/constants/routes.ts
@@ -2,7 +2,6 @@ export const route = {
// home as new chat or thread
home: '/',
appLogs: '/logs',
- assistant: '/assistant',
project: '/project',
projectDetail: '/project/$projectId',
settings: {
@@ -19,6 +18,7 @@ export const route = {
mcp_servers: '/settings/mcp-servers',
https_proxy: '/settings/https-proxy',
hardware: '/settings/hardware',
+ assistant: '/settings/assistant',
},
hub: {
index: '/hub/',
diff --git a/web-app/src/containers/LeftPanel.tsx b/web-app/src/containers/LeftPanel.tsx
index 56973cd1d..99450fcf8 100644
--- a/web-app/src/containers/LeftPanel.tsx
+++ b/web-app/src/containers/LeftPanel.tsx
@@ -12,7 +12,6 @@ import {
IconApps,
IconX,
IconSearch,
- IconClipboardSmile,
IconFolder,
IconPencil,
IconTrash,
@@ -62,12 +61,6 @@ const mainMenus = [
]
const secondaryMenus = [
- {
- title: 'common:assistants',
- icon: IconClipboardSmile,
- route: route.assistant,
- isEnabled: PlatformFeatures[PlatformFeature.ASSISTANTS],
- },
{
title: 'common:hub',
icon: IconApps,
@@ -407,94 +400,97 @@ const LeftPanel = () => {
{projectsEnabled &&
filteredProjects.length > 0 &&
!(IS_IOS || IS_ANDROID) && (
- <div className="space-y-1 py-1">
- <div className="flex items-center justify-between mb-2">
- <span className="block text-xs text-left-panel-fg/50 px-1 font-semibold">
- {t('common:projects.title')}
- </span>
- </div>
- <div className="flex flex-col max-h-[140px] overflow-y-scroll">
- {filteredProjects
- .slice()
- .sort((a, b) => b.updated_at - a.updated_at)
- .map((folder) => {
- const ProjectItem = () => {
- const [openDropdown, setOpenDropdown] = useState(false)
- const isProjectActive =
- currentPath === `/project/${folder.id}`
-
- return (
- <div key={folder.id} className="mb-1">
- <div
- className={cn(
- 'rounded hover:bg-left-panel-fg/10 flex items-center justify-between gap-2 px-1.5 group/project-list transition-all cursor-pointer',
- isProjectActive && 'bg-left-panel-fg/10'
- )}
- >
- <Link
- to="/project/$projectId"
- params={{ projectId: folder.id }}
- onClick={() =>
- isSmallScreen && setLeftPanel(false)
- }
- className="py-1 pr-2 truncate flex items-center gap-2 flex-1"
+ <div className="space-y-1 py-1">
+ <div className="flex items-center justify-between mb-2">
+ <span className="block text-xs text-left-panel-fg/50 px-1 font-semibold">
+ {t('common:projects.title')}
+ </span>
+ </div>
+ <div className="flex flex-col max-h-[140px] overflow-y-scroll">
+ {filteredProjects
+ .slice()
+ .sort((a, b) => b.updated_at - a.updated_at)
+ .map((folder) => {
+ const ProjectItem = () => {
+ const [openDropdown, setOpenDropdown] = useState(false)
+ const isProjectActive =
+ currentPath === `/project/${folder.id}`
+
+ return (
+ <div key={folder.id} className="mb-1">
+ <div
+ className={cn(
+ 'rounded hover:bg-left-panel-fg/10 flex items-center justify-between gap-2 px-1.5 group/project-list transition-all cursor-pointer',
+ isProjectActive && 'bg-left-panel-fg/10'
+ )}
>
- <IconFolder
- size={16}
- className="text-left-panel-fg/70 shrink-0"
- />
- <span className="text-sm text-left-panel-fg/90 truncate">
- {folder.name}
- </span>
- </Link>
- <div className="flex items-center">
- <DropdownMenu
- open={openDropdown}
- onOpenChange={(open) => setOpenDropdown(open)}
+ <Link
+ to="/project/$projectId"
+ params={{ projectId: folder.id }}
+ onClick={() =>
+ isSmallScreen && setLeftPanel(false)
+ }
+ className="py-1 pr-2 truncate flex items-center gap-2 flex-1"
>
- <DropdownMenuTrigger asChild>
- <IconDots
- size={14}
- className="text-left-panel-fg/60 shrink-0 cursor-pointer px-0.5 -mr-1 data-[state=open]:bg-left-panel-fg/10 rounded group-hover/project-list:data-[state=closed]:size-5 size-5 data-[state=closed]:size-0"
- onClick={(e) => {
- e.preventDefault()
- e.stopPropagation()
- }}
- />
- </DropdownMenuTrigger>
- <DropdownMenuContent side="bottom" align="end">
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation()
- setEditingProjectKey(folder.id)
- setProjectDialogOpen(true)
- }}
- >
- <IconPencil size={16} />
- <span>Edit</span>
- </DropdownMenuItem>
- <DropdownMenuItem
- onClick={(e) => {
- e.stopPropagation()
- handleProjectDelete(folder.id)
- }}
+ <IconFolder
+ size={16}
+ className="text-left-panel-fg/70 shrink-0"
+ />
+ <span className="text-sm text-left-panel-fg/90 truncate">
+ {folder.name}
+ </span>
+ </Link>
+ <div className="flex items-center">
+ <DropdownMenu
+ open={openDropdown}
+ onOpenChange={(open) => setOpenDropdown(open)}
+ >
+ <DropdownMenuTrigger asChild>
+ <IconDots
+ size={14}
+ className="text-left-panel-fg/60 shrink-0 cursor-pointer px-0.5 -mr-1 data-[state=open]:bg-left-panel-fg/10 rounded group-hover/project-list:data-[state=closed]:size-5 size-5 data-[state=closed]:size-0"
+ onClick={(e) => {
+ e.preventDefault()
+ e.stopPropagation()
+ }}
+ />
+ </DropdownMenuTrigger>
+ <DropdownMenuContent
+ side="bottom"
+ align="end"
>
- <IconTrash size={16} />
- <span>Delete</span>
- </DropdownMenuItem>
- </DropdownMenuContent>
- </DropdownMenu>
+ <DropdownMenuItem
+ onClick={(e) => {
+ e.stopPropagation()
+ setEditingProjectKey(folder.id)
+ setProjectDialogOpen(true)
+ }}
+ >
+ <IconPencil size={16} />
+ <span>Edit</span>
+ </DropdownMenuItem>
+ <DropdownMenuItem
+ onClick={(e) => {
+ e.stopPropagation()
+ handleProjectDelete(folder.id)
+ }}
+ >
+ <IconTrash size={16} />
+ <span>Delete</span>
+ </DropdownMenuItem>
+ </DropdownMenuContent>
+ </DropdownMenu>
+ </div>
</div>
</div>
- </div>
- )
- }
+ )
+ }
- return <ProjectItem key={folder.id} />
- })}
+ return <ProjectItem key={folder.id} />
+ })}
+ </div>
</div>
- </div>
- )}
+ )}
<div className="flex flex-col h-full overflow-y-scroll w-[calc(100%+6px)]">
<div className="flex flex-col w-full h-full overflow-y-auto overflow-x-hidden mb-3">
diff --git a/web-app/src/containers/SettingsMenu.tsx b/web-app/src/containers/SettingsMenu.tsx
index e04836650..7e90abd67 100644
--- a/web-app/src/containers/SettingsMenu.tsx
+++ b/web-app/src/containers/SettingsMenu.tsx
@@ -97,6 +97,12 @@ const SettingsMenu = () => {
hasSubMenu: activeProviders.length > 0,
isEnabled: PlatformFeatures[PlatformFeature.MODEL_PROVIDER_SETTINGS],
},
+ {
+ title: 'common:assistants',
+ route: route.settings.assistant,
+ hasSubMenu: false,
+ isEnabled: PlatformFeatures[PlatformFeature.ASSISTANTS],
+ },
{
title: 'common:keyboardShortcuts',
route: route.settings.shortcuts,
diff --git a/web-app/src/routeTree.gen.ts b/web-app/src/routeTree.gen.ts
index 6c20c988e..e9c64ca10 100644
--- a/web-app/src/routeTree.gen.ts
+++ b/web-app/src/routeTree.gen.ts
@@ -13,7 +13,6 @@
import { Route as rootRoute } from './routes/__root'
import { Route as SystemMonitorImport } from './routes/system-monitor'
import { Route as LogsImport } from './routes/logs'
-import { Route as AssistantImport } from './routes/assistant'
import { Route as IndexImport } from './routes/index'
import { Route as ProjectIndexImport } from './routes/project/index'
import { Route as HubIndexImport } from './routes/hub/index'
@@ -28,6 +27,7 @@ import { Route as SettingsHardwareImport } from './routes/settings/hardware'
import { Route as SettingsGeneralImport } from './routes/settings/general'
import { Route as SettingsExtensionsImport } from './routes/settings/extensions'
import { Route as SettingsAttachmentsImport } from './routes/settings/attachments'
+import { Route as SettingsAssistantImport } from './routes/settings/assistant'
import { Route as ProjectProjectIdImport } from './routes/project/$projectId'
import { Route as LocalApiServerLogsImport } from './routes/local-api-server/logs'
import { Route as HubModelIdImport } from './routes/hub/$modelId'
@@ -49,12 +49,6 @@ const LogsRoute = LogsImport.update({
getParentRoute: () => rootRoute,
} as any)
-const AssistantRoute = AssistantImport.update({
- id: '/assistant',
- path: '/assistant',
- getParentRoute: () => rootRoute,
-} as any)
-
const IndexRoute = IndexImport.update({
id: '/',
path: '/',
@@ -139,6 +133,12 @@ const SettingsAttachmentsRoute = SettingsAttachmentsImport.update({
getParentRoute: () => rootRoute,
} as any)
+const SettingsAssistantRoute = SettingsAssistantImport.update({
+ id: '/settings/assistant',
+ path: '/settings/assistant',
+ getParentRoute: () => rootRoute,
+} as any)
+
const ProjectProjectIdRoute = ProjectProjectIdImport.update({
id: '/project/$projectId',
path: '/project/$projectId',
@@ -187,13 +187,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof IndexImport
parentRoute: typeof rootRoute
}
- '/assistant': {
- id: '/assistant'
- path: '/assistant'
- fullPath: '/assistant'
- preLoaderRoute: typeof AssistantImport
- parentRoute: typeof rootRoute
- }
'/logs': {
id: '/logs'
path: '/logs'
@@ -229,6 +222,13 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof ProjectProjectIdImport
parentRoute: typeof rootRoute
}
+ '/settings/assistant': {
+ id: '/settings/assistant'
+ path: '/settings/assistant'
+ fullPath: '/settings/assistant'
+ preLoaderRoute: typeof SettingsAssistantImport
+ parentRoute: typeof rootRoute
+ }
'/settings/attachments': {
id: '/settings/attachments'
path: '/settings/attachments'
@@ -348,12 +348,12 @@ declare module '@tanstack/react-router' {
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
- '/assistant': typeof AssistantRoute
'/logs': typeof LogsRoute
'/system-monitor': typeof SystemMonitorRoute
'/hub/$modelId': typeof HubModelIdRoute
'/local-api-server/logs': typeof LocalApiServerLogsRoute
'/project/$projectId': typeof ProjectProjectIdRoute
+ '/settings/assistant': typeof SettingsAssistantRoute
'/settings/attachments': typeof SettingsAttachmentsRoute
'/settings/extensions': typeof SettingsExtensionsRoute
'/settings/general': typeof SettingsGeneralRoute
@@ -374,12 +374,12 @@ export interface FileRoutesByFullPath {
export interface FileRoutesByTo {
'/': typeof IndexRoute
- '/assistant': typeof AssistantRoute
'/logs': typeof LogsRoute
'/system-monitor': typeof SystemMonitorRoute
'/hub/$modelId': typeof HubModelIdRoute
'/local-api-server/logs': typeof LocalApiServerLogsRoute
'/project/$projectId': typeof ProjectProjectIdRoute
+ '/settings/assistant': typeof SettingsAssistantRoute
'/settings/attachments': typeof SettingsAttachmentsRoute
'/settings/extensions': typeof SettingsExtensionsRoute
'/settings/general': typeof SettingsGeneralRoute
@@ -401,12 +401,12 @@ export interface FileRoutesByTo {
export interface FileRoutesById {
__root__: typeof rootRoute
'/': typeof IndexRoute
- '/assistant': typeof AssistantRoute
'/logs': typeof LogsRoute
'/system-monitor': typeof SystemMonitorRoute
'/hub/$modelId': typeof HubModelIdRoute
'/local-api-server/logs': typeof LocalApiServerLogsRoute
'/project/$projectId': typeof ProjectProjectIdRoute
+ '/settings/assistant': typeof SettingsAssistantRoute
'/settings/attachments': typeof SettingsAttachmentsRoute
'/settings/extensions': typeof SettingsExtensionsRoute
'/settings/general': typeof SettingsGeneralRoute
@@ -429,12 +429,12 @@ export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths:
| '/'
- | '/assistant'
| '/logs'
| '/system-monitor'
| '/hub/$modelId'
| '/local-api-server/logs'
| '/project/$projectId'
+ | '/settings/assistant'
| '/settings/attachments'
| '/settings/extensions'
| '/settings/general'
@@ -454,12 +454,12 @@ export interface FileRouteTypes {
fileRoutesByTo: FileRoutesByTo
to:
| '/'
- | '/assistant'
| '/logs'
| '/system-monitor'
| '/hub/$modelId'
| '/local-api-server/logs'
| '/project/$projectId'
+ | '/settings/assistant'
| '/settings/attachments'
| '/settings/extensions'
| '/settings/general'
@@ -479,12 +479,12 @@ export interface FileRouteTypes {
id:
| '__root__'
| '/'
- | '/assistant'
| '/logs'
| '/system-monitor'
| '/hub/$modelId'
| '/local-api-server/logs'
| '/project/$projectId'
+ | '/settings/assistant'
| '/settings/attachments'
| '/settings/extensions'
| '/settings/general'
@@ -506,12 +506,12 @@ export interface FileRouteTypes {
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
- AssistantRoute: typeof AssistantRoute
LogsRoute: typeof LogsRoute
SystemMonitorRoute: typeof SystemMonitorRoute
HubModelIdRoute: typeof HubModelIdRoute
LocalApiServerLogsRoute: typeof LocalApiServerLogsRoute
ProjectProjectIdRoute: typeof ProjectProjectIdRoute
+ SettingsAssistantRoute: typeof SettingsAssistantRoute
SettingsAttachmentsRoute: typeof SettingsAttachmentsRoute
SettingsExtensionsRoute: typeof SettingsExtensionsRoute
SettingsGeneralRoute: typeof SettingsGeneralRoute
@@ -532,12 +532,12 @@ export interface RootRouteChildren {
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
- AssistantRoute: AssistantRoute,
LogsRoute: LogsRoute,
SystemMonitorRoute: SystemMonitorRoute,
HubModelIdRoute: HubModelIdRoute,
LocalApiServerLogsRoute: LocalApiServerLogsRoute,
ProjectProjectIdRoute: ProjectProjectIdRoute,
+ SettingsAssistantRoute: SettingsAssistantRoute,
SettingsAttachmentsRoute: SettingsAttachmentsRoute,
SettingsExtensionsRoute: SettingsExtensionsRoute,
SettingsGeneralRoute: SettingsGeneralRoute,
@@ -567,12 +567,12 @@ export const routeTree = rootRoute
"filePath": "__root.tsx",
"children": [
"/",
- "/assistant",
"/logs",
"/system-monitor",
"/hub/$modelId",
"/local-api-server/logs",
"/project/$projectId",
+ "/settings/assistant",
"/settings/attachments",
"/settings/extensions",
"/settings/general",
@@ -594,9 +594,6 @@ export const routeTree = rootRoute
"/": {
"filePath": "index.tsx"
},
- "/assistant": {
- "filePath": "assistant.tsx"
- },
"/logs": {
"filePath": "logs.tsx"
},
@@ -612,6 +609,9 @@ export const routeTree = rootRoute
"/project/$projectId": {
"filePath": "project/$projectId.tsx"
},
+ "/settings/assistant": {
+ "filePath": "settings/assistant.tsx"
+ },
"/settings/attachments": {
"filePath": "settings/attachments.tsx"
},
diff --git a/web-app/src/routes/assistant.tsx b/web-app/src/routes/settings/assistant.tsx
similarity index 95%
rename from web-app/src/routes/assistant.tsx
rename to web-app/src/routes/settings/assistant.tsx
index dca4c93ef..d4de24a86 100644
--- a/web-app/src/routes/assistant.tsx
+++ b/web-app/src/routes/settings/assistant.tsx
@@ -13,9 +13,10 @@ import { useTranslation } from '@/i18n/react-i18next-compat'
import { PlatformGuard } from '@/lib/platform/PlatformGuard'
import { PlatformFeature } from '@/lib/platform/types'
import { Button } from '@/components/ui/button'
+import SettingsMenu from '@/containers/SettingsMenu'
// eslint-disable-next-line @typescript-eslint/no-explicit-any
-export const Route = createFileRoute(route.assistant as any)({
+export const Route = createFileRoute(route.settings.assistant as any)({
component: Assistant,
})
@@ -77,8 +78,9 @@ function AssistantContent() {
</Button>
</div>
</HeaderPage>
- <div className="h-full p-4 w-3/4 mx-auto overflow-y-auto mt-2">
- <div className="space-y-3">
+ <div className="flex h-full w-full">
+ <SettingsMenu />
+ <div className="space-y-3 p-4">
{assistants
.slice()
.sort((a, b) => a.created_at - b.created_at)