Skip to content

Commit 426094d

Browse files
variants
1 parent 7f0e90f commit 426094d

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/messages/inject.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,16 @@ export const insertPruneToolContext = (
149149
injectionType: isGitHubCopilot ? "assistant-with-tool-part" : "user-message",
150150
})
151151

152+
const variant = state.variant ?? (lastUserMessage.info as UserMessage).variant
152153
if (isGitHubCopilot) {
153154
messages.push(
154-
createSyntheticAssistantMessageWithToolPart(lastUserMessage, prunableToolsContent),
155+
createSyntheticAssistantMessageWithToolPart(
156+
lastUserMessage,
157+
prunableToolsContent,
158+
variant,
159+
),
155160
)
156161
} else {
157-
messages.push(createSyntheticUserMessage(lastUserMessage, prunableToolsContent))
162+
messages.push(createSyntheticUserMessage(lastUserMessage, prunableToolsContent, variant))
158163
}
159164
}

lib/messages/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ export const createSyntheticUserMessage = (
4141
export const createSyntheticAssistantMessageWithToolPart = (
4242
baseMessage: WithParts,
4343
content: string,
44+
variant?: string,
4445
): WithParts => {
4546
const userInfo = baseMessage.info as UserMessage
4647
const now = Date.now()
@@ -61,6 +62,7 @@ export const createSyntheticAssistantMessageWithToolPart = (
6162
time: { created: now, completed: now },
6263
cost: 0,
6364
tokens: { input: 0, output: 0, reasoning: 0, cache: { read: 0, write: 0 } },
65+
...(variant !== undefined && { variant }),
6466
},
6567
parts: [
6668
{

0 commit comments

Comments
 (0)