🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
🌐 chore: translate non-English comments to English in file services (#10089)
LobeHub Botc3c4319625e7
diff --git a/src/services/electron/desktopNotification.ts b/src/services/electron/desktopNotification.tsindex 803622abfef..5728832355f 100644--- a/src/services/electron/desktopNotification.ts+++ b/src/services/electron/desktopNotification.ts@@ -5,13 +5,13 @@ import {} from '@lobechat/electron-client-ipc';/**- * 桌面通知服务+ * Desktop notification service*/export class DesktopNotificationService {/**- * 显示桌面通知(仅在窗口隐藏时)- * @param params 通知参数- * @returns 通知结果+ * Show desktop notification (only when window is hidden)+ * @param params Notification parameters+ * @returns Notification result*/async showNotification(params: ShowDesktopNotificationParams,@@ -20,8 +20,8 @@ export class DesktopNotificationService {}/**- * 检查主窗口是否隐藏- * @returns 是否隐藏+ * Check if main window is hidden+ * @returns Whether it is hidden*/async isMainWindowHidden(): Promise<boolean> {return dispatch('isMainWindowHidden');diff --git a/src/services/electron/file.ts b/src/services/electron/file.tsindex e7b3a082b1c..1b63129f6c5 100644--- a/src/services/electron/file.ts+++ b/src/services/electron/file.ts@@ -2,15 +2,15 @@ import { dispatch } from '@lobechat/electron-client-ipc';import { FileMetadata } from '@lobechat/types';/**- * 桌面应用文件API客户端服务+ * Desktop application file API client service*/class DesktopFileAPI {/**- * 上传文件到桌面应用- * @param file 文件对象- * @param hash 文件哈希- * @param path 文件存储路径- * @returns 上传结果+ * Upload file to desktop application+ * @param file File object+ * @param hash File hash+ * @param path File storage path+ * @returns Upload result*/async uploadFile(file: File,diff --git a/src/services/file/ClientS3/index.ts b/src/services/file/ClientS3/index.tsindex 068c54635a6..0f863fc68ad 100644--- a/src/services/file/ClientS3/index.ts+++ b/src/services/file/ClientS3/index.ts@@ -13,9 +13,9 @@ export class BrowserS3Storage {}/**- * 上传文件- * @param key 文件 hash- * @param file File 对象+ * Upload file+ * @param key File hash+ * @param file File object*/putObject = async (key: string, file: File): Promise<void> => {try {@@ -27,9 +27,9 @@ export class BrowserS3Storage {};/**- * 获取文件- * @param key 文件 hash- * @returns File 对象+ * Get file+ * @param key File hash+ * @returns File object*/getObject = async (key: string): Promise<File | undefined> => {try {@@ -44,8 +44,8 @@ export class BrowserS3Storage {};/**- * 删除文件- * @param key 文件 hash+ * Delete file+ * @param key File hash*/deleteObject = async (key: string): Promise<void> => {try {diff --git a/src/services/upload.ts b/src/services/upload.tsindex c0a95f9ef45..7d4f924f8be 100644--- a/src/services/upload.ts+++ b/src/services/upload.ts@@ -68,13 +68,13 @@ class UploadService {const state = getElectronStoreState();const isSyncActive = electronSyncSelectors.isSyncActive(state);- // 桌面端上传逻辑(并且没开启 sync 同步)+ // Desktop upload logic (when sync is not enabled)if (isDesktop && !isSyncActive) {const data = await this.uploadToDesktopS3(file, { directory, pathname });return { data, success: true };}- // 服务端上传逻辑+ // Server-side upload logicif (isServerMode) {// if is server mode, upload to server s3,@@ -83,7 +83,7 @@ class UploadService {}// upload to client s3- // 客户端上传逻辑+ // Client-side upload logicif (!skipCheckFileType && !file.type.startsWith('image') && !file.type.startsWith('video')) {onNotSupported?.();return { data: undefined as unknown as FileMetadata, success: false };@@ -103,18 +103,18 @@ class UploadService {base64Data: string,options: UploadFileToS3Options = {},): Promise<UploadBase64ToS3Result> => {- // 解析 base64 数据+ // Parse base64 dataconst { base64, mimeType, type } = parseDataUri(base64Data);if (!base64 || !mimeType || type !== 'base64') {throw new Error('Invalid base64 data for image');}- // 将 base64 转换为 Blob+ // Convert base64 to Blobconst byteCharacters = atob(base64);const byteArrays = [];- // 分块处理以避免内存问题+ // Process in chunks to avoid memory issuesfor (let offset = 0; offset < byteCharacters.length; offset += 1024) {const slice = byteCharacters.slice(offset, offset + 1024);@@ -129,14 +129,14 @@ class UploadService {const blob = new Blob(byteArrays, { type: mimeType });- // 确定文件扩展名+ // Determine file extensionconst fileExtension = mimeType.split('/')[1] || 'png';const fileName = `${options.filename || `image_${dayjs().format('YYYY-MM-DD-hh-mm-ss')}`}.${fileExtension}`;- // 创建文件对象+ // Create file objectconst file = new File([blob], fileName, { type: mimeType });- // 使用统一的上传方法+ // Use unified upload methodconst { data: metadata } = await this.uploadFileToS3(file, options);const hash = sha256(await file.arrayBuffer());@@ -221,7 +221,7 @@ class UploadService {const fileArrayBuffer = await file.arrayBuffer();const hash = sha256(fileArrayBuffer);- // 生成文件路径元数据+ // Generate file path metadataconst { pathname } = generateFilePathMetadata(file.name, options);const { desktopFileAPI } = await import('@/services/electron/file');@@ -261,7 +261,7 @@ class UploadService {preSignUrl: string;}> => {- // 生成文件路径元数据+ // Generate file path metadataconst { date, dirname, filename, pathname } = generateFilePathMetadata(file.name, options);const preSignUrl = await lambdaClient.upload.createS3PreSignedUrl.mutate({ pathname });