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

Method appendMessage

apps/sim/executor/handlers/agent/memory.ts:248–270  ·  view source on GitHub ↗
(workspaceId: string, key: string, message: Message)

Source from the content-addressed store, hash-verified

246 }
247
248 private async appendMessage(workspaceId: string, key: string, message: Message): Promise<void> {
249 const now = new Date()
250
251 const sanitizedMessage = this.sanitizeMessageForStorage(message)
252
253 await db
254 .insert(memory)
255 .values({
256 id: generateId(),
257 workspaceId,
258 key,
259 data: [sanitizedMessage],
260 createdAt: now,
261 updatedAt: now,
262 })
263 .onConflictDoUpdate({
264 target: [memory.workspaceId, memory.key],
265 set: {
266 data: sql`${memory.data} || ${JSON.stringify([sanitizedMessage])}::jsonb`,
267 updatedAt: now,
268 },
269 })
270 }
271
272 private parsePositiveInt(value: string | undefined, defaultValue: number): number {
273 if (!value) return defaultValue

Callers 1

appendToMemoryMethod · 0.95

Calls 2

generateIdFunction · 0.90

Tested by

no test coverage detected