fix: stable session IDs for chat/task context persistence
- Chat messages use 'chat-{chat_id}' session → conversation history preserved
- Task messages use 'task-{task_id}' session → task context preserved
- Previously every message created a new random session (no memory)
This commit is contained in:
parent
7dd39f65f6
commit
b2a620185f
@ -87,6 +87,7 @@ export class EventRouter {
|
||||
let collectedText = '';
|
||||
for await (const msg of runAgent(prompt, {
|
||||
workDir: this.config.workDir,
|
||||
sessionId: `task-${task.id}`,
|
||||
model: this.config.model,
|
||||
provider: this.config.provider,
|
||||
systemPrompt: this.config.prompt || undefined,
|
||||
@ -155,9 +156,13 @@ export class EventRouter {
|
||||
this.log.info('│ MESSAGE from @%s: "%s"', authorSlug, content.slice(0, 200));
|
||||
this.log.info('│ Context: %s | Mentioned: %s', taskId ? `task=${taskId}` : chatId ? `chat=${chatId}` : 'none', isMentioned);
|
||||
|
||||
// Stable session ID per chat/task context — preserves conversation history
|
||||
const sessionId = chatId ? `chat-${chatId}` : taskId ? `task-${taskId}` : `msg-${Date.now()}`;
|
||||
|
||||
let collectedText = '';
|
||||
for await (const msg of runAgent(content, {
|
||||
workDir: this.config.workDir,
|
||||
sessionId,
|
||||
model: this.config.model,
|
||||
provider: this.config.provider,
|
||||
systemPrompt: this.config.prompt || undefined,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user