mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-20 22:02:38 +00:00
added logic to skip rendering pending tool (#1250)
This commit is contained in:
parent
2d16d73ba1
commit
b065ce75b5
2 changed files with 7 additions and 0 deletions
|
|
@ -67,6 +67,7 @@ export class MessageList extends LitElement {
|
||||||
.pendingToolCalls=${this.pendingToolCalls}
|
.pendingToolCalls=${this.pendingToolCalls}
|
||||||
.toolResultsById=${resultByCallId}
|
.toolResultsById=${resultByCallId}
|
||||||
.hideToolCalls=${false}
|
.hideToolCalls=${false}
|
||||||
|
.hidePendingToolCalls=${this.isStreaming}
|
||||||
.onCostClick=${this.onCostClick}
|
.onCostClick=${this.onCostClick}
|
||||||
></assistant-message>`,
|
></assistant-message>`,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,7 @@ export class AssistantMessage extends LitElement {
|
||||||
@property({ type: Boolean }) hideToolCalls = false;
|
@property({ type: Boolean }) hideToolCalls = false;
|
||||||
@property({ type: Object }) toolResultsById?: Map<string, ToolResultMessageType>;
|
@property({ type: Object }) toolResultsById?: Map<string, ToolResultMessageType>;
|
||||||
@property({ type: Boolean }) isStreaming: boolean = false;
|
@property({ type: Boolean }) isStreaming: boolean = false;
|
||||||
|
@property({ type: Boolean }) hidePendingToolCalls = false;
|
||||||
@property({ attribute: false }) onCostClick?: () => void;
|
@property({ attribute: false }) onCostClick?: () => void;
|
||||||
|
|
||||||
protected override createRenderRoot(): HTMLElement | DocumentFragment {
|
protected override createRenderRoot(): HTMLElement | DocumentFragment {
|
||||||
|
|
@ -116,6 +117,11 @@ export class AssistantMessage extends LitElement {
|
||||||
const tool = this.tools?.find((t) => t.name === chunk.name);
|
const tool = this.tools?.find((t) => t.name === chunk.name);
|
||||||
const pending = this.pendingToolCalls?.has(chunk.id) ?? false;
|
const pending = this.pendingToolCalls?.has(chunk.id) ?? false;
|
||||||
const result = this.toolResultsById?.get(chunk.id);
|
const result = this.toolResultsById?.get(chunk.id);
|
||||||
|
// Skip rendering pending tool calls when hidePendingToolCalls is true
|
||||||
|
// (used to prevent duplication when StreamingMessageContainer is showing them)
|
||||||
|
if (this.hidePendingToolCalls && pending && !result) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// A tool call is aborted if the message was aborted and there's no result for this tool call
|
// A tool call is aborted if the message was aborted and there's no result for this tool call
|
||||||
const aborted = this.message.stopReason === "aborted" && !result;
|
const aborted = this.message.stopReason === "aborted" && !result;
|
||||||
orderedParts.push(
|
orderedParts.push(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue