Skip to content

Commit f071f25

Browse files
Lightning00BladeDevtools-frontend LUCI CQ
authored andcommitted
[AI Assistance] Fix handle action for old conversations
The issue is that we re-run the contestation from history even if the agent didn't change. Bug: 379614235 Change-Id: I332312dd446908c2a0a113fc186a8a89630773eb Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6025273 Auto-Submit: Nikolay Vitkov <[email protected]> Reviewed-by: Alex Rudenko <[email protected]> Commit-Queue: Alex Rudenko <[email protected]>
1 parent 0281cab commit f071f25

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

front_end/panels/freestyler/FreestylerPanel.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -617,18 +617,22 @@ export class FreestylerPanel extends UI.Panel.Panel {
617617
return;
618618
}
619619

620+
let newAgent = false;
620621
if (!this.#currentAgent || this.#currentAgent.type !== targetAgentType || this.#currentAgent.isHistoryEntry ||
621622
targetAgentType === AgentType.DRJONES_PERFORMANCE) {
622623
this.#currentAgent = this.#createAgent(targetAgentType);
624+
newAgent = true;
623625
}
624626
this.#viewProps.agentType = this.#currentAgent.type;
625627
this.#viewOutput.freestylerChatUi?.focusTextInput();
626628
Host.userMetrics.actionTaken(Host.UserMetrics.Action.FreestylerOpenedFromElementsPanelFloatingButton);
627-
this.#viewProps.messages = [];
628629
this.#onContextSelectionChanged();
629630
void this.doUpdate();
630-
this.#viewProps.isReadOnly = false;
631-
void this.#doConversation(this.#currentAgent.runFromHistory());
631+
if (newAgent) {
632+
this.#viewProps.messages = [];
633+
this.#viewProps.isReadOnly = false;
634+
void this.#doConversation(this.#currentAgent.runFromHistory());
635+
}
632636
}
633637

634638
#onHistoryClicked(event: Event): void {

0 commit comments

Comments
 (0)