MCPcopy
hub / github.com/HisMax/RedInk / inferCode

Function inferCode

frontend/src/utils/errors.ts:103–114  ·  view source on GitHub ↗
(message: string)

Source from the content-addressed store, hash-verified

101}
102
103function 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
116function inferTitle(message: string, fallbackTitle: string): string {
117 const code = inferCode(message)

Callers 4

legacyMessageToErrorFunction · 0.85
inferTitleFunction · 0.85
inferSuggestionFunction · 0.85
inferRetryableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected