diff --git a/src/main/mcpServers/brave-search.ts b/src/main/mcpServers/brave-search.ts index 56a7a0b094..6f219e1eb8 100644 --- a/src/main/mcpServers/brave-search.ts +++ b/src/main/mcpServers/brave-search.ts @@ -237,8 +237,7 @@ async function getPoisData(apiKey: string, ids: string[]): Promise { @@ -257,8 +256,7 @@ async function getDescriptionsData(apiKey: string, ids: string[]): Promise { const validatedArgs = RequestPayloadSchema.parse(args) if (request.params.name === 'fetch_html') { - const fetchResult = await Fetcher.html(validatedArgs) - return fetchResult + return await Fetcher.html(validatedArgs) } if (request.params.name === 'fetch_json') { - const fetchResult = await Fetcher.json(validatedArgs) - return fetchResult + return await Fetcher.json(validatedArgs) } if (request.params.name === 'fetch_txt') { - const fetchResult = await Fetcher.txt(validatedArgs) - return fetchResult + return await Fetcher.txt(validatedArgs) } if (request.params.name === 'fetch_markdown') { - const fetchResult = await Fetcher.markdown(validatedArgs) - return fetchResult + return await Fetcher.markdown(validatedArgs) } throw new Error('Tool not found') }) diff --git a/src/main/mcpServers/filesystem.ts b/src/main/mcpServers/filesystem.ts index 624f11c658..4d99507ba2 100644 --- a/src/main/mcpServers/filesystem.ts +++ b/src/main/mcpServers/filesystem.ts @@ -183,7 +183,6 @@ async function searchFiles( } } catch (error) { // Skip invalid paths during search - continue } } } diff --git a/src/main/mcpServers/sequentialthinking.ts b/src/main/mcpServers/sequentialthinking.ts index b212c54f88..4589c0bf34 100644 --- a/src/main/mcpServers/sequentialthinking.ts +++ b/src/main/mcpServers/sequentialthinking.ts @@ -55,8 +55,8 @@ class SequentialThinkingServer { const { thoughtNumber, totalThoughts, thought, isRevision, revisesThought, branchFromThought, branchId } = thoughtData - let prefix = '' - let context = '' + let prefix: string + let context: string if (isRevision) { prefix = chalk.yellow('🔄 Revision') diff --git a/src/main/services/ExportService.ts b/src/main/services/ExportService.ts index 44175f4244..7f58ccafa1 100644 --- a/src/main/services/ExportService.ts +++ b/src/main/services/ExportService.ts @@ -83,7 +83,7 @@ export class ExportService { } break case 'text': - runs.push(new TextRun({ text: token.content, bold: isHeaderRow ? true : false })) + runs.push(new TextRun({ text: token.content, bold: isHeaderRow })) break case 'strong': runs.push(new TextRun({ text: token.content, bold: true })) diff --git a/src/main/services/GeminiService.ts b/src/main/services/GeminiService.ts index d2e46f4b89..8427e1304e 100644 --- a/src/main/services/GeminiService.ts +++ b/src/main/services/GeminiService.ts @@ -10,7 +10,7 @@ export class GeminiService { static async uploadFile(_: Electron.IpcMainInvokeEvent, file: FileType, apiKey: string): Promise { const sdk = new GoogleGenAI({ vertexai: false, apiKey }) - const uploadResult = await sdk.files.upload({ + return await sdk.files.upload({ file: file.path, config: { mimeType: 'application/pdf', @@ -18,7 +18,6 @@ export class GeminiService { displayName: file.origin_name } }) - return uploadResult } static async base64File(_: Electron.IpcMainInvokeEvent, file: FileType) { diff --git a/src/main/services/MCPService.ts b/src/main/services/MCPService.ts index 9b4a15d23b..aa41751595 100644 --- a/src/main/services/MCPService.ts +++ b/src/main/services/MCPService.ts @@ -429,13 +429,12 @@ class McpService { const client = await this.initClient(server) try { const { prompts } = await client.listPrompts() - const serverPrompts = prompts.map((prompt: any) => ({ + return prompts.map((prompt: any) => ({ ...prompt, id: `p${nanoid()}`, serverId: server.id, serverName: server.name })) - return serverPrompts } catch (error) { Logger.error(`[MCP] Failed to list prompts for server: ${server.name}`, error) return [] diff --git a/src/main/services/NutstoreService.ts b/src/main/services/NutstoreService.ts index e106fa0cc0..5f256f52c3 100644 --- a/src/main/services/NutstoreService.ts +++ b/src/main/services/NutstoreService.ts @@ -32,10 +32,9 @@ interface WebDAVResponse { } export async function getNutstoreSSOUrl() { - const url = await createOAuthUrl({ + return await createOAuthUrl({ app: 'cherrystudio' }) - return url } export async function decryptToken(token: string) { diff --git a/src/main/services/ProxyManager.ts b/src/main/services/ProxyManager.ts index afefbaf007..84d3f84038 100644 --- a/src/main/services/ProxyManager.ts +++ b/src/main/services/ProxyManager.ts @@ -129,12 +129,11 @@ export class ProxyManager { if (!protocol.includes('socks')) { setGlobalDispatcher(new ProxyAgent(proxyUrl)) } else { - const dispatcher = socksDispatcher({ + global[Symbol.for('undici.globalDispatcher.1')] = socksDispatcher({ port: parseInt(port), type: protocol === 'socks5' ? 5 : 4, host: host }) - global[Symbol.for('undici.globalDispatcher.1')] = dispatcher } } } diff --git a/src/main/services/SearchService.ts b/src/main/services/SearchService.ts index 327bf6e7ff..95e9d8b1be 100644 --- a/src/main/services/SearchService.ts +++ b/src/main/services/SearchService.ts @@ -74,8 +74,7 @@ export class SearchService { }) // Get the page content after ensuring it's fully loaded - const content = await window.webContents.executeJavaScript('document.documentElement.outerHTML') - return content + return await window.webContents.executeJavaScript('document.documentElement.outerHTML') } } diff --git a/src/main/services/mcp/oauth/callback.ts b/src/main/services/mcp/oauth/callback.ts index 87ae6f95e3..db70827d00 100644 --- a/src/main/services/mcp/oauth/callback.ts +++ b/src/main/services/mcp/oauth/callback.ts @@ -44,7 +44,7 @@ export class CallBackServer { Logger.error('OAuth callback server error:', error) }) - const runningServer = new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { server.listen(port, () => { Logger.info(`OAuth callback server listening on port ${port}`) resolve(server) @@ -54,7 +54,6 @@ export class CallBackServer { reject(error) }) }) - return runningServer } get getServer(): Promise { diff --git a/src/main/utils/zip.ts b/src/main/utils/zip.ts index 7b456973c0..177ccba7fe 100644 --- a/src/main/utils/zip.ts +++ b/src/main/utils/zip.ts @@ -9,14 +9,13 @@ const gunzipPromise = util.promisify(zlib.gunzip) /** * 压缩字符串 - * @param {string} string - 要压缩的 JSON 字符串 * @returns {Promise} 压缩后的 Buffer + * @param str */ export async function compress(str) { try { const buffer = Buffer.from(str, 'utf-8') - const compressedBuffer = await gzipPromise(buffer) - return compressedBuffer + return await gzipPromise(buffer) } catch (error) { logger.error('Compression failed:', error) throw error