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

Function ParseChatWorkspaceTTL

codersdk/chats.go:1055–1067  ·  view source on GitHub ↗

ParseChatWorkspaceTTL parses a stored TTL string, returning the default when the value is empty.

(s string)

Source from the content-addressed store, hash-verified

1053// ParseChatWorkspaceTTL parses a stored TTL string, returning the
1054// default when the value is empty.
1055func ParseChatWorkspaceTTL(s string) (time.Duration, error) {
1056 if s == "" {
1057 return DefaultChatWorkspaceTTL, nil
1058 }
1059 d, err := time.ParseDuration(s)
1060 if err != nil {
1061 return 0, xerrors.Errorf("invalid duration %q: %w", s, err)
1062 }
1063 if d < 0 {
1064 return 0, xerrors.New("duration must be non-negative")
1065 }
1066 return d, nil
1067}
1068
1069// ChatTemplateAllowlist is the request and response body for the
1070// chat template allowlist configuration endpoint. An empty list

Callers 3

getChatWorkspaceTTLMethod · 0.92
CreateWorkspaceFunction · 0.92

Calls 2

NewMethod · 0.65
ErrorfMethod · 0.45

Tested by 1