Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: electron build #908

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions cortex-cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cortex-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 3 additions & 0 deletions cortex-js/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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`),
Expand Down
5 changes: 4 additions & 1 deletion cortex-js/src/usecases/chat/chat.usecases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading