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) { if (modelConfig && modelConfig.model_path) {
const result = await serviceHub const result = await serviceHub
.models() .models()
.planModelLoad( .planModelLoad(modelConfig.model_path, modelConfig.mmproj_path)
modelConfig.model_path,
undefined,
modelConfig.mmproj_path
)
// Apply the recommended settings to the model sequentially to avoid race conditions // Apply the recommended settings to the model sequentially to avoid race conditions
const settingsToUpdate: Array<{ 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 ( if (
model.settings?.no_kv_offload && model.settings?.no_kv_offload &&
result.noOffloadKVCache !== undefined result.noOffloadKVCache !== undefined

View File

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

View File

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