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

Commit b77fb70

Browse files
authored
fix: cortex serve should run in attached mode by default (#711)
1 parent afbc566 commit b77fb70

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

cortex-js/src/app.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { ModelsController } from './infrastructure/controllers/models.controller
2626
import { ThreadsController } from './infrastructure/controllers/threads.controller';
2727
import { StatusController } from './infrastructure/controllers/status.controller';
2828
import { ProcessController } from './infrastructure/controllers/process.controller';
29+
import { DownloadManagerModule } from './download-manager/download-manager.module';
2930

3031
@Module({
3132
imports: [
@@ -48,6 +49,7 @@ import { ProcessController } from './infrastructure/controllers/process.controll
4849
FileManagerModule,
4950
TelemetryModule,
5051
UtilModule,
52+
DownloadManagerModule,
5153
],
5254
controllers: [
5355
AssistantsController,

cortex-js/src/infrastructure/commanders/serve.command.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ServeStopCommand } from './sub-commands/serve-stop.command';
1212
type ServeOptions = {
1313
address?: string;
1414
port?: number;
15-
attach: boolean;
15+
detach: boolean;
1616
};
1717

1818
@SubCommand({
@@ -36,7 +36,7 @@ export class ServeCommand extends CommandRunner {
3636
private async startServer(
3737
host: string,
3838
port: number,
39-
options: ServeOptions = { attach: true },
39+
options: ServeOptions = { detach: false },
4040
) {
4141
const serveProcess = spawn(
4242
'node',
@@ -50,11 +50,11 @@ export class ServeCommand extends CommandRunner {
5050
CORTEX_JS_PORT: port.toString(),
5151
NODE_ENV: 'production',
5252
},
53-
stdio: options?.attach ? 'inherit' : 'ignore',
53+
stdio: options?.detach ? 'ignore' : 'inherit',
5454
detached: true,
5555
},
5656
);
57-
if (!options?.attach) {
57+
if (options?.detach) {
5858
serveProcess.unref();
5959
console.log('Started server at http://%s:%d', host, port);
6060
}
@@ -77,12 +77,12 @@ export class ServeCommand extends CommandRunner {
7777
}
7878

7979
@Option({
80-
flags: '-a, --attach',
81-
description: 'Attach to interactive chat session',
80+
flags: '-d, --detach',
81+
description: 'Run the server in detached mode',
8282
defaultValue: false,
83-
name: 'attach',
83+
name: 'detach',
8484
})
85-
parseAttach() {
85+
parseDetach() {
8686
return true;
8787
}
8888
}

0 commit comments

Comments
 (0)