Skip to content

Commit 694d8e3

Browse files
committed
fix: use variant from baseMessage in synthetic user message
Instead of creating a separate findUserVariant function that iterates through messages, access the variant directly from the baseMessage that is already passed to createSyntheticUserMessage.
1 parent 20e1efa commit 694d8e3

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/messages/utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const SYNTHETIC_PART_ID = "prt_01234567890123456789012345"
88

99
export const createSyntheticUserMessage = (baseMessage: WithParts, content: string): WithParts => {
1010
const userInfo = baseMessage.info as UserMessage
11+
const variant = (userInfo as any).variant
1112
return {
1213
info: {
1314
id: SYNTHETIC_MESSAGE_ID,
@@ -19,6 +20,7 @@ export const createSyntheticUserMessage = (baseMessage: WithParts, content: stri
1920
providerID: userInfo.model.providerID,
2021
modelID: userInfo.model.modelID,
2122
},
23+
...(variant !== undefined && { variant }),
2224
},
2325
parts: [
2426
{

0 commit comments

Comments
 (0)