mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-10-10 03:28:14 +00:00
fix(tools): resolve openai-middleware and voltagent test type errors (#1689)
This commit is contained in:
parent
b5db9a725b
commit
e3d32b7d52
2 changed files with 11 additions and 5 deletions
|
|
@ -26,7 +26,7 @@ describe("OpenAI middleware memory context", () => {
|
|||
}),
|
||||
}),
|
||||
)
|
||||
const originalCreate = vi.fn(() =>
|
||||
const originalCreate = vi.fn((_body?: unknown) =>
|
||||
Object.assign(Promise.resolve({ choices: [] }), {
|
||||
asResponse: async () => new Response(),
|
||||
}),
|
||||
|
|
@ -53,8 +53,11 @@ describe("OpenAI middleware memory context", () => {
|
|||
],
|
||||
})
|
||||
|
||||
const forwarded = originalCreate.mock.calls[0]?.[0]
|
||||
const content = String(forwarded.messages[0].content)
|
||||
const forwarded = originalCreate.mock.calls[0]?.[0] as
|
||||
| { messages: Array<{ role: string; content: unknown }> }
|
||||
| undefined
|
||||
expect(forwarded).toBeDefined()
|
||||
const content = String(forwarded?.messages[0]?.content)
|
||||
expect(content).toContain("Be helpful.")
|
||||
expect(content).toContain("Fresh profile fact")
|
||||
expect(content).not.toContain("Stale profile fact")
|
||||
|
|
|
|||
|
|
@ -36,10 +36,13 @@ describe("VoltAgent memory context", () => {
|
|||
parts: [],
|
||||
},
|
||||
],
|
||||
} as Parameters<NonNullable<typeof hooks.onPrepareMessages>>[0]
|
||||
} as unknown as Parameters<NonNullable<typeof hooks.onPrepareMessages>>[0]
|
||||
const result = await hooks.onPrepareMessages?.(args)
|
||||
|
||||
const content = String(result?.messages?.[0]?.content ?? "")
|
||||
const firstMessage = result?.messages?.[0] as
|
||||
| Record<string, unknown>
|
||||
| undefined
|
||||
const content = String(firstMessage?.content ?? "")
|
||||
expect(content).toContain("Be helpful.")
|
||||
expect(content).toContain("Fresh profile fact")
|
||||
expect(content).not.toContain("Stale profile fact")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue