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

Commit 777f914

Browse files
authored
fix: electron build (#908)
1 parent 4165a06 commit 777f914

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

cortex-cpp/CMakeLists.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ project(cortex-cpp C CXX)
44

55
# Build using CMAKE-JS
66
if(DEFINED CMAKE_JS_INC)
7+
if(WIN32)
8+
add_definitions(
9+
-DV8_COMPRESS_POINTERS
10+
-DV8_REVERSE_JSARGS
11+
-DV8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
12+
)
13+
endif()
714
include_directories(${CMAKE_JS_INC})
815
endif()
916

@@ -76,7 +83,19 @@ if(DEFINED CMAKE_JS_INC)
7683

7784
add_library(${PROJECT_NAME} SHARED addon.cc
7885
${CMAKE_CURRENT_SOURCE_DIR}/utils/cpuid/cpu_info.cc
86+
${CMAKE_JS_SRC}
7987
)
88+
89+
if(WIN32)
90+
target_link_libraries(${PROJECT_NAME}
91+
PRIVATE
92+
msvcprt.lib
93+
msvcrt.lib
94+
vcruntime.lib
95+
ucrt.lib
96+
${CMAKE_JS_LIB}
97+
)
98+
endif()
8099
else() # Official build
81100
add_executable(${PROJECT_NAME} main.cc
82101
${CMAKE_CURRENT_SOURCE_DIR}/utils/cpuid/cpu_info.cc

cortex-js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"class-transformer": "^0.5.1",
5555
"class-validator": "^0.14.1",
5656
"cli-progress": "^3.12.0",
57-
"cortex-cpp": "0.4.25",
57+
"cortex-cpp": "0.4.34",
5858
"cortexso-node": "^0.0.4",
5959
"cpu-instructions": "^0.0.11",
6060
"decompress": "^4.2.1",

cortex-js/src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
} from '@/infrastructure/constants/cortex';
66
import { getApp } from './app';
77
import chalk from 'chalk';
8+
import { CortexUsecases } from './usecases/cortex/cortex.usecases';
89

910
/**
1011
* Start the API server
@@ -17,6 +18,8 @@ export async function start(host?: string, port?: number) {
1718

1819
try {
1920
await app.listen(sPort, sHost);
21+
const cortexUsecases = await app.resolve(CortexUsecases);
22+
await cortexUsecases.startCortex();
2023
console.log(chalk.blue(`Started server at http://${sHost}:${sPort}`));
2124
console.log(
2225
chalk.blue(`API Playground available at http://${sHost}:${sPort}/api`),

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export class ChatUsecases {
5050
throw new Error(`No engine found with name: ${model.engine}`);
5151
}
5252
try {
53-
return await engine.inference(createChatDto, headers);
53+
return await engine.inference(
54+
{ ...createChatDto, engine: model.engine },
55+
headers,
56+
);
5457
} catch (error) {
5558
await this.telemetryUseCases.createCrashReport(
5659
error,

0 commit comments

Comments
 (0)