代码优化:清理冗余功能并修复关键问题
- 删除未使用的 axios 依赖 - 移除 Provider 接口中未使用的 model 字段 - 删除未使用的供应商连通性检查功能 - 修复 preload.ts 中缺失的 IPC 方法暴露 - 简化 UI:移除重复的单选按钮,仅保留启用按钮 - 修复 TypeScript 接口定义不完整的问题
This commit is contained in:
@@ -128,25 +128,6 @@ ipcMain.handle('selectConfigFile', async () => {
|
||||
return result.filePaths[0]
|
||||
})
|
||||
|
||||
ipcMain.handle('checkStatus', async (_, provider: Provider) => {
|
||||
// 简单的连通性检查 - 向API地址发送HEAD请求
|
||||
try {
|
||||
const controller = new AbortController()
|
||||
const timeoutId = setTimeout(() => controller.abort(), 5000)
|
||||
|
||||
const response = await fetch(provider.apiUrl, {
|
||||
method: 'HEAD',
|
||||
signal: controller.signal
|
||||
})
|
||||
|
||||
clearTimeout(timeoutId)
|
||||
return response.ok
|
||||
} catch (error) {
|
||||
console.error('检查供应商状态失败:', error)
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
ipcMain.handle('openExternal', async (_, url: string) => {
|
||||
try {
|
||||
await shell.openExternal(url)
|
||||
|
||||
Reference in New Issue
Block a user