bugfix
This commit is contained in:
@@ -734,7 +734,7 @@ export class AgentHarness {
|
|||||||
* Yields typed HarnessEvents (chunk, tool_call, image, done) and saves the
|
* Yields typed HarnessEvents (chunk, tool_call, image, done) and saves the
|
||||||
* conversation to the store once the done event has been emitted.
|
* conversation to the store once the done event has been emitted.
|
||||||
*/
|
*/
|
||||||
async *streamMessage(message: InboundMessage): AsyncGenerator<HarnessEvent> {
|
async *streamMessage(message: InboundMessage, options?: { saveUserMessage?: boolean }): AsyncGenerator<HarnessEvent> {
|
||||||
this.config.logger.info(
|
this.config.logger.info(
|
||||||
{ messageId: message.messageId, userId: message.userId, content: message.content.substring(0, 100) },
|
{ messageId: message.messageId, userId: message.userId, content: message.content.substring(0, 100) },
|
||||||
'Processing user message'
|
'Processing user message'
|
||||||
@@ -889,9 +889,11 @@ export class AgentHarness {
|
|||||||
blobRefs = blobIds.map((id, i) => ({ id, mimeType: collectedImages[i].mimeType, caption: collectedImages[i].caption }));
|
blobRefs = blobIds.map((id, i) => ({ id, mimeType: collectedImages[i].mimeType, caption: collectedImages[i].caption }));
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.conversationStore.saveMessage(
|
if (options?.saveUserMessage !== false) {
|
||||||
this.config.userId, this.config.sessionId, 'user', message.content, undefined, channelKey
|
await this.conversationStore.saveMessage(
|
||||||
);
|
this.config.userId, this.config.sessionId, 'user', message.content, undefined, channelKey
|
||||||
|
);
|
||||||
|
}
|
||||||
await this.conversationStore.saveMessage(
|
await this.conversationStore.saveMessage(
|
||||||
this.config.userId, this.config.sessionId, 'assistant', finalContent,
|
this.config.userId, this.config.sessionId, 'assistant', finalContent,
|
||||||
blobRefs.length > 0 ? { blobs: blobRefs } : undefined,
|
blobRefs.length > 0 ? { blobs: blobRefs } : undefined,
|
||||||
@@ -914,7 +916,7 @@ export class AgentHarness {
|
|||||||
content,
|
content,
|
||||||
timestamp: new Date(),
|
timestamp: new Date(),
|
||||||
};
|
};
|
||||||
yield* this.streamMessage(greetingMessage);
|
yield* this.streamMessage(greetingMessage, { saveUserMessage: false });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user