MCPcopy Index your code
hub / github.com/simstudioai/sim / loadCopilotChatMessages

Function loadCopilotChatMessages

apps/sim/lib/copilot/chat/lifecycle.ts:77–89  ·  view source on GitHub ↗
(chatId: string)

Source from the content-addressed store, hash-verified

75 * pipeline is unchanged.
76 */
77export async function loadCopilotChatMessages(chatId: string): Promise<PersistedMessage[]> {
78 const rows = await db
79 .select({ content: copilotMessages.content })
80 .from(copilotMessages)
81 .where(and(eq(copilotMessages.chatId, chatId), isNull(copilotMessages.deletedAt)))
82 .orderBy(
83 sql`${copilotMessages.seq} asc nulls last`,
84 asc(copilotMessages.createdAt),
85 asc(copilotMessages.id)
86 )
87 // Also strip on read: rows written before the backfill still carry outputs.
88 return rows.map((row) => stripToolResultOutput(row.content as PersistedMessage))
89}
90
91type CopilotChatAuthRow = Pick<
92 typeof copilotChats.$inferSelect,

Callers 4

route.tsFile · 0.90
route.tsFile · 0.90
getAccessibleCopilotChatFunction · 0.85

Calls 2

stripToolResultOutputFunction · 0.90
eqFunction · 0.50

Tested by

no test coverage detected