@cc-monitoring/proxy-core 0.1.3-alpha.1 → 0.1.3-alpha.2
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/server/ui-route.js +3 -2
- package/package.json +1 -1
package/dist/server/ui-route.js
CHANGED
|
@@ -3,6 +3,7 @@ import path from 'path';
|
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import { spawn } from 'child_process';
|
|
5
5
|
import { WebSocketServer, WebSocket } from 'ws';
|
|
6
|
+
import { nanoid } from 'nanoid';
|
|
6
7
|
import { loadConfig, saveConfig } from '../config/index.js';
|
|
7
8
|
import { getProcessStatus, startProcess, stopProcess, reloadProcess } from '../utils/pm2.js';
|
|
8
9
|
import { getCallerDirname } from '../utils/esm-dirname.js';
|
|
@@ -235,7 +236,7 @@ export async function setupUiRoutes(fastify) {
|
|
|
235
236
|
}
|
|
236
237
|
if (stream) {
|
|
237
238
|
// Streaming mode: use SSE
|
|
238
|
-
const newSessionId = sessionId ??
|
|
239
|
+
const newSessionId = sessionId ?? nanoid();
|
|
239
240
|
reply.hijack();
|
|
240
241
|
const res = reply.raw;
|
|
241
242
|
res.writeHead(200, {
|
|
@@ -298,7 +299,7 @@ export async function setupUiRoutes(fastify) {
|
|
|
298
299
|
}
|
|
299
300
|
else {
|
|
300
301
|
// Non-streaming mode: buffer all output
|
|
301
|
-
const newSessionId = sessionId ??
|
|
302
|
+
const newSessionId = sessionId ?? nanoid();
|
|
302
303
|
const spawnArgs = sessionId
|
|
303
304
|
? ['-r', sessionId, '-p', prompt]
|
|
304
305
|
: ['--session-id', newSessionId, '-p', prompt];
|