Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

🐛 fix(userMemories): must assign workflow id (#11021)

Neko78b0c7be9bb1
diff --git a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic-layers/route.ts b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic-layers/route.ts
index df37ecbe50c..00de5dfc0d5 100644
--- a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic-layers/route.ts
+++ b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topic-layers/route.ts
@@ -1,5 +1,5 @@
import { MemorySourceType } from '@lobechat/types';
-import { createWorkflow, serveMany } from '@upstash/workflow/nextjs';
+import { serve } from '@upstash/workflow/nextjs';
import {
MemoryExtractionExecutor,
@@ -7,12 +7,8 @@ import {
normalizeMemoryExtractionPayload,
} from '@/server/services/memory/userMemory/extract';
-export const { POST } = serveMany({
- 'memory:user-memory:extract:users:topics:extract-layers:other-layers': createWorkflow<
- MemoryExtractionPayloadInput,
- { processed: number; results: any[] }
- >(async (context) => {
- const params = normalizeMemoryExtractionPayload(context.requestPayload || {});
+export const { POST } = serve<MemoryExtractionPayloadInput>(async (context) => {
+ const params = normalizeMemoryExtractionPayload(context.requestPayload || {});
if (!params.userIds.length) {
return { message: 'No user id provided for topic batch.', processed: 0, results: [] };
}
@@ -54,5 +50,4 @@ export const { POST } = serveMany({
}
return { processed: results.length, results };
- }),
});
diff --git a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/workflows/workflows.ts b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/workflows/workflows.ts
index 6420075f8b1..94d6ac31599 100644
--- a/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/workflows/workflows.ts
+++ b/src/app/(backend)/api/workflows/memory-user-memory/pipelines/chat-topic/process-topics/workflows/workflows.ts
@@ -4,6 +4,7 @@ import { createWorkflow } from '@upstash/workflow/nextjs';
import {
MemoryExtractionExecutor,
type MemoryExtractionPayloadInput,
+ TOPIC_WORKFLOW_NAMES,
normalizeMemoryExtractionPayload,
} from '@/server/services/memory/userMemory/extract';
@@ -180,3 +181,8 @@ export const orchestratorWorkflow = createWorkflow<
processedIdentity: identityIndex - (params.identityCursor ?? 0),
};
});
+
+// Explicitly set workflow ids to ensure context.invoke works
+cepWorkflow.workflowId = TOPIC_WORKFLOW_NAMES.cep;
+identityWorkflow.workflowId = TOPIC_WORKFLOW_NAMES.identity;
+orchestratorWorkflow.workflowId = TOPIC_WORKFLOW_NAMES.orchestrator;