( requested *int32, fallback int32, )
| 4558 | } |
| 4559 | |
| 4560 | func normalizeChatCompressionThreshold( |
| 4561 | requested *int32, |
| 4562 | fallback int32, |
| 4563 | ) (int32, error) { |
| 4564 | threshold := fallback |
| 4565 | if requested != nil { |
| 4566 | threshold = *requested |
| 4567 | } |
| 4568 | |
| 4569 | if threshold < minChatContextCompressionThreshold || |
| 4570 | threshold > maxChatContextCompressionThreshold { |
| 4571 | return 0, xerrors.Errorf( |
| 4572 | "context_compression_threshold must be between %d and %d", |
| 4573 | minChatContextCompressionThreshold, |
| 4574 | maxChatContextCompressionThreshold, |
| 4575 | ) |
| 4576 | } |
| 4577 | |
| 4578 | return threshold, nil |
| 4579 | } |
| 4580 | |
| 4581 | func parseCompactionThresholdKey(key string) (uuid.UUID, error) { |
| 4582 | if !strings.HasPrefix(key, codersdk.ChatCompactionThresholdKeyPrefix) { |
no test coverage detected