chatlab-cli 0.27.1 → 0.28.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/README.md +1 -1
- package/dist/{chat-command-B7POB3C3.mjs → chat-command-7WL5NMZ6.mjs} +5 -5
- package/dist/{chunk-I7BHOZPX.mjs → chunk-55WR6WKW.mjs} +84 -19
- package/dist/{chunk-I7BHOZPX.mjs.map → chunk-55WR6WKW.mjs.map} +1 -1
- package/dist/{chunk-3FUF3PEY.mjs → chunk-GFRG7TZQ.mjs} +27 -12
- package/dist/chunk-GFRG7TZQ.mjs.map +1 -0
- package/dist/{chunk-N3G43SCQ.mjs → chunk-GPF34WXV.mjs} +2560 -324
- package/dist/chunk-GPF34WXV.mjs.map +1 -0
- package/dist/{chunk-WQMKKUSD.mjs → chunk-VASK54KT.mjs} +2 -2
- package/dist/{chunk-3JNVGW62.mjs → chunk-WGS33EWH.mjs} +2 -2
- package/dist/{chunk-RJ4D4QWK.mjs → chunk-XNU5X7EV.mjs} +3 -3
- package/dist/{chunk-SIVERPF5.mjs → chunk-YQ2FJGBT.mjs} +172 -18
- package/dist/chunk-YQ2FJGBT.mjs.map +1 -0
- package/dist/{chunk-YUFYTDRH.mjs → chunk-YZDEZ6UI.mjs} +3 -3
- package/dist/{chunk-SAE2H2LN.mjs → chunk-ZSFVX6FM.mjs} +3 -3
- package/dist/cli.mjs +4 -4
- package/dist/{http-A54ZBBAY.mjs → http-C2FBHNZG.mjs} +9 -9
- package/dist/{import-EA3TB3S2.mjs → import-ED6JCPSJ.mjs} +5 -5
- package/dist/index.mjs +9 -9
- package/dist/{mcp-DJDOWHH3.mjs → mcp-5JIBER4M.mjs} +5 -5
- package/dist/semantic-index-worker.mjs +1 -1
- package/dist/{src-EKPMJRG6.mjs → src-WBNM42SL.mjs} +21 -3
- package/dist/{stream-import-FQFNRQ2B.mjs → stream-import-37U3SROO.mjs} +4 -4
- package/dist/{worker-runtime-UH2OBO3T.mjs → worker-runtime-6DGYL4TF.mjs} +2 -2
- package/dist-web/assets/{DebugToolsPanel.vue_vue_type_script_setup_true_lang-NL1sTF6i.js → DebugToolsPanel.vue_vue_type_script_setup_true_lang-CCz0Syxo.js} +5 -5
- package/dist-web/assets/{MessageExportModal-B60rvfCh.js → MessageExportModal-Dd6R-cX_.js} +1 -1
- package/dist-web/assets/electron-D9vE5t3H.js +1 -0
- package/dist-web/assets/electron-DGxVMsvC.js +1 -0
- package/dist-web/assets/{electron-BRUg9LnY.js → electron-DjminAKK.js} +1 -1
- package/dist-web/assets/{fetch-DSN-QYZE.js → fetch-B_kLRm6-.js} +1 -1
- package/dist-web/assets/{fetch-DLAp7h55.js → fetch-CURbMNJV.js} +1 -1
- package/dist-web/assets/fetch-Cle6QKmL.js +3 -0
- package/dist-web/assets/{fetch-BIpjJHxj.js → fetch-DFCYOQe5.js} +1 -1
- package/dist-web/assets/{fetch-DNSaxRnL.js → fetch-DOhCQ5J8.js} +1 -1
- package/dist-web/assets/{fetch-DE8gj5Ke.js → fetch-DV8A1dGB.js} +1 -1
- package/dist-web/assets/{fetch-C-m3IysH.js → fetch-Wad5mWVH.js} +1 -1
- package/dist-web/assets/{fetch-BRsMdFcn.js → fetch-r83wdzHy.js} +1 -1
- package/dist-web/assets/{fetch-Cma-mZjd.js → fetch-srCJzcWc.js} +1 -1
- package/dist-web/assets/{fetch-woAa3H2L.js → fetch-uM3erGZm.js} +1 -1
- package/dist-web/assets/index-7E5GSvR2.css +1 -0
- package/dist-web/assets/index-BCRHSc1k.js +173 -0
- package/dist-web/assets/{index-r_zHR2t9.js → index-BIvLzdwg.js} +1 -1
- package/dist-web/assets/{index-o6veAyTB.js → index-BpszRZ8V.js} +3 -3
- package/dist-web/assets/index-D5UgZUpS.js +12 -0
- package/dist-web/assets/{index-iwqJDVMJ.js → index-hOsKRsp6.js} +2 -2
- package/dist-web/assets/{index-B9I-Y3fR.js → index-tkbEq8av.js} +1 -1
- package/dist-web/assets/web-D27K6zSX.js +1 -0
- package/dist-web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-3FUF3PEY.mjs.map +0 -1
- package/dist/chunk-N3G43SCQ.mjs.map +0 -1
- package/dist/chunk-SIVERPF5.mjs.map +0 -1
- package/dist-web/assets/electron-2m4Vdk2z.js +0 -1
- package/dist-web/assets/electron-CRSL7qPM.js +0 -1
- package/dist-web/assets/fetch-DOEbyLSD.js +0 -3
- package/dist-web/assets/index-B3mDjury.js +0 -11
- package/dist-web/assets/index-GAU7LI1r.js +0 -173
- package/dist-web/assets/index-YmzTgkb2.css +0 -1
- package/dist-web/assets/web-C2UtGskd.js +0 -1
- /package/dist/{chat-command-B7POB3C3.mjs.map → chat-command-7WL5NMZ6.mjs.map} +0 -0
- /package/dist/{chunk-WQMKKUSD.mjs.map → chunk-VASK54KT.mjs.map} +0 -0
- /package/dist/{chunk-3JNVGW62.mjs.map → chunk-WGS33EWH.mjs.map} +0 -0
- /package/dist/{chunk-RJ4D4QWK.mjs.map → chunk-XNU5X7EV.mjs.map} +0 -0
- /package/dist/{chunk-YUFYTDRH.mjs.map → chunk-YZDEZ6UI.mjs.map} +0 -0
- /package/dist/{chunk-SAE2H2LN.mjs.map → chunk-ZSFVX6FM.mjs.map} +0 -0
- /package/dist/{http-A54ZBBAY.mjs.map → http-C2FBHNZG.mjs.map} +0 -0
- /package/dist/{import-EA3TB3S2.mjs.map → import-ED6JCPSJ.mjs.map} +0 -0
- /package/dist/{mcp-DJDOWHH3.mjs.map → mcp-5JIBER4M.mjs.map} +0 -0
- /package/dist/{src-EKPMJRG6.mjs.map → src-WBNM42SL.mjs.map} +0 -0
- /package/dist/{stream-import-FQFNRQ2B.mjs.map → stream-import-37U3SROO.mjs.map} +0 -0
- /package/dist/{worker-runtime-UH2OBO3T.mjs.map → worker-runtime-6DGYL4TF.mjs.map} +0 -0
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ English | [简体中文](./README.zh-CN.md)
|
|
|
14
14
|
|
|
15
15
|
ChatLab is an open-source desktop app for understanding your social conversations. It combines a flexible SQL engine with AI agents so you can explore patterns, ask better questions, and extract insights from chat data, all on your own machine.
|
|
16
16
|
|
|
17
|
-
Currently supported: **WhatsApp, LINE, QQ, Discord, Instagram, Telegram, and
|
|
17
|
+
Currently supported: **WhatsApp, LINE, QQ, Discord, Instagram, Telegram, iMessage, and Google Chat**. Coming next: **Messenger and KakaoTalk**.
|
|
18
18
|
|
|
19
19
|
> New install? Start here: [Getting started](https://docs.chatlab.fun/usage/quick-start)
|
|
20
20
|
|
|
@@ -6,10 +6,10 @@ const __filename = __fileURLToPath(import.meta.url);
|
|
|
6
6
|
const __dirname = __pathDirname(__filename);
|
|
7
7
|
import {
|
|
8
8
|
createCliRunAgentStream
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
12
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-XNU5X7EV.mjs";
|
|
10
|
+
import "./chunk-VASK54KT.mjs";
|
|
11
|
+
import "./chunk-GPF34WXV.mjs";
|
|
12
|
+
import "./chunk-55WR6WKW.mjs";
|
|
13
13
|
import "./chunk-GFHSSCCR.mjs";
|
|
14
14
|
|
|
15
15
|
// src/ai/chat-command.ts
|
|
@@ -302,4 +302,4 @@ export {
|
|
|
302
302
|
runChatCommand,
|
|
303
303
|
runChatTurn
|
|
304
304
|
};
|
|
305
|
-
//# sourceMappingURL=chat-command-
|
|
305
|
+
//# sourceMappingURL=chat-command-7WL5NMZ6.mjs.map
|
|
@@ -200,6 +200,14 @@ function writeAuthProfile(name, profile) {
|
|
|
200
200
|
const filePath = getAuthProfilesPath();
|
|
201
201
|
fs2.writeFileSync(filePath, JSON.stringify(data, null, 2), { encoding: "utf-8", mode: 384 });
|
|
202
202
|
}
|
|
203
|
+
function deleteAuthProfile(name) {
|
|
204
|
+
const data = loadAuthProfiles();
|
|
205
|
+
if (!(name in data.profiles)) return false;
|
|
206
|
+
delete data.profiles[name];
|
|
207
|
+
const filePath = getAuthProfilesPath();
|
|
208
|
+
fs2.writeFileSync(filePath, JSON.stringify(data, null, 2), { encoding: "utf-8", mode: 384 });
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
203
211
|
|
|
204
212
|
// ../../packages/config/src/migrations/runner.ts
|
|
205
213
|
import * as fs3 from "fs";
|
|
@@ -12678,11 +12686,22 @@ function resolveSlot(slot, configs) {
|
|
|
12678
12686
|
const fallback = configs[0];
|
|
12679
12687
|
return fallback ? { configId: fallback.id, modelId: fallback.model || "" } : null;
|
|
12680
12688
|
}
|
|
12689
|
+
function getAuthProfile(config) {
|
|
12690
|
+
return config.authProfile;
|
|
12691
|
+
}
|
|
12692
|
+
function isAuthProfileUsed(configs, authProfile, profileProvider) {
|
|
12693
|
+
return configs.some((config) => {
|
|
12694
|
+
const configAuthProfile = getAuthProfile(config);
|
|
12695
|
+
if (configAuthProfile === authProfile) return true;
|
|
12696
|
+
return !configAuthProfile && profileProvider !== void 0 && config.provider === profileProvider;
|
|
12697
|
+
});
|
|
12698
|
+
}
|
|
12681
12699
|
var LLMConfigStore = class {
|
|
12682
12700
|
storage;
|
|
12683
12701
|
t;
|
|
12684
12702
|
generateId;
|
|
12685
12703
|
onApiKeyCreated;
|
|
12704
|
+
onApiKeyDeleted;
|
|
12686
12705
|
resolveApiKey;
|
|
12687
12706
|
onStoreLoaded;
|
|
12688
12707
|
constructor(storage, deps = {}) {
|
|
@@ -12690,6 +12709,7 @@ var LLMConfigStore = class {
|
|
|
12690
12709
|
this.t = deps.t || defaultT;
|
|
12691
12710
|
this.generateId = deps.generateId || defaultGenerateId;
|
|
12692
12711
|
this.onApiKeyCreated = deps.onApiKeyCreated;
|
|
12712
|
+
this.onApiKeyDeleted = deps.onApiKeyDeleted;
|
|
12693
12713
|
this.resolveApiKey = deps.resolveApiKey;
|
|
12694
12714
|
this.onStoreLoaded = deps.onStoreLoaded;
|
|
12695
12715
|
}
|
|
@@ -12788,20 +12808,27 @@ var LLMConfigStore = class {
|
|
|
12788
12808
|
if (index === -1) {
|
|
12789
12809
|
return { success: false, error: this.t("llm.configNotFound") };
|
|
12790
12810
|
}
|
|
12811
|
+
const oldConfig = store.configs[index];
|
|
12812
|
+
const oldProfileName = oldConfig.authProfile;
|
|
12791
12813
|
const updated = {
|
|
12792
|
-
...
|
|
12814
|
+
...oldConfig,
|
|
12793
12815
|
...updates,
|
|
12794
12816
|
updatedAt: Date.now()
|
|
12795
12817
|
};
|
|
12796
12818
|
store.configs[index] = updated;
|
|
12819
|
+
let oldProfileToDelete = null;
|
|
12797
12820
|
if (updates.apiKey && this.onApiKeyCreated) {
|
|
12798
12821
|
const profileName = this.onApiKeyCreated(updated, updates.apiKey);
|
|
12799
12822
|
if (profileName) {
|
|
12800
12823
|
;
|
|
12801
12824
|
store.configs[index].authProfile = profileName;
|
|
12825
|
+
if (oldProfileName && oldProfileName !== profileName && !isAuthProfileUsed(store.configs, oldProfileName, oldConfig.provider)) {
|
|
12826
|
+
oldProfileToDelete = oldConfig;
|
|
12827
|
+
}
|
|
12802
12828
|
}
|
|
12803
12829
|
}
|
|
12804
12830
|
this.saveStore(store);
|
|
12831
|
+
if (oldProfileToDelete) this.onApiKeyDeleted?.(oldProfileToDelete);
|
|
12805
12832
|
return { success: true };
|
|
12806
12833
|
}
|
|
12807
12834
|
deleteConfig(id) {
|
|
@@ -12810,6 +12837,7 @@ var LLMConfigStore = class {
|
|
|
12810
12837
|
if (index === -1) {
|
|
12811
12838
|
return { success: false, error: this.t("llm.configNotFound") };
|
|
12812
12839
|
}
|
|
12840
|
+
const deleted = store.configs[index];
|
|
12813
12841
|
store.configs.splice(index, 1);
|
|
12814
12842
|
const fallback = store.configs[0];
|
|
12815
12843
|
if (store.defaultAssistant?.configId === id) {
|
|
@@ -12819,6 +12847,10 @@ var LLMConfigStore = class {
|
|
|
12819
12847
|
store.fastModel = fallback ? { configId: fallback.id, modelId: fallback.model || "" } : null;
|
|
12820
12848
|
}
|
|
12821
12849
|
this.saveStore(store);
|
|
12850
|
+
const deletedProfileName = getAuthProfile(deleted);
|
|
12851
|
+
if (!deletedProfileName || !isAuthProfileUsed(store.configs, deletedProfileName, deleted.provider)) {
|
|
12852
|
+
this.onApiKeyDeleted?.(deleted);
|
|
12853
|
+
}
|
|
12822
12854
|
return { success: true };
|
|
12823
12855
|
}
|
|
12824
12856
|
setDefaultAssistantModel(configId, modelId) {
|
|
@@ -15283,7 +15315,7 @@ function normalizeConfig(raw) {
|
|
|
15283
15315
|
mode,
|
|
15284
15316
|
local: { modelId: raw.local?.modelId ?? base.local.modelId },
|
|
15285
15317
|
api,
|
|
15286
|
-
searchMaxResults:
|
|
15318
|
+
searchMaxResults: SEARCH_MAX_RESULTS_DEFAULT
|
|
15287
15319
|
};
|
|
15288
15320
|
}
|
|
15289
15321
|
var SemanticIndexConfigStore = class {
|
|
@@ -15430,6 +15462,8 @@ var OpenAICompatibleEmbeddingProvider = class {
|
|
|
15430
15462
|
const [vector] = await this.embedDocuments([text]);
|
|
15431
15463
|
return vector;
|
|
15432
15464
|
}
|
|
15465
|
+
async preload() {
|
|
15466
|
+
}
|
|
15433
15467
|
};
|
|
15434
15468
|
|
|
15435
15469
|
// ../../packages/node-runtime/src/semantic-index/embedding/text.ts
|
|
@@ -15509,6 +15543,9 @@ var LocalEmbeddingProvider = class {
|
|
|
15509
15543
|
const [vector] = await this.embedDocuments([withInstruction]);
|
|
15510
15544
|
return vector;
|
|
15511
15545
|
}
|
|
15546
|
+
async preload() {
|
|
15547
|
+
await this.getExtractor();
|
|
15548
|
+
}
|
|
15512
15549
|
};
|
|
15513
15550
|
|
|
15514
15551
|
// ../../packages/node-runtime/src/semantic-index/embedding/profiles.ts
|
|
@@ -16045,7 +16082,7 @@ var SemanticIndexStateStore = class {
|
|
|
16045
16082
|
return rows.map(rowToState);
|
|
16046
16083
|
}
|
|
16047
16084
|
remove(dbPathHash) {
|
|
16048
|
-
this.db.prepare(`DELETE FROM semantic_index_session WHERE db_path_hash = ?`).run(dbPathHash);
|
|
16085
|
+
return this.db.prepare(`DELETE FROM semantic_index_session WHERE db_path_hash = ?`).run(dbPathHash).changes;
|
|
16049
16086
|
}
|
|
16050
16087
|
close() {
|
|
16051
16088
|
this.db.close();
|
|
@@ -16126,6 +16163,7 @@ var KNOWN_PLATFORMS = {
|
|
|
16126
16163
|
WHATSAPP: "whatsapp",
|
|
16127
16164
|
TELEGRAM: "telegram",
|
|
16128
16165
|
INSTAGRAM: "instagram",
|
|
16166
|
+
GOOGLE_CHAT: "google-chat",
|
|
16129
16167
|
LINE: "line",
|
|
16130
16168
|
UNKNOWN: "unknown"
|
|
16131
16169
|
};
|
|
@@ -16764,7 +16802,7 @@ function createSemanticIndexService(params) {
|
|
|
16764
16802
|
return new SemanticIndexService({
|
|
16765
16803
|
vectorDbPath: path22.join(pathProvider.getVectorDir(), SEMANTIC_INDEX_DB_FILE),
|
|
16766
16804
|
configPath: path22.join(pathProvider.getAiDataDir(), SEMANTIC_INDEX_CONFIG_FILE),
|
|
16767
|
-
modelsCacheDir: path22.join(pathProvider.
|
|
16805
|
+
modelsCacheDir: path22.join(pathProvider.getAiDataDir(), "models", "semantic-index"),
|
|
16768
16806
|
sessionAdapter: params.sessionAdapter,
|
|
16769
16807
|
nativeBinding: params.nativeBinding,
|
|
16770
16808
|
loadSqliteVec: params.loadSqliteVec,
|
|
@@ -16780,6 +16818,7 @@ var SemanticIndexService = class {
|
|
|
16780
16818
|
options;
|
|
16781
16819
|
embedder = null;
|
|
16782
16820
|
embedderModelId = null;
|
|
16821
|
+
modelPreloadStatus = "idle";
|
|
16783
16822
|
/** 当前激活的 chunker 身份(version + 参数 hash),随索引记录用于重建判定 */
|
|
16784
16823
|
chunkerVersion = CHUNKER_VERSION;
|
|
16785
16824
|
chunkerConfigHash = computeChunkerConfigHash(DEFAULT_CHUNKER_CONFIG);
|
|
@@ -16820,6 +16859,9 @@ var SemanticIndexService = class {
|
|
|
16820
16859
|
* 保存配置;模型身份变化会使已启用对话的索引在重建完成前不被检索使用。
|
|
16821
16860
|
* 传入 apiKey 时写入固定 auth profile,config 内只保存引用,绝不持久化明文。
|
|
16822
16861
|
*/
|
|
16862
|
+
getModelStatus() {
|
|
16863
|
+
return this.modelPreloadStatus;
|
|
16864
|
+
}
|
|
16823
16865
|
setConfig(config, options) {
|
|
16824
16866
|
const saved = persistSemanticIndexConfig(this.configStore, config, {
|
|
16825
16867
|
apiKey: options?.apiKey,
|
|
@@ -16827,9 +16869,18 @@ var SemanticIndexService = class {
|
|
|
16827
16869
|
});
|
|
16828
16870
|
this.embedder = null;
|
|
16829
16871
|
this.embedderModelId = null;
|
|
16872
|
+
this.modelPreloadStatus = "idle";
|
|
16830
16873
|
if (!saved.enabled) {
|
|
16831
16874
|
for (const state of this.stateStore.listEnabled()) this.queue.pause(state.dbPathHash);
|
|
16832
16875
|
}
|
|
16876
|
+
if (saved.enabled && isSemanticIndexConfigured(saved) && saved.mode === "local") {
|
|
16877
|
+
this.modelPreloadStatus = "downloading";
|
|
16878
|
+
void this.getEmbedder().preload?.().then(() => {
|
|
16879
|
+
this.modelPreloadStatus = "ready";
|
|
16880
|
+
}).catch(() => {
|
|
16881
|
+
this.modelPreloadStatus = "error";
|
|
16882
|
+
});
|
|
16883
|
+
}
|
|
16833
16884
|
return saved;
|
|
16834
16885
|
}
|
|
16835
16886
|
currentModelId() {
|
|
@@ -16850,13 +16901,24 @@ var SemanticIndexService = class {
|
|
|
16850
16901
|
hashFor(sessionId) {
|
|
16851
16902
|
return computeDbPathHash(sessionId);
|
|
16852
16903
|
}
|
|
16904
|
+
/**
|
|
16905
|
+
* 查找 sessionId 对应的实际 db_path_hash。
|
|
16906
|
+
* 优先用当前规则(computeDbPathHash(sessionId)),找不到时扫全表匹配 dbPath basename,
|
|
16907
|
+
* 兼容旧版本用完整 dbPath 计算 hash 存储的历史记录。
|
|
16908
|
+
*/
|
|
16909
|
+
resolveHash(sessionId) {
|
|
16910
|
+
const hash = this.hashFor(sessionId);
|
|
16911
|
+
if (this.stateStore.getState(hash)) return hash;
|
|
16912
|
+
const legacy = this.stateStore.listAll().find((s) => sessionIdFromDbPath(s.dbPath) === sessionId);
|
|
16913
|
+
return legacy?.dbPathHash ?? hash;
|
|
16914
|
+
}
|
|
16853
16915
|
/** 索引身份是否与当前运行时不一致(模型身份或 chunker 身份变化 => 需重建) */
|
|
16854
16916
|
isStale(state, currentModelId) {
|
|
16855
16917
|
return state.modelId !== currentModelId || state.chunkerVersion !== this.chunkerVersion || state.chunkerConfigHash !== this.chunkerConfigHash;
|
|
16856
16918
|
}
|
|
16857
|
-
enableParams(dbPath) {
|
|
16919
|
+
enableParams(dbPath, dbPathHash) {
|
|
16858
16920
|
return {
|
|
16859
|
-
dbPathHash: computeDbPathHash(sessionIdFromDbPath(dbPath)),
|
|
16921
|
+
dbPathHash: dbPathHash ?? computeDbPathHash(sessionIdFromDbPath(dbPath)),
|
|
16860
16922
|
dbPath,
|
|
16861
16923
|
modelId: this.currentModelId(),
|
|
16862
16924
|
chunkerVersion: this.chunkerVersion,
|
|
@@ -16876,29 +16938,31 @@ var SemanticIndexService = class {
|
|
|
16876
16938
|
this.stateStore.enable(this.enableParams(dbPath));
|
|
16877
16939
|
}
|
|
16878
16940
|
}
|
|
16879
|
-
|
|
16880
|
-
|
|
16941
|
+
/** 彻底移除:取消队列、删除向量数据、删除状态记录,立即生效无需二次清理 */
|
|
16942
|
+
remove(sessionId) {
|
|
16943
|
+
const hash = this.resolveHash(sessionId);
|
|
16881
16944
|
this.queue.cancel(hash);
|
|
16882
|
-
this.
|
|
16945
|
+
this.store.deleteByDbPathHash(hash);
|
|
16946
|
+
this.stateStore.remove(hash);
|
|
16883
16947
|
}
|
|
16884
16948
|
/** 建立 / 续跑索引(续跑从断点游标继续) */
|
|
16885
16949
|
build(sessionId) {
|
|
16886
16950
|
if (!this.canRun()) return;
|
|
16887
|
-
this.queue.enqueue({ type: "build", dbPathHash: this.
|
|
16951
|
+
this.queue.enqueue({ type: "build", dbPathHash: this.resolveHash(sessionId) });
|
|
16888
16952
|
}
|
|
16889
16953
|
pause(sessionId) {
|
|
16890
|
-
this.queue.pause(this.
|
|
16954
|
+
this.queue.pause(this.resolveHash(sessionId));
|
|
16891
16955
|
}
|
|
16892
16956
|
cancel(sessionId) {
|
|
16893
|
-
this.queue.cancel(this.
|
|
16957
|
+
this.queue.cancel(this.resolveHash(sessionId));
|
|
16894
16958
|
}
|
|
16895
16959
|
/** 重建:换模型身份或用户主动重建时清空旧索引后重新建立 */
|
|
16896
16960
|
rebuild(sessionId) {
|
|
16897
16961
|
if (!this.canRun()) return;
|
|
16898
16962
|
const dbPath = this.sessionAdapter.getDbPath(sessionId);
|
|
16899
|
-
const hash =
|
|
16963
|
+
const hash = this.resolveHash(sessionId);
|
|
16900
16964
|
this.queue.cancel(hash);
|
|
16901
|
-
this.stateStore.enable(this.enableParams(dbPath));
|
|
16965
|
+
this.stateStore.enable(this.enableParams(dbPath, hash));
|
|
16902
16966
|
this.queue.enqueue({ type: "rebuild", dbPathHash: hash });
|
|
16903
16967
|
}
|
|
16904
16968
|
/** 为所有启用但未完成 / 需重建的对话入队("建立待处理索引") */
|
|
@@ -16946,7 +17010,7 @@ var SemanticIndexService = class {
|
|
|
16946
17010
|
};
|
|
16947
17011
|
}
|
|
16948
17012
|
status(sessionId) {
|
|
16949
|
-
const state = this.stateStore.getState(this.
|
|
17013
|
+
const state = this.stateStore.getState(this.resolveHash(sessionId));
|
|
16950
17014
|
if (!state) return null;
|
|
16951
17015
|
return this.toStatus(state, this.currentModelId());
|
|
16952
17016
|
}
|
|
@@ -16955,7 +17019,7 @@ var SemanticIndexService = class {
|
|
|
16955
17019
|
const modelId = this.currentModelId();
|
|
16956
17020
|
const result = [];
|
|
16957
17021
|
for (const sessionId of sessionIds) {
|
|
16958
|
-
const state = this.stateStore.getState(this.
|
|
17022
|
+
const state = this.stateStore.getState(this.resolveHash(sessionId));
|
|
16959
17023
|
if (state) result.push(this.toStatus(state, modelId));
|
|
16960
17024
|
}
|
|
16961
17025
|
return result;
|
|
@@ -16979,7 +17043,7 @@ var SemanticIndexService = class {
|
|
|
16979
17043
|
async search(sessionId, query, options) {
|
|
16980
17044
|
if (!this.canRun())
|
|
16981
17045
|
return { available: false, reason: "disabled", blocks: [], coverage: 0, partial: false, hitCount: 0 };
|
|
16982
|
-
const hash = this.
|
|
17046
|
+
const hash = this.resolveHash(sessionId);
|
|
16983
17047
|
const state = this.stateStore.getState(hash);
|
|
16984
17048
|
const modelId = this.currentModelId();
|
|
16985
17049
|
if (!state || !state.enabled)
|
|
@@ -17037,7 +17101,7 @@ var SemanticIndexService = class {
|
|
|
17037
17101
|
*/
|
|
17038
17102
|
canSearch(sessionId) {
|
|
17039
17103
|
if (!this.canRun()) return false;
|
|
17040
|
-
const hash = this.
|
|
17104
|
+
const hash = this.resolveHash(sessionId);
|
|
17041
17105
|
const state = this.stateStore.getState(hash);
|
|
17042
17106
|
if (!state || !state.enabled) return false;
|
|
17043
17107
|
const modelId = this.currentModelId();
|
|
@@ -17408,6 +17472,7 @@ export {
|
|
|
17408
17472
|
writeConfigField,
|
|
17409
17473
|
resolveApiKey,
|
|
17410
17474
|
writeAuthProfile,
|
|
17475
|
+
deleteAuthProfile,
|
|
17411
17476
|
MigrationRunner,
|
|
17412
17477
|
ALL_MIGRATIONS,
|
|
17413
17478
|
BetterSqliteAdapter,
|
|
@@ -17685,4 +17750,4 @@ export {
|
|
|
17685
17750
|
createDatabaseManagerAdapter,
|
|
17686
17751
|
MergeSessionCache
|
|
17687
17752
|
};
|
|
17688
|
-
//# sourceMappingURL=chunk-
|
|
17753
|
+
//# sourceMappingURL=chunk-55WR6WKW.mjs.map
|