From e613696e0844071bbe07b3dca4288530ac47b3c0 Mon Sep 17 00:00:00 2001 From: farion1231 Date: Wed, 6 Aug 2025 07:42:57 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20any=20=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E4=B8=BA=E5=85=B7=E4=BD=93=E7=9A=84=E6=8E=A5=E5=8F=A3=E5=AE=9A?= =?UTF-8?q?=E4=B9=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 定义 ClaudeCodeConfig 接口替代 any 类型 - 提升类型安全性和代码可维护性 - 明确配置文件结构 --- src/main/services.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/services.ts b/src/main/services.ts index 6118657..14e7101 100644 --- a/src/main/services.ts +++ b/src/main/services.ts @@ -3,6 +3,15 @@ import path from 'path' import os from 'os' import { Provider } from '../shared/types' +interface ClaudeCodeConfig { + env?: { + ANTHROPIC_AUTH_TOKEN?: string + ANTHROPIC_BASE_URL?: string + [key: string]: string | undefined + } + [key: string]: any +} + export function getClaudeCodeConfig() { // Claude Code 配置文件路径 const configDir = path.join(os.homedir(), '.claude') @@ -19,7 +28,7 @@ export async function switchProvider(provider: Provider): Promise { await fs.mkdir(configDir, { recursive: true }) // 读取现有配置 - let config: any = {} + let config: ClaudeCodeConfig = {} try { const content = await fs.readFile(configPath, 'utf-8') config = JSON.parse(content)