@aictrl/hush 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +10 -1
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
- package/src/cli.ts +10 -1
package/dist/cli.js
CHANGED
|
@@ -3,8 +3,17 @@ import { app } from './index.js';
|
|
|
3
3
|
import { createLogger } from './lib/logger.js';
|
|
4
4
|
const log = createLogger('hush-cli');
|
|
5
5
|
const PORT = process.env.PORT || 4000;
|
|
6
|
-
app.listen(PORT, () => {
|
|
6
|
+
const server = app.listen(PORT, () => {
|
|
7
7
|
log.info(`Hush Semantic Gateway is listening on http://localhost:${PORT}`);
|
|
8
8
|
log.info(`Routes: /v1/messages → Anthropic, /v1/chat/completions → OpenAI, /api/paas/v4/** → ZhipuAI, * → Google`);
|
|
9
9
|
});
|
|
10
|
+
server.on('error', (err) => {
|
|
11
|
+
if (err.code === 'EADDRINUSE') {
|
|
12
|
+
log.error(`Port ${PORT} is already in use. Stop the other process or use PORT=<number> hush`);
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
log.error({ err }, 'Failed to start server');
|
|
16
|
+
}
|
|
17
|
+
process.exit(1);
|
|
18
|
+
});
|
|
10
19
|
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AAEtC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,GAAG,GAAG,YAAY,CAAC,UAAU,CAAC,CAAC;AACrC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC;AAEtC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE;IACnC,GAAG,CAAC,IAAI,CAAC,0DAA0D,IAAI,EAAE,CAAC,CAAC;IAC3E,GAAG,CAAC,IAAI,CAAC,wGAAwG,CAAC,CAAC;AACrH,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;IAChD,IAAI,GAAG,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;QAC9B,GAAG,CAAC,KAAK,CAAC,QAAQ,IAAI,sEAAsE,CAAC,CAAC;IAChG,CAAC;SAAM,CAAC;QACN,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,EAAE,wBAAwB,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
package/src/cli.ts
CHANGED
|
@@ -5,7 +5,16 @@ import { createLogger } from './lib/logger.js';
|
|
|
5
5
|
const log = createLogger('hush-cli');
|
|
6
6
|
const PORT = process.env.PORT || 4000;
|
|
7
7
|
|
|
8
|
-
app.listen(PORT, () => {
|
|
8
|
+
const server = app.listen(PORT, () => {
|
|
9
9
|
log.info(`Hush Semantic Gateway is listening on http://localhost:${PORT}`);
|
|
10
10
|
log.info(`Routes: /v1/messages → Anthropic, /v1/chat/completions → OpenAI, /api/paas/v4/** → ZhipuAI, * → Google`);
|
|
11
11
|
});
|
|
12
|
+
|
|
13
|
+
server.on('error', (err: NodeJS.ErrnoException) => {
|
|
14
|
+
if (err.code === 'EADDRINUSE') {
|
|
15
|
+
log.error(`Port ${PORT} is already in use. Stop the other process or use PORT=<number> hush`);
|
|
16
|
+
} else {
|
|
17
|
+
log.error({ err }, 'Failed to start server');
|
|
18
|
+
}
|
|
19
|
+
process.exit(1);
|
|
20
|
+
});
|