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

Function truncateOutput

coderd/x/chatd/chattool/execute.go:236–241  ·  view source on GitHub ↗

truncateOutput safely truncates output to maxOutputToModel, ensuring the result is valid UTF-8 even if the cut falls in the middle of a multi-byte character.

(output string)

Source from the content-addressed store, hash-verified

234// ensuring the result is valid UTF-8 even if the cut falls in
235// the middle of a multi-byte character.
236func truncateOutput(output string) string {
237 if len(output) > maxOutputToModel {
238 output = strings.ToValidUTF8(output[:maxOutputToModel], "")
239 }
240 return output
241}
242
243// waitForProcess waits for process completion using the
244// blocking process output API instead of polling.

Callers 2

waitForProcessFunction · 0.85
ProcessOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected