From 7c4e17d843ed05ea02d739b64974671e07cb0eba Mon Sep 17 00:00:00 2001 From: Andy Brenneke Date: Fri, 13 Oct 2023 14:20:08 -0700 Subject: [PATCH] TrimChatMessages now coerces its input array into a chat-message[] --- packages/core/src/model/nodes/TrimChatMessagesNode.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/core/src/model/nodes/TrimChatMessagesNode.ts b/packages/core/src/model/nodes/TrimChatMessagesNode.ts index e7b5c076f..25c1c5c6e 100644 --- a/packages/core/src/model/nodes/TrimChatMessagesNode.ts +++ b/packages/core/src/model/nodes/TrimChatMessagesNode.ts @@ -8,6 +8,7 @@ import { import { NodeImpl, type NodeUIData } from '../../model/NodeImpl.js'; import { nanoid } from 'nanoid/non-secure'; import { + coerceType, type EditorDefinition, type Inputs, type InternalProcessContext, @@ -103,7 +104,7 @@ export class TrimChatMessagesNodeImpl extends NodeImpl { } async process(inputs: Inputs, context: InternalProcessContext): Promise { - const input = expectType(inputs['input' as PortId], 'chat-message[]'); + const input = coerceType(inputs['input' as PortId], 'chat-message[]'); const maxTokenCount = this.chartNode.data.maxTokenCount; const removeFromBeginning = this.chartNode.data.removeFromBeginning;