-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmain.ts
36 lines (29 loc) · 989 Bytes
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { createApi } from "@/api/server.ts";
import { loadAuthKeys } from "@/common/auth.ts";
import { parseArgs } from "@/common/args.ts";
import { config, loadConfig } from "@/common/config.ts";
import { logger } from "@/common/logging.ts";
import { loadModel } from "@/common/modelContainer.ts";
import { getYalsVersion } from "@/common/utils.ts";
if (import.meta.main) {
// Use Promise resolution to avoid nested try/catch
const version = await getYalsVersion();
if (version) {
logger.info(`Using YALS commit ${version}`);
} else {
logger.info("Could not find YALS commit version. Launching anyway.");
}
// Parse CLI args
const { args, usage } = parseArgs();
// Display help message if needed
if (args.support.help) {
console.log(usage);
Deno.exit();
}
await loadConfig(args);
if (config.model.model_name) {
await loadModel(config.model);
}
await loadAuthKeys();
createApi();
}