chore: update argument

This commit is contained in:
Faisal Amir 2025-09-11 14:23:56 +07:00
parent abd0cbe599
commit 14c7fc0450
3 changed files with 20 additions and 8 deletions

View File

@ -55,11 +55,7 @@ export function ModelSetting({
if (modelConfig && modelConfig.model_path) {
const result = await serviceHub
.models()
.planModelLoad(
modelConfig.model_path,
undefined,
modelConfig.mmproj_path
)
.planModelLoad(modelConfig.model_path, modelConfig.mmproj_path)
// Apply the recommended settings to the model sequentially to avoid race conditions
const settingsToUpdate: Array<{
@ -78,6 +74,15 @@ export function ModelSetting({
})
}
if (
model.settings?.no_kv_offload &&
result.noOffloadKVCache !== undefined
) {
settingsToUpdate.push({
key: 'no_kv_offload',
value: result.noOffloadKVCache,
})
}
if (
model.settings?.no_kv_offload &&
result.noOffloadKVCache !== undefined

View File

@ -495,12 +495,14 @@ export class DefaultModelsService implements ModelsService {
async planModelLoad(
modelPath: string,
mmprojPath?: string,
requestedCtx?: number
): Promise<ModelPlan> {
try {
const engine = this.getEngine('llamacpp') as AIEngine & {
planModelLoad?: (
path: string,
mmprojPath?: string,
requestedCtx?: number
) => Promise<ModelPlan>
}
@ -514,7 +516,12 @@ export class DefaultModelsService implements ModelsService {
(core) => core.joinPath
)
const fullModelPath = await joinPath([janDataFolderPath, modelPath])
return await engine.planModelLoad(fullModelPath, requestedCtx)
// mmprojPath is currently unused, but included for compatibility
return await engine.planModelLoad(
fullModelPath,
mmprojPath,
requestedCtx
)
}
// Fallback if method is not available

View File

@ -138,7 +138,7 @@ export interface ModelsService {
validateGgufFile(filePath: string): Promise<ModelValidationResult>
planModelLoad(
modelPath: string,
requestedCtx?: number,
mmprojPath?: string
mmprojPath?: string,
requestedCtx?: number
): Promise<ModelPlan>
}