MCPcopy Create free account
hub / github.com/aiprodcoder/MIXAPI / buildMessageContent

Function buildMessageContent

web/src/helpers/utils.js:363–381  ·  view source on GitHub ↗
(textContent, imageUrls = [], imageEnabled = false)

Source from the content-addressed store, hash-verified

361
362// 构建消息内容(包含图片)
363export const buildMessageContent = (textContent, imageUrls = [], imageEnabled = false) => {
364 if (!textContent && (!imageUrls || imageUrls.length === 0)) {
365 return '';
366 }
367
368 const validImageUrls = imageUrls.filter(url => url && url.trim() !== '');
369
370 if (imageEnabled && validImageUrls.length > 0) {
371 return [
372 { type: 'text', text: textContent || '' },
373 ...validImageUrls.map(url => ({
374 type: 'image_url',
375 image_url: { url: url.trim() }
376 }))
377 ];
378 }
379
380 return textContent || '';
381};
382
383// 创建新消息
384export const createMessage = (role, content, options = {}) => ({

Callers 2

index.jsFile · 0.90
onMessageSendFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected