MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / normalizeMoonshotContent

Function normalizeMoonshotContent

web/src/llm-api/moonshot.ts:184–201  ·  view source on GitHub ↗
(
  content: ChatCompletionRequestBody['messages'][number]['content'],
)

Source from the content-addressed store, hash-verified

182}
183
184function normalizeMoonshotContent(
185 content: ChatCompletionRequestBody['messages'][number]['content'],
186): ChatCompletionRequestBody['messages'][number]['content'] {
187 if (!Array.isArray(content)) {
188 return content
189 }
190
191 return content.map((part) => {
192 if (!part || typeof part !== 'object') {
193 return part
194 }
195 const { cache_control: _cacheControl, ...rest } =
196 part as ChatCompletionContentPart & {
197 cache_control?: unknown
198 }
199 return rest
200 })
201}
202
203function normalizeMoonshotTool(tool: ChatCompletionTool): ChatCompletionTool {
204 const { function: fn, ...rest } = tool

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected