()
| 116 | } |
| 117 | |
| 118 | const testConnection = async () => { |
| 119 | try { |
| 120 | const values = await form.validateFields() |
| 121 | setLoading(true) |
| 122 | |
| 123 | const result = await window.api.ai.testConnection({ |
| 124 | apiHost: values.apiHost, |
| 125 | apiKey: values.apiKey, |
| 126 | modelName: values.modelName |
| 127 | }) |
| 128 | |
| 129 | if (result.success) { |
| 130 | message.success('连接测试成功') |
| 131 | } else { |
| 132 | message.error(result.error || '连接测试失败,请检查配置') |
| 133 | } |
| 134 | } catch (error) { |
| 135 | message.error('连接测试失败,请检查配置') |
| 136 | } finally { |
| 137 | setLoading(false) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | return ( |
| 142 | <Modal |
nothing calls this directly
no test coverage detected