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

Function normalizeChatCompressionThreshold

coderd/exp_chats.go:4560–4579  ·  view source on GitHub ↗
(
	requested *int32,
	fallback int32,
)

Source from the content-addressed store, hash-verified

4558}
4559
4560func 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
4581func parseCompactionThresholdKey(key string) (uuid.UUID, error) {
4582 if !strings.HasPrefix(key, codersdk.ChatCompactionThresholdKeyPrefix) {

Callers 2

createChatModelConfigMethod · 0.85
updateChatModelConfigMethod · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by

no test coverage detected