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

Function getAccessibleCopilotChat

apps/sim/lib/copilot/chat/lifecycle.ts:179–194  ·  view source on GitHub ↗
(
  chatId: string,
  userId: string
)

Source from the content-addressed store, hash-verified

177 * (JSONB), `pinned`, and `lastSeenAt` — none of which the endpoint returns.
178 */
179export async function getAccessibleCopilotChat(
180 chatId: string,
181 userId: string
182): Promise<CopilotChatLegacyDetailRow | null> {
183 const [chat] = await db
184 .select(copilotChatLegacyDetailColumns)
185 .from(copilotChats)
186 .where(and(eq(copilotChats.id, chatId), eq(copilotChats.userId, userId)))
187 .limit(1)
188
189 const authorized = await authorizeCopilotChatRow(chat, chatId, userId)
190 if (!authorized) return null
191
192 const messages = await loadCopilotChatMessages(chatId)
193 return { ...authorized, messages }
194}
195
196/**
197 * Load a copilot chat with the conversation transcript and resources after

Callers 2

lifecycle.test.tsFile · 0.90
GETFunction · 0.90

Calls 3

authorizeCopilotChatRowFunction · 0.85
loadCopilotChatMessagesFunction · 0.85
eqFunction · 0.50

Tested by

no test coverage detected