Skip to content

Commit 076b5fc

Browse files
committed
chore: migrate no_kv_offload from llamacpp setting to model setting
1 parent bbd272f commit 076b5fc

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

extensions/llamacpp-extension/settings.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,15 +193,6 @@
193193
"value": false
194194
}
195195
},
196-
{
197-
"key": "no_kv_offload",
198-
"title": "Disable KV Offload",
199-
"description": "Disable KV cache offload to GPU (if GPU is used).",
200-
"controllerType": "checkbox",
201-
"controllerProps": {
202-
"value": false
203-
}
204-
},
205196
{
206197
"key": "cache_type_k",
207198
"title": "KV Cache K Type",

web-app/src/hooks/useModelProvider.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,11 @@ export const useModelProvider = create<ModelProviderState>()(
9393
? legacyModels
9494
: models
9595
).find(
96-
(m) => m.id.split(':').slice(0, 2).join(getServiceHub().path().sep()) === model.id
96+
(m) =>
97+
m.id
98+
.split(':')
99+
.slice(0, 2)
100+
.join(getServiceHub().path().sep()) === model.id
97101
)?.settings || model.settings
98102
const existingModel = models.find((m) => m.id === model.id)
99103
return {
@@ -227,7 +231,7 @@ export const useModelProvider = create<ModelProviderState>()(
227231
>
228232
}
229233

230-
if (version === 0 && state?.providers) {
234+
if (version <= 1 && state?.providers) {
231235
state.providers.forEach((provider) => {
232236
// Update cont_batching description for llamacpp provider
233237
if (provider.provider === 'llamacpp' && provider.settings) {
@@ -270,14 +274,23 @@ export const useModelProvider = create<ModelProviderState>()(
270274
},
271275
}
272276
}
277+
278+
if (!model.settings.no_kv_offload) {
279+
model.settings.no_kv_offload = {
280+
...modelSettings.no_kv_offload,
281+
controller_props: {
282+
...modelSettings.no_kv_offload.controller_props,
283+
},
284+
}
285+
}
273286
})
274287
}
275288
})
276289
}
277290

278291
return state
279292
},
280-
version: 1,
293+
version: 2,
281294
}
282295
)
283296
)

web-app/src/lib/predefined.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,13 @@ export const modelSettings = {
144144
type: 'text',
145145
},
146146
},
147+
no_kv_offload: {
148+
key: 'no_kv_offload',
149+
title: 'Disable KV Offload',
150+
description: 'Disable KV cache offload to GPU (if GPU is used).',
151+
controller_type: 'checkbox',
152+
controller_props: {
153+
value: false,
154+
},
155+
},
147156
}

0 commit comments

Comments
 (0)