Skip to content

Commit 9733adc

Browse files
fixed merge conflicts and updated conversationid bug
1 parent cc5874d commit 9733adc

4 files changed

Lines changed: 14 additions & 29 deletions

File tree

packages/tools/src/voltagent/hooks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {
3535
* const hooks = createSupermemoryHooks("user-123", {
3636
* mode: "full",
3737
* addMemory: "always",
38-
* threadId: "conv-456",
38+
* conversationId: "conv-456",
3939
* })
4040
*
4141
* const agent = new Agent({
@@ -49,7 +49,7 @@ import {
4949
*/
5050
export function createSupermemoryHooks(
5151
containerTag: string,
52-
options: SupermemoryVoltAgent = {},
52+
options: SupermemoryVoltAgent,
5353
): VoltAgentHooks {
5454
const ctx = createSupermemoryContext(containerTag, options)
5555

packages/tools/src/voltagent/index.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import type { VoltAgentConfig, SupermemoryVoltAgent } from "./types"
2727
* @param options.containerTag - Required. The container tag/user ID for scoping memories (e.g., "user-123")
2828
* @param options.mode - Memory retrieval mode: "profile" (default), "query", or "full"
2929
* @param options.addMemory - Memory persistence: "always" (default for VoltAgent) or "never"
30-
* @param options.threadId - Optional conversation/thread ID to group messages
30+
* @param options.conversationId - Conversation ID to group messages into a single document
3131
* @param options.apiKey - Supermemory API key (falls back to SUPERMEMORY_API_KEY env var)
3232
* @param options.baseUrl - Custom Supermemory API base URL
3333
* @param options.promptTemplate - Custom function to format memory data into prompt
@@ -37,7 +37,6 @@ import type { VoltAgentConfig, SupermemoryVoltAgent } from "./types"
3737
* @param options.rewriteQuery - If true, AI-rewrite query for better results (+400ms latency). Default: false
3838
* @param options.filters - Advanced AND/OR filters for search
3939
* @param options.include - Control what additional data to include (chunks, documents, etc.)
40-
* @param options.customId - Optional custom ID for document creation (alternative to threadId)
4140
* @param options.metadata - Optional metadata to attach to saved conversations
4241
* @param options.searchMode - Search mode: "memories" (atomic facts), "documents" (chunks), or "hybrid" (both)
4342
* @param options.entityContext - Context for memory extraction (max 1500 chars), guides how memories are understood
@@ -84,7 +83,7 @@ import type { VoltAgentConfig, SupermemoryVoltAgent } from "./types"
8483
* containerTag: "user-123", // Required: user/project ID
8584
* mode: "full", // "profile" | "query" | "full"
8685
* addMemory: "always", // "always" | "never"
87-
* threadId: "conv-456", // Group messages by conversation
86+
* conversationId: "conv-456", // Group messages by conversation
8887
* threshold: 0.7, // 0.0-1.0 (higher = more accurate)
8988
* limit: 15, // Max results to return
9089
* rerank: true, // Rerank for best relevance

packages/tools/src/voltagent/middleware.ts

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface SupermemoryMiddlewareContext {
2727
client: Supermemory
2828
logger: Logger
2929
containerTag: string
30-
threadId?: string
30+
conversationId: string
3131
mode: MemoryMode
3232
addMemory: "always" | "never"
3333
normalizedBaseUrl: string
@@ -56,7 +56,6 @@ export interface SupermemoryMiddlewareContext {
5656
summaries?: boolean
5757
}
5858
// Storage parameters
59-
customId?: string
6059
metadata?: Record<string, string | number | boolean>
6160
searchMode?: "memories" | "documents" | "hybrid"
6261
entityContext?: string
@@ -67,7 +66,7 @@ export interface SupermemoryMiddlewareContext {
6766
*/
6867
export const createSupermemoryContext = (
6968
containerTag: string,
70-
options: SupermemoryVoltAgent = {},
69+
options: SupermemoryVoltAgent,
7170
): SupermemoryMiddlewareContext => {
7271
const apiKey = options.apiKey ?? process.env.SUPERMEMORY_API_KEY
7372
if (!apiKey) {
@@ -77,7 +76,7 @@ export const createSupermemoryContext = (
7776
}
7877

7978
const {
80-
threadId,
79+
conversationId,
8180
mode = "profile",
8281
addMemory = "always", // VoltAgent default: save conversations by default for chat apps
8382
baseUrl,
@@ -88,7 +87,6 @@ export const createSupermemoryContext = (
8887
rewriteQuery,
8988
filters,
9089
include,
91-
customId,
9290
metadata,
9391
searchMode,
9492
entityContext,
@@ -108,7 +106,7 @@ export const createSupermemoryContext = (
108106
client,
109107
logger,
110108
containerTag,
111-
threadId,
109+
conversationId,
112110
mode,
113111
addMemory,
114112
normalizedBaseUrl,
@@ -121,7 +119,6 @@ export const createSupermemoryContext = (
121119
rewriteQuery,
122120
filters,
123121
include,
124-
customId,
125122
metadata,
126123
searchMode,
127124
entityContext,
@@ -137,7 +134,7 @@ const makeTurnKey = (
137134
): string => {
138135
return MemoryCache.makeTurnKey(
139136
ctx.containerTag,
140-
ctx.threadId,
137+
ctx.conversationId,
141138
ctx.mode,
142139
userMessage,
143140
)
@@ -218,7 +215,7 @@ export const enhanceMessagesWithMemories = async (
218215

219216
ctx.logger.info("Starting memory search", {
220217
containerTag: ctx.containerTag,
221-
threadId: ctx.threadId,
218+
conversationId: ctx.conversationId,
222219
mode: ctx.mode,
223220
isNewTurn,
224221
})
@@ -444,13 +441,7 @@ export const saveConversation = async (
444441
return
445442
}
446443

447-
const conversationId = ctx.threadId || ctx.customId
448-
if (!conversationId) {
449-
ctx.logger.debug(
450-
"No threadId or customId provided, skipping conversation save",
451-
)
452-
return
453-
}
444+
const conversationId = ctx.conversationId
454445

455446
try {
456447
const conversationMessages = convertToConversationMessages(messages)

packages/tools/src/voltagent/types.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import type {
2020
export interface SupermemoryVoltAgent
2121
extends Omit<SupermemoryBaseOptions, "verbose"> {
2222
/**
23-
* When using memory storage, set this to enable automatic conversation saving.
24-
* The threadId is used to group messages into a single conversation.
23+
* Conversation ID to group messages into a single document.
24+
* Ensures related messages are added to the same document for that conversation.
2525
*/
26-
threadId?: string
26+
conversationId: string
2727

2828
/**
2929
* Threshold / sensitivity for memory selection. 0 is least sensitive (returns
@@ -60,11 +60,6 @@ export interface SupermemoryVoltAgent
6060
*/
6161
include?: IncludeOptions
6262

63-
/**
64-
* Optional custom ID for document creation (alternative to threadId).
65-
* Max 100 characters, alphanumeric with hyphens and underscores only.
66-
*/
67-
customId?: string
6863

6964
/**
7065
* Optional metadata to attach to saved documents/conversations.

0 commit comments

Comments
 (0)