Skip to content

Commit 12f2759

Browse files
authored
enhance: toggle access nanobot legacy chat (#5899)
* enhance: toggle launch chat/agent access based on flags * remove deep research prompt for now
1 parent 35eb0f7 commit 12f2759

4 files changed

Lines changed: 49 additions & 66 deletions

File tree

ui/user/src/lib/components/Layout.svelte

Lines changed: 29 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,32 @@
118118
let isBootStrapUser = $derived(profile.current.isBootstrapUser?.() ?? false);
119119
let isAtLeastPowerUserPlus = $derived(profile.current.groups.includes(Group.POWERUSER_PLUS));
120120
let isAtLeastPowerUser = $derived(profile.current.groups.includes(Group.POWERUSER));
121+
let chatLinks = $derived<NavLink[]>([
122+
...(version.current.disableLegacyChat !== true
123+
? [
124+
{
125+
id: 'legacy-chat',
126+
href: '/chat',
127+
icon: MessageCircle,
128+
label: 'Launch Chat',
129+
disabled: isBootStrapUser,
130+
collapsible: false
131+
}
132+
]
133+
: []),
134+
...(version.current.nanobotIntegration
135+
? [
136+
{
137+
id: 'nanobot-chat',
138+
href: '/nanobot',
139+
icon: BotMessageSquare,
140+
disabled: isBootStrapUser,
141+
label: 'Launch Agent',
142+
collapsible: false
143+
}
144+
]
145+
: [])
146+
]);
121147
let navLinks = $derived<NavLink[]>(
122148
profile.current.hasAdminAccess?.()
123149
? [
@@ -235,26 +261,7 @@
235261
disabled: isBootStrapUser,
236262
collapsible: false
237263
},
238-
{
239-
id: 'chat',
240-
href: '/chat',
241-
icon: MessageCircle,
242-
label: 'Launch Chat',
243-
disabled: isBootStrapUser,
244-
collapsible: false
245-
},
246-
...(version.current.nanobotIntegration
247-
? [
248-
{
249-
id: 'nanobot',
250-
href: '/nanobot',
251-
icon: BotMessageSquare,
252-
disabled: isBootStrapUser,
253-
label: 'Launch Nanobot',
254-
collapsible: false
255-
}
256-
]
257-
: [])
264+
...chatLinks
258265
]
259266
},
260267
{
@@ -362,25 +369,7 @@
362369
}
363370
]
364371
},
365-
{
366-
id: 'chat',
367-
href: '/chat',
368-
icon: MessageCircle,
369-
label: 'Chat',
370-
disabled: isBootStrapUser,
371-
collapsible: false
372-
},
373-
...(version.current.nanobotIntegration
374-
? [
375-
{
376-
id: 'nanobot',
377-
href: '/nanobot',
378-
icon: BotMessageSquare,
379-
label: 'Launch Nanobot',
380-
collapsible: false
381-
}
382-
]
383-
: [])
372+
...chatLinks
384373
]
385374
: [
386375
{
@@ -391,14 +380,7 @@
391380
disabled: false,
392381
collapsible: false
393382
},
394-
{
395-
id: 'chat',
396-
href: '/chat',
397-
icon: MessageCircle,
398-
label: 'Chat',
399-
disabled: isBootStrapUser,
400-
collapsible: false
401-
}
383+
...chatLinks
402384
]
403385
);
404386

ui/user/src/lib/components/nanobot/ProjectStartThread.svelte

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import type { ChatService } from '$lib/services/nanobot/chat/index.svelte';
33
import Thread from '$lib/components/nanobot/Thread.svelte';
4-
import { Binoculars, MessageCircle, Sparkles } from 'lucide-svelte';
4+
import { MessageCircle, Sparkles } from 'lucide-svelte';
55
import { AdminService, NanobotService } from '$lib/services';
66
import { errors } from '$lib/stores';
77
import Confirm from '$lib/components/Confirm.svelte';
@@ -90,20 +90,6 @@
9090
Design and execute an agentic workflow through conversation
9191
</p>
9292
</button>
93-
<button
94-
class="bg-base-200 dark:border-base-300 rounded-field col-span-1 h-full p-4 text-left shadow-sm"
95-
onclick={() => {
96-
chat?.sendMessage(
97-
'I want you to perform deep research on a topic. Help me get started.'
98-
);
99-
}}
100-
>
101-
<Binoculars class="mb-4 size-5" />
102-
<h3 class="text-base font-semibold">Deep research a topic</h3>
103-
<p class="text-base-content/50 text-sm font-light">
104-
Get a thorough, evidence-backed report on complex topics
105-
</p>
106-
</button>
10793
<button
10894
class="bg-base-200 dark:border-base-300 rounded-field col-span-1 h-full p-4 text-left shadow-sm"
10995
onclick={() => {

ui/user/src/lib/components/navbar/Profile.svelte

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
MessageCircle,
1515
CircleFadingArrowUp,
1616
LayoutDashboard,
17-
KeyRound
17+
KeyRound,
18+
BotMessageSquare
1819
} from 'lucide-svelte/icons';
1920
import { twMerge } from 'tailwind-merge';
2021
import { version } from '$lib/stores';
@@ -74,7 +75,10 @@
7475
7576
afterNavigate(() => {
7677
inAdminRoute = window.location.pathname.includes('/admin');
77-
showChatLink = !window.location.pathname.startsWith('/o') || inAdminRoute;
78+
showChatLink =
79+
(!window.location.pathname.startsWith('/o') &&
80+
!window.location.pathname.startsWith('/nanobot')) ||
81+
inAdminRoute;
7882
showMcpManagement = ['/o', '/profile', '/nanobot'].some((path) =>
7983
window.location.pathname.startsWith(path)
8084
);
@@ -149,7 +153,7 @@
149153
{/snippet}
150154
{#snippet body()}
151155
<div class="flex flex-col gap-2 px-2 pb-4">
152-
{#if showChatLink}
156+
{#if showChatLink && version.current.disableLegacyChat !== true}
153157
<button
154158
class="dropdown-link"
155159
onclick={async (event) => {
@@ -176,7 +180,17 @@
176180
}}
177181
>
178182
<MessageCircle class="size-4" />
179-
Chat
183+
Launch Chat
184+
</button>
185+
{/if}
186+
{#if showChatLink && version.current.nanobotIntegration}
187+
<button
188+
class="dropdown-link"
189+
onclick={async (event) => {
190+
navigateTo('/nanobot', event?.ctrlKey || event?.metaKey);
191+
}}
192+
>
193+
<BotMessageSquare class="size-4" /> Launch Agent
180194
</button>
181195
{/if}
182196
{#if showMcpManagement}

ui/user/src/lib/services/chat/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export interface Version {
167167
engine?: 'docker' | 'kubernetes' | 'local';
168168
autonomousToolUseEnabled?: boolean;
169169
nanobotIntegration?: boolean;
170+
disableLegacyChat?: boolean;
170171
}
171172

172173
export interface Profile {

0 commit comments

Comments
 (0)