Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(home): add folder to AgentContextType and context persistence
  • Loading branch information
waleedlatif1 committed Apr 7, 2026
commit 09e4a7bbcc6ce6aa59927eb4950924397abcf89e
2 changes: 2 additions & 0 deletions apps/sim/app/api/copilot/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const ChatMessageSchema = z.object({
'docs',
'table',
'file',
'folder',
]),
label: z.string(),
chatId: z.string().optional(),
Expand All @@ -99,6 +100,7 @@ const ChatMessageSchema = z.object({
executionId: z.string().optional(),
tableId: z.string().optional(),
fileId: z.string().optional(),
folderId: z.string().optional(),
})
)
.optional(),
Expand Down
5 changes: 4 additions & 1 deletion apps/sim/app/api/mothership/chat/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const FileAttachmentSchema = z.object({
})

const ResourceAttachmentSchema = z.object({
type: z.enum(['workflow', 'table', 'file', 'knowledgebase']),
type: z.enum(['workflow', 'table', 'file', 'knowledgebase', 'folder']),
id: z.string().min(1),
title: z.string().optional(),
active: z.boolean().optional(),
Expand Down Expand Up @@ -66,6 +66,7 @@ const MothershipMessageSchema = z.object({
'docs',
'table',
'file',
'folder',
]),
label: z.string(),
chatId: z.string().optional(),
Expand All @@ -77,6 +78,7 @@ const MothershipMessageSchema = z.object({
executionId: z.string().optional(),
tableId: z.string().optional(),
fileId: z.string().optional(),
folderId: z.string().optional(),
})
)
.optional(),
Expand Down Expand Up @@ -224,6 +226,7 @@ export async function POST(req: NextRequest) {
...(c.knowledgeId && { knowledgeId: c.knowledgeId }),
...(c.tableId && { tableId: c.tableId }),
...(c.fileId && { fileId: c.fileId }),
...(c.folderId && { folderId: c.folderId }),
})),
}),
}
Expand Down
2 changes: 2 additions & 0 deletions apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ function mapStoredMessage(msg: TaskStoredMessage): ChatMessage {
...(c.knowledgeId && { knowledgeId: c.knowledgeId }),
...(c.tableId && { tableId: c.tableId }),
...(c.fileId && { fileId: c.fileId }),
...(c.folderId && { folderId: c.folderId }),
}))
}

Expand Down Expand Up @@ -1953,6 +1954,7 @@ export function useChat(
...('knowledgeId' in c && c.knowledgeId ? { knowledgeId: c.knowledgeId } : {}),
...('tableId' in c && c.tableId ? { tableId: c.tableId } : {}),
...('fileId' in c && c.fileId ? { fileId: c.fileId } : {}),
...('folderId' in c && c.folderId ? { folderId: c.folderId } : {}),
}))

setMessages((prev) => [
Expand Down
1 change: 1 addition & 0 deletions apps/sim/lib/copilot/process-contents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export type AgentContextType =
| 'templates'
| 'workflow_block'
| 'docs'
| 'folder'
| 'active_resource'

export interface AgentContext {
Expand Down
Loading