(message?: string | null)
| 194 | } |
| 195 | |
| 196 | export function describeIssue(message?: string | null) { |
| 197 | const text = trimText(message); |
| 198 | if (!text) { |
| 199 | return { |
| 200 | title: '运行失败', |
| 201 | detail: '请查看运行日志了解更多信息。', |
| 202 | tone: 'error' as const, |
| 203 | }; |
| 204 | } |
| 205 | |
| 206 | if (/at capacity|provider is busy|different upstream model|busy right now/i.test(text)) { |
| 207 | return { |
| 208 | title: '上游模型繁忙', |
| 209 | detail: |
| 210 | '本地链路已经接通,但当前模型负载过高。请稍后重试,或切换到其他上游模型。', |
| 211 | tone: 'warn' as const, |
| 212 | }; |
| 213 | } |
| 214 | |
| 215 | if (/rate limiting|rate limit|too many requests|quota/i.test(text)) { |
| 216 | return { |
| 217 | title: '上游触发限流', |
| 218 | detail: |
| 219 | '请稍等片刻后重试。如果持续出现,可以更换密钥或切换到更空闲的模型。', |
| 220 | tone: 'warn' as const, |
| 221 | }; |
| 222 | } |
| 223 | |
| 224 | if (/api key was rejected|api key|unauthorized/i.test(text)) { |
| 225 | return { |
| 226 | title: 'API Key 无效', |
| 227 | detail: '请打开配置面板,确认当前 API Key 与所选 provider 匹配。', |
| 228 | tone: 'error' as const, |
| 229 | }; |
| 230 | } |
| 231 | |
| 232 | if (/model name was not accepted|unknown model|not accepted/i.test(text)) { |
| 233 | return { |
| 234 | title: '模型名称需要检查', |
| 235 | detail: |
| 236 | '请确认上游模型和 Claw 模型字段填写的是可用的真实模型名。', |
| 237 | tone: 'error' as const, |
| 238 | }; |
| 239 | } |
| 240 | |
| 241 | if (/could not reach the upstream api|network connection|base url/i.test(text)) { |
| 242 | return { |
| 243 | title: '无法连接上游服务', |
| 244 | detail: |
| 245 | '请检查上游接口地址、网络连接,然后重新执行连接测试。', |
| 246 | tone: 'error' as const, |
| 247 | }; |
| 248 | } |
| 249 | |
| 250 | if (/timed out|timeout/i.test(text)) { |
| 251 | return { |
| 252 | title: '请求超时', |
| 253 | detail: '当前 provider 可能响应较慢。请稍后重试,或重新做一次连接测试。', |
no test coverage detected