(message: string)
| 101 | } |
| 102 | |
| 103 | function inferCode(message: string): string { |
| 104 | const text = message.toLowerCase() |
| 105 | if (text.includes('proxyerror') || (text.includes('connection refused') && text.includes('127.0.0.1'))) return 'PROXY_UNAVAILABLE' |
| 106 | if (text.includes('ssleoferror') || text.includes('unexpected_eof') || text.includes('198.18.')) return 'NETWORK_FAKE_IP_TLS' |
| 107 | if (message.includes('不支持 /v1/chat/completions')) return 'MODEL_ENDPOINT_MISMATCH' |
| 108 | if (text.includes('405') || text.includes('method not allowed') || text.includes('not allowed')) return 'ENDPOINT_METHOD_MISMATCH' |
| 109 | if (text.includes('401') || text.includes('403') || text.includes('unauthorized') || text.includes('forbidden')) return 'AUTH_OR_PERMISSION' |
| 110 | if (text.includes('429') || text.includes('rate') || message.includes('配额') || message.includes('限流')) return 'RATE_LIMITED' |
| 111 | if (text.includes('timeout') || message.includes('超时')) return 'NETWORK_TIMEOUT' |
| 112 | if (message.includes('不存在') || text.includes('not found')) return 'RESOURCE_NOT_FOUND' |
| 113 | return 'UNKNOWN_ERROR' |
| 114 | } |
| 115 | |
| 116 | function inferTitle(message: string, fallbackTitle: string): string { |
| 117 | const code = inferCode(message) |
no outgoing calls
no test coverage detected