mirror of
https://github.com/simstudioai/sim.git
synced 2026-01-09 15:07:55 -05:00
* improvement(memory): should not be block scoped * cleanup provider code * update other providers * cleanup fallback code * remove flaky test * fix memory * move streaming fix to right level * cleanup streaming server * make memories workspace scoped * update docs * fix dedup logic * fix streaming parsing issue for multiple onStream calls for same block * fix(provieders): support parallel agent tool calls, consolidate utils * address greptile comments * remove all comments * fixed openrouter response format handling, groq & cerebras response formats * removed duplicate type --------- Co-authored-by: waleed <walif6@gmail.com>
73 lines
1.8 KiB
TypeScript
73 lines
1.8 KiB
TypeScript
import type { MemoryResponse } from '@/tools/memory/types'
|
|
import type { ToolConfig } from '@/tools/types'
|
|
|
|
export const memoryGetAllTool: ToolConfig<any, MemoryResponse> = {
|
|
id: 'memory_get_all',
|
|
name: 'Get All Memories',
|
|
description: 'Retrieve all memories from the database',
|
|
version: '1.0.0',
|
|
|
|
params: {},
|
|
|
|
request: {
|
|
url: (params): any => {
|
|
const workspaceId = params._context?.workspaceId
|
|
|
|
if (!workspaceId) {
|
|
return {
|
|
_errorResponse: {
|
|
status: 400,
|
|
data: {
|
|
success: false,
|
|
error: {
|
|
message: 'workspaceId is required and must be provided in execution context',
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|
|
|
|
return `/api/memory?workspaceId=${encodeURIComponent(workspaceId)}`
|
|
},
|
|
method: 'GET',
|
|
headers: () => ({
|
|
'Content-Type': 'application/json',
|
|
}),
|
|
},
|
|
|
|
transformResponse: async (response): Promise<MemoryResponse> => {
|
|
const result = await response.json()
|
|
|
|
const data = result.data || result
|
|
const memories = data.memories || data || []
|
|
|
|
if (!Array.isArray(memories) || memories.length === 0) {
|
|
return {
|
|
success: true,
|
|
output: {
|
|
memories: [],
|
|
message: 'No memories found',
|
|
},
|
|
}
|
|
}
|
|
|
|
return {
|
|
success: true,
|
|
output: {
|
|
memories,
|
|
message: `Found ${memories.length} memories`,
|
|
},
|
|
}
|
|
},
|
|
|
|
outputs: {
|
|
success: { type: 'boolean', description: 'Whether all memories were retrieved successfully' },
|
|
memories: {
|
|
type: 'array',
|
|
description: 'Array of all memory objects with key, conversationId, and data fields',
|
|
},
|
|
message: { type: 'string', description: 'Success or error message' },
|
|
error: { type: 'string', description: 'Error message if operation failed' },
|
|
},
|
|
}
|