chatlab-cli 0.22.1 → 0.23.0
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/{chunk-OC2W5Q5T.mjs → chunk-3MX7VF2B.mjs} +2 -2
- package/dist/chunk-5ADKYYNA.mjs +28 -0
- package/dist/chunk-5ADKYYNA.mjs.map +1 -0
- package/dist/{chunk-QRC3RSER.mjs → chunk-643S2N2U.mjs} +2 -2
- package/dist/{chunk-XPBPKH6B.mjs → chunk-D2BR3MFN.mjs} +107 -37
- package/dist/chunk-D2BR3MFN.mjs.map +1 -0
- package/dist/{chunk-6NB475AA.mjs → chunk-FJ35V3TE.mjs} +2 -17
- package/dist/chunk-FJ35V3TE.mjs.map +1 -0
- package/dist/{chunk-SQKT45MM.mjs → chunk-G7Q7EQ3V.mjs} +546 -84
- package/dist/chunk-G7Q7EQ3V.mjs.map +1 -0
- package/dist/{chunk-LZ3W6NS5.mjs → chunk-NTWDG52H.mjs} +66 -68
- package/dist/chunk-NTWDG52H.mjs.map +1 -0
- package/dist/{chunk-Z2LYMKCC.mjs → chunk-WTQ7LAZR.mjs} +2 -2
- package/dist/cli.mjs +4 -3
- package/dist/{http-O5P4BYXU.mjs → http-2DN3XOXO.mjs} +8 -7
- package/dist/{import-BDLL3DG7.mjs → import-LCBSBLYF.mjs} +4 -4
- package/dist/index.mjs +10 -9
- package/dist/{mcp-L2TPZFE7.mjs → mcp-AR7HBIK4.mjs} +8 -6
- package/dist/{mcp-L2TPZFE7.mjs.map → mcp-AR7HBIK4.mjs.map} +1 -1
- package/dist/service-WNEVPQ4N.mjs +258 -0
- package/dist/service-WNEVPQ4N.mjs.map +1 -0
- package/dist/{src-FVJL5ENA.mjs → src-EGXULYFQ.mjs} +2 -2
- package/dist/{stream-import-ZTEW3YVL.mjs → stream-import-QM5R5FDG.mjs} +3 -3
- package/dist/{update-checker-MQMQ6A4B.mjs → update-checker-JG5K67O2.mjs} +3 -2
- package/dist/{update-checker-MQMQ6A4B.mjs.map → update-checker-JG5K67O2.mjs.map} +1 -1
- package/dist-web/assets/{DebugToolsPanel-DkbsB6lr.css → DebugToolsPanel-D9O_4J04.css} +1 -1
- package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-hp9Mjpub.js +161 -0
- package/dist-web/assets/{EChartWordcloud-Ubal_aYg.js → EChartWordcloud-Cenbzcyj.js} +1 -1
- package/dist-web/assets/MessageExportModal-CvocO88D.js +1 -0
- package/dist-web/assets/electron-DpE69lO4.js +1 -0
- package/dist-web/assets/electron-SyPZX9OU.js +1 -0
- package/dist-web/assets/{fetch-BS4SlQjA.js → fetch-B7OBmANJ.js} +1 -1
- package/dist-web/assets/{fetch-o5NJ2uWE.js → fetch-BikSxuED.js} +1 -1
- package/dist-web/assets/fetch-BwMZFwbF.js +1 -0
- package/dist-web/assets/fetch-CfTcWxqG.js +1 -0
- package/dist-web/assets/fetch-DTP8Q782.js +17 -0
- package/dist-web/assets/{fetch-W43zfemj.js → fetch-LBHcBBkv.js} +1 -1
- package/dist-web/assets/http-C741fIwb.js +1 -0
- package/dist-web/assets/index-B6dkyIiA.js +2 -0
- package/dist-web/assets/index-CALU1QPF.js +163 -0
- package/dist-web/assets/{index-DOwQB7In.js → index-CHkXbqMb.js} +1 -1
- package/dist-web/assets/{index-DSpvXged.css → index-CvuHOeoU.css} +1 -1
- package/dist-web/assets/{index-BE64tUWq.css → index-CxMP0DNd.css} +1 -1
- package/dist-web/assets/index-DOS5o2_H.js +7 -0
- package/dist-web/assets/{index-CbQMfheg.css → index-DuepdDzz.css} +1 -1
- package/dist-web/assets/index-niwrSprs.js +173 -0
- package/dist-web/assets/model-catalog-DUuKjIVU.js +1 -0
- package/dist-web/assets/{vendor-nuxt-ui-7OAuiz_i.js → vendor-nuxt-ui-CuCZ1aRl.js} +2 -2
- package/dist-web/assets/vendor-reka-ui-BrTYuIfH.js +11 -0
- package/dist-web/assets/{web-Cx5APyCN.js → web-DGd63PrV.js} +1 -1
- package/dist-web/index.html +4 -4
- package/package.json +1 -1
- package/dist/chunk-6NB475AA.mjs.map +0 -1
- package/dist/chunk-LZ3W6NS5.mjs.map +0 -1
- package/dist/chunk-SQKT45MM.mjs.map +0 -1
- package/dist/chunk-XPBPKH6B.mjs.map +0 -1
- package/dist-web/assets/DebugToolsPanel.vue_vue_type_script_setup_true_lang-CqacsKDU.js +0 -147
- package/dist-web/assets/MessageExportModal-D1GY6WSV.js +0 -1
- package/dist-web/assets/electron-8qi0d92j.js +0 -1
- package/dist-web/assets/electron-CsUM2O_Y.js +0 -1
- package/dist-web/assets/fetch-BOogCPfg.js +0 -1
- package/dist-web/assets/fetch-CclRWOHf.js +0 -1
- package/dist-web/assets/fetch-CxwnEEqk.js +0 -17
- package/dist-web/assets/http-CeXMt-Fv.js +0 -1
- package/dist-web/assets/index-CM29Kc4p.js +0 -173
- package/dist-web/assets/index-D183wYuz.js +0 -7
- package/dist-web/assets/index-DTxRy2FH.js +0 -163
- package/dist-web/assets/index-grds3iG-.js +0 -2
- package/dist-web/assets/vendor-reka-ui-CW2cIgMu.js +0 -11
- /package/dist/{chunk-OC2W5Q5T.mjs.map → chunk-3MX7VF2B.mjs.map} +0 -0
- /package/dist/{chunk-QRC3RSER.mjs.map → chunk-643S2N2U.mjs.map} +0 -0
- /package/dist/{chunk-Z2LYMKCC.mjs.map → chunk-WTQ7LAZR.mjs.map} +0 -0
- /package/dist/{http-O5P4BYXU.mjs.map → http-2DN3XOXO.mjs.map} +0 -0
- /package/dist/{import-BDLL3DG7.mjs.map → import-LCBSBLYF.mjs.map} +0 -0
- /package/dist/{src-FVJL5ENA.mjs.map → src-EGXULYFQ.mjs.map} +0 -0
- /package/dist/{stream-import-ZTEW3YVL.mjs.map → stream-import-QM5R5FDG.mjs.map} +0 -0
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
generateMessageKey,
|
|
12
12
|
openBetterSqliteDatabase,
|
|
13
13
|
writeParseResultToDb
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-G7Q7EQ3V.mjs";
|
|
15
15
|
|
|
16
16
|
// src/import/chatlab-reader.ts
|
|
17
17
|
import * as fs from "fs";
|
|
@@ -392,4 +392,4 @@ export {
|
|
|
392
392
|
parseFile,
|
|
393
393
|
importData
|
|
394
394
|
};
|
|
395
|
-
//# sourceMappingURL=chunk-
|
|
395
|
+
//# sourceMappingURL=chunk-3MX7VF2B.mjs.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'module';
|
|
2
|
+
import { dirname as __pathDirname } from 'path';
|
|
3
|
+
import { fileURLToPath as __fileURLToPath } from 'url';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
const __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = __pathDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
resolveCliPath
|
|
9
|
+
} from "./chunk-FJ35V3TE.mjs";
|
|
10
|
+
|
|
11
|
+
// src/version.ts
|
|
12
|
+
import { readFileSync } from "fs";
|
|
13
|
+
var cached;
|
|
14
|
+
function getVersion() {
|
|
15
|
+
if (cached) return cached;
|
|
16
|
+
try {
|
|
17
|
+
const pkgPath = resolveCliPath("package.json");
|
|
18
|
+
cached = JSON.parse(readFileSync(pkgPath, "utf-8")).version;
|
|
19
|
+
} catch {
|
|
20
|
+
cached = "0.0.0-dev";
|
|
21
|
+
}
|
|
22
|
+
return cached;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
getVersion
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=chunk-5ADKYYNA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/version.ts"],"sourcesContent":["import { readFileSync } from 'fs'\nimport { resolveCliPath } from './paths'\n\nlet cached: string | undefined\n\n/**\n * Read version from apps/cli/package.json at runtime.\n * Works for both tsx dev (src/) and bundled (dist/).\n */\nexport function getVersion(): string {\n if (cached) return cached\n try {\n const pkgPath = resolveCliPath('package.json')\n cached = JSON.parse(readFileSync(pkgPath, 'utf-8')).version\n } catch {\n cached = '0.0.0-dev'\n }\n return cached!\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,oBAAoB;AAG7B,IAAI;AAMG,SAAS,aAAqB;AACnC,MAAI,OAAQ,QAAO;AACnB,MAAI;AACF,UAAM,UAAU,eAAe,cAAc;AAC7C,aAAS,KAAK,MAAM,aAAa,SAAS,OAAO,CAAC,EAAE;AAAA,EACtD,QAAQ;AACN,aAAS;AAAA,EACX;AACA,SAAO;AACT;","names":[]}
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
incrementalImport,
|
|
14
14
|
openBetterSqliteDatabase,
|
|
15
15
|
streamingImport
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-G7Q7EQ3V.mjs";
|
|
17
17
|
|
|
18
18
|
// src/import/stream-import.ts
|
|
19
19
|
import * as fs from "fs";
|
|
@@ -141,4 +141,4 @@ export {
|
|
|
141
141
|
analyzeIncrementalImport2 as analyzeIncrementalImport,
|
|
142
142
|
analyzeNewImport2 as analyzeNewImport
|
|
143
143
|
};
|
|
144
|
-
//# sourceMappingURL=chunk-
|
|
144
|
+
//# sourceMappingURL=chunk-643S2N2U.mjs.map
|
|
@@ -7,21 +7,20 @@ const __dirname = __pathDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
importData,
|
|
9
9
|
parseFile
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3MX7VF2B.mjs";
|
|
11
11
|
import {
|
|
12
12
|
analyzeIncrementalImport,
|
|
13
13
|
analyzeNewImport,
|
|
14
14
|
incrementalImport,
|
|
15
15
|
streamImport
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-643S2N2U.mjs";
|
|
17
17
|
import {
|
|
18
18
|
AGENT_TOOL_REGISTRY,
|
|
19
19
|
CoreDataProvider
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WTQ7LAZR.mjs";
|
|
21
21
|
import {
|
|
22
|
-
getVersion
|
|
23
|
-
|
|
24
|
-
} from "./chunk-6NB475AA.mjs";
|
|
22
|
+
getVersion
|
|
23
|
+
} from "./chunk-5ADKYYNA.mjs";
|
|
25
24
|
import {
|
|
26
25
|
AIConversationManager,
|
|
27
26
|
ALL_MIGRATIONS,
|
|
@@ -115,7 +114,10 @@ import {
|
|
|
115
114
|
verifyCliDataPath,
|
|
116
115
|
writeAuthProfile,
|
|
117
116
|
writeConfigField
|
|
118
|
-
} from "./chunk-
|
|
117
|
+
} from "./chunk-G7Q7EQ3V.mjs";
|
|
118
|
+
import {
|
|
119
|
+
resolveCliPath
|
|
120
|
+
} from "./chunk-FJ35V3TE.mjs";
|
|
119
121
|
|
|
120
122
|
// src/http/index.ts
|
|
121
123
|
import * as fs14 from "fs";
|
|
@@ -847,6 +849,9 @@ function registerSqlRoutes(server2, adapter) {
|
|
|
847
849
|
|
|
848
850
|
// src/http/routes/web/session-index.ts
|
|
849
851
|
function registerSessionIndexRoutes(server2, adapter) {
|
|
852
|
+
server2.get("/_web/sessions/index-stats", async () => {
|
|
853
|
+
return session_index_service_exports.getAllIndexStats(adapter);
|
|
854
|
+
});
|
|
850
855
|
server2.post("/_web/sessions/:id/generate-index", async (request) => {
|
|
851
856
|
const gapThreshold = request.body?.gapThreshold ?? 1800;
|
|
852
857
|
const sessionCount = session_index_service_exports.generateIndex(adapter, request.params.id, gapThreshold);
|
|
@@ -1349,9 +1354,16 @@ data: ${JSON.stringify(eventData)}
|
|
|
1349
1354
|
cleanupTemp(tmpPath, tmpDir);
|
|
1350
1355
|
}
|
|
1351
1356
|
});
|
|
1357
|
+
const DEMO_FILES = [
|
|
1358
|
+
"demo-group.json",
|
|
1359
|
+
"demo-private-A-cuilan.json",
|
|
1360
|
+
"demo-private-B-wukong.json",
|
|
1361
|
+
"demo-private-C-spider.json"
|
|
1362
|
+
];
|
|
1352
1363
|
server2.post("/_web/demo/import", async (request, reply) => {
|
|
1353
1364
|
const locale = request.body?.locale || "en";
|
|
1354
1365
|
const nativeBinding = resolveNativeBinding();
|
|
1366
|
+
const total = DEMO_FILES.length;
|
|
1355
1367
|
reply.raw.writeHead(200, {
|
|
1356
1368
|
"Content-Type": "text/event-stream",
|
|
1357
1369
|
"Cache-Control": "no-cache",
|
|
@@ -1364,36 +1376,37 @@ data: ${JSON.stringify(eventData)}
|
|
|
1364
1376
|
`);
|
|
1365
1377
|
}
|
|
1366
1378
|
const tmpDir = fs4.mkdtempSync(path3.join(os.tmpdir(), "chatlab-demo-"));
|
|
1367
|
-
const groupPath = path3.join(tmpDir, "demo-group.json");
|
|
1368
|
-
const privatePath = path3.join(tmpDir, "demo-private.json");
|
|
1369
1379
|
try {
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
const groupResult = await streamImport(dbManager2, groupPath, { nativeBinding });
|
|
1380
|
+
const localPaths = [];
|
|
1381
|
+
for (let i = 0; i < total; i++) {
|
|
1382
|
+
sendEvent("progress", { stage: "downloading", current: i + 1, total });
|
|
1383
|
+
const localPath = path3.join(tmpDir, DEMO_FILES[i]);
|
|
1384
|
+
const resp = await fetch(`${DEMO_BASE_URL}/${locale}/${DEMO_FILES[i]}`, {
|
|
1385
|
+
signal: AbortSignal.timeout(6e4)
|
|
1386
|
+
});
|
|
1387
|
+
if (!resp.ok) throw new Error(`Download demo failed (${DEMO_FILES[i]}): ${resp.status}`);
|
|
1388
|
+
fs4.writeFileSync(localPath, Buffer.from(await resp.arrayBuffer()));
|
|
1389
|
+
localPaths.push(localPath);
|
|
1390
|
+
}
|
|
1391
|
+
sendEvent("progress", { stage: "importing", current: 1, total });
|
|
1392
|
+
const groupResult = await streamImport(dbManager2, localPaths[0], { nativeBinding });
|
|
1384
1393
|
if (!groupResult.success) throw new Error(groupResult.error || "Failed to import group demo");
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1394
|
+
const privateSessionIds = [];
|
|
1395
|
+
for (let i = 1; i < localPaths.length; i++) {
|
|
1396
|
+
sendEvent("progress", { stage: "importing", current: i + 1, total });
|
|
1397
|
+
const result = await streamImport(dbManager2, localPaths[i], { nativeBinding });
|
|
1398
|
+
if (!result.success) throw new Error(result.error || `Failed to import private demo: ${DEMO_FILES[i]}`);
|
|
1399
|
+
if (result.sessionId) privateSessionIds.push(result.sessionId);
|
|
1400
|
+
}
|
|
1401
|
+
sendEvent("progress", { stage: "done", current: total, total });
|
|
1389
1402
|
sendEvent("result", {
|
|
1390
1403
|
success: true,
|
|
1391
1404
|
groupSessionId: groupResult.sessionId,
|
|
1392
|
-
|
|
1405
|
+
privateSessionIds
|
|
1393
1406
|
});
|
|
1394
1407
|
} catch (err) {
|
|
1395
1408
|
const message = err instanceof Error ? err.message : String(err);
|
|
1396
|
-
sendEvent("progress", { stage: "error", current: 0, total
|
|
1409
|
+
sendEvent("progress", { stage: "error", current: 0, total, message });
|
|
1397
1410
|
sendEvent("result", { success: false, error: message });
|
|
1398
1411
|
} finally {
|
|
1399
1412
|
reply.raw.end();
|
|
@@ -1485,7 +1498,7 @@ function registerMergeRoutes(server2, dbManager2, mergeCache) {
|
|
|
1485
1498
|
const merged = buildMergedOutput(dataSources, outputName);
|
|
1486
1499
|
let sessionId;
|
|
1487
1500
|
if (andImport) {
|
|
1488
|
-
const { streamImport: serverStreamImport } = await import("./stream-import-
|
|
1501
|
+
const { streamImport: serverStreamImport } = await import("./stream-import-QM5R5FDG.mjs");
|
|
1489
1502
|
const jsonData = JSON.stringify(merged.chatLabData);
|
|
1490
1503
|
const tmpDir = fs5.mkdtempSync(path4.join(os2.tmpdir(), "chatlab-merged-"));
|
|
1491
1504
|
const tmpPath = path4.join(tmpDir, `${outputName}.json`);
|
|
@@ -1538,7 +1551,7 @@ function registerMergeRoutes(server2, dbManager2, mergeCache) {
|
|
|
1538
1551
|
const db = ensureDb2(dbManager2, sid);
|
|
1539
1552
|
const exported = exportSessionToJson(db);
|
|
1540
1553
|
const { db: tempDb, tempDbPath } = mergeCache.createTempDatabase(exported.meta.name);
|
|
1541
|
-
const { TempDbWriter } = await import("./src-
|
|
1554
|
+
const { TempDbWriter } = await import("./src-EGXULYFQ.mjs");
|
|
1542
1555
|
const writer = new TempDbWriter(tempDb);
|
|
1543
1556
|
writer.writeMeta({
|
|
1544
1557
|
name: exported.meta.name,
|
|
@@ -2096,6 +2109,7 @@ async function runServerAgent(options) {
|
|
|
2096
2109
|
const {
|
|
2097
2110
|
userMessage,
|
|
2098
2111
|
conversationId,
|
|
2112
|
+
historyLeafMessageId,
|
|
2099
2113
|
chatType = "group",
|
|
2100
2114
|
locale = "zh-CN",
|
|
2101
2115
|
assistantSystemPrompt,
|
|
@@ -2108,7 +2122,8 @@ async function runServerAgent(options) {
|
|
|
2108
2122
|
abortSignal,
|
|
2109
2123
|
ownerInfo,
|
|
2110
2124
|
mentionedMembers,
|
|
2111
|
-
dataSnapshot
|
|
2125
|
+
dataSnapshot,
|
|
2126
|
+
thinkingLevel
|
|
2112
2127
|
} = options;
|
|
2113
2128
|
const aiLogger = getServerAiLogger();
|
|
2114
2129
|
const llmConfig = getDefaultAssistantConfig(aiDataDir);
|
|
@@ -2138,7 +2153,7 @@ async function runServerAgent(options) {
|
|
|
2138
2153
|
context: {},
|
|
2139
2154
|
systemPrompt
|
|
2140
2155
|
});
|
|
2141
|
-
if (compressionConfig?.enabled) {
|
|
2156
|
+
if (compressionConfig?.enabled && historyLeafMessageId === void 0) {
|
|
2142
2157
|
const llmAdapter = createCompressionLlmAdapter({
|
|
2143
2158
|
piModel,
|
|
2144
2159
|
apiKey: llmConfig.apiKey,
|
|
@@ -2163,6 +2178,11 @@ async function runServerAgent(options) {
|
|
|
2163
2178
|
}
|
|
2164
2179
|
});
|
|
2165
2180
|
}
|
|
2181
|
+
} else if (compressionConfig?.enabled && historyLeafMessageId !== void 0) {
|
|
2182
|
+
aiLogger?.info?.("Compression", "Skipping compression for edited branch request", {
|
|
2183
|
+
conversationId,
|
|
2184
|
+
historyLeafMessageId
|
|
2185
|
+
});
|
|
2166
2186
|
}
|
|
2167
2187
|
if (abortSignal?.aborted) {
|
|
2168
2188
|
handler.emitStatus("aborted", [], { force: true });
|
|
@@ -2171,7 +2191,7 @@ async function runServerAgent(options) {
|
|
|
2171
2191
|
}
|
|
2172
2192
|
let history = [];
|
|
2173
2193
|
try {
|
|
2174
|
-
history = convManager2.getHistoryForAgent(conversationId);
|
|
2194
|
+
history = convManager2.getHistoryForAgent(conversationId, void 0, historyLeafMessageId);
|
|
2175
2195
|
} catch {
|
|
2176
2196
|
}
|
|
2177
2197
|
handler.emitStatus("preparing", [], { pendingUserMessage: userMessage, force: true });
|
|
@@ -2188,6 +2208,7 @@ async function runServerAgent(options) {
|
|
|
2188
2208
|
maxToolRounds: 5,
|
|
2189
2209
|
abortSignal,
|
|
2190
2210
|
steerMessage,
|
|
2211
|
+
thinkingLevel,
|
|
2191
2212
|
onConvertToLlm: (filteredMessages) => {
|
|
2192
2213
|
cachedMessages = filteredMessages;
|
|
2193
2214
|
},
|
|
@@ -2625,6 +2646,51 @@ data: ${JSON.stringify(data)}
|
|
|
2625
2646
|
server2.get("/_web/ai/conversations/:id/messages", async (request) => {
|
|
2626
2647
|
return convManager2.getMessages(request.params.id);
|
|
2627
2648
|
});
|
|
2649
|
+
server2.post("/_web/ai/conversations/:id/messages/:messageId/delete-from", async (request, reply) => {
|
|
2650
|
+
const { id, messageId } = request.params;
|
|
2651
|
+
if (!id || typeof id !== "string" || !messageId || typeof messageId !== "string") {
|
|
2652
|
+
return reply.code(400).send({ error: "conversation id and messageId are required" });
|
|
2653
|
+
}
|
|
2654
|
+
convManager2.deleteMessagesFrom(id, messageId);
|
|
2655
|
+
return { success: true };
|
|
2656
|
+
});
|
|
2657
|
+
server2.post("/_web/ai/conversations/:id/fork", async (request, reply) => {
|
|
2658
|
+
const { upToMessageId, title } = request.body;
|
|
2659
|
+
if (!upToMessageId || typeof upToMessageId !== "string") {
|
|
2660
|
+
return reply.code(400).send({ error: "upToMessageId is required" });
|
|
2661
|
+
}
|
|
2662
|
+
return convManager2.forkConversation(request.params.id, upToMessageId, title);
|
|
2663
|
+
});
|
|
2664
|
+
server2.put("/_web/ai/messages/:messageId/content", async (request, reply) => {
|
|
2665
|
+
const { content } = request.body;
|
|
2666
|
+
if (!content || typeof content !== "string") {
|
|
2667
|
+
return reply.code(400).send({ error: "content is required" });
|
|
2668
|
+
}
|
|
2669
|
+
convManager2.updateMessageContent(request.params.messageId, content);
|
|
2670
|
+
return { success: true };
|
|
2671
|
+
});
|
|
2672
|
+
server2.post("/_web/ai/conversations/:id/messages/:messageId/delete-relink", async (request, reply) => {
|
|
2673
|
+
const { id, messageId } = request.params;
|
|
2674
|
+
if (!id || !messageId) {
|
|
2675
|
+
return reply.code(400).send({ error: "conversation id and messageId are required" });
|
|
2676
|
+
}
|
|
2677
|
+
convManager2.deleteAndRelinkMessage(id, messageId);
|
|
2678
|
+
return { success: true };
|
|
2679
|
+
});
|
|
2680
|
+
server2.post("/_web/ai/conversations/:id/messages/insert-after", async (request, reply) => {
|
|
2681
|
+
const { afterMessageId, role, content, contentBlocks, tokenUsage } = request.body;
|
|
2682
|
+
if (!afterMessageId || typeof afterMessageId !== "string") {
|
|
2683
|
+
return reply.code(400).send({ error: "afterMessageId is required" });
|
|
2684
|
+
}
|
|
2685
|
+
return convManager2.insertMessageAfter(
|
|
2686
|
+
request.params.id,
|
|
2687
|
+
afterMessageId,
|
|
2688
|
+
role,
|
|
2689
|
+
content,
|
|
2690
|
+
contentBlocks,
|
|
2691
|
+
tokenUsage
|
|
2692
|
+
);
|
|
2693
|
+
});
|
|
2628
2694
|
server2.get("/_web/ai/conversations/:id/token-usage", async (request) => {
|
|
2629
2695
|
return convManager2.getConversationTokenUsage(request.params.id);
|
|
2630
2696
|
});
|
|
@@ -2633,13 +2699,15 @@ data: ${JSON.stringify(data)}
|
|
|
2633
2699
|
const {
|
|
2634
2700
|
userMessage,
|
|
2635
2701
|
conversationId,
|
|
2702
|
+
historyLeafMessageId,
|
|
2636
2703
|
sessionId,
|
|
2637
2704
|
chatType,
|
|
2638
2705
|
locale,
|
|
2639
2706
|
assistantId,
|
|
2640
2707
|
compressionConfig,
|
|
2641
2708
|
ownerInfo,
|
|
2642
|
-
mentionedMembers
|
|
2709
|
+
mentionedMembers,
|
|
2710
|
+
thinkingLevel
|
|
2643
2711
|
} = request.body;
|
|
2644
2712
|
const requestId = `req_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
|
|
2645
2713
|
const abortController = new AbortController();
|
|
@@ -2726,6 +2794,7 @@ data: ${JSON.stringify(data)}
|
|
|
2726
2794
|
await runServerAgent({
|
|
2727
2795
|
userMessage,
|
|
2728
2796
|
conversationId,
|
|
2797
|
+
historyLeafMessageId,
|
|
2729
2798
|
chatType,
|
|
2730
2799
|
locale,
|
|
2731
2800
|
assistantSystemPrompt,
|
|
@@ -2738,7 +2807,8 @@ data: ${JSON.stringify(data)}
|
|
|
2738
2807
|
abortSignal: abortController.signal,
|
|
2739
2808
|
ownerInfo,
|
|
2740
2809
|
mentionedMembers,
|
|
2741
|
-
dataSnapshot
|
|
2810
|
+
dataSnapshot,
|
|
2811
|
+
thinkingLevel
|
|
2742
2812
|
});
|
|
2743
2813
|
} catch (error) {
|
|
2744
2814
|
const msg = error instanceof Error ? error.message : String(error);
|
|
@@ -3808,4 +3878,4 @@ export {
|
|
|
3808
3878
|
startHttpServer,
|
|
3809
3879
|
stopHttpServer
|
|
3810
3880
|
};
|
|
3811
|
-
//# sourceMappingURL=chunk-
|
|
3881
|
+
//# sourceMappingURL=chunk-D2BR3MFN.mjs.map
|