Skip to content

Function: appendUserMessageToChatHistory()

ts
function appendUserMessageToChatHistory(chatHistory: readonly ChatHistoryItem[], message: string): ChatHistoryItem[]

Appends a user message to the chat history. If the last message in the chat history is also a user message, the new message will be appended to it.

Parameters

ParameterType
chatHistoryreadonly ChatHistoryItem[]
messagestring

Returns

ChatHistoryItem[]

Defined in

utils/appendUserMessageToChatHistory.ts:7