chatlab-cli 0.36.2 → 0.37.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/{chat-command-SEV6N3AR.mjs → chat-command-WBAJBKIE.mjs} +15 -16
- package/dist/{chat-command-SEV6N3AR.mjs.map → chat-command-WBAJBKIE.mjs.map} +1 -1
- package/dist/chunk-2TV7M4CC.mjs +101 -0
- package/dist/chunk-2TV7M4CC.mjs.map +1 -0
- package/dist/{chunk-TRGR3KKJ.mjs → chunk-4J4MA3RC.mjs} +2605 -672
- package/dist/chunk-4J4MA3RC.mjs.map +1 -0
- package/dist/{chunk-TJ3NOBVI.mjs → chunk-5YOHLJFB.mjs} +98 -284
- package/dist/chunk-5YOHLJFB.mjs.map +1 -0
- package/dist/{chunk-WRBFV2GX.mjs → chunk-CR2MU7LN.mjs} +49 -55
- package/dist/chunk-CR2MU7LN.mjs.map +1 -0
- package/dist/{chunk-WJQOXOMR.mjs → chunk-DKIYHA3O.mjs} +281 -30
- package/dist/chunk-DKIYHA3O.mjs.map +1 -0
- package/dist/{chunk-VREVDZ4Q.mjs → chunk-DQR2YS3I.mjs} +1930 -33
- package/dist/chunk-DQR2YS3I.mjs.map +1 -0
- package/dist/{chunk-VUYWUHWW.mjs → chunk-EJBBVLUN.mjs} +3 -3
- package/dist/chunk-EJBBVLUN.mjs.map +1 -0
- package/dist/{chunk-HWIXK7SU.mjs → chunk-FM3GXNEO.mjs} +1643 -3
- package/dist/chunk-FM3GXNEO.mjs.map +1 -0
- package/dist/{chunk-YUH3H3QW.mjs → chunk-MSMDLDPB.mjs} +96 -5
- package/dist/chunk-MSMDLDPB.mjs.map +1 -0
- package/dist/{chunk-6EZPD3XJ.mjs → chunk-N2WGG3MS.mjs} +2 -2
- package/dist/{chunk-TWH422HC.mjs → chunk-RXMSZIYD.mjs} +3 -3
- package/dist/{chunk-CH5YAZ4Q.mjs → chunk-SQWN4GTQ.mjs} +2 -2
- package/dist/cli.mjs +9 -9
- package/dist/contacts-worker.mjs +2 -2
- package/dist/global-insight-worker.mjs +1 -1
- package/dist/{http-237XYNRT.mjs → http-X6OEOOSH.mjs} +12 -12
- package/dist/{import-R2E2TFAK.mjs → import-WBJ6YIQ7.mjs} +7 -7
- package/dist/index.mjs +12 -12
- package/dist/{mcp-BED4AARV.mjs → mcp-FR6OKWKL.mjs} +8 -8
- package/dist/people-relationships-worker.mjs +2 -2
- package/dist/semantic-index-worker.mjs +1 -1
- package/dist/{src-AYMALWU5.mjs → src-WE5HNN2O.mjs} +44 -14
- package/dist/{stream-import-RXNSOOYH.mjs → stream-import-YYQVZDGQ.mjs} +7 -7
- package/dist/{worker-runtime-JGAZU7MC.mjs → worker-runtime-YGB5ZDE4.mjs} +5 -5
- package/dist-cli-web/assets/AISettingsTab-Co2sM1iY.js +1 -0
- package/dist-cli-web/assets/{AboutTab-DCM1-glA.js → AboutTab-DQ8r6mYE.js} +1 -1
- package/dist-cli-web/assets/ActionToolsPanel-CmYpw8Mt.css +1 -0
- package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang--RPlmfIu.js +75 -0
- package/dist-cli-web/assets/{Alert-D-egBWcb.js → Alert-DU1tLAAg.js} +1 -1
- package/dist-cli-web/assets/ApiSettingsTab-D5g5b79L.js +2 -0
- package/dist-cli-web/assets/BatchManageTab-BFUyVaGU.js +1 -0
- package/dist-cli-web/assets/{BufferResource-BE2_2bZK.js → BufferResource-C-RfYwQW.js} +1 -1
- package/dist-cli-web/assets/{CanvasRenderer-DDKdvEYQ.js → CanvasRenderer-Dz7JAMrR.js} +1 -1
- package/dist-cli-web/assets/CardDecoration-D28DI1G9.js +1 -0
- package/dist-cli-web/assets/ChatRecordDrawer-Cph819yY.js +1 -0
- package/dist-cli-web/assets/{ChatRecordWorkspace-DqUI4QiU.js → ChatRecordWorkspace-BAfERdPc.js} +1 -1
- package/dist-cli-web/assets/Checkbox-B8uqt13j.js +1 -0
- package/dist-cli-web/assets/DataDirCleanupNotice-3sGBE5vU.js +1 -0
- package/dist-cli-web/assets/{DatePicker.vue_vue_type_script_setup_true_lang-sPDoPzZ9.js → DatePicker.vue_vue_type_script_setup_true_lang-CQuub8-f.js} +1 -1
- package/dist-cli-web/assets/{DebugToolsPanel-BIHA6jw4.js → DebugToolsPanel-Cwkr0BOY.js} +1 -1
- package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-BuLujQCF.js +1 -0
- package/dist-cli-web/assets/EChartBar.vue_vue_type_script_setup_true_lang-DuA5xbcC.js +1 -0
- package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-CvmMEfYq.js +1 -0
- package/dist-cli-web/assets/EChartWordcloud-CHVtyPR7.js +1 -0
- package/dist-cli-web/assets/FileDropZone.vue_vue_type_script_setup_true_lang-BKPy9Qv-.js +1 -0
- package/dist-cli-web/assets/{Filter-kO4dIDJ2.js → Filter-CMfRHIoK.js} +1 -1
- package/dist-cli-web/assets/GlobalTaskBar-Jz6MASCu.js +1 -0
- package/dist-cli-web/assets/GlobalTaskBar-haLzezqY.css +1 -0
- package/dist-cli-web/assets/GroupRelationshipGalaxyView-Ch4obfEq.js +1 -0
- package/dist-cli-web/assets/Label-CuryuymO.js +1 -0
- package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-CoeQsaiL.js +1 -0
- package/dist-cli-web/assets/MessageExportModal-JqGZ-iLr.js +1 -0
- package/dist-cli-web/assets/PageHeader-CPLgiKT8.css +1 -0
- package/dist-cli-web/assets/PageHeader-D4up77TB.js +1 -0
- package/dist-cli-web/assets/{PageTabs.vue_vue_type_script_setup_true_lang-Cgungbjl.js → PageTabs.vue_vue_type_script_setup_true_lang-DYQRFk9s.js} +1 -1
- package/dist-cli-web/assets/{RelationshipGalaxyCanvas-Cod1JX9m.js → RelationshipGalaxyCanvas-Cn7Eta5U.js} +3 -3
- package/dist-cli-web/assets/{RelationshipGalaxyThreeCanvas-CkefzeFJ.js → RelationshipGalaxyThreeCanvas-LlaX57z6.js} +1 -1
- package/dist-cli-web/assets/{RenderTargetSystem-SuQ7cbze.js → RenderTargetSystem-JhA2PUFi.js} +1 -1
- package/dist-cli-web/assets/{RovingFocusItem-psoFYxrC.js → RovingFocusItem-DHaiTb4j.js} +1 -1
- package/dist-cli-web/assets/{ScreenCaptureModal-D4r9ixKh.js → ScreenCaptureModal-Bxhyt5g1.js} +1 -1
- package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-BlAje3Tf.js +1 -0
- package/dist-cli-web/assets/Select-Beeqv0wU.js +1 -0
- package/dist-cli-web/assets/SettingsModal-DV8yDBJs.js +2 -0
- package/dist-cli-web/assets/{StorageTab-DhSJ-0Ir.js → StorageTab-B7GHadia.js} +1 -1
- package/dist-cli-web/assets/Switch-u4zlvUMa.js +1 -0
- package/dist-cli-web/assets/{Tabs-Bnm_Q7yW.js → Tabs-B7-Koq3x.js} +1 -1
- package/dist-cli-web/assets/Tabs-RWKHwtfM.js +1 -0
- package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-ndsa3-aT.js +1 -0
- package/dist-cli-web/assets/{TimeSelect.vue_vue_type_script_setup_true_lang-Cjz8Wpg-.js → TimeSelect.vue_vue_type_script_setup_true_lang-DKa1flT-.js} +1 -1
- package/dist-cli-web/assets/{VisuallyHiddenInput-Bo_XwaLu.js → VisuallyHiddenInput-DGDqcvUy.js} +1 -1
- package/dist-cli-web/assets/{WebGLRenderer-D1x9WZRj.js → WebGLRenderer-ifvgA1fe.js} +1 -1
- package/dist-cli-web/assets/{WebGPURenderer-37Nw-tLm.js → WebGPURenderer-DwzmuWF0.js} +1 -1
- package/dist-cli-web/assets/aiChat-BY4C3UQe.js +8 -0
- package/dist-cli-web/assets/base-BWDX-164.js +1 -0
- package/dist-cli-web/assets/{browserAll-CWrz_-4U.js → browserAll-CSIIETeE.js} +1 -1
- package/dist-cli-web/assets/chatMessages--r0obAVw.css +1 -0
- package/dist-cli-web/assets/chatMessages-Zywjea1n.js +147 -0
- package/dist-cli-web/assets/cli-web-BRY49NWe.js +1 -0
- package/dist-cli-web/assets/{fetch-Du-wU0OO.js → fetch-Bf4cqeM3.js} +1 -1
- package/dist-cli-web/assets/{fetch-DPSWt6yX.js → fetch-BiXab0IF.js} +1 -1
- package/dist-cli-web/assets/{fetch-B69OkB6B.js → fetch-C8CcoTWY.js} +1 -1
- package/dist-cli-web/assets/{fetch-qd2FgBWQ.js → fetch-Co2vLmiE.js} +1 -1
- package/dist-cli-web/assets/{fetch-BGmCCyzz.js → fetch-D3nLtFBi.js} +1 -1
- package/dist-cli-web/assets/{fetch-CFpLXWTe.js → fetch-DNSDHSqQ.js} +1 -1
- package/dist-cli-web/assets/{fetch-DZ6OF-xW.js → fetch-DeHqF6yL.js} +1 -1
- package/dist-cli-web/assets/{fetch-CkXgOxcu.js → fetch-jx1VdM9j.js} +3 -3
- package/dist-cli-web/assets/{fetch-Gu4qQjUB.js → fetch-mYSeL4Ki.js} +1 -1
- package/dist-cli-web/assets/fetch-qBaUXqFt.js +1 -0
- package/dist-cli-web/assets/{fetch-6pcVxB9h.js → fetch-r6mhEGrP.js} +1 -1
- package/dist-cli-web/assets/{fetch-CgA1peJD.js → fetch-wzv71PYy.js} +1 -1
- package/dist-cli-web/assets/{host-CWsAWKgy.js → host-1emQf9_4.js} +1 -1
- package/dist-cli-web/assets/{host-D8zlA62K.js → host-jXJHyyOX.js} +1 -1
- package/dist-cli-web/assets/index-2dJCozDq.js +64 -0
- package/dist-cli-web/assets/index-6ejRbH3h.js +2 -0
- package/dist-cli-web/assets/index-B4mJkX_d.js +1 -0
- package/dist-cli-web/assets/index-B7biznha.js +1 -0
- package/dist-cli-web/assets/index-BOcFyPCa.js +1 -0
- package/dist-cli-web/assets/index-BQ463TS7.js +1 -0
- package/dist-cli-web/assets/index-BZpR015e.css +1 -0
- package/dist-cli-web/assets/index-BgelKQTW.css +1 -0
- package/dist-cli-web/assets/index-C1A1FwpO.css +1 -0
- package/dist-cli-web/assets/index-CIIyg_o9.css +1 -0
- package/dist-cli-web/assets/{index-a7CT8DQm.js → index-CYc_VLgK.js} +1 -1
- package/dist-cli-web/assets/index-ClHMs0-a.js +2 -0
- package/dist-cli-web/assets/{index-Dy0fRMDf.js → index-Cw0IhKZ6.js} +10 -10
- package/dist-cli-web/assets/{index-v6DlL4ue.js → index-DOqbUvhA.js} +1 -1
- package/dist-cli-web/assets/index-DnpnIyle.js +135 -0
- package/dist-cli-web/assets/index-LV9LfFNu.js +1 -0
- package/dist-cli-web/assets/index-kePiJ3ca.js +137 -0
- package/dist-cli-web/assets/index-slDUxib2.js +1 -0
- package/dist-cli-web/assets/{people-page-header-Czt9e1jv.js → people-page-header-Cx5r9Bk2.js} +1 -1
- package/dist-cli-web/assets/{prompt-DGazz143.js → prompt-BggEDxxi.js} +1 -1
- package/dist-cli-web/assets/{semantic-index-config-builder-BkFHzIUy.js → semantic-index-config-builder-1sO0aEc1.js} +1 -1
- package/dist-cli-web/assets/{service-CAp0YJoS.js → service-Bvq1fRkC.js} +1 -1
- package/dist-cli-web/assets/service-DkPheDt8.js +1 -0
- package/dist-cli-web/assets/service-DvI8O_7K.js +1 -0
- package/dist-cli-web/assets/useFormControl-B0aShtLp.js +1 -0
- package/dist-cli-web/assets/useTable-DC7oxmBl.js +1 -0
- package/dist-cli-web/assets/{useToast-YAHDkKDN.js → useToast-CCPBE-Sy.js} +1 -1
- package/dist-cli-web/assets/{vendor-echarts-hTLhTs52.js → vendor-echarts-C9ugTmum.js} +1 -1
- package/dist-cli-web/assets/{vendor-echarts-wordcloud-B8CF_NgP.js → vendor-echarts-wordcloud-DNiU8Psq.js} +1 -1
- package/dist-cli-web/assets/{webworkerAll-CvSp2Y8j.js → webworkerAll-FCJk6reG.js} +1 -1
- package/dist-cli-web/index.html +2 -2
- package/package.json +1 -1
- package/dist/chunk-6E46U4H2.mjs +0 -41
- package/dist/chunk-6E46U4H2.mjs.map +0 -1
- package/dist/chunk-HWIXK7SU.mjs.map +0 -1
- package/dist/chunk-TJ3NOBVI.mjs.map +0 -1
- package/dist/chunk-TRGR3KKJ.mjs.map +0 -1
- package/dist/chunk-VREVDZ4Q.mjs.map +0 -1
- package/dist/chunk-VUYWUHWW.mjs.map +0 -1
- package/dist/chunk-WJQOXOMR.mjs.map +0 -1
- package/dist/chunk-WRBFV2GX.mjs.map +0 -1
- package/dist/chunk-YUH3H3QW.mjs.map +0 -1
- package/dist-cli-web/assets/AISettingsTab-VgI7PiJd.js +0 -1
- package/dist-cli-web/assets/ActionToolsPanel-BTGgwXVD.css +0 -1
- package/dist-cli-web/assets/ActionToolsPanel.vue_vue_type_script_setup_true_lang-a7RMjjve.js +0 -112
- package/dist-cli-web/assets/ApiSettingsTab-Co3LWf1f.js +0 -2
- package/dist-cli-web/assets/BatchManageTab-2LrckmQm.js +0 -1
- package/dist-cli-web/assets/ChatRecordDrawer-DRhztqLG.js +0 -1
- package/dist-cli-web/assets/Checkbox-EfpQmv4A.js +0 -1
- package/dist-cli-web/assets/DataDirCleanupNotice-BYIiR58J.js +0 -1
- package/dist-cli-web/assets/EChart.vue_vue_type_script_setup_true_lang-DryMSoCz.js +0 -1
- package/dist-cli-web/assets/EChartBar.vue_vue_type_script_setup_true_lang-BdFW-hvt.js +0 -1
- package/dist-cli-web/assets/EChartLine.vue_vue_type_script_setup_true_lang-C69Kdw9X.js +0 -1
- package/dist-cli-web/assets/EChartWordcloud-DM7UEHdK.js +0 -1
- package/dist-cli-web/assets/GlobalTaskBar-BZS_h0zC.js +0 -1
- package/dist-cli-web/assets/GlobalTaskBar-COW_uBX6.css +0 -1
- package/dist-cli-web/assets/GroupRelationshipGalaxyView--WIaHx_F.js +0 -1
- package/dist-cli-web/assets/Label-CIuDXyeM.js +0 -1
- package/dist-cli-web/assets/LoadingState.vue_vue_type_script_setup_true_lang-B_7VHxTx.js +0 -1
- package/dist-cli-web/assets/MessageExportModal-BQsIpyxv.js +0 -1
- package/dist-cli-web/assets/PageHeader-DxhQHF_0.js +0 -1
- package/dist-cli-web/assets/PageHeader-XIXMTomn.css +0 -1
- package/dist-cli-web/assets/SectionTabs.vue_vue_type_script_setup_true_lang-v_7aRBgM.js +0 -1
- package/dist-cli-web/assets/Select-CxurgslB.js +0 -1
- package/dist-cli-web/assets/SettingsModal-DBZucuf6.js +0 -2
- package/dist-cli-web/assets/Switch-3D81G6uV.js +0 -1
- package/dist-cli-web/assets/Tabs-DB603EEu.js +0 -1
- package/dist-cli-web/assets/ThemeCard.vue_vue_type_script_setup_true_lang-BDTdkH5i.js +0 -1
- package/dist-cli-web/assets/aiChat-BCzYQeZq.js +0 -8
- package/dist-cli-web/assets/cli-web-C-8N0CJh.js +0 -1
- package/dist-cli-web/assets/fetch-z9M9FcIC.js +0 -1
- package/dist-cli-web/assets/index-BGd4ZfhO.js +0 -2
- package/dist-cli-web/assets/index-BYZF1ngN.js +0 -1
- package/dist-cli-web/assets/index-BcuwlCin.css +0 -1
- package/dist-cli-web/assets/index-BnaLj2dx.css +0 -1
- package/dist-cli-web/assets/index-Bq5q3kSU.js +0 -36
- package/dist-cli-web/assets/index-CPR3jdC2.js +0 -137
- package/dist-cli-web/assets/index-D3AjvaOX.js +0 -1
- package/dist-cli-web/assets/index-DAitScUA.js +0 -1
- package/dist-cli-web/assets/index-DBSMWAJ0.js +0 -1
- package/dist-cli-web/assets/index-DTn9htw-.js +0 -64
- package/dist-cli-web/assets/index-DV_rWxcH.js +0 -1
- package/dist-cli-web/assets/index-DxhAGqYM.css +0 -1
- package/dist-cli-web/assets/index-I0mIcDpE.css +0 -1
- package/dist-cli-web/assets/index-onwNShRw.js +0 -2
- package/dist-cli-web/assets/service-BMqwB74f.js +0 -1
- package/dist-cli-web/assets/service-CUQ8iHdS.js +0 -1
- package/dist-cli-web/assets/useFormControl-DcSMUc2d.js +0 -1
- package/dist-cli-web/assets/useTable-Clmq3sge.js +0 -1
- /package/dist/{chunk-6EZPD3XJ.mjs.map → chunk-N2WGG3MS.mjs.map} +0 -0
- /package/dist/{chunk-TWH422HC.mjs.map → chunk-RXMSZIYD.mjs.map} +0 -0
- /package/dist/{chunk-CH5YAZ4Q.mjs.map → chunk-SQWN4GTQ.mjs.map} +0 -0
- /package/dist/{http-237XYNRT.mjs.map → http-X6OEOOSH.mjs.map} +0 -0
- /package/dist/{import-R2E2TFAK.mjs.map → import-WBJ6YIQ7.mjs.map} +0 -0
- /package/dist/{mcp-BED4AARV.mjs.map → mcp-FR6OKWKL.mjs.map} +0 -0
- /package/dist/{src-AYMALWU5.mjs.map → src-WE5HNN2O.mjs.map} +0 -0
- /package/dist/{stream-import-RXNSOOYH.mjs.map → stream-import-YYQVZDGQ.mjs.map} +0 -0
- /package/dist/{worker-runtime-JGAZU7MC.mjs.map → worker-runtime-YGB5ZDE4.mjs.map} +0 -0
|
@@ -54,6 +54,7 @@ import {
|
|
|
54
54
|
getChatLabTempScopeDir,
|
|
55
55
|
getLocalProfileByModelId,
|
|
56
56
|
getLocalProfilesForLocale,
|
|
57
|
+
hasUnmatchedFallbackOnlyMessage,
|
|
57
58
|
isKeylessSemanticIndexApiBaseUrl,
|
|
58
59
|
isSemanticIndexConfigured,
|
|
59
60
|
isSemanticVoid,
|
|
@@ -68,32 +69,35 @@ import {
|
|
|
68
69
|
semanticSearch,
|
|
69
70
|
vecTableName,
|
|
70
71
|
vecTableSchema
|
|
71
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-DQR2YS3I.mjs";
|
|
72
73
|
import {
|
|
73
74
|
CHATLAB_FORMAT_VERSION,
|
|
74
75
|
DESENSITIZE_RULES_SCHEMA_VERSION,
|
|
75
76
|
MEANINGFUL_POS_TAGS,
|
|
76
|
-
POS_TAG_DEFINITIONS,
|
|
77
77
|
StaticPathProvider,
|
|
78
78
|
appLogger,
|
|
79
|
+
batchSegmentChineseWithStats,
|
|
80
|
+
batchSegmentWithFrequency,
|
|
79
81
|
buildExcludeKeywordsConditions,
|
|
80
|
-
|
|
82
|
+
clearJiebaInstance,
|
|
83
|
+
collectPosTagStats,
|
|
81
84
|
detectConflictsInMessages,
|
|
82
85
|
getCollidingPlatformIds,
|
|
83
86
|
getCollidingPlatformIdsFromMessages,
|
|
87
|
+
getJieba,
|
|
84
88
|
isStopword,
|
|
85
|
-
isValidWord,
|
|
86
89
|
loadConfig,
|
|
87
90
|
mergeMembers2 as mergeMembers,
|
|
88
91
|
migrateFromElectronIfNeeded,
|
|
89
92
|
normalizePlatformId,
|
|
90
93
|
readJsonFile,
|
|
91
94
|
resolveApiKey,
|
|
95
|
+
segment,
|
|
92
96
|
snapshotPathProvider,
|
|
93
97
|
withFileLock,
|
|
94
98
|
writeConfigField,
|
|
95
99
|
writeJsonFileAtomically
|
|
96
|
-
} from "./chunk-
|
|
100
|
+
} from "./chunk-4J4MA3RC.mjs";
|
|
97
101
|
import {
|
|
98
102
|
__export
|
|
99
103
|
} from "./chunk-VSOWNKPA.mjs";
|
|
@@ -559,220 +563,6 @@ function expandHome(filePath) {
|
|
|
559
563
|
return filePath;
|
|
560
564
|
}
|
|
561
565
|
|
|
562
|
-
// ../../packages/node-runtime/src/nlp/segmenter.ts
|
|
563
|
-
import * as fs3 from "fs";
|
|
564
|
-
import * as path3 from "path";
|
|
565
|
-
import { createRequire } from "module";
|
|
566
|
-
var _nlpDir = null;
|
|
567
|
-
var jiebaInstances = /* @__PURE__ */ new Map();
|
|
568
|
-
var require2 = createRequire(import.meta.url);
|
|
569
|
-
function initNlpDir(nlpDir) {
|
|
570
|
-
_nlpDir = nlpDir;
|
|
571
|
-
}
|
|
572
|
-
function getNlpDir() {
|
|
573
|
-
return _nlpDir;
|
|
574
|
-
}
|
|
575
|
-
function existsDictOnDisk(dictId) {
|
|
576
|
-
if (!_nlpDir) return false;
|
|
577
|
-
return fs3.existsSync(path3.join(_nlpDir, `${dictId}.dict`));
|
|
578
|
-
}
|
|
579
|
-
function tryLoadDictFromDisk(dictId) {
|
|
580
|
-
if (!_nlpDir) return null;
|
|
581
|
-
const dictPath = path3.join(_nlpDir, `${dictId}.dict`);
|
|
582
|
-
if (!fs3.existsSync(dictPath)) return null;
|
|
583
|
-
try {
|
|
584
|
-
return fs3.readFileSync(dictPath);
|
|
585
|
-
} catch {
|
|
586
|
-
return null;
|
|
587
|
-
}
|
|
588
|
-
}
|
|
589
|
-
function getJieba(dictType = "default") {
|
|
590
|
-
const effectiveType = dictType === "default" ? "zh-CN" : dictType;
|
|
591
|
-
const cached = jiebaInstances.get(effectiveType);
|
|
592
|
-
if (cached) {
|
|
593
|
-
if (cached.fromDiskDict === existsDictOnDisk(effectiveType)) return cached.instance;
|
|
594
|
-
jiebaInstances.delete(effectiveType);
|
|
595
|
-
console.error(`[NLP] jieba cache invalidated (dict ${cached.fromDiskDict ? "removed" : "added"}): ${effectiveType}`);
|
|
596
|
-
}
|
|
597
|
-
try {
|
|
598
|
-
const { Jieba } = require2("@node-rs/jieba");
|
|
599
|
-
let instance;
|
|
600
|
-
const diskDict = tryLoadDictFromDisk(effectiveType);
|
|
601
|
-
if (diskDict) {
|
|
602
|
-
instance = Jieba.withDict(diskDict);
|
|
603
|
-
console.error(`[NLP] jieba dict loaded: ${effectiveType} (${diskDict.length} bytes)`);
|
|
604
|
-
} else {
|
|
605
|
-
instance = new Jieba();
|
|
606
|
-
console.warn(`[NLP] jieba dict missing: ${effectiveType}, fallback to built-in tokenizer`);
|
|
607
|
-
}
|
|
608
|
-
jiebaInstances.set(effectiveType, { instance, fromDiskDict: !!diskDict });
|
|
609
|
-
return instance;
|
|
610
|
-
} catch (error) {
|
|
611
|
-
console.error(`[NLP] Failed to load jieba module (dict=${effectiveType}):`, error);
|
|
612
|
-
throw new Error(`jieba \u6A21\u5757\u52A0\u8F7D\u5931\u8D25 (${effectiveType})`);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
function clearJiebaInstance(dictType) {
|
|
616
|
-
jiebaInstances.delete(dictType);
|
|
617
|
-
console.error(`[NLP] jieba instance cleared: ${dictType}`);
|
|
618
|
-
}
|
|
619
|
-
function segmentChinese(text, options = {}) {
|
|
620
|
-
const { posFilterMode = "meaningful", customPosTags, dictType = "default" } = options;
|
|
621
|
-
const cleaned = cleanText(text);
|
|
622
|
-
if (!cleaned) return [];
|
|
623
|
-
try {
|
|
624
|
-
const jieba = getJieba(dictType);
|
|
625
|
-
if (posFilterMode === "all") return jieba.cut(cleaned, false);
|
|
626
|
-
const tagged = jieba.tag(cleaned);
|
|
627
|
-
const allowedTags = posFilterMode === "custom" && customPosTags ? new Set(customPosTags) : MEANINGFUL_POS_TAGS;
|
|
628
|
-
return tagged.filter((item) => allowedTags.has(item.tag)).map((item) => item.word);
|
|
629
|
-
} catch (error) {
|
|
630
|
-
console.error("[NLP] Chinese segmentation failed:", error);
|
|
631
|
-
try {
|
|
632
|
-
return getJieba("default").cut(cleanText(text), false);
|
|
633
|
-
} catch {
|
|
634
|
-
return cleaned.split("");
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
function segmentEnglish(text) {
|
|
639
|
-
const cleaned = cleanText(text);
|
|
640
|
-
if (!cleaned) return [];
|
|
641
|
-
try {
|
|
642
|
-
const segmenter = new Intl.Segmenter("en", { granularity: "word" });
|
|
643
|
-
return [...segmenter.segment(cleaned)].filter((s) => s.isWordLike).map((s) => s.segment.toLowerCase());
|
|
644
|
-
} catch {
|
|
645
|
-
return cleaned.toLowerCase().split(/\s+/).filter((w) => w.length > 0);
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
function segmentJapanese(text) {
|
|
649
|
-
const cleaned = cleanText(text);
|
|
650
|
-
if (!cleaned) return [];
|
|
651
|
-
try {
|
|
652
|
-
const segmenter = new Intl.Segmenter("ja", { granularity: "word" });
|
|
653
|
-
return [...segmenter.segment(cleaned)].filter((s) => s.isWordLike).map((s) => s.segment);
|
|
654
|
-
} catch {
|
|
655
|
-
return cleaned.split("").filter((ch) => ch.trim().length > 0);
|
|
656
|
-
}
|
|
657
|
-
}
|
|
658
|
-
function segment(text, locale, options = {}) {
|
|
659
|
-
const {
|
|
660
|
-
minLength,
|
|
661
|
-
posFilterMode = "meaningful",
|
|
662
|
-
customPosTags,
|
|
663
|
-
enableStopwords = true,
|
|
664
|
-
dictType = "default"
|
|
665
|
-
} = options;
|
|
666
|
-
const isChinese = locale.startsWith("zh");
|
|
667
|
-
const isJapanese = locale === "ja-JP";
|
|
668
|
-
const defaultMinLength = isChinese || isJapanese ? 2 : 3;
|
|
669
|
-
const effectiveMinLength = minLength ?? defaultMinLength;
|
|
670
|
-
let words;
|
|
671
|
-
if (isChinese) {
|
|
672
|
-
words = segmentChinese(text, { posFilterMode, customPosTags, dictType });
|
|
673
|
-
} else if (isJapanese) {
|
|
674
|
-
words = segmentJapanese(text);
|
|
675
|
-
} else {
|
|
676
|
-
words = segmentEnglish(text);
|
|
677
|
-
}
|
|
678
|
-
return words.filter((word) => isValidWord(word, locale, effectiveMinLength, enableStopwords, isStopword));
|
|
679
|
-
}
|
|
680
|
-
function batchSegmentWithFrequency(texts, locale, options = {}) {
|
|
681
|
-
const {
|
|
682
|
-
minLength,
|
|
683
|
-
minCount = 2,
|
|
684
|
-
topN = 100,
|
|
685
|
-
posFilterMode,
|
|
686
|
-
customPosTags,
|
|
687
|
-
enableStopwords,
|
|
688
|
-
dictType,
|
|
689
|
-
excludeWords
|
|
690
|
-
} = options;
|
|
691
|
-
const wordFrequency = /* @__PURE__ */ new Map();
|
|
692
|
-
const excludeSet = excludeWords?.length ? new Set(excludeWords.map((w) => w.toLowerCase())) : null;
|
|
693
|
-
for (const text of texts) {
|
|
694
|
-
const words = segment(text, locale, { minLength, posFilterMode, customPosTags, enableStopwords, dictType });
|
|
695
|
-
for (const word of words) {
|
|
696
|
-
if (excludeSet && excludeSet.has(word.toLowerCase())) continue;
|
|
697
|
-
wordFrequency.set(word, (wordFrequency.get(word) || 0) + 1);
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
const filtered = /* @__PURE__ */ new Map();
|
|
701
|
-
let totalWords = 0;
|
|
702
|
-
for (const [word, count] of wordFrequency) {
|
|
703
|
-
if (count >= minCount) {
|
|
704
|
-
filtered.set(word, count);
|
|
705
|
-
totalWords += count;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
const sorted = [...filtered.entries()].sort((a, b) => b[1] - a[1]).slice(0, topN);
|
|
709
|
-
return { words: new Map(sorted), uniqueWords: filtered.size, totalWords };
|
|
710
|
-
}
|
|
711
|
-
function batchSegmentChineseWithStats(texts, locale, options = {}) {
|
|
712
|
-
const {
|
|
713
|
-
minLength,
|
|
714
|
-
minCount = 2,
|
|
715
|
-
topN = 100,
|
|
716
|
-
posFilterMode = "meaningful",
|
|
717
|
-
customPosTags,
|
|
718
|
-
enableStopwords = true,
|
|
719
|
-
dictType = "default",
|
|
720
|
-
excludeWords
|
|
721
|
-
} = options;
|
|
722
|
-
const effectiveMinLength = minLength ?? 2;
|
|
723
|
-
const allowedTags = posFilterMode === "custom" && customPosTags ? new Set(customPosTags) : MEANINGFUL_POS_TAGS;
|
|
724
|
-
const excludeSet = excludeWords?.length ? new Set(excludeWords.map((w) => w.toLowerCase())) : null;
|
|
725
|
-
const wordFrequency = /* @__PURE__ */ new Map();
|
|
726
|
-
const posTagStats = /* @__PURE__ */ new Map();
|
|
727
|
-
try {
|
|
728
|
-
const jieba = getJieba(dictType);
|
|
729
|
-
for (const text of texts) {
|
|
730
|
-
const cleaned = cleanText(text);
|
|
731
|
-
if (!cleaned) continue;
|
|
732
|
-
for (const { tag, word } of jieba.tag(cleaned)) {
|
|
733
|
-
if (!isValidWord(word, locale, effectiveMinLength, enableStopwords, isStopword)) continue;
|
|
734
|
-
posTagStats.set(tag, (posTagStats.get(tag) || 0) + 1);
|
|
735
|
-
if (!allowedTags.has(tag)) continue;
|
|
736
|
-
if (excludeSet && excludeSet.has(word.toLowerCase())) continue;
|
|
737
|
-
wordFrequency.set(word, (wordFrequency.get(word) || 0) + 1);
|
|
738
|
-
}
|
|
739
|
-
}
|
|
740
|
-
} catch (error) {
|
|
741
|
-
console.error("[NLP] Chinese single-pass segmentation failed:", error);
|
|
742
|
-
}
|
|
743
|
-
const filtered = /* @__PURE__ */ new Map();
|
|
744
|
-
let totalWords = 0;
|
|
745
|
-
for (const [word, count] of wordFrequency) {
|
|
746
|
-
if (count >= minCount) {
|
|
747
|
-
filtered.set(word, count);
|
|
748
|
-
totalWords += count;
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
const sorted = [...filtered.entries()].sort((a, b) => b[1] - a[1]).slice(0, topN);
|
|
752
|
-
return { words: new Map(sorted), uniqueWords: filtered.size, totalWords, posTagStats };
|
|
753
|
-
}
|
|
754
|
-
function collectPosTagStats(texts, minWordLength = 2, enableStopwords = true, dictType = "default") {
|
|
755
|
-
const posStats = /* @__PURE__ */ new Map();
|
|
756
|
-
try {
|
|
757
|
-
const jieba = getJieba(dictType);
|
|
758
|
-
for (const text of texts) {
|
|
759
|
-
const cleaned = cleanText(text);
|
|
760
|
-
if (!cleaned) continue;
|
|
761
|
-
const tagged = jieba.tag(cleaned);
|
|
762
|
-
for (const item of tagged) {
|
|
763
|
-
if (!isValidWord(item.word, "zh-CN", minWordLength, enableStopwords, isStopword)) continue;
|
|
764
|
-
posStats.set(item.tag, (posStats.get(item.tag) || 0) + 1);
|
|
765
|
-
}
|
|
766
|
-
}
|
|
767
|
-
} catch (error) {
|
|
768
|
-
console.error("[NLP] Failed to collect POS stats:", error);
|
|
769
|
-
}
|
|
770
|
-
return posStats;
|
|
771
|
-
}
|
|
772
|
-
function getPosTagDefinitions() {
|
|
773
|
-
return POS_TAG_DEFINITIONS;
|
|
774
|
-
}
|
|
775
|
-
|
|
776
566
|
// ../../packages/node-runtime/src/jieba-nlp-provider.ts
|
|
777
567
|
function createJiebaNlpProvider(dictType = "default") {
|
|
778
568
|
return {
|
|
@@ -878,8 +668,8 @@ function segmentText(text, locale, minLength) {
|
|
|
878
668
|
}
|
|
879
669
|
|
|
880
670
|
// ../../packages/node-runtime/src/nlp/dict-manager.ts
|
|
881
|
-
import * as
|
|
882
|
-
import * as
|
|
671
|
+
import * as fs3 from "fs";
|
|
672
|
+
import * as path3 from "path";
|
|
883
673
|
import { createHash } from "crypto";
|
|
884
674
|
var DICT_DOWNLOAD_URL_BASE = "https://chatlab.fun/assets/nlp";
|
|
885
675
|
var DICT_SHA256 = {
|
|
@@ -891,19 +681,19 @@ var AVAILABLE_DICTS = [
|
|
|
891
681
|
{ id: "zh-TW", label: "\u7E41\u9AD4\u4E2D\u6587", locale: "zh-TW" }
|
|
892
682
|
];
|
|
893
683
|
function getDictFilePath(nlpDir, dictId) {
|
|
894
|
-
return
|
|
684
|
+
return path3.join(nlpDir, `${dictId}.dict`);
|
|
895
685
|
}
|
|
896
686
|
function isDictDownloaded(nlpDir, dictId) {
|
|
897
|
-
return
|
|
687
|
+
return fs3.existsSync(getDictFilePath(nlpDir, dictId));
|
|
898
688
|
}
|
|
899
689
|
function getDictList(nlpDir) {
|
|
900
690
|
return AVAILABLE_DICTS.map((d) => {
|
|
901
691
|
const filePath = getDictFilePath(nlpDir, d.id);
|
|
902
|
-
const downloaded =
|
|
692
|
+
const downloaded = fs3.existsSync(filePath);
|
|
903
693
|
let fileSize;
|
|
904
694
|
if (downloaded) {
|
|
905
695
|
try {
|
|
906
|
-
fileSize =
|
|
696
|
+
fileSize = fs3.statSync(filePath).size;
|
|
907
697
|
} catch {
|
|
908
698
|
}
|
|
909
699
|
}
|
|
@@ -912,9 +702,9 @@ function getDictList(nlpDir) {
|
|
|
912
702
|
}
|
|
913
703
|
function loadDictBuffer(nlpDir, dictId) {
|
|
914
704
|
const filePath = getDictFilePath(nlpDir, dictId);
|
|
915
|
-
if (!
|
|
705
|
+
if (!fs3.existsSync(filePath)) return null;
|
|
916
706
|
try {
|
|
917
|
-
return
|
|
707
|
+
return fs3.readFileSync(filePath);
|
|
918
708
|
} catch (error) {
|
|
919
709
|
console.error(`[NLP DictManager] Failed to read dict file: ${filePath}`, error);
|
|
920
710
|
return null;
|
|
@@ -924,7 +714,7 @@ async function downloadDict(nlpDir, dictId, onProgress) {
|
|
|
924
714
|
if (!AVAILABLE_DICTS.find((d) => d.id === dictId)) {
|
|
925
715
|
return { success: false, error: `Unknown dict: ${dictId}` };
|
|
926
716
|
}
|
|
927
|
-
|
|
717
|
+
fs3.mkdirSync(nlpDir, { recursive: true });
|
|
928
718
|
const url = `${DICT_DOWNLOAD_URL_BASE}/${dictId}.dict`;
|
|
929
719
|
const filePath = getDictFilePath(nlpDir, dictId);
|
|
930
720
|
const tmpPath = filePath + ".tmp";
|
|
@@ -965,16 +755,16 @@ async function downloadDict(nlpDir, dictId, onProgress) {
|
|
|
965
755
|
if (actualSha256 !== expectedSha256) {
|
|
966
756
|
return { success: false, error: "Dictionary integrity check failed (SHA256 mismatch)" };
|
|
967
757
|
}
|
|
968
|
-
|
|
969
|
-
if (
|
|
970
|
-
|
|
758
|
+
fs3.writeFileSync(tmpPath, buffer);
|
|
759
|
+
if (fs3.existsSync(filePath)) fs3.unlinkSync(filePath);
|
|
760
|
+
fs3.renameSync(tmpPath, filePath);
|
|
971
761
|
clearJiebaInstance(dictId);
|
|
972
|
-
console.log(`[NLP DictManager] Dict downloaded: ${dictId} (${
|
|
762
|
+
console.log(`[NLP DictManager] Dict downloaded: ${dictId} (${fs3.statSync(filePath).size} bytes)`);
|
|
973
763
|
return { success: true };
|
|
974
764
|
} catch (error) {
|
|
975
|
-
if (
|
|
765
|
+
if (fs3.existsSync(tmpPath)) {
|
|
976
766
|
try {
|
|
977
|
-
|
|
767
|
+
fs3.unlinkSync(tmpPath);
|
|
978
768
|
} catch {
|
|
979
769
|
}
|
|
980
770
|
}
|
|
@@ -985,9 +775,9 @@ async function downloadDict(nlpDir, dictId, onProgress) {
|
|
|
985
775
|
}
|
|
986
776
|
function deleteDict(nlpDir, dictId) {
|
|
987
777
|
const filePath = getDictFilePath(nlpDir, dictId);
|
|
988
|
-
if (!
|
|
778
|
+
if (!fs3.existsSync(filePath)) return { success: true };
|
|
989
779
|
try {
|
|
990
|
-
|
|
780
|
+
fs3.unlinkSync(filePath);
|
|
991
781
|
clearJiebaInstance(dictId);
|
|
992
782
|
console.log(`[NLP DictManager] Dict deleted: ${dictId}`);
|
|
993
783
|
return { success: true };
|
|
@@ -1009,8 +799,8 @@ async function ensureDefaultDict(nlpDir) {
|
|
|
1009
799
|
}
|
|
1010
800
|
|
|
1011
801
|
// ../../packages/node-runtime/src/preferences.ts
|
|
1012
|
-
import * as
|
|
1013
|
-
import * as
|
|
802
|
+
import * as fs4 from "fs";
|
|
803
|
+
import * as path4 from "path";
|
|
1014
804
|
var DEFAULTS = {
|
|
1015
805
|
pinnedSessionIds: [],
|
|
1016
806
|
assistantUpgradeSkippedVersions: {},
|
|
@@ -1051,13 +841,13 @@ var PreferencesManager = class {
|
|
|
1051
841
|
filePath;
|
|
1052
842
|
cache = null;
|
|
1053
843
|
constructor(systemDir) {
|
|
1054
|
-
this.filePath =
|
|
844
|
+
this.filePath = path4.join(systemDir, "preferences.json");
|
|
1055
845
|
}
|
|
1056
846
|
load() {
|
|
1057
847
|
if (this.cache) return this.cache;
|
|
1058
848
|
try {
|
|
1059
|
-
if (
|
|
1060
|
-
const raw =
|
|
849
|
+
if (fs4.existsSync(this.filePath)) {
|
|
850
|
+
const raw = fs4.readFileSync(this.filePath, "utf-8");
|
|
1061
851
|
const parsed = JSON.parse(raw);
|
|
1062
852
|
const desensitizeMigration = this.migrateLegacyDesensitizeRules(parsed, raw);
|
|
1063
853
|
const ownerMigration = this.migrateLegacyOwnerExclusions(desensitizeMigration.preferences);
|
|
@@ -1117,6 +907,7 @@ var PreferencesManager = class {
|
|
|
1117
907
|
normalizeAiGlobalSettings(partial) {
|
|
1118
908
|
const normalized = { ...partial ?? {} };
|
|
1119
909
|
delete normalized.contextCompression;
|
|
910
|
+
delete normalized.allowProactiveMemory;
|
|
1120
911
|
return { ...DEFAULTS.aiGlobalSettings, ...normalized };
|
|
1121
912
|
}
|
|
1122
913
|
normalizeAiPreprocessConfig(partial) {
|
|
@@ -1199,21 +990,21 @@ var PreferencesManager = class {
|
|
|
1199
990
|
};
|
|
1200
991
|
}
|
|
1201
992
|
backupLegacyPreferences(rawContent) {
|
|
1202
|
-
const backupDir =
|
|
1203
|
-
if (!
|
|
1204
|
-
|
|
993
|
+
const backupDir = path4.join(path4.dirname(this.filePath), "backups");
|
|
994
|
+
if (!fs4.existsSync(backupDir)) {
|
|
995
|
+
fs4.mkdirSync(backupDir, { recursive: true });
|
|
1205
996
|
}
|
|
1206
997
|
const timestamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
1207
|
-
const backupPath =
|
|
1208
|
-
|
|
998
|
+
const backupPath = path4.join(backupDir, `preferences-pre-desensitize-groups-${timestamp}.json`);
|
|
999
|
+
fs4.writeFileSync(backupPath, rawContent, "utf-8");
|
|
1209
1000
|
console.info(`[Preferences] Backed up legacy desensitize rules to ${backupPath}`);
|
|
1210
1001
|
}
|
|
1211
1002
|
writePreferences(preferences) {
|
|
1212
|
-
const dir =
|
|
1213
|
-
if (!
|
|
1214
|
-
|
|
1003
|
+
const dir = path4.dirname(this.filePath);
|
|
1004
|
+
if (!fs4.existsSync(dir)) {
|
|
1005
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
1215
1006
|
}
|
|
1216
|
-
|
|
1007
|
+
fs4.writeFileSync(this.filePath, JSON.stringify(preferences, null, 2), "utf-8");
|
|
1217
1008
|
}
|
|
1218
1009
|
/**
|
|
1219
1010
|
* Deep merge: arrays are replaced (not concatenated), objects are merged.
|
|
@@ -1261,6 +1052,31 @@ function createMessageIdNormalizer(scopes) {
|
|
|
1261
1052
|
return `__chatlab_message_scope__${scopeIndexes.get(scope) ?? 0}__${encodeURIComponent(id)}`;
|
|
1262
1053
|
};
|
|
1263
1054
|
}
|
|
1055
|
+
function createFallbackOccurrenceTracker() {
|
|
1056
|
+
const maximumOccurrences = /* @__PURE__ */ new Map();
|
|
1057
|
+
const sourceOccurrences = /* @__PURE__ */ new Map();
|
|
1058
|
+
return (message, sourceIndex) => {
|
|
1059
|
+
if (message.platformMessageId) return false;
|
|
1060
|
+
const fallbackKey = generateFallbackMessageKey({
|
|
1061
|
+
timestamp: message.timestamp,
|
|
1062
|
+
senderPlatformId: message.senderPlatformId,
|
|
1063
|
+
type: message.type,
|
|
1064
|
+
content: message.content ?? null,
|
|
1065
|
+
replyToMessageId: message.replyToMessageId
|
|
1066
|
+
});
|
|
1067
|
+
let occurrences = sourceOccurrences.get(sourceIndex);
|
|
1068
|
+
if (!occurrences) {
|
|
1069
|
+
occurrences = /* @__PURE__ */ new Map();
|
|
1070
|
+
sourceOccurrences.set(sourceIndex, occurrences);
|
|
1071
|
+
}
|
|
1072
|
+
const occurrence = (occurrences.get(fallbackKey) ?? 0) + 1;
|
|
1073
|
+
occurrences.set(fallbackKey, occurrence);
|
|
1074
|
+
const previousMaximum = maximumOccurrences.get(fallbackKey) ?? 0;
|
|
1075
|
+
if (occurrence <= previousMaximum) return true;
|
|
1076
|
+
maximumOccurrences.set(fallbackKey, occurrence);
|
|
1077
|
+
return false;
|
|
1078
|
+
};
|
|
1079
|
+
}
|
|
1264
1080
|
function createMessageScopeResolver(contexts) {
|
|
1265
1081
|
const contextBySource = /* @__PURE__ */ new Map();
|
|
1266
1082
|
const parents = /* @__PURE__ */ new Map();
|
|
@@ -1339,22 +1155,21 @@ function checkConflictsFromSources(dataSources) {
|
|
|
1339
1155
|
const normalizeMessageId = createMessageIdNormalizer(
|
|
1340
1156
|
preparedSources.map(({ sourceIndex }) => scopeResolver.resolve(sourceIndex))
|
|
1341
1157
|
);
|
|
1342
|
-
const dedupState = createMessageDedupState();
|
|
1158
|
+
const dedupState = createMessageDedupState([], [], [], { preserveFallbackMultiplicity: true });
|
|
1159
|
+
const isCoveredFallbackOccurrence = createFallbackOccurrenceTracker();
|
|
1343
1160
|
let totalMessages = 0;
|
|
1344
1161
|
for (const { msg, sourceIndex, platform } of allMessages) {
|
|
1345
1162
|
const messageScope = scopeResolver.resolve(sourceIndex);
|
|
1346
1163
|
const senderPlatformId = normalizePlatformId(msg.senderPlatformId, platform, collidingIds);
|
|
1347
|
-
const
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
dedupState
|
|
1357
|
-
);
|
|
1164
|
+
const dedupMessage = {
|
|
1165
|
+
platformMessageId: normalizeMessageId(msg.platformMessageId, messageScope),
|
|
1166
|
+
timestamp: msg.timestamp,
|
|
1167
|
+
senderPlatformId,
|
|
1168
|
+
type: msg.type,
|
|
1169
|
+
content: msg.content ?? null,
|
|
1170
|
+
replyToMessageId: normalizeMessageId(msg.replyToMessageId, messageScope)
|
|
1171
|
+
};
|
|
1172
|
+
const duplicate = isCoveredFallbackOccurrence(dedupMessage, sourceIndex) || registerMessageAndCheckDuplicate(dedupMessage, dedupState);
|
|
1358
1173
|
if (!duplicate) totalMessages++;
|
|
1359
1174
|
}
|
|
1360
1175
|
return { ...result, totalMessages };
|
|
@@ -1398,7 +1213,8 @@ function buildMergedOutput(dataSources, outputName) {
|
|
|
1398
1213
|
const normalizeMessageId = createMessageIdNormalizer(
|
|
1399
1214
|
metas.map(({ sourceIndex }) => scopeResolver.resolve(sourceIndex))
|
|
1400
1215
|
);
|
|
1401
|
-
const dedupState = createMessageDedupState();
|
|
1216
|
+
const dedupState = createMessageDedupState([], [], [], { preserveFallbackMultiplicity: true });
|
|
1217
|
+
const isCoveredFallbackOccurrence = createFallbackOccurrenceTracker();
|
|
1402
1218
|
const fallbackOnlyMessageIndexes = /* @__PURE__ */ new Map();
|
|
1403
1219
|
const mergedMessages = [];
|
|
1404
1220
|
for (const { source, meta, sourceIndex } of metas) {
|
|
@@ -1418,15 +1234,17 @@ function buildMergedOutput(dataSources, outputName) {
|
|
|
1418
1234
|
replyToMessageId
|
|
1419
1235
|
};
|
|
1420
1236
|
const fallbackKey = generateFallbackMessageKey(dedupMessage);
|
|
1237
|
+
if (isCoveredFallbackOccurrence(dedupMessage, sourceIndex)) continue;
|
|
1421
1238
|
const shouldBackfillId = Boolean(
|
|
1422
|
-
platformMessageId && !dedupState.platformMessageIds.has(platformMessageId) && dedupState
|
|
1239
|
+
platformMessageId && !dedupState.platformMessageIds.has(platformMessageId) && hasUnmatchedFallbackOnlyMessage(dedupState, fallbackKey)
|
|
1423
1240
|
);
|
|
1424
1241
|
if (registerMessageAndCheckDuplicate(dedupMessage, dedupState)) {
|
|
1425
1242
|
if (shouldBackfillId) {
|
|
1426
|
-
const
|
|
1243
|
+
const retainedIndexes = fallbackOnlyMessageIndexes.get(fallbackKey);
|
|
1244
|
+
const retainedIndex2 = retainedIndexes?.shift();
|
|
1427
1245
|
if (retainedIndex2 !== void 0) {
|
|
1428
1246
|
mergedMessages[retainedIndex2].platformMessageId = platformMessageId;
|
|
1429
|
-
fallbackOnlyMessageIndexes.delete(fallbackKey);
|
|
1247
|
+
if (retainedIndexes?.length === 0) fallbackOnlyMessageIndexes.delete(fallbackKey);
|
|
1430
1248
|
}
|
|
1431
1249
|
}
|
|
1432
1250
|
continue;
|
|
@@ -1442,7 +1260,11 @@ function buildMergedOutput(dataSources, outputName) {
|
|
|
1442
1260
|
content: msg.content,
|
|
1443
1261
|
replyToMessageId
|
|
1444
1262
|
});
|
|
1445
|
-
if (!platformMessageId)
|
|
1263
|
+
if (!platformMessageId) {
|
|
1264
|
+
const retainedIndexes = fallbackOnlyMessageIndexes.get(fallbackKey) ?? [];
|
|
1265
|
+
retainedIndexes.push(retainedIndex);
|
|
1266
|
+
fallbackOnlyMessageIndexes.set(fallbackKey, retainedIndexes);
|
|
1267
|
+
}
|
|
1446
1268
|
}
|
|
1447
1269
|
});
|
|
1448
1270
|
}
|
|
@@ -1495,7 +1317,7 @@ function* serializeChatLabToJsonl(data) {
|
|
|
1495
1317
|
}
|
|
1496
1318
|
|
|
1497
1319
|
// ../../packages/node-runtime/src/services/analytics.ts
|
|
1498
|
-
import * as
|
|
1320
|
+
import * as path5 from "path";
|
|
1499
1321
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
1500
1322
|
var DEFAULT_DATA = {
|
|
1501
1323
|
lastReportDate: null,
|
|
@@ -1607,7 +1429,7 @@ var AnalyticsService = class {
|
|
|
1607
1429
|
// Daily-active deduplication is intentionally process-local unless concurrent runtimes become supported.
|
|
1608
1430
|
dailyActivePromise = null;
|
|
1609
1431
|
constructor(systemDir, options) {
|
|
1610
|
-
this.dataPath =
|
|
1432
|
+
this.dataPath = path5.join(systemDir, "analytics.json");
|
|
1611
1433
|
this.options = {
|
|
1612
1434
|
...options,
|
|
1613
1435
|
umami: options.umami ?? getUmamiConfigFromEnv()
|
|
@@ -1769,8 +1591,8 @@ var AnalyticsService = class {
|
|
|
1769
1591
|
};
|
|
1770
1592
|
|
|
1771
1593
|
// ../../packages/node-runtime/src/services/demo-import.ts
|
|
1772
|
-
import * as
|
|
1773
|
-
import * as
|
|
1594
|
+
import * as fs5 from "fs";
|
|
1595
|
+
import * as path6 from "path";
|
|
1774
1596
|
var DEMO_BASE_URL = "https://chatlab.fun/assets/demo";
|
|
1775
1597
|
var DEMO_FILES = ["demo-group.json", "demo-private-B-wukong.json"];
|
|
1776
1598
|
async function importDemoSessions(options) {
|
|
@@ -1802,8 +1624,8 @@ async function importDemoSessions(options) {
|
|
|
1802
1624
|
}
|
|
1803
1625
|
const rebased = rebaseChatLabDemoDocuments(downloaded, options.now?.() ?? /* @__PURE__ */ new Date(), options.targetTimeZone);
|
|
1804
1626
|
const localPaths = rebased.documents.map((document, index) => {
|
|
1805
|
-
const localPath =
|
|
1806
|
-
|
|
1627
|
+
const localPath = path6.join(createdTempDir, DEMO_FILES[index]);
|
|
1628
|
+
fs5.writeFileSync(localPath, document, "utf8");
|
|
1807
1629
|
return localPath;
|
|
1808
1630
|
});
|
|
1809
1631
|
appLogger.info("demo-import", "Demo timeline prepared", {
|
|
@@ -1914,7 +1736,7 @@ __export(semantic_index_exports, {
|
|
|
1914
1736
|
});
|
|
1915
1737
|
|
|
1916
1738
|
// ../../packages/node-runtime/src/semantic-index/worker-client.ts
|
|
1917
|
-
import
|
|
1739
|
+
import path7 from "path";
|
|
1918
1740
|
|
|
1919
1741
|
// ../../packages/node-runtime/src/semantic-index/worker-thread-transport.ts
|
|
1920
1742
|
import { Worker } from "worker_threads";
|
|
@@ -2296,7 +2118,7 @@ function createSemanticIndexWorkerClient(options) {
|
|
|
2296
2118
|
}
|
|
2297
2119
|
function createSemanticIndexWorkerRuntimeClient(options) {
|
|
2298
2120
|
const configStore = new SemanticIndexConfigStore(
|
|
2299
|
-
|
|
2121
|
+
path7.join(options.pathProvider.getAiDataDir(), SEMANTIC_INDEX_CONFIG_FILE)
|
|
2300
2122
|
);
|
|
2301
2123
|
return createSemanticIndexWorkerClient({
|
|
2302
2124
|
configStore,
|
|
@@ -2351,14 +2173,6 @@ export {
|
|
|
2351
2173
|
NodePathProvider,
|
|
2352
2174
|
getDefaultNodeUserDataDir,
|
|
2353
2175
|
getSystemLogsDir,
|
|
2354
|
-
initNlpDir,
|
|
2355
|
-
getNlpDir,
|
|
2356
|
-
getJieba,
|
|
2357
|
-
clearJiebaInstance,
|
|
2358
|
-
segment,
|
|
2359
|
-
batchSegmentWithFrequency,
|
|
2360
|
-
collectPosTagStats,
|
|
2361
|
-
getPosTagDefinitions,
|
|
2362
2176
|
createJiebaNlpProvider,
|
|
2363
2177
|
computeWordFrequency,
|
|
2364
2178
|
segmentText,
|
|
@@ -2377,4 +2191,4 @@ export {
|
|
|
2377
2191
|
createSemanticIndexWorkerRuntimeClient,
|
|
2378
2192
|
semantic_index_exports
|
|
2379
2193
|
};
|
|
2380
|
-
//# sourceMappingURL=chunk-
|
|
2194
|
+
//# sourceMappingURL=chunk-5YOHLJFB.mjs.map
|