fix: restore variant restoration for OpenCode 1.4.0 (#871)
OpenCode 1.4.0 moved `UserMessage.variant` from the top-level to `UserMessage.model.variant`. OpenChamber still read the legacy location, so variant selection silently stopped being restored on sessions served by OpenCode 1.4.0+. Read `model.variant` first and fall back to the legacy top-level field so both pre-1.4 and 1.4+ OpenCode servers keep working.
This commit is contained in:
@@ -655,7 +655,10 @@ const TurnBlock: React.FC<TurnBlockProps> = ({
|
||||
|
||||
const turnGroupingContextBase = React.useMemo(() => {
|
||||
const userCreatedAt = (turn.userMessage.info.time as { created?: number } | undefined)?.created;
|
||||
const rawVariant = (turn.userMessage.info as { variant?: unknown } | undefined)?.variant;
|
||||
// OpenCode 1.4.0 moved variant from top-level to model.variant on UserMessage.
|
||||
// Prefer the new location, fall back to the legacy one for older servers.
|
||||
const info = turn.userMessage.info as { variant?: unknown; model?: { variant?: unknown } } | undefined;
|
||||
const rawVariant = info?.model?.variant ?? info?.variant;
|
||||
const userMessageVariant = typeof rawVariant === 'string' && rawVariant.trim().length > 0
|
||||
? rawVariant
|
||||
: undefined;
|
||||
|
||||
Reference in New Issue
Block a user