Skip to content

Commit

Permalink
TrimChatMessages now coerces its input array into a chat-message[]
Browse files Browse the repository at this point in the history
  • Loading branch information
abrenneke committed Oct 13, 2023
1 parent 2884c28 commit 7c4e17d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/core/src/model/nodes/TrimChatMessagesNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -103,7 +104,7 @@ export class TrimChatMessagesNodeImpl extends NodeImpl<TrimChatMessagesNode> {
}

async process(inputs: Inputs, context: InternalProcessContext<TrimChatMessagesNode>): Promise<Outputs> {
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;

Expand Down

0 comments on commit 7c4e17d

Please sign in to comment.