diff --git a/cortex-cpp/CMakeLists.txt b/cortex-cpp/CMakeLists.txt index 031428263..a53e9fa70 100644 --- a/cortex-cpp/CMakeLists.txt +++ b/cortex-cpp/CMakeLists.txt @@ -4,6 +4,13 @@ project(cortex-cpp C CXX) # Build using CMAKE-JS if(DEFINED CMAKE_JS_INC) + if(WIN32) + add_definitions( + -DV8_COMPRESS_POINTERS + -DV8_REVERSE_JSARGS + -DV8_COMPRESS_POINTERS_IN_ISOLATE_CAGE + ) + endif() include_directories(${CMAKE_JS_INC}) endif() @@ -76,7 +83,19 @@ if(DEFINED CMAKE_JS_INC) add_library(${PROJECT_NAME} SHARED addon.cc ${CMAKE_CURRENT_SOURCE_DIR}/utils/cpuid/cpu_info.cc + ${CMAKE_JS_SRC} ) + + if(WIN32) + target_link_libraries(${PROJECT_NAME} + PRIVATE + msvcprt.lib + msvcrt.lib + vcruntime.lib + ucrt.lib + ${CMAKE_JS_LIB} + ) + endif() else() # Official build add_executable(${PROJECT_NAME} main.cc ${CMAKE_CURRENT_SOURCE_DIR}/utils/cpuid/cpu_info.cc diff --git a/cortex-js/package.json b/cortex-js/package.json index 81dd98da3..2711965ac 100644 --- a/cortex-js/package.json +++ b/cortex-js/package.json @@ -54,7 +54,7 @@ "class-transformer": "^0.5.1", "class-validator": "^0.14.1", "cli-progress": "^3.12.0", - "cortex-cpp": "0.4.25", + "cortex-cpp": "0.4.34", "cortexso-node": "^0.0.4", "cpu-instructions": "^0.0.11", "decompress": "^4.2.1", diff --git a/cortex-js/src/index.ts b/cortex-js/src/index.ts index 0f6faf861..a355a9a7d 100644 --- a/cortex-js/src/index.ts +++ b/cortex-js/src/index.ts @@ -5,6 +5,7 @@ import { } from '@/infrastructure/constants/cortex'; import { getApp } from './app'; import chalk from 'chalk'; +import { CortexUsecases } from './usecases/cortex/cortex.usecases'; /** * Start the API server @@ -17,6 +18,8 @@ export async function start(host?: string, port?: number) { try { await app.listen(sPort, sHost); + const cortexUsecases = await app.resolve(CortexUsecases); + await cortexUsecases.startCortex(); console.log(chalk.blue(`Started server at http://${sHost}:${sPort}`)); console.log( chalk.blue(`API Playground available at http://${sHost}:${sPort}/api`), diff --git a/cortex-js/src/usecases/chat/chat.usecases.ts b/cortex-js/src/usecases/chat/chat.usecases.ts index 7c0854181..190c24f96 100644 --- a/cortex-js/src/usecases/chat/chat.usecases.ts +++ b/cortex-js/src/usecases/chat/chat.usecases.ts @@ -50,7 +50,10 @@ export class ChatUsecases { throw new Error(`No engine found with name: ${model.engine}`); } try { - return await engine.inference(createChatDto, headers); + return await engine.inference( + { ...createChatDto, engine: model.engine }, + headers, + ); } catch (error) { await this.telemetryUseCases.createCrashReport( error,