Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 2ba0bc8

Browse files
committed
fix: add dylib import path
1 parent 1a17c1c commit 2ba0bc8

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

cortex-js/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"scripts": {
1212
"dev": "nest dev",
1313
"build": "nest build && cpx \"cpuinfo/bin/**\" dist/bin",
14-
"build:binary": "run-script-os && cpx \"cpuinfo/bin/**\" dist/bin",
14+
"build:binary": "npx -q patch-package && run-script-os && cpx \"cpuinfo/bin/**\" dist/bin",
1515
"build:binary:windows": "bun build --compile ./src/command.ts --outfile cortex.exe --external @nestjs/microservices --external @nestjs/websockets/socket-module --external class-transformer/storage",
1616
"build:binary:linux": "bun build --compile ./src/command.ts --outfile cortex --external @nestjs/microservices --external @nestjs/websockets/socket-module --external class-transformer/storage",
1717
"build:binary:macos": "bun build --compile ./src/command.ts --outfile cortex --external @nestjs/microservices --external @nestjs/websockets/socket-module --external class-transformer/storage",
@@ -31,8 +31,7 @@
3131
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
3232
"test:e2e": "jest --config ./test/jest-e2e.json",
3333
"typeorm": "typeorm-ts-node-esm",
34-
"build:dev": "npx nest build && chmod +x ./dist/src/command.js && npm link",
35-
"postinstall": "npx --yes patch-package"
34+
"build:dev": "npx nest build && chmod +x ./dist/src/command.js && npm link"
3635
},
3736
"dependencies": {
3837
"@huggingface/gguf": "^0.1.5",

cortex-js/src/usecases/cortex/cortex.usecases.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Injectable } from '@nestjs/common';
22
import { ChildProcess, spawn } from 'child_process';
3-
import { join } from 'path';
3+
import { delimiter, join } from 'path';
44
import { CortexOperationSuccessfullyDto } from '@/infrastructure/dtos/cortex/cortex-operation-successfully.dto';
55
import { HttpService } from '@nestjs/axios';
66

@@ -11,6 +11,7 @@ import {
1111
CORTEX_CPP_HEALTH_Z_URL,
1212
CORTEX_CPP_PROCESS_DESTROY_URL,
1313
} from '@/infrastructure/constants/cortex';
14+
import { Engines } from '@/infrastructure/commanders/types/engine.interface';
1415

1516
@Injectable()
1617
export class CortexUsecases {
@@ -44,6 +45,11 @@ export class CortexUsecases {
4445
throw new Error('The engine is not available, please run "cortex init".');
4546
}
4647

48+
const cortexCPPPath = join(
49+
await this.fileManagerService.getDataFolderPath(),
50+
'cortex-cpp',
51+
);
52+
4753
// go up one level to get the binary folder, have to also work on windows
4854
this.cortexProcess = spawn(cortexCppPath, args, {
4955
detached: !attach,
@@ -52,6 +58,11 @@ export class CortexUsecases {
5258
env: {
5359
...process.env,
5460
CUDA_VISIBLE_DEVICES: '0',
61+
PATH: (process.env.PATH || '').concat(delimiter, cortexCPPPath),
62+
LD_LIBRARY_PATH: (process.env.LD_LIBRARY_PATH || '').concat(
63+
delimiter,
64+
cortexCPPPath,
65+
),
5566
// // Vulkan - Support 1 device at a time for now
5667
// ...(executableOptions.vkVisibleDevices?.length > 0 && {
5768
// GGML_VULKAN_DEVICE: executableOptions.vkVisibleDevices[0],

0 commit comments

Comments
 (0)