refactor(frontend): 前端重构 V3

This commit is contained in:
sophie committed 2026-06-14 21:41:07 +08:00
1 parent 8d8b40812d
commit ec97ea8787
80 files changed
+6887 -3733

No files matched your search

+406
View File
@@ -0,0 +1,406 @@
/**
* scripts/merge-kb-runtime-i18n.mjs
* 合并 kbWorkspace 运行时文案(status / workflow / errors / msg)至各语言 kb.json
*/
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const localesRoot = path.resolve(__dirname, '../src/locales');
const patches = {
en: {
status: {
draft: 'Pending upload',
uploaded: 'Uploaded',
processing: 'Cleaning',
cleaned: 'Cleaned',
ready: 'Ready',
synced: 'Synced',
syncing: 'Syncing',
failed: 'Failed',
queued: 'Queued',
running: 'Running',
success: 'Success',
cancelled: 'Cancelled',
idle: 'Not started',
done: 'Completed',
pendingClean: 'Pending clean',
pendingSync: 'Pending sync',
cleaning: 'Cleaning',
uploading: 'Uploading',
unknown: 'Unknown status',
unnamedDocument: 'Untitled document',
},
workflow: { upload: 'Upload', clean: 'Clean', sync: 'Sync' },
failureModal: {
uploadData: 'Upload failures',
cleanData: 'Clean failures',
syncData: 'Sync failures',
generic: 'Failure data',
stageUploadFailed: 'Upload failed',
stageCleanFailed: 'Clean failed',
stageSyncFailed: 'Sync failed',
},
errors: {
unreadableClean: 'Historical failure reason is unreadable. Click "Clean data" to retry.',
unreadableSync: 'Historical sync failure is unreadable. Please retry sync.',
unreadableUpload: 'Historical upload failure is unreadable. Please re-upload.',
legacyCleanRecovered: 'Legacy clean task was recovered manually. Click "Clean data" to retry.',
sourceFileNotFound: 'Source file not found. Re-upload before cleaning.',
cleanTimeout: 'Clean timed out. Retry later or check if the source file is corrupted.',
duplicateFile: 'Upload failed: file already exists.',
apiRequestFailed: 'Knowledge base API request failed.',
localFolder: 'Local folder',
fileFallback: 'File {index}',
uploadFailed: 'Upload failed',
},
msg: {
operationFailed: 'Operation failed',
loadGroupsFailed: 'Failed to load groups',
loadDocumentsFailed: 'Failed to load documents',
loadJobsFailed: 'Failed to load jobs',
readSourceFailed: 'Failed to read source file',
noVersion: 'No version',
readMarkdownFailed: 'Failed to read cleaned Markdown',
saveMarkdownFailed: 'Failed to save Markdown',
markdownSaved: 'Cleaned Markdown saved',
deleteDocumentFailed: 'Failed to delete document',
documentDeleted: 'Document deleted',
selectDocumentsToSync: 'Please select documents to sync',
batchSyncResult: 'Batch sync submitted: {success} succeeded, {fail} failed. {detail}',
batchSyncSuccess: 'Batch sync submitted: {success} succeeded',
selectDocumentsToClean: 'Please select documents to clean',
noDocumentsToClean: 'No selected documents can be cleaned',
batchCleanResult: 'Batch clean submitted: {success} succeeded, {fail} failed. {detail}',
batchCleanSuccess: 'Batch clean submitted: {success} succeeded',
selectDocumentsToDelete: 'Please select documents to delete',
batchDeleteResult: 'Batch delete completed: {success} succeeded, {fail} failed. {detail}',
batchDeleteSuccess: 'Batch delete completed: {success} succeeded',
reselectFile: 'Please re-select a file for "{name}"',
recleanFailed: 'Re-clean failed',
recleanSubmitted: 'Re-clean submitted: {name}',
resyncFailed: 'Re-sync failed: {detail}',
resyncSubmitted: 'Re-sync submitted: {name}',
processingFile: 'Processing file...',
uploadFailed: 'File upload failed',
versionUploaded: 'Version "{file}" uploaded, clean queued',
uploadingProgress: 'Uploading {current}/{total}: {file}',
createDocumentFailed: 'Failed to create document',
uploadVersionFailed: 'Failed to upload version',
uploadCleanupFailed: 'Upload failed and empty document could not be removed ({detail})',
uploadSummary: 'Upload done: {success} succeeded, {fail} failed. {detail}',
uploadAllSuccess: 'Uploaded {count} file(s), clean tasks queued',
syncDifyFailed: 'Sync to Dify failed: {detail}',
syncDifyFailedGeneric: 'Sync to Dify failed',
syncSubmitted: 'Sync task submitted',
pathUploadBusy: 'Upload in progress, please wait',
selectGroupFirst: 'Please select a group first',
selectPathFiles: 'Please select at least one local folder or file',
createPathJobFailed: 'Failed to create path upload job',
pathStageFailed: 'Path file staging failed',
pathUploadDone: 'Path files uploaded and clean submitted',
deletePathFileConfirm: 'Delete path file "{path}"?',
deletePathFileFailed: 'Failed to delete path file',
pathRecordDeletedWithDoc: 'Path record deleted with document',
pathRecordDeleted: 'Path record deleted',
selectPathFilesToDelete: 'Please select files to delete',
batchDeletePathConfirm: 'Delete {count} selected path file(s)?',
batchDeletePathResult: 'Batch delete: {success} succeeded, {fail} failed. {detail}',
batchDeletePathSuccess: 'Batch delete: {success} succeeded',
retryPathFailed: 'Failed to retry files',
retryPathOne: 'Failed file resubmitted',
retryPathAll: 'Failed files resubmitted',
pathUploadProgress: 'Path upload: total {total}, pending {pending}, uploaded {uploaded}, failed {failed}',
deleteDocumentConfirm: 'Delete document "{name}"?',
batchDeleteDocumentsConfirm: 'Delete {count} selected document(s)? Dify documents will also be removed.',
markdownFailedWithReason: 'Clean failed, no Markdown yet. Reason: {reason}',
markdownFailedRetry: 'Clean failed, no Markdown yet. Please re-clean.',
markdownProcessing: 'Document is being cleaned, no Markdown yet.',
markdownPendingClean: 'Document pending clean, no Markdown yet.',
markdownNotGenerated: 'No Markdown generated for this document yet.',
},
},
'zh-CN': {
status: {
draft: '待上传', uploaded: '已上传', processing: '清洗中', cleaned: '已清洗', ready: '已就绪',
synced: '已同步', syncing: '同步中', failed: '失败', queued: '排队中', running: '进行中',
success: '成功', cancelled: '已取消', idle: '未开始', done: '已完成', pendingClean: '待清洗',
pendingSync: '待同步', cleaning: '清洗中', uploading: '上传中', unknown: '未知状态', unnamedDocument: '未命名文档',
},
workflow: { upload: '上传', clean: '清洗', sync: '同步' },
failureModal: {
uploadData: '上传失败数据', cleanData: '清洗失败数据', syncData: '同步失败数据', generic: '失败数据',
stageUploadFailed: '上传失败', stageCleanFailed: '清洗失败', stageSyncFailed: '同步失败',
},
errors: {
unreadableClean: '历史失败任务原因不可读,请重新点击“清洗数据”发起清洗',
unreadableSync: '历史同步失败原因不可读,请重新发起同步',
unreadableUpload: '历史上传失败原因不可读,请重新上传文件',
legacyCleanRecovered: '历史遗留清洗任务已人工回收,请重新点击“清洗数据”发起清洗',
sourceFileNotFound: '原始文件不存在,请重新上传后再清洗',
cleanTimeout: '文件清洗超时,请稍后重试;若多次失败,请检查源文件是否损坏',
duplicateFile: '上传失败,文件已存在',
apiRequestFailed: '知识库接口请求失败',
localFolder: '本地目录',
fileFallback: '文件{index}',
uploadFailed: '上传失败',
},
msg: {
operationFailed: '操作失败',
loadGroupsFailed: '加载知识库分组失败',
loadDocumentsFailed: '加载文档列表失败',
loadJobsFailed: '加载任务列表失败',
readSourceFailed: '读取原始文件失败',
noVersion: '暂无版本',
readMarkdownFailed: '读取清洗后的 Markdown 失败',
saveMarkdownFailed: '保存 Markdown 失败',
markdownSaved: '清洗后的 Markdown 已保存',
deleteDocumentFailed: '删除文档失败',
documentDeleted: '文档已删除',
selectDocumentsToSync: '请先选择要批量同步的文档',
batchSyncResult: '批量同步任务已提交:成功 {success} 条,失败 {fail} 条。{detail}',
batchSyncSuccess: '批量同步任务已提交:共成功 {success} 条',
selectDocumentsToClean: '请先选择要清洗的文档',
noDocumentsToClean: '当前所选文档没有可重新清洗的项',
batchCleanResult: '批量清洗任务已提交:成功 {success} 条,失败 {fail} 条。{detail}',
batchCleanSuccess: '批量清洗任务已提交:共成功 {success} 条',
selectDocumentsToDelete: '请先选择要批量删除的文档',
batchDeleteResult: '批量删除完成:成功 {success} 条,失败 {fail} 条。{detail}',
batchDeleteSuccess: '批量删除完成:共成功 {success} 条',
reselectFile: '请重新为「{name}」选择文件后提交',
recleanFailed: '重新清洗失败',
recleanSubmitted: '已重新提交清洗:{name}',
resyncFailed: '重新同步失败:{detail}',
resyncSubmitted: '已重新提交同步:{name}',
processingFile: '开始处理文件...',
uploadFailed: '文件上传失败',
versionUploaded: '版本文件「{file}」上传成功,清洗已排队',
uploadingProgress: '正在上传 {current}/{total}: {file}',
createDocumentFailed: '创建文档失败',
uploadVersionFailed: '上传文档版本失败',
uploadCleanupFailed: '上传失败后未能自动清理空文档({detail})',
uploadSummary: '上传完成:成功 {success} 个,失败 {fail} 个。{detail}',
uploadAllSuccess: '成功上传 {count} 个文件,清洗任务已排队',
syncDifyFailed: '同步到 Dify 失败:{detail}',
syncDifyFailedGeneric: '同步到 Dify 失败',
syncSubmitted: '同步任务已提交,等待后台处理',
pathUploadBusy: '有文件正在上传请稍等再试~',
selectGroupFirst: '请先选择知识库分组',
selectPathFiles: '请先选择至少一个本地目录或文件',
createPathJobFailed: '创建上传路径任务失败',
pathStageFailed: '路径文件暂存失败',
pathUploadDone: '路径文件已逐个上传并提交清洗',
deletePathFileConfirm: '确认删除路径文件「{path}」吗?',
deletePathFileFailed: '删除路径上传文件失败',
pathRecordDeletedWithDoc: '已删除路径记录,并同步删除对应文档',
pathRecordDeleted: '已删除路径记录',
selectPathFilesToDelete: '请先选择要删除的文件',
batchDeletePathConfirm: '确认批量删除已选中的 {count} 条路径文件吗?',
batchDeletePathResult: '批量删除完成:成功 {success} 条,失败 {fail} 条。{detail}',
batchDeletePathSuccess: '批量删除完成:共成功 {success} 条',
retryPathFailed: '重试失败文件失败',
retryPathOne: '已重新提交该失败文件',
retryPathAll: '已重新提交失败文件',
pathUploadProgress: '路径上传进度:总计 {total} 条,待上传 {pending} 条,已上传 {uploaded} 条,失败 {failed} 条',
deleteDocumentConfirm: '确认删除文档「{name}」吗?',
batchDeleteDocumentsConfirm: '确认批量删除已选中的 {count} 条文档吗?会同步删除 Dify 对应文档。',
markdownFailedWithReason: '当前文档清洗失败,尚未生成 Markdown。失败原因:{reason}',
markdownFailedRetry: '当前文档清洗失败,尚未生成 Markdown,请重新清洗后重试',
markdownProcessing: '当前文档正在清洗中,暂未生成 Markdown,请稍后再试',
markdownPendingClean: '当前文档待清洗,暂未生成 Markdown,请先发起清洗',
markdownNotGenerated: '当前文档尚未生成 Markdown',
},
},
'zh-TW': {
status: {
draft: '待上傳', uploaded: '已上傳', processing: '清洗中', cleaned: '已清洗', ready: '已就緒',
synced: '已同步', syncing: '同步中', failed: '失敗', queued: '排隊中', running: '進行中',
success: '成功', cancelled: '已取消', idle: '未開始', done: '已完成', pendingClean: '待清洗',
pendingSync: '待同步', cleaning: '清洗中', uploading: '上傳中', unknown: '未知狀態', unnamedDocument: '未命名文檔',
},
workflow: { upload: '上傳', clean: '清洗', sync: '同步' },
failureModal: {
uploadData: '上傳失敗數據', cleanData: '清洗失敗數據', syncData: '同步失敗數據', generic: '失敗數據',
stageUploadFailed: '上傳失敗', stageCleanFailed: '清洗失敗', stageSyncFailed: '同步失敗',
},
errors: {
unreadableClean: '歷史失敗任務原因不可讀,請重新點擊「清洗數據」發起清洗',
unreadableSync: '歷史同步失敗原因不可讀,請重新發起同步',
unreadableUpload: '歷史上傳失敗原因不可讀,請重新上傳文件',
legacyCleanRecovered: '歷史遺留清洗任務已人工回收,請重新點擊「清洗數據」發起清洗',
sourceFileNotFound: '原始文件不存在,請重新上傳後再清洗',
cleanTimeout: '文件清洗超時,請稍後重試;若多次失敗,請檢查源文件是否損壞',
duplicateFile: '上傳失敗,文件已存在',
apiRequestFailed: '知識庫接口請求失敗',
localFolder: '本地目錄',
fileFallback: '文件{index}',
uploadFailed: '上傳失敗',
},
msg: {
operationFailed: '操作失敗',
loadGroupsFailed: '載入知識庫分組失敗',
loadDocumentsFailed: '載入文檔列表失敗',
loadJobsFailed: '載入任務列表失敗',
readSourceFailed: '讀取原始文件失敗',
noVersion: '暫無版本',
readMarkdownFailed: '讀取清洗後的 Markdown 失敗',
saveMarkdownFailed: '保存 Markdown 失敗',
markdownSaved: '清洗後的 Markdown 已保存',
deleteDocumentFailed: '刪除文檔失敗',
documentDeleted: '文檔已刪除',
selectDocumentsToSync: '請先選擇要批量同步的文檔',
batchSyncResult: '批量同步任務已提交:成功 {success} 條,失敗 {fail} 條。{detail}',
batchSyncSuccess: '批量同步任務已提交:共成功 {success} 條',
selectDocumentsToClean: '請先選擇要清洗的文檔',
noDocumentsToClean: '當前所選文檔沒有可重新清洗的項',
batchCleanResult: '批量清洗任務已提交:成功 {success} 條,失敗 {fail} 條。{detail}',
batchCleanSuccess: '批量清洗任務已提交:共成功 {success} 條',
selectDocumentsToDelete: '請先選擇要批量刪除的文檔',
batchDeleteResult: '批量刪除完成:成功 {success} 條,失敗 {fail} 條。{detail}',
batchDeleteSuccess: '批量刪除完成:共成功 {success} 條',
reselectFile: '請重新為「{name}」選擇文件後提交',
recleanFailed: '重新清洗失敗',
recleanSubmitted: '已重新提交清洗:{name}',
resyncFailed: '重新同步失敗:{detail}',
resyncSubmitted: '已重新提交同步:{name}',
processingFile: '開始處理文件...',
uploadFailed: '文件上傳失敗',
versionUploaded: '版本文件「{file}」上傳成功,清洗已排隊',
uploadingProgress: '正在上傳 {current}/{total}: {file}',
createDocumentFailed: '創建文檔失敗',
uploadVersionFailed: '上傳文檔版本失敗',
uploadCleanupFailed: '上傳失敗後未能自動清理空文檔({detail})',
uploadSummary: '上傳完成:成功 {success} 個,失敗 {fail} 個。{detail}',
uploadAllSuccess: '成功上傳 {count} 個文件,清洗任務已排隊',
syncDifyFailed: '同步到 Dify 失敗:{detail}',
syncDifyFailedGeneric: '同步到 Dify 失敗',
syncSubmitted: '同步任務已提交,等待後台處理',
pathUploadBusy: '有文件正在上傳請稍等再試~',
selectGroupFirst: '請先選擇知識庫分組',
selectPathFiles: '請先選擇至少一個本地目錄或文件',
createPathJobFailed: '創建上傳路徑任務失敗',
pathStageFailed: '路徑文件暫存失敗',
pathUploadDone: '路徑文件已逐個上傳並提交清洗',
deletePathFileConfirm: '確認刪除路徑文件「{path}」嗎?',
deletePathFileFailed: '刪除路徑上傳文件失敗',
pathRecordDeletedWithDoc: '已刪除路徑記錄,並同步刪除對應文檔',
pathRecordDeleted: '已刪除路徑記錄',
selectPathFilesToDelete: '請先選擇要刪除的文件',
batchDeletePathConfirm: '確認批量刪除已選中的 {count} 條路徑文件嗎?',
batchDeletePathResult: '批量刪除完成:成功 {success} 條,失敗 {fail} 條。{detail}',
batchDeletePathSuccess: '批量刪除完成:共成功 {success} 條',
retryPathFailed: '重試失敗文件失敗',
retryPathOne: '已重新提交該失敗文件',
retryPathAll: '已重新提交失敗文件',
pathUploadProgress: '路徑上傳進度:總計 {total} 條,待上傳 {pending} 條,已上傳 {uploaded} 條,失敗 {failed} 條',
deleteDocumentConfirm: '確認刪除文檔「{name}」嗎?',
batchDeleteDocumentsConfirm: '確認批量刪除已選中的 {count} 條文檔嗎?會同步刪除 Dify 對應文檔。',
markdownFailedWithReason: '當前文檔清洗失敗,尚未生成 Markdown。失敗原因:{reason}',
markdownFailedRetry: '當前文檔清洗失敗,尚未生成 Markdown,請重新清洗後重試',
markdownProcessing: '當前文檔正在清洗中,暫未生成 Markdown,請稍後再試',
markdownPendingClean: '當前文檔待清洗,暫未生成 Markdown,請先發起清洗',
markdownNotGenerated: '當前文檔尚未生成 Markdown',
},
},
th: {
status: {
draft: 'รออัปโหลด', uploaded: 'อัปโหลดแล้ว', processing: 'กำลังทำความสะอาด', cleaned: 'ทำความสะอาดแล้ว', ready: 'พร้อม',
synced: 'ซิงค์แล้ว', syncing: 'กำลังซิงค์', failed: 'ล้มเหลว', queued: 'อยู่ในคิว', running: 'กำลังดำเนินการ',
success: 'สำเร็จ', cancelled: 'ยกเลิกแล้ว', idle: 'ยังไม่เริ่ม', done: 'เสร็จสิ้น', pendingClean: 'รอทำความสะอาด',
pendingSync: 'รอซิงค์', cleaning: 'กำลังทำความสะอาด', uploading: 'กำลังอัปโหลด', unknown: 'สถานะไม่ทราบ', unnamedDocument: 'เอกสารไม่มีชื่อ',
},
workflow: { upload: 'อัปโหลด', clean: 'ทำความสะอาด', sync: 'ซิงค์' },
failureModal: {
uploadData: 'ข้อมูลอัปโหลดล้มเหลว', cleanData: 'ข้อมูลทำความสะอาดล้มเหลว', syncData: 'ข้อมูลซิงค์ล้มเหลว', generic: 'ข้อมูลล้มเหลว',
stageUploadFailed: 'อัปโหลดล้มเหลว', stageCleanFailed: 'ทำความสะอาดล้มเหลว', stageSyncFailed: 'ซิงค์ล้มเหลว',
},
errors: {
unreadableClean: 'ไม่สามารถอ่านสาเหตุความล้มเหลวในอดีตได้ กด "ทำความสะอาดข้อมูล" เพื่อลองใหม่',
unreadableSync: 'ไม่สามารถอ่านสาเหตุซิงค์ล้มเหลวในอดีตได้ โปรดซิงค์ใหม่',
unreadableUpload: 'ไม่สามารถอ่านสาเหตุอัปโหลดล้มเหลวในอดีตได้ โปรดอัปโหลดใหม่',
legacyCleanRecovered: 'งานทำความสะอาดเก่าถูกกู้คืนด้วยตนเอง กด "ทำความสะอาดข้อมูล" เพื่อลองใหม่',
sourceFileNotFound: 'ไม่พบไฟล์ต้นฉบับ โปรดอัปโหลดใหม่ก่อนทำความสะอาด',
cleanTimeout: 'ทำความสะอาดหมดเวลา ลองใหม่ภายหลังหรือตรวจสอบไฟล์ต้นฉบับ',
duplicateFile: 'อัปโหลดล้มเหลว: มีไฟล์นี้อยู่แล้ว',
apiRequestFailed: 'คำขอ API คลังความรู้ล้มเหลว',
localFolder: 'โฟลเดอร์ในเครื่อง',
fileFallback: 'ไฟล์ {index}',
uploadFailed: 'อัปโหลดล้มเหลว',
},
msg: {
operationFailed: 'ดำเนินการล้มเหลว',
loadGroupsFailed: 'โหลดกลุ่มล้มเหลว',
loadDocumentsFailed: 'โหลดเอกสารล้มเหลว',
loadJobsFailed: 'โหลดงานล้มเหลว',
readSourceFailed: 'อ่านไฟล์ต้นฉบับล้มเหลว',
noVersion: 'ไม่มีเวอร์ชัน',
readMarkdownFailed: 'อ่าน Markdown ที่ทำความสะอาดแล้วล้มเหลว',
saveMarkdownFailed: 'บันทึก Markdown ล้มเหลว',
markdownSaved: 'บันทึก Markdown ที่ทำความสะอาดแล้ว',
deleteDocumentFailed: 'ลบเอกสารล้มเหลว',
documentDeleted: 'ลบเอกสารแล้ว',
selectDocumentsToSync: 'โปรดเลือกเอกสารที่จะซิงค์เป็นชุด',
batchSyncResult: 'ส่งซิงค์เป็นชุด: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchSyncSuccess: 'ส่งซิงค์เป็นชุด: สำเร็จ {success}',
selectDocumentsToClean: 'โปรดเลือกเอกสารที่จะทำความสะอาด',
noDocumentsToClean: 'เอกสารที่เลือกไม่มีรายการที่ทำความสะอาดได้',
batchCleanResult: 'ส่งทำความสะอาดเป็นชุด: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchCleanSuccess: 'ส่งทำความสะอาดเป็นชุด: สำเร็จ {success}',
selectDocumentsToDelete: 'โปรดเลือกเอกสารที่จะลบเป็นชุด',
batchDeleteResult: 'ลบเป็นชุดเสร็จ: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchDeleteSuccess: 'ลบเป็นชุดเสร็จ: สำเร็จ {success}',
reselectFile: 'โปรดเลือกไฟล์ใหม่สำหรับ "{name}"',
recleanFailed: 'ทำความสะอาดใหม่ล้มเหลว',
recleanSubmitted: 'ส่งทำความสะอาดใหม่: {name}',
resyncFailed: 'ซิงค์ใหม่ล้มเหลว: {detail}',
resyncSubmitted: 'ส่งซิงค์ใหม่: {name}',
processingFile: 'เริ่มประมวลผลไฟล์...',
uploadFailed: 'อัปโหลดไฟล์ล้มเหลว',
versionUploaded: 'อัปโหลดเวอร์ชัน "{file}" แล้ว งานทำความสะอาดอยู่ในคิว',
uploadingProgress: 'กำลังอัปโหลด {current}/{total}: {file}',
createDocumentFailed: 'สร้างเอกสารล้มเหลว',
uploadVersionFailed: 'อัปโหลดเวอร์ชันเอกสารล้มเหลว',
uploadCleanupFailed: 'อัปโหลดล้มเหลวและลบเอกสารว่างไม่ได้ ({detail})',
uploadSummary: 'อัปโหลดเสร็จ: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
uploadAllSuccess: 'อัปโหลด {count} ไฟล์สำเร็จ งานทำความสะอาดอยู่ในคิว',
syncDifyFailed: 'ซิงค์ไป Dify ล้มเหลว: {detail}',
syncDifyFailedGeneric: 'ซิงค์ไป Dify ล้มเหลว',
syncSubmitted: 'ส่งงานซิงค์แล้ว',
pathUploadBusy: 'กำลังอัปโหลด โปรดรอสักครู่',
selectGroupFirst: 'โปรดเลือกกลุ่มก่อน',
selectPathFiles: 'โปรดเลือกโฟลเดอร์หรือไฟล์ในเครื่องอย่างน้อยหนึ่งรายการ',
createPathJobFailed: 'สร้างงานอัปโหลด path ล้มเหลว',
pathStageFailed: 'จัดเก็บไฟล์ path ชั่วคราวล้มเหลว',
pathUploadDone: 'อัปโหลดไฟล์ path และส่งทำความสะอาดแล้ว',
deletePathFileConfirm: 'ลบไฟล์ path "{path}"?',
deletePathFileFailed: 'ลบไฟล์ path ล้มเหลว',
pathRecordDeletedWithDoc: 'ลบบันทึก path และเอกสารที่เกี่ยวข้องแล้ว',
pathRecordDeleted: 'ลบบันทึก path แล้ว',
selectPathFilesToDelete: 'โปรดเลือกไฟล์ที่จะลบ',
batchDeletePathConfirm: 'ลบไฟล์ path ที่เลือก {count} รายการ?',
batchDeletePathResult: 'ลบเป็นชุด: สำเร็จ {success}, ล้มเหลว {fail}. {detail}',
batchDeletePathSuccess: 'ลบเป็นชุด: สำเร็จ {success}',
retryPathFailed: 'ลองใหม่ไฟล์ล้มเหลวไม่สำเร็จ',
retryPathOne: 'ส่งไฟล์ที่ล้มเหลวใหม่แล้ว',
retryPathAll: 'ส่งไฟล์ล้มเหลวทั้งหมดใหม่แล้ว',
pathUploadProgress: 'อัปโหลด path: ทั้งหมด {total}, รอ {pending}, อัปโหลด {uploaded}, ล้มเหลว {failed}',
deleteDocumentConfirm: 'ลบเอกสาร "{name}"?',
batchDeleteDocumentsConfirm: 'ลบเอกสารที่เลือก {count} รายการ? จะลบใน Dify ด้วย',
markdownFailedWithReason: 'ทำความสะอาดล้มเหลว ยังไม่มี Markdown. สาเหตุ: {reason}',
markdownFailedRetry: 'ทำความสะอาดล้มเหลว ยังไม่มี Markdown โปรดทำความสะอาดใหม่',
markdownProcessing: 'กำลังทำความสะอาด ยังไม่มี Markdown',
markdownPendingClean: 'รอทำความสะอาด ยังไม่มี Markdown',
markdownNotGenerated: 'ยังไม่มี Markdown สำหรับเอกสารนี้',
},
},
};
for (const [locale, patch] of Object.entries(patches)) {
const filePath = path.join(localesRoot, locale, 'kb.json');
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
data.kbWorkspace = { ...data.kbWorkspace, ...patch };
fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
console.log(`Merged runtime i18n into ${locale}/kb.json`);
}
@@ -0,0 +1,629 @@
/**
* scripts/merge-kb-workspace-i18n.mjs
* 合并 kbWorkspace 作业面 i18n 键至各语言 locales 下 kb.json
*/
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const localesRoot = path.resolve(__dirname, '../src/locales');
const patches = {
en: {
sidebar: {
groupsTitle: 'Groups',
loadingGroups: 'Loading groups...',
emptyGroups: 'No knowledge base groups yet.',
noDescription: 'No description',
},
summary: {
currentGroup: 'Current group',
documentCount: 'Documents',
pendingSync: 'Pending sync',
uploadFailed: 'Upload failures',
cleanFailed: 'Clean failures',
syncFailed: 'Sync failures',
},
filters: { all: 'All', upload: 'Upload', clean: 'Clean', sync: 'Sync' },
common: {
processing: 'Processing...',
delete: 'Delete',
close: 'Close',
cancel: 'Cancel',
retry: 'Retry',
remove: 'Remove',
none: 'None',
countUnit: 'items',
failureReason: 'Reason: {reason}',
perPage: 'Per page',
prevPage: 'Previous',
nextPage: 'Next',
},
documents: {
title: 'Documents',
infoTip: 'Basic document entries in this group. Uploading files creates documents and starts cleaning automatically.',
uploadPath: 'Upload path',
uploadFile: 'Upload file',
batchClean: 'Clean data',
batchCleanCount: 'Clean data ({count})',
batchSync: 'Batch sync',
batchSyncCount: 'Batch sync ({count})',
batchDelete: 'Batch delete',
batchDeleteCount: 'Batch delete ({count})',
historyBatches: 'History batches',
searchPlaceholder: 'Search by file name',
clearSearch: 'Clear search',
selectGroup: 'Please select a knowledge base group.',
loadingDocuments: 'Loading documents...',
emptyNoDocs: 'No documents in this group. Upload a file above to create the first record.',
emptyNoSearchMatch: 'No documents match the current search and filters.',
emptyNoFilterMatch: 'No documents match the current filters.',
versionCount: 'Versions: {count}',
currentVersion: 'Current: v{version}',
viewRecord: 'View history',
uploadVersion: 'Upload version',
syncDify: 'Sync to Dify',
syncingDify: 'Syncing...',
updatedAt: 'Updated: {time}',
selectedCount: 'Selected {selected} · Total {total}',
showingRange: 'Showing {start}-{end}',
pageInfo: 'Page {page} / {totalPages} · {total} items',
documentFallback: 'Document #{id}',
},
pathUpload: {
progressTitle: 'Path upload progress',
uploading: 'Uploading',
completed: 'Completed',
batchHint: 'Recommended {batchSize} files per batch, auto-continue every {seconds}s.',
total: 'Total {count}',
pending: 'Pending {count}',
uploaded: 'Uploaded {count}',
failed: 'Failed {count}',
success: 'Success {count}',
pendingProcess: 'Pending {count}',
currentFile: 'Current file: {name}',
details: 'Upload details',
viewHistory: 'View history',
retryFailedFiles: 'Retry failed files',
retryAllFailed: 'Retry all failed files',
selectAllFiltered: 'Select all filtered',
deselectAllFiltered: 'Deselect all',
selectAll: 'Select all',
deselectAll: 'Deselect all',
batchLabel: 'Batch #{id}',
createdAt: 'Created: {time}',
finishedAt: ' · Finished: {time}',
noBatchMessage: 'No batch description',
batchDelete: 'Batch delete',
batchDeleteCount: 'Batch delete ({count})',
deleting: 'Deleting...',
emptyHistory: 'No path upload history yet.',
},
recordModal: {
title: 'Document history',
viewing: 'Viewing: {name}',
loading: 'Loading document history...',
versionsTitle: 'Versions',
versionsCount: '{count} items',
versionsEmpty: 'No versions yet. Upload a version to see it here.',
syncTitle: 'Dify sync records',
syncEmpty: 'No Dify sync records. Click "Sync to Dify" to create one.',
versionLabel: 'Version: {id}',
sizeBytes: 'Size: {size} bytes',
},
markdownModal: {
readingVersion: 'Loading current version...',
previewText: 'Preview text',
cleanMarkdown: 'Cleaned Markdown',
loading: 'Loading cleaned Markdown...',
placeholder: 'No Markdown yet. Paste or edit content here.',
saving: 'Saving...',
save: 'Save Markdown',
editorTitle: 'Markdown editor',
},
sourceInfoModal: {
title: 'Source file info',
viewing: 'Viewing: {name}',
loading: 'Loading source file info...',
empty: 'No source file info. Upload a version to see it here.',
currentVersion: 'Current version',
opening: 'Opening...',
fileName: 'File: {name}',
fileSize: 'Size: {size}',
fileType: 'Type: {ext}',
},
failureModal: {
summary: '{count} failure records in this group, {pageSize} per page.',
empty: 'No failure data.',
currentVersion: 'Current version:',
noVersion: 'No version',
resubmit: 'Resubmit',
reclean: 'Re-clean',
resync: 'Re-sync',
pageInfo: 'Page {page} / {totalPages}',
},
pathUploadModal: {
title: 'Upload path',
subtitle: 'Select a local folder. Files are imported in batches and enter the cleaning workflow automatically.',
localPickerTitle: 'Local folder picker',
localPickerHint: 'You can add folders multiple times. Browsers cannot read arbitrary pasted paths.',
pickFolder: 'Select local folder',
pathListLabel: 'Path list',
pathListPlaceholder: 'Paths fill in after folder selection; paste notes for multiple paths if needed.',
pendingFiles: 'Pending files',
selectedRoots: 'Selected roots: {paths}',
noRoots: 'None',
pickFolderFirst: 'Select a local folder before confirming upload.',
confirmUpload: 'Confirm upload',
},
pathUploadHistoryModal: {
title: 'Path upload history',
subtitle: 'View batch results, failed files, and retry options.',
},
},
'zh-CN': {
sidebar: {
groupsTitle: '分组列表',
loadingGroups: '正在加载分组...',
emptyGroups: '暂无知识库分组。',
noDescription: '暂无描述',
},
summary: {
currentGroup: '当前知识库分组',
documentCount: '文档数量',
pendingSync: '待同步数量',
uploadFailed: '上传失败数量',
cleanFailed: '清洗失败数量',
syncFailed: '同步失败数量',
},
filters: { all: '全部', upload: '上传', clean: '清洗', sync: '同步' },
common: {
processing: '处理中...',
delete: '删除',
close: '关闭',
cancel: '取消',
retry: '重试',
remove: '移除',
none: '暂无',
countUnit: '条',
failureReason: '失败原因:{reason}',
perPage: '每页',
prevPage: '上一页',
nextPage: '下一页',
},
documents: {
title: '文档列表',
infoTip: '当前分组下的基础文档条目,上传文件后将自动创建文档并开始清洗流程。',
uploadPath: '上传路径',
uploadFile: '上传文件',
batchClean: '清洗数据',
batchCleanCount: '清洗数据({count})',
batchSync: '批量同步',
batchSyncCount: '批量同步({count})',
batchDelete: '批量删除',
batchDeleteCount: '批量删除({count})',
historyBatches: '历史批次',
searchPlaceholder: '按文件名称模糊搜索',
clearSearch: '清空搜索',
selectGroup: '请选择一个知识库分组。',
loadingDocuments: '正在加载文档...',
emptyNoDocs: '当前分组暂无文档,可直接在上方创建第一条文档记录。',
emptyNoSearchMatch: '当前搜索和筛选条件下暂无匹配文档。',
emptyNoFilterMatch: '当前筛选条件下暂无匹配文档。',
versionCount: '版本数:{count}',
currentVersion: ' · 当前版本:v{version} · ',
viewRecord: '查看记录',
uploadVersion: '上传版本',
syncDify: '同步 Dify',
syncingDify: '同步中...',
updatedAt: '更新时间:{time}',
selectedCount: '已选 {selected} 条 · 共 {total} 条',
showingRange: '当前显示 {start}-{end} 条',
pageInfo: '第 {page} / {totalPages} 页 · 共 {total} 条',
documentFallback: '文档 #{id}',
},
pathUpload: {
progressTitle: '路径上传进度',
uploading: '上传中',
completed: '已完成',
batchHint: '建议每批 {batchSize} 条,间隔 {seconds} 秒自动继续。',
total: '总计 {count}',
pending: '待上传 {count}',
uploaded: '已上传 {count}',
failed: '失败 {count}',
success: '成功 {count}',
pendingProcess: '待处理 {count}',
currentFile: '当前文件:{name}',
details: '上传详情',
viewHistory: '查看历史',
retryFailedFiles: '重试失败文件',
retryAllFailed: '重试全部失败文件',
selectAllFiltered: '全选当前筛选',
deselectAllFiltered: '取消全选',
selectAll: '全选',
deselectAll: '取消全选',
batchLabel: '批次 #{id}',
createdAt: '创建时间:{time}',
finishedAt: ' · 完成时间:{time}',
noBatchMessage: '暂无批次说明',
batchDelete: '批量删除',
batchDeleteCount: '批量删除 ({count})',
deleting: '删除中...',
emptyHistory: '当前暂无上传路径历史批次。',
},
recordModal: {
title: '文档记录',
viewing: '当前查看:{name}',
loading: '正在加载文档记录...',
versionsTitle: '版本记录',
versionsCount: '{count} 条',
versionsEmpty: '暂无版本记录,上传版本后会显示在这里。',
syncTitle: 'Dify 同步记录',
syncEmpty: '暂无 Dify 同步记录,手动点击“同步 Dify”后会显示在这里。',
versionLabel: '版本:{id}',
sizeBytes: '大小:{size} bytes',
},
markdownModal: {
readingVersion: '正在读取当前版本...',
previewText: '预览文本',
cleanMarkdown: '清洗 Markdown',
loading: '正在加载清洗后的 Markdown...',
placeholder: '当前文档尚未生成 Markdown,可在此粘贴或编辑内容。',
saving: '保存中...',
save: '保存 Markdown',
editorTitle: 'Markdown 编辑器',
},
sourceInfoModal: {
title: '源文件信息',
viewing: '当前查看:{name}',
loading: '正在加载源文件信息...',
empty: '暂无源文件信息,上传版本后会显示在这里。',
currentVersion: '当前版本',
opening: '正在打开...',
fileName: '文件名:{name}',
fileSize: '大小:{size}',
fileType: '类型:{ext}',
},
failureModal: {
summary: '当前分组共 {count} 条失败记录,每页 {pageSize} 条。',
empty: '当前没有失败数据。',
currentVersion: '当前版本:',
noVersion: '暂无版本',
resubmit: '重新提交',
reclean: '重新清洗',
resync: '重新同步',
pageInfo: '第 {page} / {totalPages} 页',
},
pathUploadModal: {
title: '上传路径',
subtitle: '选择本地目录后,系统会按批次将该路径下文件导入当前分组并自动进入清洗流程。',
localPickerTitle: '本地路径选择',
localPickerHint: '支持多次选择目录追加文件;当前浏览器安全限制下,手动粘贴任意本机路径不能直接读取文件内容。',
pickFolder: '选择本地目录',
pathListLabel: '路径清单',
pathListPlaceholder: '目录选择后会自动填充路径清单;如需记录多路径,可在此粘贴备注。',
pendingFiles: '待上传文件',
selectedRoots: '已选根路径:{paths}',
noRoots: '暂无',
pickFolderFirst: '请选择本地目录后再确认上传。',
confirmUpload: '确认上传',
},
pathUploadHistoryModal: {
title: '上传路径历史批次',
subtitle: '查看每次路径上传的批次结果、失败文件与重试入口。',
},
},
'zh-TW': {
sidebar: {
groupsTitle: '分組列表',
loadingGroups: '正在載入分組...',
emptyGroups: '暫無知識庫分組。',
noDescription: '暫無描述',
},
summary: {
currentGroup: '當前知識庫分組',
documentCount: '文檔數量',
pendingSync: '待同步數量',
uploadFailed: '上傳失敗數量',
cleanFailed: '清洗失敗數量',
syncFailed: '同步失敗數量',
},
filters: { all: '全部', upload: '上傳', clean: '清洗', sync: '同步' },
common: {
processing: '處理中...',
delete: '刪除',
close: '關閉',
cancel: '取消',
retry: '重試',
remove: '移除',
none: '暫無',
countUnit: '條',
failureReason: '失敗原因:{reason}',
perPage: '每頁',
prevPage: '上一頁',
nextPage: '下一頁',
},
documents: {
title: '文檔列表',
infoTip: '當前分組下的基礎文檔條目,上傳文件後將自動創建文檔並開始清洗流程。',
uploadPath: '上傳路徑',
uploadFile: '上傳文件',
batchClean: '清洗數據',
batchCleanCount: '清洗數據({count})',
batchSync: '批量同步',
batchSyncCount: '批量同步({count})',
batchDelete: '批量刪除',
batchDeleteCount: '批量刪除({count})',
historyBatches: '歷史批次',
searchPlaceholder: '按文件名稱模糊搜索',
clearSearch: '清空搜索',
selectGroup: '請選擇一個知識庫分組。',
loadingDocuments: '正在載入文檔...',
emptyNoDocs: '當前分組暫無文檔,可直接在上方創建第一條文檔記錄。',
emptyNoSearchMatch: '當前搜索和篩選條件下暫無匹配文檔。',
emptyNoFilterMatch: '當前篩選條件下暫無匹配文檔。',
versionCount: '版本數:{count}',
currentVersion: ' · 當前版本:v{version} · ',
viewRecord: '查看記錄',
uploadVersion: '上傳版本',
syncDify: '同步 Dify',
syncingDify: '同步中...',
updatedAt: '更新時間:{time}',
selectedCount: '已選 {selected} 條 · 共 {total} 條',
showingRange: '當前顯示 {start}-{end} 條',
pageInfo: '第 {page} / {totalPages} 頁 · 共 {total} 條',
documentFallback: '文檔 #{id}',
},
pathUpload: {
progressTitle: '路徑上傳進度',
uploading: '上傳中',
completed: '已完成',
batchHint: '建議每批 {batchSize} 條,間隔 {seconds} 秒自動繼續。',
total: '總計 {count}',
pending: '待上傳 {count}',
uploaded: '已上傳 {count}',
failed: '失敗 {count}',
success: '成功 {count}',
pendingProcess: '待處理 {count}',
currentFile: '當前文件:{name}',
details: '上傳詳情',
viewHistory: '查看歷史',
retryFailedFiles: '重試失敗文件',
retryAllFailed: '重試全部失敗文件',
selectAllFiltered: '全選當前篩選',
deselectAllFiltered: '取消全選',
selectAll: '全選',
deselectAll: '取消全選',
batchLabel: '批次 #{id}',
createdAt: '創建時間:{time}',
finishedAt: ' · 完成時間:{time}',
noBatchMessage: '暫無批次說明',
batchDelete: '批量刪除',
batchDeleteCount: '批量刪除 ({count})',
deleting: '刪除中...',
emptyHistory: '當前暫無上傳路徑歷史批次。',
},
recordModal: {
title: '文檔記錄',
viewing: '當前查看:{name}',
loading: '正在載入文檔記錄...',
versionsTitle: '版本記錄',
versionsCount: '{count} 條',
versionsEmpty: '暫無版本記錄,上傳版本後會顯示在這裡。',
syncTitle: 'Dify 同步記錄',
syncEmpty: '暫無 Dify 同步記錄,手動點擊「同步 Dify」後會顯示在這裡。',
versionLabel: '版本:{id}',
sizeBytes: '大小:{size} bytes',
},
markdownModal: {
readingVersion: '正在讀取當前版本...',
previewText: '預覽文本',
cleanMarkdown: '清洗 Markdown',
loading: '正在載入清洗後的 Markdown...',
placeholder: '當前文檔尚未生成 Markdown,可在此粘貼或編輯內容。',
saving: '保存中...',
save: '保存 Markdown',
editorTitle: 'Markdown 編輯器',
},
sourceInfoModal: {
title: '源文件信息',
viewing: '當前查看:{name}',
loading: '正在載入源文件信息...',
empty: '暫無源文件信息,上傳版本後會顯示在這裡。',
currentVersion: '當前版本',
opening: '正在打開...',
fileName: '文件名:{name}',
fileSize: '大小:{size}',
fileType: '類型:{ext}',
},
failureModal: {
summary: '當前分組共 {count} 條失敗記錄,每頁 {pageSize} 條。',
empty: '當前沒有失敗數據。',
currentVersion: '當前版本:',
noVersion: '暫無版本',
resubmit: '重新提交',
reclean: '重新清洗',
resync: '重新同步',
pageInfo: '第 {page} / {totalPages} 頁',
},
pathUploadModal: {
title: '上傳路徑',
subtitle: '選擇本地目錄後,系統會按批次將該路徑下文件導入當前分組並自動進入清洗流程。',
localPickerTitle: '本地路徑選擇',
localPickerHint: '支持多次選擇目錄追加文件;當前瀏覽器安全限制下,手動粘貼任意本機路徑不能直接讀取文件內容。',
pickFolder: '選擇本地目錄',
pathListLabel: '路徑清單',
pathListPlaceholder: '目錄選擇後會自動填充路徑清單;如需記錄多路徑,可在此粘貼備註。',
pendingFiles: '待上傳文件',
selectedRoots: '已選根路徑:{paths}',
noRoots: '暫無',
pickFolderFirst: '請選擇本地目錄後再確認上傳。',
confirmUpload: '確認上傳',
},
pathUploadHistoryModal: {
title: '上傳路徑歷史批次',
subtitle: '查看每次路徑上傳的批次結果、失敗文件與重試入口。',
},
},
th: {
sidebar: {
groupsTitle: 'รายการกลุ่ม',
loadingGroups: 'กำลังโหลดกลุ่ม...',
emptyGroups: 'ยังไม่มีกลุ่มคลังความรู้',
noDescription: 'ไม่มีคำอธิบาย',
},
summary: {
currentGroup: 'กลุ่มปัจจุบัน',
documentCount: 'จำนวนเอกสาร',
pendingSync: 'รอซิงค์',
uploadFailed: 'อัปโหลดล้มเหลว',
cleanFailed: 'ทำความสะอาดล้มเหลว',
syncFailed: 'ซิงค์ล้มเหลว',
},
filters: { all: 'ทั้งหมด', upload: 'อัปโหลด', clean: 'ทำความสะอาด', sync: 'ซิงค์' },
common: {
processing: 'กำลังดำเนินการ...',
delete: 'ลบ',
close: 'ปิด',
cancel: 'ยกเลิก',
retry: 'ลองใหม่',
remove: 'นำออก',
none: 'ไม่มี',
countUnit: 'รายการ',
failureReason: 'สาเหตุ: {reason}',
perPage: 'ต่อหน้า',
prevPage: 'ก่อนหน้า',
nextPage: 'ถัดไป',
},
documents: {
title: 'รายการเอกสาร',
infoTip: 'รายการเอกสารพื้นฐานในกลุ่มนี้ การอัปโหลดไฟล์จะสร้างเอกสารและเริ่มทำความสะอาดอัตโนมัติ',
uploadPath: 'อัปโหลดจาก path',
uploadFile: 'อัปโหลดไฟล์',
batchClean: 'ทำความสะอาดข้อมูล',
batchCleanCount: 'ทำความสะอาดข้อมูล ({count})',
batchSync: 'ซิงค์เป็นชุด',
batchSyncCount: 'ซิงค์เป็นชุด ({count})',
batchDelete: 'ลบเป็นชุด',
batchDeleteCount: 'ลบเป็นชุด ({count})',
historyBatches: 'ประวัติ batch',
searchPlaceholder: 'ค้นหาตามชื่อไฟล์',
clearSearch: 'ล้างการค้นหา',
selectGroup: 'โปรดเลือกกลุ่มคลังความรู้',
loadingDocuments: 'กำลังโหลดเอกสาร...',
emptyNoDocs: 'ยังไม่มีเอกสารในกลุ่มนี้ อัปโหลดไฟล์ด้านบนเพื่อสร้างรายการแรก',
emptyNoSearchMatch: 'ไม่พบเอกสารที่ตรงกับการค้นหาและตัวกรอง',
emptyNoFilterMatch: 'ไม่พบเอกสารที่ตรงกับตัวกรอง',
versionCount: 'เวอร์ชัน: {count}',
currentVersion: ' · เวอร์ชันปัจจุบัน: v{version} · ',
viewRecord: 'ดูประวัติ',
uploadVersion: 'อัปโหลดเวอร์ชัน',
syncDify: 'ซิงค์ไป Dify',
syncingDify: 'กำลังซิงค์...',
updatedAt: 'อัปเดต: {time}',
selectedCount: 'เลือก {selected} · ทั้งหมด {total}',
showingRange: 'แสดง {start}-{end}',
pageInfo: 'หน้า {page} / {totalPages} · {total} รายการ',
documentFallback: 'เอกสาร #{id}',
},
pathUpload: {
progressTitle: 'ความคืบหน้าการอัปโหลด path',
uploading: 'กำลังอัปโหลด',
completed: 'เสร็จสิ้น',
batchHint: 'แนะนำ {batchSize} ไฟล์ต่อ batch ทำต่ออัตโนมัติทุก {seconds} วินาที',
total: 'ทั้งหมด {count}',
pending: 'รออัปโหลด {count}',
uploaded: 'อัปโหลดแล้ว {count}',
failed: 'ล้มเหลว {count}',
success: 'สำเร็จ {count}',
pendingProcess: 'รอดำเนินการ {count}',
currentFile: 'ไฟล์ปัจจุบัน: {name}',
details: 'รายละเอียดการอัปโหลด',
viewHistory: 'ดูประวัติ',
retryFailedFiles: 'ลองใหม่ไฟล์ที่ล้มเหลว',
retryAllFailed: 'ลองใหม่ไฟล์ล้มเหลวทั้งหมด',
selectAllFiltered: 'เลือกทั้งหมดที่กรอง',
deselectAllFiltered: 'ยกเลิกการเลือก',
selectAll: 'เลือกทั้งหมด',
deselectAll: 'ยกเลิกการเลือก',
batchLabel: 'Batch #{id}',
createdAt: 'สร้างเมื่อ: {time}',
finishedAt: ' · เสร็จเมื่อ: {time}',
noBatchMessage: 'ไม่มีคำอธิบาย batch',
batchDelete: 'ลบเป็นชุด',
batchDeleteCount: 'ลบเป็นชุด ({count})',
deleting: 'กำลังลบ...',
emptyHistory: 'ยังไม่มีประวัติการอัปโหลด path',
},
recordModal: {
title: 'ประวัติเอกสาร',
viewing: 'กำลังดู: {name}',
loading: 'กำลังโหลดประวัติเอกสาร...',
versionsTitle: 'เวอร์ชัน',
versionsCount: '{count} รายการ',
versionsEmpty: 'ยังไม่มีเวอร์ชัน อัปโหลดเวอร์ชันเพื่อดูที่นี่',
syncTitle: 'บันทึกซิงค์ Dify',
syncEmpty: 'ยังไม่มีบันทึกซิงค์ Dify คลิก "ซิงค์ไป Dify" เพื่อสร้าง',
versionLabel: 'เวอร์ชัน: {id}',
sizeBytes: 'ขนาด: {size} bytes',
},
markdownModal: {
readingVersion: 'กำลังโหลดเวอร์ชันปัจจุบัน...',
previewText: 'ข้อความตัวอย่าง',
cleanMarkdown: 'Markdown ที่ทำความสะอาดแล้ว',
loading: 'กำลังโหลด Markdown...',
placeholder: 'ยังไม่มี Markdown วางหรือแก้ไขเนื้อหาได้ที่นี่',
saving: 'กำลังบันทึก...',
save: 'บันทึก Markdown',
editorTitle: 'ตัวแก้ไข Markdown',
},
sourceInfoModal: {
title: 'ข้อมูลไฟล์ต้นฉบับ',
viewing: 'กำลังดู: {name}',
loading: 'กำลังโหลดข้อมูลไฟล์ต้นฉบับ...',
empty: 'ยังไม่มีข้อมูลไฟล์ต้นฉบับ อัปโหลดเวอร์ชันเพื่อดูที่นี่',
currentVersion: 'เวอร์ชันปัจจุบัน',
opening: 'กำลังเปิด...',
fileName: 'ไฟล์: {name}',
fileSize: 'ขนาด: {size}',
fileType: 'ประเภท: {ext}',
},
failureModal: {
summary: 'กลุ่มนี้มี {count} รายการล้มเหลว {pageSize} รายการต่อหน้า',
empty: 'ไม่มีข้อมูลล้มเหลว',
currentVersion: 'เวอร์ชันปัจจุบัน:',
noVersion: 'ไม่มีเวอร์ชัน',
resubmit: 'ส่งใหม่',
reclean: 'ทำความสะอาดใหม่',
resync: 'ซิงค์ใหม่',
pageInfo: 'หน้า {page} / {totalPages}',
},
pathUploadModal: {
title: 'อัปโหลด path',
subtitle: 'เลือกโฟลเดอร์ในเครื่อง ระบบจะนำเข้าไฟล์เป็น batch และเข้าสู่ workflow ทำความสะอาดอัตโนมัติ',
localPickerTitle: 'เลือกโฟลเดอร์ในเครื่อง',
localPickerHint: 'เลือกโฟลเดอร์ได้หลายครั้ง เบราว์เซอร์ไม่สามารถอ่าน path ที่วางเองได้',
pickFolder: 'เลือกโฟลเดอร์ในเครื่อง',
pathListLabel: 'รายการ path',
pathListPlaceholder: 'path จะเติมหลังเลือกโฟลเดอร์ วางหมายเหตุหลาย path ได้ที่นี่',
pendingFiles: 'ไฟล์รออัปโหลด',
selectedRoots: 'root ที่เลือก: {paths}',
noRoots: 'ไม่มี',
pickFolderFirst: 'โปรดเลือกโฟลเดอร์ในเครื่องก่อนยืนยันอัปโหลด',
confirmUpload: 'ยืนยันอัปโหลด',
},
pathUploadHistoryModal: {
title: 'ประวัติ batch อัปโหลด path',
subtitle: 'ดูผลลัพธ์ batch ไฟล์ล้มเหลว และตัวเลือกลองใหม่',
},
},
};
for (const [locale, patch] of Object.entries(patches)) {
const filePath = path.join(localesRoot, locale, 'kb.json');
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
data.kbWorkspace = { ...data.kbWorkspace, ...patch };
fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
console.log(`Merged kbWorkspace i18n into ${locale}/kb.json`);
}
@@ -0,0 +1,259 @@
/**
* scripts/merge-schedule-form-i18n.mjs
* 合并排程创建/编辑弹窗与 Dify 快照相关文案至各语言 admin.json
*/
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const localesRoot = path.resolve(__dirname, '../src/locales');
const patches = {
en: {
form: {
dsDbType: 'Database type',
dsHost: 'Host',
dsHostPlaceholder: 'e.g. 192.168.1.100 or ${SRM_SQLSERVER_HOST}',
dsPort: 'Port',
dsDatabase: 'Database',
dsDatabasePlaceholder: 'Database name',
dsUsername: 'Username',
dsPassword: 'Password',
dsPasswordPlaceholder: 'or ${ENV_VAR}',
dsDriver: 'ODBC driver',
dsEncrypt: 'Encrypt',
dsTrustCert: 'TrustServerCertificate',
defaultNo: 'Default (no)',
defaultYes: 'Default (yes)',
envVarHint: 'Values support {token} format and are resolved from environment variables at runtime (recommended for passwords).',
envVarToken: '${ENV_VAR_NAME}',
baseFetchSql: 'Base fetch SQL (base_fetch_sql) — SELECT + FROM + JOIN only, no WHERE',
fetchWhereConditions: 'WHERE clause (fetch_where_conditions) — edit to test different filters',
fetchOrderBy: 'Order by (fetch_order_by)',
detailSql: 'Detail SQL (detail_sql)',
writebackSql: 'Writeback SQL (writeback_sql)',
rowIdKey: 'Row ID key (row_id_key)',
logPrefix: 'Log prefix (log_prefix)',
aliasOrder: 'Field order (alias_order) — comma-separated',
detailAliasOrder: 'Detail field order (detail_alias_order) — comma-separated',
headerLabels: 'Header labels (header_labels) — JSON',
apiUrl: 'API URL',
apiMethod: 'HTTP method',
apiTimeoutSeconds: 'Timeout (seconds)',
apiHeaders: 'Request headers (Headers) — JSON',
apiBodyTemplate: 'Request body template (Body)',
agentLabel: 'Agent',
agentOptionId: ' (ID: {id})',
difySystemPrompt: 'Dify System Prompt',
difySystemPromptHint: 'Available when a Dify Agent is enabled. Saved as system_prompt in the Workflow; LLM nodes must reference this variable.',
difySystemPromptPlaceholder:
'e.g. You are a material compliance assistant. Based on record test data, return JSON with dify_result (pass/fail/manual review) and dify_message.',
},
difySnapshot: {
title: 'Dify execution snapshot (audit)',
agent: 'Agent',
agentId: ' (ID: {id})',
difyAppId: 'Dify App ID',
systemPrompt: 'System Prompt',
notConfigured: '(Not configured)',
notConfiguredUseDefault: '(Not configured; using Dify workflow default prompt)',
notEnabledTest: 'Dify was not enabled for this test',
notEnabledRun: 'Dify Agent was not enabled for this run',
},
testRun: {
baseFetchSqlReadonly: 'Base fetch SQL (base_fetch_sql) — read-only',
limitRows: 'Row limit (limit)',
},
},
'zh-CN': {
form: {
dsDbType: '数据库类型',
dsHost: '主机地址',
dsHostPlaceholder: '如 192.168.1.100 或 ${SRM_SQLSERVER_HOST}',
dsPort: '端口',
dsDatabase: '数据库',
dsDatabasePlaceholder: '数据库名',
dsUsername: '用户名',
dsPassword: '密码',
dsPasswordPlaceholder: '或 ${ENV_VAR}',
dsDriver: 'ODBC 驱动',
dsEncrypt: 'Encrypt',
dsTrustCert: 'TrustServerCertificate',
defaultNo: '默认 (no)',
defaultYes: '默认 (yes)',
envVarHint: '值支持 {token} 格式,运行时自动从环境变量解析(推荐密码使用此方式)',
envVarToken: '${环境变量名}',
baseFetchSql: '基础查询 SQL (base_fetch_sql) — SELECT + FROM + JOIN 部分,不含 WHERE',
fetchWhereConditions: 'WHERE 条件 (fetch_where_conditions) — 可修改以测试不同筛选条件',
fetchOrderBy: '排序 (fetch_order_by)',
detailSql: '明细 SQL (detail_sql)',
writebackSql: '回写 SQL (writeback_sql)',
rowIdKey: '主键字段 (row_id_key)',
logPrefix: '日志前缀 (log_prefix)',
aliasOrder: '字段顺序 (alias_order) — 逗号分隔',
detailAliasOrder: '明细字段顺序 (detail_alias_order) — 逗号分隔',
headerLabels: '表头标签 (header_labels) — JSON 格式',
apiUrl: 'API 地址',
apiMethod: '请求方法',
apiTimeoutSeconds: '超时(秒)',
apiHeaders: '请求头 (Headers) — JSON 格式',
apiBodyTemplate: '请求体模板 (Body)',
agentLabel: 'Agent',
agentOptionId: '(ID: {id})',
difySystemPrompt: 'Dify System Prompt',
difySystemPromptHint:
'仅在启用 Dify Agent 时可配置。保存后将作为 system_prompt 传入 Workflow;编排中 LLM 节点需引用该变量。',
difySystemPromptPlaceholder:
'例如:你是物料合规判定助手。根据 record 中的检测数据判定是否合格,仅返回 JSON:dify_result(合格/不合格/人工判定)与 dify_message。',
},
difySnapshot: {
title: 'Dify 执行快照(审计)',
agent: 'Agent',
agentId: '(ID: {id})',
difyAppId: 'Dify App ID',
systemPrompt: 'System Prompt',
notConfigured: '(未配置)',
notConfiguredUseDefault: '(未配置,使用 Dify 编排内默认提示词)',
notEnabledTest: '本次测试未启用 Dify',
notEnabledRun: '本次执行未启用 Dify Agent',
},
testRun: {
baseFetchSqlReadonly: '基础查询 SQL (base_fetch_sql) — 只读',
limitRows: '限制行数 (limit)',
},
},
'zh-TW': {
form: {
dsDbType: '資料庫類型',
dsHost: '主機位址',
dsHostPlaceholder: '如 192.168.1.100 或 ${SRM_SQLSERVER_HOST}',
dsPort: '連接埠',
dsDatabase: '資料庫',
dsDatabasePlaceholder: '資料庫名稱',
dsUsername: '使用者名稱',
dsPassword: '密碼',
dsPasswordPlaceholder: '或 ${ENV_VAR}',
dsDriver: 'ODBC 驅動',
dsEncrypt: 'Encrypt',
dsTrustCert: 'TrustServerCertificate',
defaultNo: '預設 (no)',
defaultYes: '預設 (yes)',
envVarHint: '值支援 {token} 格式,執行時自動從環境變數解析(建議密碼使用此方式)',
envVarToken: '${環境變數名}',
baseFetchSql: '基礎查詢 SQL (base_fetch_sql) — SELECT + FROM + JOIN 部分,不含 WHERE',
fetchWhereConditions: 'WHERE 條件 (fetch_where_conditions) — 可修改以測試不同篩選條件',
fetchOrderBy: '排序 (fetch_order_by)',
detailSql: '明細 SQL (detail_sql)',
writebackSql: '回寫 SQL (writeback_sql)',
rowIdKey: '主鍵欄位 (row_id_key)',
logPrefix: '日誌前綴 (log_prefix)',
aliasOrder: '欄位順序 (alias_order) — 逗號分隔',
detailAliasOrder: '明細欄位順序 (detail_alias_order) — 逗號分隔',
headerLabels: '表頭標籤 (header_labels) — JSON 格式',
apiUrl: 'API 位址',
apiMethod: '請求方法',
apiTimeoutSeconds: '逾時(秒)',
apiHeaders: '請求標頭 (Headers) — JSON 格式',
apiBodyTemplate: '請求體模板 (Body)',
agentLabel: 'Agent',
agentOptionId: '(ID: {id})',
difySystemPrompt: 'Dify System Prompt',
difySystemPromptHint:
'僅在啟用 Dify Agent 時可配置。保存後將作為 system_prompt 傳入 Workflow;編排中 LLM 節點需引用該變數。',
difySystemPromptPlaceholder:
'例如:你是物料合規判定助手。根據 record 中的檢測資料判定是否合格,僅返回 JSON:dify_result(合格/不合格/人工判定)與 dify_message。',
},
difySnapshot: {
title: 'Dify 執行快照(審計)',
agent: 'Agent',
agentId: '(ID: {id})',
difyAppId: 'Dify App ID',
systemPrompt: 'System Prompt',
notConfigured: '(未配置)',
notConfiguredUseDefault: '(未配置,使用 Dify 編排內預設提示詞)',
notEnabledTest: '本次測試未啟用 Dify',
notEnabledRun: '本次執行未啟用 Dify Agent',
},
testRun: {
baseFetchSqlReadonly: '基礎查詢 SQL (base_fetch_sql) — 唯讀',
limitRows: '限制行數 (limit)',
},
},
th: {
form: {
dsDbType: 'ประเภทฐานข้อมูล',
dsHost: 'โฮสต์',
dsHostPlaceholder: 'เช่น 192.168.1.100 หรือ ${SRM_SQLSERVER_HOST}',
dsPort: 'พอร์ต',
dsDatabase: 'ฐานข้อมูล',
dsDatabasePlaceholder: 'ชื่อฐานข้อมูล',
dsUsername: 'ชื่อผู้ใช้',
dsPassword: 'รหัสผ่าน',
dsPasswordPlaceholder: 'หรือ ${ENV_VAR}',
dsDriver: 'ไดรเวอร์ ODBC',
dsEncrypt: 'Encrypt',
dsTrustCert: 'TrustServerCertificate',
defaultNo: 'ค่าเริ่มต้น (no)',
defaultYes: 'ค่าเริ่มต้น (yes)',
envVarHint: 'รองรับรูปแบบ {token} และจะถูกแก้จากตัวแปรสภาพแวดล้อมขณะรัน (แนะนำสำหรับรหัสผ่าน)',
envVarToken: '${ชื่อตัวแปรสภาพแวดล้อม}',
baseFetchSql: 'SQL ดึงข้อมูลพื้นฐาน (base_fetch_sql) — เฉพาะ SELECT + FROM + JOIN ไม่รวม WHERE',
fetchWhereConditions: 'เงื่อนไข WHERE (fetch_where_conditions) — แก้ไขเพื่อทดสอบตัวกรอง',
fetchOrderBy: 'เรียงลำดับ (fetch_order_by)',
detailSql: 'SQL รายละเอียด (detail_sql)',
writebackSql: 'SQL เขียนกลับ (writeback_sql)',
rowIdKey: 'คีย์แถว (row_id_key)',
logPrefix: 'คำนำหน้าบันทึก (log_prefix)',
aliasOrder: 'ลำดับฟิลด์ (alias_order) — คั่นด้วยจุลภาค',
detailAliasOrder: 'ลำดับฟิลด์รายละเอียด (detail_alias_order) — คั่นด้วยจุลภาค',
headerLabels: 'ป้ายหัวตาราง (header_labels) — JSON',
apiUrl: 'URL ของ API',
apiMethod: 'วิธี HTTP',
apiTimeoutSeconds: 'หมดเวลา (วินาที)',
apiHeaders: 'ส่วนหัวคำขอ (Headers) — JSON',
apiBodyTemplate: 'เทมเพลต body คำขอ (Body)',
agentLabel: 'Agent',
agentOptionId: ' (ID: {id})',
difySystemPrompt: 'Dify System Prompt',
difySystemPromptHint:
'ใช้ได้เมื่อเปิดใช้ Dify Agent จะบันทึกเป็น system_prompt ใน Workflow; โหนด LLM ต้องอ้างอิงตัวแปรนี้',
difySystemPromptPlaceholder:
'เช่น คุณเป็นผู้ช่วยตรวจสอบความสอดคล้องของวัสดุ จากข้อมูล record ให้คืน JSON: dify_result (ผ่าน/ไม่ผ่าน/ตรวจด้วยมือ) และ dify_message',
},
difySnapshot: {
title: 'สแนปช็อตการทำงาน Dify (ตรวจสอบ)',
agent: 'Agent',
agentId: ' (ID: {id})',
difyAppId: 'Dify App ID',
systemPrompt: 'System Prompt',
notConfigured: '(ยังไม่ได้ตั้งค่า)',
notConfiguredUseDefault: '(ยังไม่ได้ตั้งค่า ใช้ prompt เริ่มต้นใน Dify workflow)',
notEnabledTest: 'การทดสอบนี้ไม่ได้เปิดใช้ Dify',
notEnabledRun: 'การรันนี้ไม่ได้เปิดใช้ Dify Agent',
},
testRun: {
baseFetchSqlReadonly: 'SQL ดึงข้อมูลพื้นฐาน (base_fetch_sql) — อ่านอย่างเดียว',
limitRows: 'จำกัดจำนวนแถว (limit)',
},
},
};
function deepMerge(target, source) {
for (const [key, value] of Object.entries(source)) {
if (value && typeof value === 'object' && !Array.isArray(value)) {
target[key] = deepMerge(target[key] ?? {}, value);
} else {
target[key] = value;
}
}
return target;
}
for (const [locale, patch] of Object.entries(patches)) {
const filePath = path.join(localesRoot, locale, 'admin.json');
const data = JSON.parse(fs.readFileSync(filePath, 'utf8'));
data.schedule = deepMerge(data.schedule ?? {}, patch);
fs.writeFileSync(filePath, `${JSON.stringify(data, null, 2)}\n`, 'utf8');
console.log(`Updated ${filePath}`);
}