MCPcopy Create free account
hub / github.com/continuedev/continue / copyInteractionForMutation

Function copyInteractionForMutation

gui/src/hooks/useLLMLog.ts:103–116  ·  view source on GitHub ↗

* Makes a copy of an interaction that can be mutated without changing * any objects/arrays that are part of the old state. We always make * a copy of the last (open) result group, so that we can simply append * to it; this is very slightly inefficient for the case where we're * handling a single

(oldInteraction: LLMInteraction)

Source from the content-addressed store, hash-verified

101 * handling a single end item with no results, but makes things simpler.
102 */
103function copyInteractionForMutation(oldInteraction: LLMInteraction) {
104 const oldResults = oldInteraction.results;
105 let oldLastGroup = oldInteraction.results[oldInteraction.results.length - 1];
106 let newResults;
107
108 if (oldLastGroup == undefined || oldLastGroup.length == MAX_GROUP_LENGTH) {
109 newResults = [...oldInteraction.results];
110 } else {
111 newResults = oldInteraction.results.slice(0, -1);
112 newResults.push([...oldLastGroup]);
113 }
114
115 return { ...oldInteraction, results: newResults };
116}
117
118function appendItemsToLLMLog(
119 oldLog: LLMLog,

Callers 1

appendItemsToLLMLogFunction · 0.85

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected