fix: handle symlink model import failure - fallback to legacy model run
This commit is contained in:
parent
c501641c91
commit
af20587846
@ -100,12 +100,10 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
|
|||||||
// Legacy chat model support
|
// Legacy chat model support
|
||||||
model.settings = {
|
model.settings = {
|
||||||
...model.settings,
|
...model.settings,
|
||||||
llama_model_path: model.file_path
|
llama_model_path: await getModelFilePath(
|
||||||
? await joinPath([
|
model,
|
||||||
await dirName(model.file_path),
|
model.settings.llama_model_path
|
||||||
model.settings.llama_model_path,
|
),
|
||||||
])
|
|
||||||
: await getModelFilePath(model, model.settings.llama_model_path),
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const { llama_model_path, ...settings } = model.settings
|
const { llama_model_path, ...settings } = model.settings
|
||||||
@ -262,7 +260,7 @@ export default class JanInferenceCortexExtension extends LocalOAIEngine {
|
|||||||
|
|
||||||
/// Legacy
|
/// Legacy
|
||||||
const getModelFilePath = async (
|
const getModelFilePath = async (
|
||||||
model: Model,
|
model: Model & { file_path?: string },
|
||||||
file: string
|
file: string
|
||||||
): Promise<string> => {
|
): Promise<string> => {
|
||||||
// Symlink to the model file
|
// Symlink to the model file
|
||||||
@ -272,6 +270,9 @@ const getModelFilePath = async (
|
|||||||
) {
|
) {
|
||||||
return model.sources[0]?.url
|
return model.sources[0]?.url
|
||||||
}
|
}
|
||||||
|
if (model.file_path) {
|
||||||
|
await joinPath([await dirName(model.file_path), file])
|
||||||
|
}
|
||||||
return joinPath([await getJanDataFolderPath(), 'models', model.id, file])
|
return joinPath([await getJanDataFolderPath(), 'models', model.id, file])
|
||||||
}
|
}
|
||||||
///
|
///
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user