MCPcopy Index your code
hub / github.com/coder/coder / streamIncompleteClassification

Function streamIncompleteClassification

coderd/x/chatd/chaterror/classify.go:341–365  ·  view source on GitHub ↗
(
	lowerMessage string,
	provider string,
	statusCode int,
	structured providerErrorDetails,
)

Source from the content-addressed store, hash-verified

339}
340
341func streamIncompleteClassification(
342 lowerMessage string,
343 provider string,
344 statusCode int,
345 structured providerErrorDetails,
346) (ClassifiedError, bool) {
347 for _, match := range streamIncompleteMatches {
348 if !strings.Contains(lowerMessage, match.pattern) {
349 continue
350 }
351 if provider == "" {
352 provider = match.provider
353 }
354 return normalizeClassification(ClassifiedError{
355 Message: streamIncompleteMessage(provider),
356 Detail: structured.detail,
357 Kind: codersdk.ChatErrorKindTimeout,
358 Provider: provider,
359 Retryable: true,
360 StatusCode: statusCode,
361 RetryAfter: structured.retryAfter,
362 }), true
363 }
364 return ClassifiedError{}, false
365}
366
367func streamIncompleteMessage(provider string) string {
368 return providerSubject(provider) + " stream closed unexpectedly before the response completed."

Callers 1

ClassifyFunction · 0.85

Calls 3

normalizeClassificationFunction · 0.85
streamIncompleteMessageFunction · 0.85
ContainsMethod · 0.45

Tested by

no test coverage detected