23 lines
464 B
Go
23 lines
464 B
Go
package ai
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
)
|
|
|
|
const maxBailianPCMBytes = 2 << 20 // Per-turn media allocation bound; unrelated to prompt length.
|
|
|
|
// Never log vendor payloads, prompt text or credentials.
|
|
func bailianFailureSummary(err error) (string, int) {
|
|
if err == nil {
|
|
return "none", 0
|
|
}
|
|
if errors.Is(err, context.DeadlineExceeded) {
|
|
return "deadline", 0
|
|
}
|
|
if errors.Is(err, context.Canceled) {
|
|
return "canceled", 0
|
|
}
|
|
return "task_websocket", 0
|
|
}
|