Skip to content

Commit ee2fcc3

Browse files
committed
feat: Update sidebar actions and main sidebar components
- Added DEFAULT_RESOURCE_ID constant in sidebar-actions.ts for default resource handling. - Removed unused fetchMemoryStatus function call in chat-sidebar.tsx and inferred memory status from agentConfig. - Cleaned up main-sidebar.tsx by removing the networks state and associated UI elements. - Updated package.json and package-lock.json to reflect new versions of dependencies.
1 parent fbce67e commit ee2fcc3

5 files changed

Lines changed: 34 additions & 72 deletions

File tree

app/chat/actions/sidebar-actions.ts

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

33
import { MastraClient } from '@mastra/client-js'
44

5+
const DEFAULT_RESOURCE_ID = 'default-resource'
6+
57
const mastraClient = new MastraClient({
68
baseUrl: process.env.NEXT_PUBLIC_MASTRA_API_URL || 'http://localhost:4111',
79
})

app/chat/components/chat-sidebar.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
fetchVectors,
1111
fetchLogs,
1212
fetchLogTransports,
13-
fetchMemoryStatus,
1413
} from '@/app/chat/actions/sidebar-actions'
1514
import type {
1615
SidebarAgent,
@@ -163,13 +162,20 @@ export function ChatSidebar() {
163162
const loadMemory = useCallback(
164163
() =>
165164
withLoading('memory', async () => {
165+
// fetchMemoryStatus is not available from sidebar-actions; infer a basic status from agentConfig
166166
if (agentConfig?.id) {
167-
setMemoryStatus(
168-
await fetchMemoryStatus(agentConfig.id)
169-
)
167+
const inferred: SidebarMemoryStatus = {
168+
result: Boolean(agentConfig.features.sources || agentConfig.features.canvas || agentConfig.features.artifacts),
169+
provider: // try to read a provider field if present on agentConfig
170+
// @ts-expect-error: agentConfig may have optional memory provider metadata
171+
agentConfig.memory?.provider ?? undefined,
172+
}
173+
setMemoryStatus(inferred)
174+
} else {
175+
setMemoryStatus(null)
170176
}
171177
}),
172-
[withLoading, agentConfig?.id]
178+
[withLoading, agentConfig]
173179
)
174180

175181
const loaders: Record<TabKey, () => void> = {

app/chat/components/main-sidebar.tsx

Lines changed: 3 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import {
4444
BotIcon,
4545
ChevronRightIcon,
4646
WorkflowIcon,
47-
NetworkIcon,
4847
CpuIcon,
4948
ActivityIcon,
5049
Loader2Icon,
@@ -59,7 +58,8 @@ export function MainSidebar() {
5958
const [agents, setAgents] = useState<SidebarAgent[]>([])
6059
const [tools, setTools] = useState<SidebarTool[]>([])
6160
const [workflows, setWorkflows] = useState<SidebarWorkflow[]>([])
62-
const [networks, setNetworks] = useState<any[]>([])
61+
62+
6363
const [traces, setTraces] = useState<SidebarTrace[]>([])
6464
const [threads, setThreads] = useState<SidebarThread[]>([])
6565
const [vectors, setVectors] = useState<SidebarVectorIndex[]>([])
@@ -232,32 +232,7 @@ export function MainSidebar() {
232232
</SidebarMenuItem>
233233
</Collapsible>
234234

235-
<Collapsible className="group/collapsible">
236-
<SidebarMenuItem>
237-
<CollapsibleTrigger asChild>
238-
<SidebarMenuButton>
239-
<NetworkIcon className="mr-2 size-4" />
240-
<span>Networks</span>
241-
<ChevronRightIcon className="ml-auto size-4 transition-transform group-data-[state=open]/collapsible:rotate-90" />
242-
</SidebarMenuButton>
243-
</CollapsibleTrigger>
244-
<CollapsibleContent>
245-
<SidebarMenuSub>
246-
{networks.map((net) => (
247-
<SidebarMenuSubItem
248-
key={net.id}
249-
>
250-
<SidebarMenuSubButton className="w-full text-xs cursor-default">
251-
<span className="truncate">
252-
{net.name}
253-
</span>
254-
</SidebarMenuSubButton>
255-
</SidebarMenuSubItem>
256-
))}
257-
</SidebarMenuSub>
258-
</CollapsibleContent>
259-
</SidebarMenuItem>
260-
</Collapsible>
235+
261236

262237
<Collapsible className="group/collapsible">
263238
<SidebarMenuItem>
@@ -352,33 +327,6 @@ export function MainSidebar() {
352327
</SidebarMenuItem>
353328
</Collapsible>
354329

355-
<Collapsible className="group/collapsible">
356-
<SidebarMenuItem>
357-
<CollapsibleTrigger asChild>
358-
<SidebarMenuButton>
359-
<NetworkIcon className="mr-2 size-4" />
360-
<span>Networks</span>
361-
<ChevronRightIcon className="ml-auto size-4 transition-transform group-data-[state=open]/collapsible:rotate-90" />
362-
</SidebarMenuButton>
363-
</CollapsibleTrigger>
364-
<CollapsibleContent>
365-
<SidebarMenuSub>
366-
{networks.map((net) => (
367-
<SidebarMenuSubItem
368-
key={net.id}
369-
>
370-
<SidebarMenuSubButton className="w-full text-xs cursor-default">
371-
<span className="truncate">
372-
{net.name}
373-
</span>
374-
</SidebarMenuSubButton>
375-
</SidebarMenuSubItem>
376-
))}
377-
</SidebarMenuSub>
378-
</CollapsibleContent>
379-
</SidebarMenuItem>
380-
</Collapsible>
381-
382330
<Collapsible className="group/collapsible">
383331
<SidebarMenuItem>
384332
<CollapsibleTrigger asChild>

package-lock.json

Lines changed: 15 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@
185185
"react-chartjs-2": "^5.3.1",
186186
"react-dom": "^19.2.4",
187187
"react-jsx-parser": "^2.4.1",
188-
"react-resizable-panels": "^4.6.4",
188+
"react-resizable-panels": "^4.6.5",
189189
"recharts": "^2.15.4",
190190
"rehype": "^13.0.2",
191191
"rehype-class-names": "^2.0.0",
@@ -229,7 +229,7 @@
229229
"@types/jsdom": "^27.0.0",
230230
"@types/leaflet.markercluster": "^1.5.6",
231231
"@types/mdx": "^2.0.13",
232-
"@types/node": "^22.19.11",
232+
"@types/node": "^24.10.13",
233233
"@types/rbush": "^4.0.0",
234234
"@types/react": "^19.2.14",
235235
"@types/react-dom": "^19.2.3",
@@ -267,4 +267,4 @@
267267
"@typescript-eslint/parser": "^8.56.0",
268268
"minimatch": "^10.2.2"
269269
}
270-
}
270+
}

0 commit comments

Comments
 (0)