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

Function ClearPreviousResponseID

coderd/x/chatd/chatopenai/responses.go:131–149  ·  view source on GitHub ↗

ClearPreviousResponseID returns a clone of providerOptions with PreviousResponseID cleared on the OpenAI Responses options. The original providerOptions is not modified.

(providerOptions fantasy.ProviderOptions)

Source from the content-addressed store, hash-verified

129// PreviousResponseID cleared on the OpenAI Responses options. The original
130// providerOptions is not modified.
131func ClearPreviousResponseID(providerOptions fantasy.ProviderOptions) fantasy.ProviderOptions {
132 cloned := maps.Clone(providerOptions)
133 if cloned == nil {
134 return fantasy.ProviderOptions{}
135 }
136
137 entry, ok := cloned[fantasyopenai.Name]
138 if !ok {
139 return cloned
140 }
141 options, ok := entry.(*fantasyopenai.ResponsesProviderOptions)
142 if !ok || options == nil {
143 return cloned
144 }
145 optionsClone := *options
146 optionsClone.PreviousResponseID = nil
147 cloned[fantasyopenai.Name] = &optionsClone
148 return cloned
149}
150
151// extractResponseID extracts the OpenAI Responses API response ID from provider
152// metadata. Returns an empty string if no OpenAI Responses metadata is present.

Callers 2

RunFunction · 0.92

Calls 1

CloneMethod · 0.45

Tested by 1