Skip to content

Commit

Permalink
fix: Jan server - v1/chat/completions is throwing ERR_REQUIRE_ESM (ja…
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored Jan 22, 2024
1 parent b4f104f commit aeab22f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"electron-store": "^8.1.0",
"electron-updater": "^6.1.7",
"fs-extra": "^11.2.0",
"node-fetch": "^3.3.2",
"node-fetch": "2",
"pacote": "^17.0.4",
"request": "^2.88.2",
"request-progress": "^3.0.0",
Expand Down
6 changes: 3 additions & 3 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const JAN_API_PORT = Number.parseInt(process.env.JAN_API_PORT || "1337");
let server: any | undefined = undefined;
let hostSetting: string = JAN_API_HOST;
let portSetting: number = JAN_API_PORT;
let corsEnbaled: boolean = true;
let corsEnabled: boolean = true;
let isVerbose: boolean = true;

/**
Expand Down Expand Up @@ -49,7 +49,7 @@ export const startServer = async (configs?: ServerConfig) => {
isVerbose = configs?.isVerboseEnabled ?? true;
hostSetting = configs?.host ?? JAN_API_HOST;
portSetting = configs?.port ?? JAN_API_PORT;
corsEnbaled = configs?.isCorsEnabled ?? true;
corsEnabled = configs?.isCorsEnabled ?? true;
const serverLogPath = getServerLogPath();

// Start the server
Expand All @@ -66,7 +66,7 @@ export const startServer = async (configs?: ServerConfig) => {
});

// Register CORS if enabled
if (corsEnbaled) await server.register(require("@fastify/cors"), {});
if (corsEnabled) await server.register(require("@fastify/cors"), {});

// Register Swagger for API documentation
await server.register(require("@fastify/swagger"), {
Expand Down

0 comments on commit aeab22f

Please sign in to comment.