mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-10-06 02:47:56 +00:00
fix: provide fallback context window values for Ollama and LM Studio models
- Add fallback ModelInfo when routerModels.ollama or lmStudioModels return undefined - Fixes context window display showing "used/1" instead of actual max tokens - Ensures proper context window management for Ollama and LM Studio providers Fixes #7674
This commit is contained in:
parent
b48b0be061
commit
5b55f6e2c4
1 changed files with 22 additions and 2 deletions
|
|
@ -255,17 +255,37 @@ function getSelectedModel({
|
|||
case "ollama": {
|
||||
const id = apiConfiguration.ollamaModelId ?? ""
|
||||
const info = routerModels.ollama && routerModels.ollama[id]
|
||||
// Provide fallback values when info is undefined to fix context window display
|
||||
return {
|
||||
id,
|
||||
info: info || undefined,
|
||||
info:
|
||||
info ||
|
||||
(id
|
||||
? {
|
||||
maxTokens: 8192,
|
||||
contextWindow: 8192,
|
||||
supportsImages: false,
|
||||
supportsPromptCache: true,
|
||||
}
|
||||
: undefined),
|
||||
}
|
||||
}
|
||||
case "lmstudio": {
|
||||
const id = apiConfiguration.lmStudioModelId ?? ""
|
||||
const info = lmStudioModels && lmStudioModels[apiConfiguration.lmStudioModelId!]
|
||||
// Provide fallback values when info is undefined to fix context window display
|
||||
return {
|
||||
id,
|
||||
info: info || undefined,
|
||||
info:
|
||||
info ||
|
||||
(id
|
||||
? {
|
||||
maxTokens: 8192,
|
||||
contextWindow: 8192,
|
||||
supportsImages: false,
|
||||
supportsPromptCache: false,
|
||||
}
|
||||
: undefined),
|
||||
}
|
||||
}
|
||||
case "vscode-lm": {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue