Skip to content

Conversation

@marker-dao
Copy link
Contributor

No description provided.

@marker-dao marker-dao self-assigned this Jan 13, 2026
@marker-dao marker-dao marked this pull request as ready for review January 13, 2026 19:21
@marker-dao marker-dao requested review from a team as code owners January 13, 2026 19:21
Copilot AI review requested due to automatic review settings January 13, 2026 19:21
Copy link
Contributor

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 pull request integrates an Accordion component into the Chat widget's MessageBubble to display function call metadata. The feature allows chat messages to include information about AI assistant function calls, showing the function name, arguments, and results in an expandable accordion interface.

Changes:

  • Added TypeScript type definitions for FunctionCall, FunctionCallArgument, and MetaData types
  • Extended TextMessage type to include optional metadata field
  • Implemented accordion rendering in MessageBubble to display function call details
  • Added localization strings for function call UI labels across all supported languages
  • Updated playground example to demonstrate the new functionality

Reviewed changes

Copilot reviewed 33 out of 34 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
packages/devextreme/js/ui/chat.d.ts Added TypeScript definitions for function call metadata types and extended TextMessage
packages/devextreme/js/__internal/ui/chat/messagegroup.ts Passed metadata from message to MessageBubble options
packages/devextreme/js/__internal/ui/chat/messagebubble.ts Implemented accordion rendering for function call metadata, added element creation and option change handling
packages/devextreme/js/localization/messages/*.json Added localization strings for function call labels in 31 language files
packages/devextreme/playground/jquery.html Updated playground to demonstrate Chat widget with function call metadata

"dxChat-fileViewLabel": "File list",
"dxChat-downloadButtonLabel": "Download file {0}",
"dxChat-fileLimitReachedWarning": "You selected too many files. Select no more than {0} files and retry.",
"dxChat-functionCallTitle": "function called",
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The localization key "dxChat-functionCallTitle" is missing the placeholder {0} in the English locale, but it's included in other locales. This will cause the function name to not be displayed in the title when using English. The value should be "{0} function called" to match the pattern used in other locales.

Suggested change
"dxChat-functionCallTitle": "function called",
"dxChat-functionCallTitle": "{0} function called",

Copilot uses AI. Check for mistakes.
const { functionCall } = metadata;

const accordionItems = [{
title: `${messageLocalization.format('dxChat-functionCallTitle')}`,
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The accordion title uses template string formatting but doesn't actually interpolate the function name. Line 169 should interpolate the function name into the title, e.g., messageLocalization.format('dxChat-functionCallTitle', functionCall.name) to properly display which function was called in the accordion header.

Suggested change
title: `${messageLocalization.format('dxChat-functionCallTitle')}`,
title: messageLocalization.format('dxChat-functionCallTitle', functionCall.name),

Copilot uses AI. Check for mistakes.
Comment on lines +77 to +88
_renderFunctionCallElement(): void {
const { metadata, isDeleted } = this.option();

this._$functionCall?.remove();
this._$functionCall = undefined;

if (metadata?.functionCall && !isDeleted) {
this._$functionCall = $('<div>')
.addClass(CHAT_MESSAGEBUBBLE_FUNCTIONCALL_CLASS)
.appendTo(this.$element());
}
}
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The new metadata and functionCall functionality lacks test coverage. Based on the existing test patterns for similar features (like attachments), tests should be added to verify: 1) rendering the accordion when metadata.functionCall is provided, 2) not rendering when metadata is absent, 3) not rendering when isDeleted is true, 4) updating the accordion when metadata option changes at runtime, and 5) proper display of function name, arguments, and result.

Copilot uses AI. Check for mistakes.
"dxChat-fileViewLabel": "File list",
"dxChat-downloadButtonLabel": "Download file {0}",
"dxChat-fileLimitReachedWarning": "You selected too many files. Select no more than {0} files and retry.",
"dxChat-functionCallTitle": "function called",
Copy link

Copilot AI Jan 13, 2026

Choose a reason for hiding this comment

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

The localization key "dxChat-functionCallTitle" is missing the placeholder {0} in the Russian locale. The value should include {0} to display the function name in the title, similar to other locales. For example: "{0} вызвана функция" or "вызвана функция {0}" depending on the proper Russian grammar.

Suggested change
"dxChat-functionCallTitle": "function called",
"dxChat-functionCallTitle": "{0} function called",

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant