rhua-chatgpt-web 1.0.90 → 1.0.92
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/{api_chain-ndbj9N9y.cjs → api_chain-Bs8HpDtx.cjs} +1 -1
- package/dist/{api_chain-C-0jZvv9.js → api_chain-DxPDMwtJ.js} +2 -2
- package/dist/{combine_docs_chain-BV3YQBdx.js → combine_docs_chain-CeeUc79G.js} +2 -2
- package/dist/{combine_docs_chain-DQTvoBRZ.cjs → combine_docs_chain-fjjQqm3y.cjs} +1 -1
- package/dist/{few_shot-CKQd-oWZ.js → few_shot-Cq0fQRie.js} +1 -1
- package/dist/{few_shot-B5sleOZV.cjs → few_shot-_naNBcYn.cjs} +1 -1
- package/dist/{index-DwuY6VJ2.js → index-0V-Agbf4.js} +1 -1
- package/dist/{index-vPFPFNIK.cjs → index-B382FZMI.cjs} +1 -1
- package/dist/{index-CHlurisP.js → index-B4raOCHT.js} +1 -1
- package/dist/{index-Cpx0aWjC.cjs → index-BMRDC6vG.cjs} +1 -1
- package/dist/{index-HO_HGmtl.js → index-BXlSzDec.js} +406 -30
- package/dist/{index-CL5dD4QL.js → index-Bc01rI6H.js} +1 -1
- package/dist/{index-kQX1nE2W.js → index-BizrRIYC.js} +1 -1
- package/dist/index-BsuzxemZ.js +4 -0
- package/dist/{index-DkbGwcKs.cjs → index-BwUwhm-3.cjs} +1 -1
- package/dist/index-C1TGA2tr.js +4 -0
- package/dist/{index---9AxgqH.cjs → index-CRgtq22N.cjs} +1 -1
- package/dist/{index-BC6UWh7M.js → index-CWyxo3Rj.js} +1 -1
- package/dist/index-CiVIUf6O.js +4 -0
- package/dist/{index-D2l1IPLs.cjs → index-CmUWpa1F.cjs} +1 -1
- package/dist/{index-ScWV43Ya.cjs → index-D2MqA5Ot.cjs} +10 -10
- package/dist/{index-BP3ZLGza.cjs → index-DEUZZnNC.cjs} +1 -1
- package/dist/{index-DbyUBV_n.js → index-DKHwiy00.js} +2 -2
- package/dist/{index-Btsunyw4.js → index-DX00UPm6.js} +2 -2
- package/dist/{index-B7SLuAnl.cjs → index-DoXR_-rB.cjs} +1 -1
- package/dist/{index-C-punTJk.cjs → index-DwoUs76b.cjs} +1 -1
- package/dist/{index-BDwOxjJB.cjs → index-FbT4xyvN.cjs} +1 -1
- package/dist/index-Z-_GOl6e.js +4 -0
- package/dist/{index-i1kcSW4p.cjs → index-aKYAt0Kk.cjs} +1 -1
- package/dist/{index-C3tkG9PE.cjs → index-gWVDzkrS.cjs} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-pbdKKw38.cjs → index.es-DBMp_6cm.cjs} +3 -3
- package/dist/{index.es-CUW_2i1O.js → index.es-tZmnPNqG.js} +1233 -1153
- package/dist/index.esm.js +1 -1
- package/dist/{llm_chain-Cp-fdIHU.js → llm_chain-D_mUrq1S.js} +1 -1
- package/dist/{llm_chain-BKOS6WwS.cjs → llm_chain-DspRhkD8.cjs} +1 -1
- package/dist/{sequential_chain-DTZBsSxs.cjs → sequential_chain-DJXIBCRm.cjs} +1 -1
- package/dist/{sequential_chain-B9xFRCud.js → sequential_chain-DZXcdvKj.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{vector_db_qa-ClnOaOPx.cjs → vector_db_qa-DOgRNEyj.cjs} +1 -1
- package/dist/{vector_db_qa-dNJ2CIeL.js → vector_db_qa-DdeBuCEV.js} +3 -3
- package/package.json +2 -2
- package/dist/index-6ysrd1Ya.js +0 -4
- package/dist/index-BQHT54Oj.js +0 -4
- package/dist/index-BngGbFgs.js +0 -4
- package/dist/index-M9STV34q.js +0 -4
|
@@ -1021,7 +1021,7 @@ const convertDifyAppToAgent = (difyApp) => {
|
|
|
1021
1021
|
const getAgentList = async (type = "app") => {
|
|
1022
1022
|
let preApi = location.hostname === "localhost" ? "http://111.6.44.42:30001" : location.origin;
|
|
1023
1023
|
let baseApi = `${preApi}/prod-api/system/apps/list?pageNum=1&pageSize=100&type=${type}`;
|
|
1024
|
-
let token = "eyJhbGciOiJIUzUxMiJ9.
|
|
1024
|
+
let token = "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhZG1pbiIsImxvZ2luX3VzZXJfa2V5IjoiMjMyZmY1YzYtOTE1My00Yzg5LTgxZGUtNmRjMTUxYjBiODJkIn0.bsoSHb61V1D0oL7lmwecYdrFiiWCrFPv2X9Jb7GSSUlcx31gLOIcvuFhwjOYqoqx1aXygaXtHABZv9iR8lFtgg";
|
|
1025
1025
|
try {
|
|
1026
1026
|
const cacheData = localStorage.getItem("agentWebCache");
|
|
1027
1027
|
console.log("cacheData", cacheData);
|
|
@@ -42739,6 +42739,16 @@ const ChatHistory = ({
|
|
|
42739
42739
|
okButtonProps: { type: "danger", autoFocus: true },
|
|
42740
42740
|
onOk: async () => {
|
|
42741
42741
|
try {
|
|
42742
|
+
const keysToRemove = [];
|
|
42743
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
42744
|
+
const key = localStorage.key(i);
|
|
42745
|
+
if (key && (key.startsWith("dialog_form_data_") || key.startsWith("dialog_files_"))) {
|
|
42746
|
+
keysToRemove.push(key);
|
|
42747
|
+
}
|
|
42748
|
+
}
|
|
42749
|
+
keysToRemove.forEach((key) => {
|
|
42750
|
+
localStorage.removeItem(key);
|
|
42751
|
+
});
|
|
42742
42752
|
await LocalForageService.clear();
|
|
42743
42753
|
Toast.success({
|
|
42744
42754
|
content: "所有本地缓存已清除",
|
|
@@ -42963,6 +42973,7 @@ const DynamicForm = ({
|
|
|
42963
42973
|
initialData,
|
|
42964
42974
|
onUploadSuccess,
|
|
42965
42975
|
onUploadError,
|
|
42976
|
+
onFileDelete,
|
|
42966
42977
|
fileNamesMap = {},
|
|
42967
42978
|
fileMimeTypesMap = {},
|
|
42968
42979
|
fileExtensionsMap = {},
|
|
@@ -43131,6 +43142,9 @@ const DynamicForm = ({
|
|
|
43131
43142
|
[variable]: fileIds.length === 0 ? void 0 : isMultiple ? fileIds : fileIds.length === 1 ? fileIds[0] : fileIds
|
|
43132
43143
|
};
|
|
43133
43144
|
setFormData(newFormData);
|
|
43145
|
+
if (onFileDelete) {
|
|
43146
|
+
onFileDelete(fileId, variable);
|
|
43147
|
+
}
|
|
43134
43148
|
};
|
|
43135
43149
|
const handleTextChange = (variable, value) => {
|
|
43136
43150
|
const newFormData = {
|
|
@@ -43440,7 +43454,7 @@ function buildDynamicFormRequestBody(userInputForm, params) {
|
|
|
43440
43454
|
formData,
|
|
43441
43455
|
formDataKeys: Object.keys(formData || {})
|
|
43442
43456
|
});
|
|
43443
|
-
const getFileType = (fileId, allowedFileTypes) => {
|
|
43457
|
+
const getFileType = (fileId, allowedFileTypes, sessionId) => {
|
|
43444
43458
|
if (!fileId) {
|
|
43445
43459
|
throw new Error(`文件ID为空,无法获取文件类型`);
|
|
43446
43460
|
}
|
|
@@ -43452,7 +43466,30 @@ function buildDynamicFormRequestBody(userInputForm, params) {
|
|
|
43452
43466
|
console.log(`从 allowed_file_types 获取文件类型: audio (优先级高于 filesTypeArr)`);
|
|
43453
43467
|
return "audio";
|
|
43454
43468
|
}
|
|
43455
|
-
|
|
43469
|
+
try {
|
|
43470
|
+
return CommonUtil.getFileTypeFromLocalStorage(fileId);
|
|
43471
|
+
} catch (error) {
|
|
43472
|
+
if (sessionId) {
|
|
43473
|
+
try {
|
|
43474
|
+
const filesKey = `dialog_files_${sessionId}`;
|
|
43475
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
43476
|
+
if (filesCache) {
|
|
43477
|
+
const filesData = JSON.parse(filesCache);
|
|
43478
|
+
const fileInfo = filesData.find((file) => file.fileId === fileId);
|
|
43479
|
+
if (fileInfo && fileInfo.fileType) {
|
|
43480
|
+
return fileInfo.fileType;
|
|
43481
|
+
} else if (fileInfo && fileInfo.fileName) {
|
|
43482
|
+
const typeFromName = CommonUtil.getFileTypeFromFileName(fileInfo.fileName);
|
|
43483
|
+
return typeFromName;
|
|
43484
|
+
}
|
|
43485
|
+
}
|
|
43486
|
+
} catch (cacheError) {
|
|
43487
|
+
console.error(`[动态表单] 从 dialog_files_ 缓存获取文件类型失败:`, cacheError);
|
|
43488
|
+
}
|
|
43489
|
+
}
|
|
43490
|
+
console.warn(`[动态表单] 无法获取文件 ${fileId} 的类型,使用默认值 document`);
|
|
43491
|
+
return "document";
|
|
43492
|
+
}
|
|
43456
43493
|
};
|
|
43457
43494
|
const inputs = {};
|
|
43458
43495
|
userInputForm.forEach((item) => {
|
|
@@ -43475,7 +43512,7 @@ function buildDynamicFormRequestBody(userInputForm, params) {
|
|
|
43475
43512
|
inputs[variable] = fileIds.map((fileId) => {
|
|
43476
43513
|
var _a3, _b2;
|
|
43477
43514
|
const fileName = fileNamesMap[fileId] || "";
|
|
43478
|
-
const fileType = getFileType(fileId, fieldConfig.allowed_file_types);
|
|
43515
|
+
const fileType = getFileType(fileId, fieldConfig.allowed_file_types, currentSession == null ? void 0 : currentSession.id);
|
|
43479
43516
|
let source = "localStorage.filesTypeArr";
|
|
43480
43517
|
if ((_a3 = fieldConfig.allowed_file_types) == null ? void 0 : _a3.includes("custom")) {
|
|
43481
43518
|
source = "allowed_file_types (custom 优先级)";
|
|
@@ -43500,7 +43537,7 @@ function buildDynamicFormRequestBody(userInputForm, params) {
|
|
|
43500
43537
|
if (fileIds.length === 1) {
|
|
43501
43538
|
const fileId = fileIds[0];
|
|
43502
43539
|
const fileName = fileNamesMap[fileId] || "";
|
|
43503
|
-
const fileType = getFileType(fileId, fieldConfig.allowed_file_types);
|
|
43540
|
+
const fileType = getFileType(fileId, fieldConfig.allowed_file_types, currentSession == null ? void 0 : currentSession.id);
|
|
43504
43541
|
let source = "localStorage.filesTypeArr";
|
|
43505
43542
|
if ((_a2 = fieldConfig.allowed_file_types) == null ? void 0 : _a2.includes("custom")) {
|
|
43506
43543
|
source = "allowed_file_types (custom 优先级)";
|
|
@@ -43524,7 +43561,7 @@ function buildDynamicFormRequestBody(userInputForm, params) {
|
|
|
43524
43561
|
inputs[variable] = fileIds.map((fileId) => {
|
|
43525
43562
|
var _a3, _b2;
|
|
43526
43563
|
const fileName = fileNamesMap[fileId] || "";
|
|
43527
|
-
const fileType = getFileType(fileId, fieldConfig.allowed_file_types);
|
|
43564
|
+
const fileType = getFileType(fileId, fieldConfig.allowed_file_types, currentSession == null ? void 0 : currentSession.id);
|
|
43528
43565
|
let source = "localStorage.filesTypeArr";
|
|
43529
43566
|
if ((_a3 = fieldConfig.allowed_file_types) == null ? void 0 : _a3.includes("custom")) {
|
|
43530
43567
|
source = "allowed_file_types (custom 优先级)";
|
|
@@ -43871,11 +43908,74 @@ function CommentIndex({
|
|
|
43871
43908
|
setCurrentCommentSessionId(newSessionId);
|
|
43872
43909
|
CommonUtil.clearFilesTypeArr();
|
|
43873
43910
|
const currentSession = sessionFindIndex < 0 ? newSessionList[0] : newSessionList[sessionFindIndex];
|
|
43911
|
+
let restoredFormData = {};
|
|
43912
|
+
let restoredFileNamesMap = currentSession.fileNamesMap || {};
|
|
43913
|
+
let restoredFileTypesMap = currentSession.fileTypesMap || {};
|
|
43914
|
+
try {
|
|
43915
|
+
const formDataKey = `dialog_form_data_${newSessionId}`;
|
|
43916
|
+
const formDataCache = localStorage.getItem(formDataKey);
|
|
43917
|
+
if (formDataCache) {
|
|
43918
|
+
const cachedFormData = JSON.parse(formDataCache);
|
|
43919
|
+
console.log("[初始化会话] 找到表单数据缓存:", cachedFormData);
|
|
43920
|
+
const filesKey = `dialog_files_${newSessionId}`;
|
|
43921
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
43922
|
+
let filesDataMap = {};
|
|
43923
|
+
if (filesCache) {
|
|
43924
|
+
const filesData = JSON.parse(filesCache);
|
|
43925
|
+
console.log("[初始化会话] 找到文件信息缓存:", filesData);
|
|
43926
|
+
filesDataMap = filesData.reduce((acc, file) => {
|
|
43927
|
+
if (!acc[file.variable]) {
|
|
43928
|
+
acc[file.variable] = [];
|
|
43929
|
+
}
|
|
43930
|
+
acc[file.variable].push(file);
|
|
43931
|
+
return acc;
|
|
43932
|
+
}, {});
|
|
43933
|
+
}
|
|
43934
|
+
restoredFormData = { ...cachedFormData.formData };
|
|
43935
|
+
Object.keys(restoredFormData).forEach((variable) => {
|
|
43936
|
+
const value = restoredFormData[variable];
|
|
43937
|
+
if (filesDataMap[variable] && (Array.isArray(value) || typeof value === "string")) {
|
|
43938
|
+
const fileIds = Array.isArray(value) ? value : [value];
|
|
43939
|
+
const matchedFiles = filesDataMap[variable].filter(
|
|
43940
|
+
(file) => fileIds.includes(file.fileId)
|
|
43941
|
+
);
|
|
43942
|
+
if (matchedFiles.length > 0) {
|
|
43943
|
+
console.log(`[初始化会话] 恢复文件字段 ${variable}:`, matchedFiles);
|
|
43944
|
+
matchedFiles.forEach((file) => {
|
|
43945
|
+
restoredFileNamesMap[file.fileId] = file.fileName;
|
|
43946
|
+
if (file.fileType) {
|
|
43947
|
+
restoredFileTypesMap[file.fileId] = file.fileType;
|
|
43948
|
+
}
|
|
43949
|
+
});
|
|
43950
|
+
}
|
|
43951
|
+
}
|
|
43952
|
+
});
|
|
43953
|
+
console.log("[初始化会话] 恢复的表单数据:", restoredFormData);
|
|
43954
|
+
} else {
|
|
43955
|
+
console.log("[初始化会话] 未找到表单数据缓存");
|
|
43956
|
+
const filesKey = `dialog_files_${newSessionId}`;
|
|
43957
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
43958
|
+
if (filesCache) {
|
|
43959
|
+
const filesData = JSON.parse(filesCache);
|
|
43960
|
+
console.log("[初始化会话] 找到文件信息缓存:", filesData);
|
|
43961
|
+
} else {
|
|
43962
|
+
console.log("[初始化会话] 未找到文件信息缓存");
|
|
43963
|
+
}
|
|
43964
|
+
}
|
|
43965
|
+
} catch (error) {
|
|
43966
|
+
console.error("[初始化会话] 查找本地缓存失败:", error);
|
|
43967
|
+
}
|
|
43874
43968
|
setCurrentCommentSession({
|
|
43875
43969
|
...currentSession,
|
|
43876
43970
|
config: { ...currentSession.config },
|
|
43877
|
-
fileIds: currentSession.fileIds || []
|
|
43971
|
+
fileIds: currentSession.fileIds || [],
|
|
43878
43972
|
// 确保fileIds字段存在
|
|
43973
|
+
fileNamesMap: restoredFileNamesMap,
|
|
43974
|
+
// 恢复文件名映射
|
|
43975
|
+
fileTypesMap: restoredFileTypesMap,
|
|
43976
|
+
// 恢复文件类型映射
|
|
43977
|
+
dynamicFormData: restoredFormData
|
|
43978
|
+
// 恢复动态表单数据
|
|
43879
43979
|
});
|
|
43880
43980
|
if ((currentSession == null ? void 0 : currentSession.fileUploadEnabled) !== void 0) {
|
|
43881
43981
|
setFileUploadEnabled(currentSession.fileUploadEnabled);
|
|
@@ -44225,11 +44325,54 @@ function CommentIndex({
|
|
|
44225
44325
|
} else {
|
|
44226
44326
|
const fileIdsToUse = (currentSession == null ? void 0 : currentSession.fileIds) || [];
|
|
44227
44327
|
const fileParams = (fileIdsToUse == null ? void 0 : fileIdsToUse.filter((fileId) => fileId).map((fileId) => {
|
|
44228
|
-
|
|
44328
|
+
let fileType = "document";
|
|
44329
|
+
let typeSource = "默认值";
|
|
44330
|
+
try {
|
|
44331
|
+
fileType = CommonUtil.getFileTypeFromLocalStorage(fileId);
|
|
44332
|
+
typeSource = "localStorage.filesTypeArr";
|
|
44333
|
+
} catch (error) {
|
|
44334
|
+
console.warn(`[发送消息] 从 filesTypeArr 获取文件类型失败:`, error);
|
|
44335
|
+
try {
|
|
44336
|
+
const sessionId = currentCommentSessionId;
|
|
44337
|
+
if (sessionId) {
|
|
44338
|
+
const filesKey = `dialog_files_${sessionId}`;
|
|
44339
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
44340
|
+
if (filesCache) {
|
|
44341
|
+
const filesData = JSON.parse(filesCache);
|
|
44342
|
+
const fileInfo = filesData.find((file) => file.fileId === fileId);
|
|
44343
|
+
if (fileInfo && fileInfo.fileType) {
|
|
44344
|
+
fileType = fileInfo.fileType;
|
|
44345
|
+
typeSource = `dialog_files_${sessionId}`;
|
|
44346
|
+
console.log(`[发送消息] 从 dialog_files_ 缓存获取文件类型成功:`, {
|
|
44347
|
+
文件ID: fileId,
|
|
44348
|
+
文件类型: fileType,
|
|
44349
|
+
文件名: fileInfo.fileName,
|
|
44350
|
+
来源: typeSource
|
|
44351
|
+
});
|
|
44352
|
+
} else {
|
|
44353
|
+
console.warn(`[发送消息] 在 dialog_files_ 缓存中未找到文件ID: ${fileId}`);
|
|
44354
|
+
if (fileInfo && fileInfo.fileName) {
|
|
44355
|
+
fileType = CommonUtil.getFileTypeFromFileName(fileInfo.fileName);
|
|
44356
|
+
typeSource = `根据文件名判断 (${fileInfo.fileName})`;
|
|
44357
|
+
console.log(`[发送消息] 根据文件名判断文件类型:`, {
|
|
44358
|
+
文件ID: fileId,
|
|
44359
|
+
文件名: fileInfo.fileName,
|
|
44360
|
+
判断类型: fileType
|
|
44361
|
+
});
|
|
44362
|
+
}
|
|
44363
|
+
}
|
|
44364
|
+
} else {
|
|
44365
|
+
console.warn(`[发送消息] 未找到 dialog_files_ 缓存: ${filesKey}`);
|
|
44366
|
+
}
|
|
44367
|
+
}
|
|
44368
|
+
} catch (cacheError) {
|
|
44369
|
+
console.error(`[发送消息] 从 dialog_files_ 缓存获取文件类型失败:`, cacheError);
|
|
44370
|
+
}
|
|
44371
|
+
}
|
|
44229
44372
|
console.log("[发送消息接口入参] 默认请求体格式 - 文件:", {
|
|
44230
44373
|
文件ID: fileId,
|
|
44231
|
-
|
|
44232
|
-
来源:
|
|
44374
|
+
文件类型: fileType,
|
|
44375
|
+
来源: typeSource
|
|
44233
44376
|
});
|
|
44234
44377
|
return {
|
|
44235
44378
|
type: fileType,
|
|
@@ -44680,16 +44823,73 @@ function CommentIndex({
|
|
|
44680
44823
|
} else {
|
|
44681
44824
|
setFileUploadEnabled(false);
|
|
44682
44825
|
}
|
|
44826
|
+
let restoredFormData = {};
|
|
44827
|
+
let restoredFileNamesMap = {};
|
|
44828
|
+
let restoredFileTypesMap = {};
|
|
44829
|
+
try {
|
|
44830
|
+
const formDataKey = `dialog_form_data_${sessionId}`;
|
|
44831
|
+
const formDataCache = localStorage.getItem(formDataKey);
|
|
44832
|
+
if (formDataCache) {
|
|
44833
|
+
const cachedFormData = JSON.parse(formDataCache);
|
|
44834
|
+
console.log("[切换会话] 找到表单数据缓存:", cachedFormData);
|
|
44835
|
+
const filesKey = `dialog_files_${sessionId}`;
|
|
44836
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
44837
|
+
let filesDataMap = {};
|
|
44838
|
+
if (filesCache) {
|
|
44839
|
+
const filesData = JSON.parse(filesCache);
|
|
44840
|
+
console.log("[切换会话] 找到文件信息缓存:", filesData);
|
|
44841
|
+
filesDataMap = filesData.reduce((acc, file) => {
|
|
44842
|
+
if (!acc[file.variable]) {
|
|
44843
|
+
acc[file.variable] = [];
|
|
44844
|
+
}
|
|
44845
|
+
acc[file.variable].push(file);
|
|
44846
|
+
return acc;
|
|
44847
|
+
}, {});
|
|
44848
|
+
}
|
|
44849
|
+
restoredFormData = { ...cachedFormData.formData };
|
|
44850
|
+
Object.keys(restoredFormData).forEach((variable) => {
|
|
44851
|
+
const value = restoredFormData[variable];
|
|
44852
|
+
if (filesDataMap[variable] && (Array.isArray(value) || typeof value === "string")) {
|
|
44853
|
+
const fileIds = Array.isArray(value) ? value : [value];
|
|
44854
|
+
const matchedFiles = filesDataMap[variable].filter(
|
|
44855
|
+
(file) => fileIds.includes(file.fileId)
|
|
44856
|
+
);
|
|
44857
|
+
if (matchedFiles.length > 0) {
|
|
44858
|
+
console.log(`[切换会话] 恢复文件字段 ${variable}:`, matchedFiles);
|
|
44859
|
+
matchedFiles.forEach((file) => {
|
|
44860
|
+
restoredFileNamesMap[file.fileId] = file.fileName;
|
|
44861
|
+
if (file.fileType) {
|
|
44862
|
+
restoredFileTypesMap[file.fileId] = file.fileType;
|
|
44863
|
+
}
|
|
44864
|
+
});
|
|
44865
|
+
}
|
|
44866
|
+
}
|
|
44867
|
+
});
|
|
44868
|
+
console.log("[切换会话] 恢复的表单数据:", restoredFormData);
|
|
44869
|
+
} else {
|
|
44870
|
+
console.log("[切换会话] 未找到表单数据缓存");
|
|
44871
|
+
const filesKey = `dialog_files_${sessionId}`;
|
|
44872
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
44873
|
+
if (filesCache) {
|
|
44874
|
+
const filesData = JSON.parse(filesCache);
|
|
44875
|
+
console.log("[切换会话] 找到文件信息缓存:", filesData);
|
|
44876
|
+
} else {
|
|
44877
|
+
console.log("[切换会话] 未找到文件信息缓存");
|
|
44878
|
+
}
|
|
44879
|
+
}
|
|
44880
|
+
} catch (error) {
|
|
44881
|
+
console.error("[切换会话] 查找本地缓存失败:", error);
|
|
44882
|
+
}
|
|
44683
44883
|
setCurrentCommentSession({
|
|
44684
44884
|
...selectedSession,
|
|
44685
44885
|
fileIds: [],
|
|
44686
|
-
// 清空文件ID
|
|
44687
|
-
fileNamesMap:
|
|
44688
|
-
//
|
|
44689
|
-
fileTypesMap:
|
|
44690
|
-
//
|
|
44691
|
-
dynamicFormData:
|
|
44692
|
-
//
|
|
44886
|
+
// 清空文件ID数组(动态表单会处理文件显示)
|
|
44887
|
+
fileNamesMap: restoredFileNamesMap,
|
|
44888
|
+
// 恢复文件名映射
|
|
44889
|
+
fileTypesMap: restoredFileTypesMap,
|
|
44890
|
+
// 恢复文件类型映射
|
|
44891
|
+
dynamicFormData: restoredFormData
|
|
44892
|
+
// 恢复动态表单数据
|
|
44693
44893
|
});
|
|
44694
44894
|
const sessionIndex = sessionList.findIndex(
|
|
44695
44895
|
(session) => session.id === sessionId
|
|
@@ -44699,8 +44899,9 @@ function CommentIndex({
|
|
|
44699
44899
|
updatedSessionList[sessionIndex] = {
|
|
44700
44900
|
...selectedSession,
|
|
44701
44901
|
fileIds: [],
|
|
44702
|
-
fileNamesMap:
|
|
44703
|
-
fileTypesMap:
|
|
44902
|
+
fileNamesMap: restoredFileNamesMap,
|
|
44903
|
+
fileTypesMap: restoredFileTypesMap,
|
|
44904
|
+
dynamicFormData: restoredFormData
|
|
44704
44905
|
};
|
|
44705
44906
|
LocalForageService.setItem("session_list", updatedSessionList);
|
|
44706
44907
|
return updatedSessionList;
|
|
@@ -44749,6 +44950,17 @@ function CommentIndex({
|
|
|
44749
44950
|
);
|
|
44750
44951
|
await LocalForageService.setItem("session_list", newSessionList);
|
|
44751
44952
|
await LocalForageService.removeItem("chat_list_" + sessionId);
|
|
44953
|
+
try {
|
|
44954
|
+
const formDataKey = `dialog_form_data_${sessionId}`;
|
|
44955
|
+
localStorage.removeItem(formDataKey);
|
|
44956
|
+
console.log(`[删除会话] 已删除表单数据缓存: ${formDataKey}`);
|
|
44957
|
+
const filesKey = `dialog_files_${sessionId}`;
|
|
44958
|
+
localStorage.removeItem(filesKey);
|
|
44959
|
+
console.log(`[删除会话] 已删除文件信息缓存: ${filesKey}`);
|
|
44960
|
+
console.log(`[删除会话] 已清理会话 ${sessionId} 的所有本地缓存`);
|
|
44961
|
+
} catch (error) {
|
|
44962
|
+
console.error(`[删除会话] 清理本地缓存失败:`, error);
|
|
44963
|
+
}
|
|
44752
44964
|
if (newSessionList.length > 0) {
|
|
44753
44965
|
const deletedSession = currentSessionList.find(
|
|
44754
44966
|
(session) => session.id === sessionId
|
|
@@ -45092,6 +45304,75 @@ function CommentIndex({
|
|
|
45092
45304
|
() => chatList && chatList.length > 0 ? chatList : createNewChatMessage()
|
|
45093
45305
|
);
|
|
45094
45306
|
await LocalForageService.setItem("current_session_id", latestSession.id);
|
|
45307
|
+
try {
|
|
45308
|
+
const formDataKey = `dialog_form_data_${latestSession.id}`;
|
|
45309
|
+
const formDataCache = localStorage.getItem(formDataKey);
|
|
45310
|
+
let restoredFormData = {};
|
|
45311
|
+
if (formDataCache) {
|
|
45312
|
+
const cachedFormData = JSON.parse(formDataCache);
|
|
45313
|
+
console.log("[智能体选择] 找到表单数据缓存:", cachedFormData);
|
|
45314
|
+
const filesKey = `dialog_files_${latestSession.id}`;
|
|
45315
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
45316
|
+
let filesDataMap = {};
|
|
45317
|
+
if (filesCache) {
|
|
45318
|
+
const filesData = JSON.parse(filesCache);
|
|
45319
|
+
console.log("[智能体选择] 找到文件信息缓存:", filesData);
|
|
45320
|
+
filesDataMap = filesData.reduce((acc, file) => {
|
|
45321
|
+
if (!acc[file.variable]) {
|
|
45322
|
+
acc[file.variable] = [];
|
|
45323
|
+
}
|
|
45324
|
+
acc[file.variable].push(file);
|
|
45325
|
+
return acc;
|
|
45326
|
+
}, {});
|
|
45327
|
+
}
|
|
45328
|
+
restoredFormData = { ...cachedFormData.formData };
|
|
45329
|
+
Object.keys(restoredFormData).forEach((variable) => {
|
|
45330
|
+
const value = restoredFormData[variable];
|
|
45331
|
+
if (filesDataMap[variable] && (Array.isArray(value) || typeof value === "string")) {
|
|
45332
|
+
const fileIds = Array.isArray(value) ? value : [value];
|
|
45333
|
+
const matchedFiles = filesDataMap[variable].filter(
|
|
45334
|
+
(file) => fileIds.includes(file.fileId)
|
|
45335
|
+
);
|
|
45336
|
+
if (matchedFiles.length > 0) {
|
|
45337
|
+
console.log(`[智能体选择] 恢复文件字段 ${variable}:`, matchedFiles);
|
|
45338
|
+
const fileNamesMap = { ...latestSession.fileNamesMap };
|
|
45339
|
+
const fileTypesMap = { ...latestSession.fileTypesMap };
|
|
45340
|
+
matchedFiles.forEach((file) => {
|
|
45341
|
+
fileNamesMap[file.fileId] = file.fileName;
|
|
45342
|
+
if (file.fileType) {
|
|
45343
|
+
fileTypesMap[file.fileId] = file.fileType;
|
|
45344
|
+
}
|
|
45345
|
+
});
|
|
45346
|
+
setCurrentCommentSession((prev) => prev ? {
|
|
45347
|
+
...prev,
|
|
45348
|
+
fileNamesMap,
|
|
45349
|
+
fileTypesMap,
|
|
45350
|
+
dynamicFormData: restoredFormData
|
|
45351
|
+
} : prev);
|
|
45352
|
+
}
|
|
45353
|
+
}
|
|
45354
|
+
});
|
|
45355
|
+
console.log("[智能体选择] 恢复的表单数据:", restoredFormData);
|
|
45356
|
+
} else {
|
|
45357
|
+
console.log("[智能体选择] 未找到表单数据缓存");
|
|
45358
|
+
const filesKey = `dialog_files_${latestSession.id}`;
|
|
45359
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
45360
|
+
if (filesCache) {
|
|
45361
|
+
const filesData = JSON.parse(filesCache);
|
|
45362
|
+
console.log("[智能体选择] 找到文件信息缓存:", filesData);
|
|
45363
|
+
} else {
|
|
45364
|
+
console.log("[智能体选择] 未找到文件信息缓存");
|
|
45365
|
+
}
|
|
45366
|
+
}
|
|
45367
|
+
if (!formDataCache) {
|
|
45368
|
+
setCurrentCommentSession((prev) => prev ? {
|
|
45369
|
+
...prev,
|
|
45370
|
+
dynamicFormData: restoredFormData
|
|
45371
|
+
} : prev);
|
|
45372
|
+
}
|
|
45373
|
+
} catch (error) {
|
|
45374
|
+
console.error("[智能体选择] 查找本地缓存失败:", error);
|
|
45375
|
+
}
|
|
45095
45376
|
if (aiContent && aiContent.trim()) {
|
|
45096
45377
|
setPendingAiContentToSend(aiContent.trim());
|
|
45097
45378
|
if (aiFiles && Array.isArray(aiFiles) && aiFiles.length > 0) {
|
|
@@ -45555,6 +45836,19 @@ function CommentIndex({
|
|
|
45555
45836
|
setCurrentCommentSession(
|
|
45556
45837
|
newSessionList[sessionIndex]
|
|
45557
45838
|
);
|
|
45839
|
+
try {
|
|
45840
|
+
const dialogFormData = {
|
|
45841
|
+
sessionId: currentCommentSessionId,
|
|
45842
|
+
formData: data
|
|
45843
|
+
};
|
|
45844
|
+
localStorage.setItem(
|
|
45845
|
+
`dialog_form_data_${currentCommentSessionId}`,
|
|
45846
|
+
JSON.stringify(dialogFormData)
|
|
45847
|
+
);
|
|
45848
|
+
console.log("对话框表单数据已存储到本地缓存:", dialogFormData);
|
|
45849
|
+
} catch (error) {
|
|
45850
|
+
console.error("存储对话框表单数据到本地缓存失败:", error);
|
|
45851
|
+
}
|
|
45558
45852
|
}
|
|
45559
45853
|
});
|
|
45560
45854
|
}
|
|
@@ -45604,6 +45898,39 @@ function CommentIndex({
|
|
|
45604
45898
|
newSessionList[sessionIndex]
|
|
45605
45899
|
);
|
|
45606
45900
|
console.log("[文件上传成功] fileNamesMap 已保存到存储和状态");
|
|
45901
|
+
try {
|
|
45902
|
+
const fileInfo = {
|
|
45903
|
+
sessionId: currentCommentSessionId,
|
|
45904
|
+
fileId,
|
|
45905
|
+
fileName,
|
|
45906
|
+
variable,
|
|
45907
|
+
mimeType,
|
|
45908
|
+
extension: extension2,
|
|
45909
|
+
fileType,
|
|
45910
|
+
timestamp: Date.now()
|
|
45911
|
+
};
|
|
45912
|
+
const existingFilesKey = `dialog_files_${currentCommentSessionId}`;
|
|
45913
|
+
const existingFilesData = localStorage.getItem(existingFilesKey);
|
|
45914
|
+
let filesList = [];
|
|
45915
|
+
if (existingFilesData) {
|
|
45916
|
+
try {
|
|
45917
|
+
filesList = JSON.parse(existingFilesData);
|
|
45918
|
+
} catch (parseError) {
|
|
45919
|
+
console.warn("解析已存储的文件列表失败:", parseError);
|
|
45920
|
+
filesList = [];
|
|
45921
|
+
}
|
|
45922
|
+
}
|
|
45923
|
+
const existingIndex = filesList.findIndex((file) => file.fileId === fileId);
|
|
45924
|
+
if (existingIndex >= 0) {
|
|
45925
|
+
filesList[existingIndex] = fileInfo;
|
|
45926
|
+
} else {
|
|
45927
|
+
filesList.push(fileInfo);
|
|
45928
|
+
}
|
|
45929
|
+
localStorage.setItem(existingFilesKey, JSON.stringify(filesList));
|
|
45930
|
+
console.log("文件信息已存储到本地缓存:", fileInfo);
|
|
45931
|
+
} catch (error) {
|
|
45932
|
+
console.error("存储文件信息到本地缓存失败:", error);
|
|
45933
|
+
}
|
|
45607
45934
|
} else {
|
|
45608
45935
|
console.warn("[文件上传成功] 未找到会话,sessionIndex:", sessionIndex);
|
|
45609
45936
|
}
|
|
@@ -45614,6 +45941,55 @@ function CommentIndex({
|
|
|
45614
45941
|
},
|
|
45615
45942
|
onUploadError: (error) => {
|
|
45616
45943
|
},
|
|
45944
|
+
onFileDelete: (fileId, variable) => {
|
|
45945
|
+
console.log("[文件删除] 开始删除文件缓存:", {
|
|
45946
|
+
fileId,
|
|
45947
|
+
variable,
|
|
45948
|
+
currentCommentSessionId
|
|
45949
|
+
});
|
|
45950
|
+
if (currentCommentSessionId) {
|
|
45951
|
+
try {
|
|
45952
|
+
const filesKey = `dialog_files_${currentCommentSessionId}`;
|
|
45953
|
+
const filesCache = localStorage.getItem(filesKey);
|
|
45954
|
+
if (filesCache) {
|
|
45955
|
+
const filesData = JSON.parse(filesCache);
|
|
45956
|
+
const updatedFilesData = filesData.filter((file) => file.fileId !== fileId);
|
|
45957
|
+
if (updatedFilesData.length !== filesData.length) {
|
|
45958
|
+
localStorage.setItem(filesKey, JSON.stringify(updatedFilesData));
|
|
45959
|
+
console.log(`[文件删除] 已从缓存中删除文件 ${fileId},剩余文件数量:`, updatedFilesData.length);
|
|
45960
|
+
} else {
|
|
45961
|
+
console.log(`[文件删除] 缓存中未找到文件 ${fileId}`);
|
|
45962
|
+
}
|
|
45963
|
+
} else {
|
|
45964
|
+
console.log(`[文件删除] 未找到文件缓存: ${filesKey}`);
|
|
45965
|
+
}
|
|
45966
|
+
LocalForageService.getItem("session_list").then((sessionList) => {
|
|
45967
|
+
const newSessionList = [...sessionList || []];
|
|
45968
|
+
const sessionIndex = newSessionList.findIndex(
|
|
45969
|
+
(session) => session.id === currentCommentSessionId
|
|
45970
|
+
);
|
|
45971
|
+
if (sessionIndex >= 0) {
|
|
45972
|
+
const currentSession = newSessionList[sessionIndex];
|
|
45973
|
+
const fileNamesMap = { ...currentSession.fileNamesMap };
|
|
45974
|
+
const fileTypesMap = { ...currentSession.fileTypesMap };
|
|
45975
|
+
delete fileNamesMap[fileId];
|
|
45976
|
+
delete fileTypesMap[fileId];
|
|
45977
|
+
newSessionList[sessionIndex] = {
|
|
45978
|
+
...currentSession,
|
|
45979
|
+
fileNamesMap,
|
|
45980
|
+
fileTypesMap
|
|
45981
|
+
};
|
|
45982
|
+
LocalForageService.setItem("session_list", newSessionList);
|
|
45983
|
+
setCommentSessionList(newSessionList);
|
|
45984
|
+
setCurrentCommentSession(newSessionList[sessionIndex]);
|
|
45985
|
+
console.log(`[文件删除] 已更新会话中的文件映射,删除文件 ${fileId}`);
|
|
45986
|
+
}
|
|
45987
|
+
});
|
|
45988
|
+
} catch (error) {
|
|
45989
|
+
console.error("[文件删除] 删除文件缓存失败:", error);
|
|
45990
|
+
}
|
|
45991
|
+
}
|
|
45992
|
+
},
|
|
45617
45993
|
fileNamesMap: (currentCommentSession == null ? void 0 : currentCommentSession.fileNamesMap) || {},
|
|
45618
45994
|
fileMimeTypesMap: (currentCommentSession == null ? void 0 : currentCommentSession.fileMimeTypesMap) || {},
|
|
45619
45995
|
fileExtensionsMap: (currentCommentSession == null ? void 0 : currentCommentSession.fileExtensionsMap) || {},
|
|
@@ -45954,7 +46330,7 @@ const BlockEdit = ({
|
|
|
45954
46330
|
const initVueEditor = async () => {
|
|
45955
46331
|
if (editorRef.current) {
|
|
45956
46332
|
try {
|
|
45957
|
-
const BlockNoteEditorModule = await import("./index.es-
|
|
46333
|
+
const BlockNoteEditorModule = await import("./index.es-tZmnPNqG.js");
|
|
45958
46334
|
const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
|
|
45959
46335
|
const theme = {
|
|
45960
46336
|
colors: {
|
|
@@ -46932,7 +47308,7 @@ const AiBlockEdit = ({
|
|
|
46932
47308
|
const initVueEditor = async () => {
|
|
46933
47309
|
if (editorRef.current) {
|
|
46934
47310
|
try {
|
|
46935
|
-
const BlockNoteEditorModule = await import("./index.es-
|
|
47311
|
+
const BlockNoteEditorModule = await import("./index.es-tZmnPNqG.js");
|
|
46936
47312
|
const BlockNoteEditor = BlockNoteEditorModule.BlockNoteEditor;
|
|
46937
47313
|
const theme = {
|
|
46938
47314
|
colors: {
|
|
@@ -47858,7 +48234,7 @@ class BasePromptTemplate extends Runnable {
|
|
|
47858
48234
|
return PromptTemplate2.deserialize({ ...data, _type: "prompt" });
|
|
47859
48235
|
}
|
|
47860
48236
|
case "few_shot": {
|
|
47861
|
-
const { FewShotPromptTemplate } = await import("./few_shot-
|
|
48237
|
+
const { FewShotPromptTemplate } = await import("./few_shot-Cq0fQRie.js");
|
|
47862
48238
|
return FewShotPromptTemplate.deserialize(data);
|
|
47863
48239
|
}
|
|
47864
48240
|
default:
|
|
@@ -49430,35 +49806,35 @@ class BaseChain extends BaseLangChain {
|
|
|
49430
49806
|
static async deserialize(data, values = {}) {
|
|
49431
49807
|
switch (data._type) {
|
|
49432
49808
|
case "llm_chain": {
|
|
49433
|
-
const { LLMChain } = await import("./llm_chain-
|
|
49809
|
+
const { LLMChain } = await import("./llm_chain-D_mUrq1S.js");
|
|
49434
49810
|
return LLMChain.deserialize(data);
|
|
49435
49811
|
}
|
|
49436
49812
|
case "sequential_chain": {
|
|
49437
|
-
const { SequentialChain } = await import("./sequential_chain-
|
|
49813
|
+
const { SequentialChain } = await import("./sequential_chain-DZXcdvKj.js");
|
|
49438
49814
|
return SequentialChain.deserialize(data);
|
|
49439
49815
|
}
|
|
49440
49816
|
case "simple_sequential_chain": {
|
|
49441
|
-
const { SimpleSequentialChain } = await import("./sequential_chain-
|
|
49817
|
+
const { SimpleSequentialChain } = await import("./sequential_chain-DZXcdvKj.js");
|
|
49442
49818
|
return SimpleSequentialChain.deserialize(data);
|
|
49443
49819
|
}
|
|
49444
49820
|
case "stuff_documents_chain": {
|
|
49445
|
-
const { StuffDocumentsChain } = await import("./combine_docs_chain-
|
|
49821
|
+
const { StuffDocumentsChain } = await import("./combine_docs_chain-CeeUc79G.js");
|
|
49446
49822
|
return StuffDocumentsChain.deserialize(data);
|
|
49447
49823
|
}
|
|
49448
49824
|
case "map_reduce_documents_chain": {
|
|
49449
|
-
const { MapReduceDocumentsChain } = await import("./combine_docs_chain-
|
|
49825
|
+
const { MapReduceDocumentsChain } = await import("./combine_docs_chain-CeeUc79G.js");
|
|
49450
49826
|
return MapReduceDocumentsChain.deserialize(data);
|
|
49451
49827
|
}
|
|
49452
49828
|
case "refine_documents_chain": {
|
|
49453
|
-
const { RefineDocumentsChain } = await import("./combine_docs_chain-
|
|
49829
|
+
const { RefineDocumentsChain } = await import("./combine_docs_chain-CeeUc79G.js");
|
|
49454
49830
|
return RefineDocumentsChain.deserialize(data);
|
|
49455
49831
|
}
|
|
49456
49832
|
case "vector_db_qa": {
|
|
49457
|
-
const { VectorDBQAChain } = await import("./vector_db_qa-
|
|
49833
|
+
const { VectorDBQAChain } = await import("./vector_db_qa-DdeBuCEV.js");
|
|
49458
49834
|
return VectorDBQAChain.deserialize(data, values);
|
|
49459
49835
|
}
|
|
49460
49836
|
case "api_chain": {
|
|
49461
|
-
const { APIChain } = await import("./api_chain-
|
|
49837
|
+
const { APIChain } = await import("./api_chain-DxPDMwtJ.js");
|
|
49462
49838
|
return APIChain.deserialize(data);
|
|
49463
49839
|
}
|
|
49464
49840
|
default:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as svg, D as html, E as webNamespaces, F as s, G as h, I as find, J as ok, V as VFile, K as VFileMessage } from "./index-
|
|
1
|
+
import { A as svg, D as html, E as webNamespaces, F as s, G as h, I as find, J as ok, V as VFile, K as VFileMessage } from "./index-BXlSzDec.js";
|
|
2
2
|
function location(file) {
|
|
3
3
|
const value = String(file);
|
|
4
4
|
const indices = [];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-
|
|
1
|
+
import { w as whitespace, A as svg, I as find, L as stringify, M as stringify$1, N as ccount, D as html$2 } from "./index-BXlSzDec.js";
|
|
2
2
|
import { z as zwitch } from "./index-BEZf1ZPW.js";
|
|
3
3
|
const htmlVoidElements = [
|
|
4
4
|
"area",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-D2MqA5Ot.cjs");exports.default=e.remarkGfm;
|