local ollama commentary

This commit is contained in:
legop3
2026-02-24 19:03:20 -05:00
parent da79a62db6
commit 42c885af28
10 changed files with 326 additions and 12 deletions
+8
View File
@@ -162,6 +162,13 @@ function pushHistory(message) {
}
}
function getRecentMessages(limit = 20, options = {}) {
const safeLimit = Number.isFinite(limit) ? Math.max(0, Math.floor(limit)) : 20;
const includeSystem = options?.includeSystem !== false;
const source = includeSystem ? history : history.filter((entry) => !entry?.system);
return source.slice(-safeLimit);
}
function broadcastMessage(message) {
pushHistory(message);
publishEvent({ source: 'chat', type: 'chat:message', payload: message });
@@ -432,4 +439,5 @@ module.exports = {
sendExternalTyping,
buildTypingPayload,
sendSystemMessage,
getRecentMessages,
};