continue-custom/core/llm/constructMessages.ts
Nate Sesti e1ed7ed0a2 ✨ config.ts
2023-12-14 12:47:01 -08:00

17 lines
415 B
TypeScript

import { ChatHistory, ChatMessage } from "..";
export function constructMessages(history: ChatHistory): ChatMessage[] {
const msgs: ChatMessage[] = [];
for (const historyItem of history) {
for (const ctxItem of historyItem.contextItems) {
msgs.push({
role: historyItem.message.role,
content: ctxItem.content,
});
}
msgs.push(historyItem.message);
}
return msgs;
}