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

Commit ffd8aaf

Browse files
authored
chore: unsupported platform engine status (#920)
1 parent f82f5d7 commit ffd8aaf

File tree

3 files changed

+26
-19
lines changed

3 files changed

+26
-19
lines changed

cortex-js/src/domain/abstracts/engine.abstract.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export enum EngineStatus {
77
READY = 'READY',
88
MISSING_CONFIGURATION = 'MISSING_CONFIGURATION',
99
NOT_INITIALIZED = 'NOT_INITIALIZED',
10+
NOT_SUPPORTED = 'NOT_SUPPORTED',
1011
ERROR = 'ERROR',
1112
}
1213

cortex-js/src/infrastructure/repositories/extensions/extension.repository.ts

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,27 +64,33 @@ export class ExtensionRepositoryImpl implements ExtensionRepository {
6464
this.httpService,
6565
this.fileManagerService,
6666
);
67-
onnxEngine.status = existsSync(
68-
join(
69-
await this.fileManagerService.getCortexCppEnginePath(),
70-
Engines.onnx,
71-
),
72-
)
73-
? EngineStatus.READY
74-
: EngineStatus.NOT_INITIALIZED;
67+
onnxEngine.status =
68+
existsSync(
69+
join(
70+
await this.fileManagerService.getCortexCppEnginePath(),
71+
Engines.onnx,
72+
),
73+
) && process.platform === 'win32'
74+
? EngineStatus.READY
75+
: process.platform !== 'win32'
76+
? EngineStatus.NOT_SUPPORTED
77+
: EngineStatus.NOT_INITIALIZED;
7578

7679
const tensorrtLLMEngine = new TensorrtLLMProvider(
7780
this.httpService,
7881
this.fileManagerService,
7982
);
80-
tensorrtLLMEngine.status = existsSync(
81-
join(
82-
await this.fileManagerService.getCortexCppEnginePath(),
83-
Engines.tensorrtLLM,
84-
),
85-
)
86-
? EngineStatus.READY
87-
: EngineStatus.NOT_INITIALIZED;
83+
tensorrtLLMEngine.status =
84+
existsSync(
85+
join(
86+
await this.fileManagerService.getCortexCppEnginePath(),
87+
Engines.tensorrtLLM,
88+
),
89+
) && process.platform !== 'darwin'
90+
? EngineStatus.READY
91+
: process.platform === 'darwin'
92+
? EngineStatus.NOT_SUPPORTED
93+
: EngineStatus.NOT_INITIALIZED;
8894

8995
await llamaCPPEngine.onLoad();
9096
await onnxEngine.onLoad();

cortex-js/src/infrastructure/services/file-manager/file-manager.service.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,11 @@ export class FileManagerService {
335335

336336
try {
337337
const content = readFileSync(configPath, 'utf8');
338-
config = yaml.load(content) as Config;
338+
config = (yaml.load(content) as Config) ?? this.defaultConfig();
339339
} catch {}
340340
return {
341-
host: config.apiServerHost ?? 'localhost',
342-
port: config.apiServerPort ?? 1337,
341+
host: this.defaultConfig().apiServerHost ?? 'localhost',
342+
port: this.defaultConfig().apiServerPort ?? 1337,
343343
};
344344
}
345345
}

0 commit comments

Comments
 (0)