Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 28 additions & 9 deletions console/src/pages/Chat/sessionApi/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,34 @@ function extractTextFromContent(content: unknown): string {
.join("\n");
}

const INTERNAL_OUTPUT_TYPES = new Set([

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Filter all internal runtime event message types

The internal-type filter is incomplete: it excludes some tool/runtime events but leaves other non-chat event types unfiltered, so shouldRenderOutputMessage can still surface internal execution traffic in history when those message types appear. To match the stated behavior, expand this set (or switch to an explicit allowlist of user-visible message types).

Useful? React with 👍 / 👎.

"reasoning",
"plugin_call",
"plugin_call_output",
"function_call",
"function_call_output",
"mcp_call",
"mcp_call_output",
"mcp_tool_call",
"mcp_tool_call_output",
]);

/**
* Return true when a backend message is safe to show in customer chat history.
* Internal reasoning/tool/MCP events are execution details, not chat content.
*/
function shouldRenderOutputMessage(msg: Message): boolean {
if (INTERNAL_OUTPUT_TYPES.has(String(msg.type || ""))) return false;
if (msg.role === "system") return false;
return true;
}

/**
* Convert a backend message to a response output message.
* - Maps system + plugin_call_output → role "tool"
* - Strips metadata (not used in card rendering)
*/
function toOutputMessage(msg: Message): OutputMessage {
let role = msg.role;
if (msg.type === "plugin_call_output" && role === "system") {
role = "tool";
}
const role = msg.role;
return {
...msg,
role,
Expand Down Expand Up @@ -145,9 +163,8 @@ function buildResponseCard(
* the @agentscope-ai/chat component.
*
* - User messages → AgentScopeRuntimeRequestCard
* - Consecutive non-user messages (assistant / system / tool) → grouped
* into a single AgentScopeRuntimeResponseCard with all messages in
* the `output` array, supporting plugin_call & plugin_call_output.
* - Consecutive non-user messages are grouped into one response card.
* - Internal reasoning/tool events are intentionally hidden from customer chat.
*/
function convertMessages(
messages: Message[],
Expand All @@ -165,7 +182,9 @@ function convertMessages(
// Group consecutive non-user messages into one response card
const outputMsgs: OutputMessage[] = [];
while (i < messages.length && messages[i].role !== "user") {
outputMsgs.push(toOutputMessage(messages[i]));
if (shouldRenderOutputMessage(messages[i])) {
outputMsgs.push(toOutputMessage(messages[i]));
}
i++;
}
if (outputMsgs.length > 0) {
Expand Down
4 changes: 4 additions & 0 deletions console/src/styles/layout.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ body {
background: transparent !important;
}

.page-content-chat .adclaw-operate-card {
display: none !important;
Comment on lines +74 to +75

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep approval cards visible on chat pages

This selector hides every adclaw-operate-card, not just reasoning/tool trace rows, so approval UIs are also suppressed; when an MCP/tool flow emits an approval request card, users cannot see or act on it and the run can stall waiting for input. This affects any environment where approval-gated tool execution is enabled.

Useful? React with 👍 / 👎.

}

.page-content-chat .adclaw-chat-anywhere-welcome-default-prompt {
background-color: rgba(255, 255, 255, 0.84) !important;
border: 1px solid rgba(226, 232, 240, 0.72);
Expand Down
Loading