MCPcopy Create free account
hub / github.com/coder/coder / formatMissingAttachmentText

Function formatMissingAttachmentText

coderd/x/chatd/chatprompt/chatprompt.go:1332–1349  ·  view source on GitHub ↗
(mediaType string)

Source from the content-addressed store, hash-verified

1330}
1331
1332func formatMissingAttachmentText(mediaType string) string {
1333 const missingAttachmentBody = "[missing-attachment] The user attached a file here, but the content has expired and is no longer available."
1334 const missingAttachmentAction = " If you need to inspect it, ask the user to re-upload."
1335
1336 if parsedMediaType, _, err := mime.ParseMediaType(mediaType); err == nil {
1337 mediaType = parsedMediaType
1338 }
1339 mediaType = strings.TrimSpace(mediaType)
1340 if mediaType == "" || mediaType == "application/octet-stream" {
1341 return missingAttachmentBody + missingAttachmentAction
1342 }
1343 return fmt.Sprintf(
1344 "%s Reported MIME type: %s.%s",
1345 missingAttachmentBody,
1346 mediaType,
1347 missingAttachmentAction,
1348 )
1349}
1350
1351// fileReferencePartToText formats a file-reference SDK part as
1352// plain text for LLM consumption. LLMs don't understand

Callers 1

partsToMessagePartsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected