You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(handleContextStrategy): add usePrevSummary logic in case only summary was pruned
refactor(loadHistory): initial message query will return all ordered messages but keep track of the latest summary
refactor(getMessagesForConversation): use object for single param, edit jsdoc, edit all files using the method
refactor(ChatGPTClient): order messages before buildPrompt is called, TODO: add convoSumBuffMemory logic
* This function constructs a conversation thread by traversing messages from a given parentMessageId up to the root message.
492
522
* It handles cyclic references by ensuring that a message is not processed more than once.
493
-
* If a message has a 'summary' property, the traversal stops at that message.
523
+
* If the 'summary' option is set to true and a message has a 'summary' property:
524
+
* - The message's 'role' is set to 'system'.
525
+
* - The message's 'text' is set to its 'summary'.
526
+
* - If the message has a 'summaryTokenCount', the message's 'tokenCount' is set to 'summaryTokenCount'.
527
+
* The traversal stops at the message with the 'summary' property.
494
528
*
495
529
* Each message object should have an 'id' or 'messageId' property and may have a 'parentMessageId' property.
496
530
* The 'parentMessageId' is the ID of the message that the current message is a reply to.
497
531
* If 'parentMessageId' is not present, null, or is '00000000-0000-0000-0000-000000000000',
498
532
* the message is considered a root message.
499
533
*
500
-
* @param {Array} messages - An array of message objects. Each object should have either an 'id' or 'messageId' property, and may have a 'parentMessageId' property.
501
-
* @param {string} parentMessageId - The ID of the parent message to start the traversal from.
502
-
* @param {Function} [mapMethod] - An optional function to map over the ordered messages. If provided, it will be applied to each message in the resulting array.
503
-
* @returns {Array} An array containing the messages in the order they should be displayed, starting with the most recent message with a 'summary' property if present, and ending with the message identified by 'parentMessageId'.
534
+
* @param {Object} options - The options for the function.
535
+
* @param {Array} options.messages - An array of message objects. Each object should have either an 'id' or 'messageId' property, and may have a 'parentMessageId' property.
536
+
* @param {string} options.parentMessageId - The ID of the parent message to start the traversal from.
537
+
* @param {Function} [options.mapMethod] - An optional function to map over the ordered messages. If provided, it will be applied to each message in the resulting array.
538
+
* @param {boolean} [options.summary=false] - If set to true, the traversal modifies messages with 'summary' and 'summaryTokenCount' properties and stops at the message with a 'summary' property.
539
+
* @returns {Array} An array containing the messages in the order they should be displayed, starting with the most recent message with a 'summary' property if the 'summary' option is true, and ending with the message identified by 'parentMessageId'.
0 commit comments