Skip to content

Rich UI copy btn and content not replacing#163

Open
LAVI9966 wants to merge 2 commits intoWalkover-Web-Solution:testingfrom
LAVI9966:rich_ui_copy_btn_and_content_not_replacing
Open

Rich UI copy btn and content not replacing#163
LAVI9966 wants to merge 2 commits intoWalkover-Web-Solution:testingfrom
LAVI9966:rich_ui_copy_btn_and_content_not_replacing

Conversation

@LAVI9966
Copy link
Copy Markdown

No description provided.

Copilot AI review requested due to automatic review settings March 14, 2026 15:38
@windsurf-bot
Copy link
Copy Markdown

windsurf-bot bot commented Mar 14, 2026

PR review rate limit exceeded

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a “rich UI” rendering path for assistant messages, plus templating utilities intended to support dynamic value replacement (including action definitions and ai_response-driven updates).

Changes:

  • Added a small template engine to resolve {{path}} placeholders in JSON-rich UI payloads and action definitions.
  • Introduced a richUI component system (registry + recursive renderer + multiple UI components) and added rendering support in AssistantMessage.
  • Updated chat-history conversion to populate ai_response from llm_message.item and adjusted copy-to-clipboard behavior for non-string message content.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
utils/templateEngine.ts Adds placeholder/path resolution and node interpolation utilities.
utils/dataConvertWrappers/makeGenericDataFormatUtility.tsx Extracts ai_response from llm_message.item for downstream rendering/replacement.
public/chatbot-local.js Changes the default login endpoint used by the local embed helper.
components/richUI/styleUtils.js Introduces shared style resolution helpers for richUI components.
components/richUI/components/TitleComponent.js New heading component for rich UI JSON rendering.
components/richUI/components/TextComponent.js New text component with optional editable input mode.
components/richUI/components/TableComponent.js New table renderer with optional rich-node cells.
components/richUI/components/SpacerComponent.js New spacer/flex filler component.
components/richUI/components/SelectComponent.js New select component emitting actions on change.
components/richUI/components/RowComponent.js New horizontal layout component with padding/background/border options.
components/richUI/components/ListViewItemComponent.js New list item wrapper component for ListView rendering.
components/richUI/components/ListViewComponent.js New list renderer supporting bindings, templates, and actionDefs forwarding.
components/richUI/components/ImageComponent.js New image component with dimension helpers and error fallback behavior.
components/richUI/components/IconComponent.js New Lucide icon wrapper with size/color helpers.
components/richUI/components/DividerComponent.js New divider component supporting label/flush/opacity customization.
components/richUI/components/DatePickerComponent.js New date/date-range input component emitting actions on change.
components/richUI/components/ColComponent.js New vertical layout component with width/padding/background/border options.
components/richUI/components/CardComponent.js New card container with variants, theming, and footer actions.
components/richUI/components/CaptionComponent.js New caption/label component with sizing and color support.
components/richUI/components/ButtonComponent.js New button component supporting declarative actionRef resolution.
components/richUI/components/BoxComponent.js New generic container/spacer component with dimension and styling options.
components/richUI/components/BadgeComponent.js New badge/chip component.
components/richUI/componentRegistry.js Adds type→component mapping for rich UI nodes.
components/richUI/RenderNode.js Adds recursive renderer for rich UI JSON trees.
components/Interface-Chatbot/Messages/AssistantMessage.tsx Detects rich UI JSON content, renders via RenderNode, and improves copy behavior for non-string content.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +119 to +120
// Default to a class (though it might be purged if not common)
return { className: `text-${color}`, style: {} };
Comment on lines +25 to +27
const safeStyle = safeStyleObj(style);
const [editValue, setEditValue] = useState(String(value));

Comment on lines +44 to +47
// If direction is not explicitly vertical, and we are binding 'buttons' or have an alias 'button', default to horizontal
const resolvedDir =
direction || (binding?.includes("button") || itemAlias?.includes("button") ? "horizontal" : "vertical");

return <div className={`flex-1 min-w-0 min-h-0 ${className}`} aria-hidden="true" />;
}

const px = typeof size === "number" ? size : parseInt(size, 10) || 16;
Comment on lines +27 to +29
const applyAiResponsePaths = (baseNode: any, ai: Record<string, any> = {}) => {
console.log("base Node ", baseNode)
console.log("ai ", ai)
Comment on lines +32 to +49
const setByPath = (obj: any, path: string, value: any) => {
const keys: Array<string | number> = [];
path.replace(/([^[.\]]+)|\[(\d+)\]/g, (_m, prop, idx) => {
keys.push(idx !== undefined ? Number(idx) : prop);
return "";
});

if (!keys.length) return;
let cur = obj;
for (let i = 0; i < keys.length - 1; i++) {
const k = keys[i];
const nk = keys[i + 1];
if (cur[k] === undefined || cur[k] === null) {
cur[k] = typeof nk === "number" ? [] : {};
}
cur = cur[k];
}
cur[keys[keys.length - 1]] = value;
};

export function resolveRounded(rounded, autoRound = false) {
if (rounded) return ROUNDED_MAP[rounded] ?? `rounded-${rounded}`;
Comment on lines +20 to +22
if (columns.length === 0 && data.length > 0) {
columns = Object.keys(data[0]);
}
Comment on lines +56 to +60
const childWithProps = dividers ? { ...child, divider: true } : child;
// If it's a list of buttons horizontally, we probably don't want each inner ListViewItem to have a hover block
if (resolvedDir === "horizontal" && childWithProps.type === "ListViewItem") {
childWithProps.hover = false;
}
Comment on lines 18 to 22
chatbotUrl: 'http://localhost:3001/chatbot',
styleSheet: 'http://localhost:3001/chatbot-style.css',
login: 'http://localhost:7072/api/chatbot/loginuser'
// login: 'https://db.gtwy.ai/api/chatbot/loginuser'
// login: 'http://localhost:7072/api/chatbot/loginuser'
login: 'https://dev-db.gtwy.ai/api/chatbot/loginuser'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants