mirror of
https://github.com/ILoveBingLu/CipherTalk.git
synced 2026-05-23 04:53:24 +08:00
fix(ai): 优化API密钥验证逻辑,支持本地服务无密钥访问
- 修改 AIService 中 API 密钥验证逻辑,允许 Ollama 本地服务跳过密钥检查 - 更新所有 AI 提供商实例化时的类型断言,使用非空断言操作符(!)确保类型安全 - 完善 AISummarySettings 中连接测试逻辑,区分 Ollama 和 Custom 服务的验证需求 - 为 Custom 服务添加 baseURL 必填验证,提升配置完整性检查 - 升级版本至 2.1.4 - 改进本地 AI 服务和自定义服务的使用体验,降低配置门槛
This commit is contained in:
@@ -242,11 +242,18 @@ function AISummarySettings({
|
||||
}
|
||||
|
||||
const handleTestConnection = async () => {
|
||||
if (!apiKey) {
|
||||
// Ollama 本地服务不需要 API 密钥
|
||||
if (provider !== 'ollama' && !apiKey) {
|
||||
showMessage('请先输入 API 密钥', false)
|
||||
return
|
||||
}
|
||||
|
||||
// Custom 服务必须配置 baseURL
|
||||
if (provider === 'custom' && !baseURL) {
|
||||
showMessage('请先配置服务地址', false)
|
||||
return
|
||||
}
|
||||
|
||||
setIsTesting(true)
|
||||
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user