UNPKG

@copilotkit/react-ui

Version:

<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />

56 lines (55 loc) 2.34 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/components/chat/messages/UserMessage.tsx var UserMessage_exports = {}; __export(UserMessage_exports, { UserMessage: () => UserMessage }); module.exports = __toCommonJS(UserMessage_exports); var import_jsx_runtime = require("react/jsx-runtime"); var getTextContent = (content) => { if (typeof content === "undefined") { return void 0; } if (typeof content === "string") { return content; } return content.map((part) => { if (part.type === "text") { return part.text; } return void 0; }).filter((value) => typeof value === "string" && value.length > 0).join(" ").trim() || void 0; }; var UserMessage = (props) => { const { message, ImageRenderer } = props; const isImageMessage = message && "image" in message && Boolean(message.image); if (isImageMessage) { const imageMessage = message; const content2 = getTextContent(imageMessage == null ? void 0 : imageMessage.content); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ImageRenderer, { image: imageMessage.image, content: content2 }) }); } const content = getTextContent(message == null ? void 0 : message.content); return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "copilotKitMessage copilotKitUserMessage", children: content }); }; // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { UserMessage }); //# sourceMappingURL=UserMessage.js.map