Skip to content

Commit 09e4a7b

Browse files
committed
fix(home): add folder to AgentContextType and context persistence
1 parent 6471057 commit 09e4a7b

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed

apps/sim/app/api/copilot/chat/route.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ const ChatMessageSchema = z.object({
8888
'docs',
8989
'table',
9090
'file',
91+
'folder',
9192
]),
9293
label: z.string(),
9394
chatId: z.string().optional(),
@@ -99,6 +100,7 @@ const ChatMessageSchema = z.object({
99100
executionId: z.string().optional(),
100101
tableId: z.string().optional(),
101102
fileId: z.string().optional(),
103+
folderId: z.string().optional(),
102104
})
103105
)
104106
.optional(),

apps/sim/app/api/mothership/chat/route.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const FileAttachmentSchema = z.object({
3636
})
3737

3838
const ResourceAttachmentSchema = z.object({
39-
type: z.enum(['workflow', 'table', 'file', 'knowledgebase']),
39+
type: z.enum(['workflow', 'table', 'file', 'knowledgebase', 'folder']),
4040
id: z.string().min(1),
4141
title: z.string().optional(),
4242
active: z.boolean().optional(),
@@ -66,6 +66,7 @@ const MothershipMessageSchema = z.object({
6666
'docs',
6767
'table',
6868
'file',
69+
'folder',
6970
]),
7071
label: z.string(),
7172
chatId: z.string().optional(),
@@ -77,6 +78,7 @@ const MothershipMessageSchema = z.object({
7778
executionId: z.string().optional(),
7879
tableId: z.string().optional(),
7980
fileId: z.string().optional(),
81+
folderId: z.string().optional(),
8082
})
8183
)
8284
.optional(),
@@ -224,6 +226,7 @@ export async function POST(req: NextRequest) {
224226
...(c.knowledgeId && { knowledgeId: c.knowledgeId }),
225227
...(c.tableId && { tableId: c.tableId }),
226228
...(c.fileId && { fileId: c.fileId }),
229+
...(c.folderId && { folderId: c.folderId }),
227230
})),
228231
}),
229232
}

apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ function mapStoredMessage(msg: TaskStoredMessage): ChatMessage {
294294
...(c.knowledgeId && { knowledgeId: c.knowledgeId }),
295295
...(c.tableId && { tableId: c.tableId }),
296296
...(c.fileId && { fileId: c.fileId }),
297+
...(c.folderId && { folderId: c.folderId }),
297298
}))
298299
}
299300

@@ -1953,6 +1954,7 @@ export function useChat(
19531954
...('knowledgeId' in c && c.knowledgeId ? { knowledgeId: c.knowledgeId } : {}),
19541955
...('tableId' in c && c.tableId ? { tableId: c.tableId } : {}),
19551956
...('fileId' in c && c.fileId ? { fileId: c.fileId } : {}),
1957+
...('folderId' in c && c.folderId ? { folderId: c.folderId } : {}),
19561958
}))
19571959

19581960
setMessages((prev) => [

apps/sim/lib/copilot/process-contents.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ export type AgentContextType =
3333
| 'templates'
3434
| 'workflow_block'
3535
| 'docs'
36+
| 'folder'
3637
| 'active_resource'
3738

3839
export interface AgentContext {

0 commit comments

Comments
 (0)