bug fixes

This commit is contained in:
Sreeram Sreedhar 2026-04-20 16:35:58 -07:00
parent 200978c93d
commit 76a32dfd00
4 changed files with 7 additions and 5 deletions

View file

@ -48,7 +48,6 @@ export function supermemoryConvexTools(
* Search through user's memories using semantic search
* The AI agent calls this when it needs to recall information
*/
// @ts-expect-error - AI SDK v4 tool type compatibility
searchMemories: tool({
description:
"Search through the user's memories and past conversations. Use this to recall information the user has shared previously, their preferences, or relevant context from past interactions.",
@ -113,7 +112,6 @@ export function supermemoryConvexTools(
* Add new information to user's memory
* The AI agent calls this when the user shares important information
*/
// @ts-expect-error - AI SDK v4 tool type compatibility
addMemory: tool({
description:
"Store new information about the user that should be remembered for future conversations. Use this when the user shares preferences, facts about themselves, or important context that should be recalled later.",

View file

@ -201,6 +201,7 @@ export function createSupermemoryClient(
*/
getApiStats: async (args?: {
containerTag?: string
limit?: number
}): Promise<ApiStats> => {
return await client.query(query("getApiStats"), args || {})
},

View file

@ -156,16 +156,19 @@ export const getApiLogs = query({
export const getApiStats = query({
args: {
containerTag: v.optional(v.string()),
limit: v.optional(v.number()),
},
handler: async (ctx, args) => {
const limit = args.limit || 1000
const logs = args.containerTag
? await ctx.db
.query("apiLogs")
.withIndex("by_container", (q) =>
q.eq("containerTag", args.containerTag),
)
.collect()
: await ctx.db.query("apiLogs").collect()
.order("desc")
.take(limit)
: await ctx.db.query("apiLogs").order("desc").take(limit)
const stats = {
totalCalls: logs.length,

View file

@ -290,7 +290,7 @@ export function useApiLogs(
* ```
*/
export function useApiStats(
args?: { containerTag?: string },
args?: { containerTag?: string; limit?: number },
componentPath = "supermemory",
) {
const query =