mirror of
https://github.com/stablyai/orca.git
synced 2026-10-23 00:03:52 +00:00
fix(native-chat): narrow the model branch to a string session-option value
SessionOptionValue widened to string | boolean for fast mode, so the model branch could index valuesByModel with a boolean and pass one to the persist callback. A boolean there is a malformed command, not a model id.
This commit is contained in:
@@ -121,6 +121,12 @@ function recordCommandApply(args: {
|
||||
}
|
||||
const previousModelId = effectiveModelId
|
||||
if (optionId === 'model') {
|
||||
// Why: SessionOptionValue widened to string | boolean for fast mode, but a
|
||||
// model id is always a string - a boolean here is a malformed command, not a
|
||||
// model, and must not index valuesByModel or reach the persist callback.
|
||||
if (typeof value !== 'string') {
|
||||
return false
|
||||
}
|
||||
if (previousModelId !== value) {
|
||||
// Why: a model command can reset model-scoped state, so an older value
|
||||
// from a prior visit is no longer evidence about this live session.
|
||||
|
||||
Reference in New Issue
Block a user