Spaces:
Sleeping
Sleeping
fix: docker image llama.cpp error catching
Browse files
src/lib/server/endpoints/local/utilsLocal.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import { getLlama } from "node-llama-cpp";
|
| 2 |
import { logger } from "$lib/server/logger";
|
| 3 |
-
|
| 4 |
export const llama = await getLlama({
|
| 5 |
logger: (level, message) => {
|
| 6 |
// Log messages based on their level
|
|
@@ -28,10 +28,11 @@ export const llama = await getLlama({
|
|
| 28 |
break;
|
| 29 |
}
|
| 30 |
},
|
| 31 |
-
build:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
});
|
| 33 |
-
|
| 34 |
-
if (building) {
|
| 35 |
-
// lazy load llama
|
| 36 |
-
llama.getSwapState();
|
| 37 |
-
}
|
|
|
|
| 1 |
import { getLlama } from "node-llama-cpp";
|
| 2 |
import { logger } from "$lib/server/logger";
|
| 3 |
+
|
| 4 |
export const llama = await getLlama({
|
| 5 |
logger: (level, message) => {
|
| 6 |
// Log messages based on their level
|
|
|
|
| 28 |
break;
|
| 29 |
}
|
| 30 |
},
|
| 31 |
+
build: "never",
|
| 32 |
+
}).catch((e) => {
|
| 33 |
+
logger.warn(
|
| 34 |
+
e,
|
| 35 |
+
"Failed to initialize llama.cpp. This won't break anything if you're not using the \"local\" endpoint."
|
| 36 |
+
);
|
| 37 |
+
return undefined;
|
| 38 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|