mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-25 15:51:12 +00:00
fix: announce chat replies from the active pane
This commit is contained in:
@@ -1944,6 +1944,7 @@ class ChatPane extends OpenClawLightDomElement {
|
||||
transcript: this.transcript,
|
||||
paneId: this.paneId,
|
||||
sessionKey: state.sessionKey,
|
||||
announceTranscript: this.active,
|
||||
onSessionKeyChange: (next) => {
|
||||
this.onPaneSessionChange?.(this.paneId, next);
|
||||
},
|
||||
|
||||
@@ -1103,6 +1103,45 @@ describe("chat transcript rendering", () => {
|
||||
"New answer",
|
||||
);
|
||||
});
|
||||
|
||||
it("does not announce appended rows from an inactive split pane", () => {
|
||||
const transcript = new ChatTranscriptController({
|
||||
addController: () => undefined,
|
||||
removeController: () => undefined,
|
||||
requestUpdate: () => undefined,
|
||||
updateComplete: Promise.resolve(true),
|
||||
} satisfies ReactiveControllerHost);
|
||||
const container = document.createElement("div");
|
||||
const existing = {
|
||||
__testVirtualRow: true,
|
||||
__testVirtualKey: "assistant-1",
|
||||
__testVirtualRole: "assistant",
|
||||
content: "Existing answer",
|
||||
};
|
||||
const appended = {
|
||||
__testVirtualRow: true,
|
||||
__testVirtualKey: "assistant-2",
|
||||
__testVirtualRole: "assistant",
|
||||
content: "New answer",
|
||||
};
|
||||
|
||||
render(
|
||||
renderChat(createChatProps({ announceTranscript: false, transcript, messages: [existing] })),
|
||||
container,
|
||||
);
|
||||
render(
|
||||
renderChat(
|
||||
createChatProps({
|
||||
announceTranscript: false,
|
||||
transcript,
|
||||
messages: [existing, appended],
|
||||
}),
|
||||
),
|
||||
container,
|
||||
);
|
||||
|
||||
expect(container.querySelector(".chat-transcript-announcement")?.textContent).toBe("");
|
||||
});
|
||||
});
|
||||
|
||||
describe("chat goal status", () => {
|
||||
|
||||
@@ -72,6 +72,7 @@ export type ChatProps = {
|
||||
transcript: ChatTranscriptController;
|
||||
paneId: string;
|
||||
sessionKey: string;
|
||||
announceTranscript?: boolean;
|
||||
onSessionKeyChange: (next: string) => void;
|
||||
thinkingLevel: string | null;
|
||||
showThinking: boolean;
|
||||
@@ -264,6 +265,7 @@ export function renderChat(props: ChatProps) {
|
||||
{
|
||||
paneId: props.paneId,
|
||||
sessionKey: props.sessionKey,
|
||||
announceTranscript: props.announceTranscript,
|
||||
loading: props.loading,
|
||||
historyPagination: props.historyPagination,
|
||||
messages: props.messages,
|
||||
|
||||
@@ -91,6 +91,7 @@ type ChatThreadState = {
|
||||
type ChatThreadProps = {
|
||||
paneId: string;
|
||||
sessionKey: string;
|
||||
announceTranscript?: boolean;
|
||||
loading: boolean;
|
||||
historyPagination?: {
|
||||
loading: boolean;
|
||||
@@ -1113,7 +1114,7 @@ function renderChatThreadContents(
|
||||
transcriptRows,
|
||||
(row) => (row.kind === "item" ? renderItem(row.item) : row.content),
|
||||
latestTranscriptAnnouncement(collapsedItems),
|
||||
!state.searchOpen && !props.loading,
|
||||
props.announceTranscript !== false && !state.searchOpen && !props.loading,
|
||||
props.historyPagination
|
||||
? renderHistorySentinel(props.historyPagination.loading)
|
||||
: nothing,
|
||||
|
||||
Reference in New Issue
Block a user