Skip to content

Commit a7c93e0

Browse files
committed
refactor: simplify add messages
1 parent 3b62fcb commit a7c93e0

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

packages/agent-api/src/functions/chats-post.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ export async function postChats(request: HttpRequest, context: InvocationContext
151151
try {
152152
if (content) {
153153
// When no content is generated, do not update the history as it's likely an error
154-
await chatHistory.addMessage(new HumanMessage(question));
155-
await chatHistory.addMessage(new AIMessage(content));
154+
await chatHistory.addMessages([new HumanMessage(question), new AIMessage(content)]);
156155
context.log('Chat history updated successfully');
157156

158157
// Ensure the session title has finished generating

0 commit comments

Comments
 (0)