Skip to content

Commit dab1461

Browse files
committed
Remove auto injected tasks
1 parent 286e9d7 commit dab1461

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

apps/sim/lib/copilot/chat/workspace-context.ts

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { db } from '@sim/db'
22
import {
3-
copilotChats,
43
knowledgeBase,
54
knowledgeConnector,
65
mcpServers,
@@ -10,7 +9,7 @@ import {
109
workflowSchedule,
1110
} from '@sim/db/schema'
1211
import { createLogger } from '@sim/logger'
13-
import { and, count, desc, eq, inArray, isNull } from 'drizzle-orm'
12+
import { and, count, eq, inArray, isNull } from 'drizzle-orm'
1413
import { getAccessibleOAuthCredentials } from '@/lib/credentials/environment'
1514
import { listWorkspaceFiles } from '@/lib/uploads/contexts/workspace'
1615
import { listCustomTools } from '@/lib/workflows/custom-tools/operations'
@@ -56,7 +55,7 @@ export interface WorkspaceMdData {
5655
tables: Array<{ id: string; name: string; description?: string | null; rowCount: number }>
5756
files: Array<{ name: string; type: string; size: number }>
5857
credentials: Array<{ providerId: string }>
59-
tasks: Array<{ id: string; title: string; updatedAt: Date }>
58+
tasks?: Array<{ id: string; title: string; updatedAt: Date }>
6059
customTools?: Array<{ id: string; name: string }>
6160
mcpServers?: Array<{ id: string; name: string; url?: string | null; enabled: boolean }>
6261
skills?: Array<{ id: string; name: string; description: string }>
@@ -182,14 +181,6 @@ export function buildWorkspaceMd(data: WorkspaceMdData): string {
182181
sections.push(`## Jobs (${data.jobs.length})\n${lines.join('\n')}`)
183182
}
184183

185-
if (data.tasks.length > 0) {
186-
const lines = data.tasks.map((t) => {
187-
const date = t.updatedAt.toISOString().split('T')[0]
188-
return `- **${t.title || 'Untitled'}** (${t.id}) — ${date}`
189-
})
190-
sections.push(`## Recent Tasks (${data.tasks.length})\n${lines.join('\n')}`)
191-
}
192-
193184
return sections.join('\n\n')
194185
}
195186

@@ -216,7 +207,6 @@ export async function generateWorkspaceContext(
216207
tables,
217208
files,
218209
credentials,
219-
recentTasks,
220210
customTools,
221211
mcpServerRows,
222212
skillRows,
@@ -262,23 +252,6 @@ export async function generateWorkspaceContext(
262252

263253
getAccessibleOAuthCredentials(workspaceId, userId),
264254

265-
db
266-
.select({
267-
id: copilotChats.id,
268-
title: copilotChats.title,
269-
updatedAt: copilotChats.updatedAt,
270-
})
271-
.from(copilotChats)
272-
.where(
273-
and(
274-
eq(copilotChats.workspaceId, workspaceId),
275-
eq(copilotChats.userId, userId),
276-
eq(copilotChats.type, 'mothership')
277-
)
278-
)
279-
.orderBy(desc(copilotChats.updatedAt))
280-
.limit(5),
281-
282255
listCustomTools({ userId, workspaceId }),
283256

284257
db
@@ -363,11 +336,6 @@ export async function generateWorkspaceContext(
363336
tables: tables.map((t, i) => ({ ...t, rowCount: rowCounts[i] ?? 0 })),
364337
files: files.map((f) => ({ name: f.name, type: f.type, size: f.size })),
365338
credentials: credentials.map((c) => ({ providerId: c.providerId })),
366-
tasks: recentTasks.map((t) => ({
367-
id: t.id,
368-
title: t.title || 'Untitled',
369-
updatedAt: t.updatedAt,
370-
})),
371339
customTools: customTools.map((t) => ({ id: t.id, name: t.title })),
372340
mcpServers: mcpServerRows,
373341
skills: skillRows.map((s) => ({ id: s.id, name: s.name, description: s.description })),

0 commit comments

Comments
 (0)