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
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,26 @@ describe('dao-chat-view element picker', () => {
expect(screenshotButton?.nextElementSibling).toBe(sendButton);
});

it('hides the empty guide and chip row until the panel has an agent',
async () => {
const view = document.createElement('dao-chat-view') as HTMLElement & {
render: () => unknown;
};
const before = templateText(view.render());
expect(before).not.toContain('class="dao-empty-guide"');
expect(before).not.toContain('class="dao-page-chip-row"');

const {view: mounted} = await mountChatViewWithSend(vi.fn());
try {
const after = templateText(
(mounted as unknown as {render: () => unknown}).render());
expect(after).toContain('class="dao-empty-guide"');
expect(after).toContain('class="dao-page-chip-row"');
} finally {
clearTabWatchTimer(mounted);
}
});

it('sends only the element screenshot image attachment', async () => {
const originalSend = vi.fn(async () => 'sent');
const {view, iface} = await mountChatViewWithSend(originalSend);
Expand Down
15 changes: 14 additions & 1 deletion src/dao/browser/ui/webui/resources/agent/dao_chat_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ export class DaoChatView extends CrLitElement {
dreamReport_: {type: Object, state: true},
proactiveSuggestion_: {type: Object, state: true},
proactiveRunning_: {type: Boolean, state: true},
agentReady_: {type: Boolean, state: true},
};
}

Expand Down Expand Up @@ -351,6 +352,7 @@ export class DaoChatView extends CrLitElement {
this.proactiveSuggestion_ = null;
this.proactiveSuggestionReceivedAtMs_ = 0;
this.proactiveRunning_ = false;
this.agentReady_ = false;
this.restoreProactiveNeverHereKeys_();
this.restoreProactiveNotNowSnoozes_();
}
Expand Down Expand Up @@ -389,6 +391,10 @@ export class DaoChatView extends CrLitElement {
private panel_: PiChatPanel | null = null;
private mounted_ = false;
private mountSucceeded_ = false;
// True once pi-chat-panel has an agent. Until then the panel shows its
// "No agent set" placeholder, so Dao's overlays (empty guide, chip row)
// stay hidden instead of floating over it.
declare protected agentReady_: boolean;
// Resolves once mount_() has finished (including maybeResumeLastSession_).
// Awaited by submitExternalPrompt so the resume probe can't land after a
// Cmd+L/Cmd+T-driven startNewSession() and re-hydrate the old conversation.
Expand Down Expand Up @@ -645,7 +651,7 @@ export class DaoChatView extends CrLitElement {
let stateClass = 'idle';
if (ratio >= 0.75) stateClass = 'hot';
else if (ratio >= 0.5) stateClass = 'warm';
const showEmptyGuide =
const showEmptyGuide = this.agentReady_ &&
this.messageCount_ === 0 && !this.isStreaming_ && !this.compacting_;

return html`
Expand Down Expand Up @@ -970,6 +976,12 @@ export class DaoChatView extends CrLitElement {
</dao-chat-history-panel>
${this.renderSkillPicker_()}
${this.renderUserContextModal_()}
${this.renderPageChipRow_()}`;
}

private renderPageChipRow_() {
if (!this.agentReady_) return nothing;
return html`
<div class="dao-page-chip-row">
<button class=${'dao-element-pick-button' +
(this.elementPickMode_ === 'context' ? ' active' : '')}
Expand Down Expand Up @@ -1323,6 +1335,7 @@ export class DaoChatView extends CrLitElement {
onApiKeyRequired: this.onApiKeyRequired_.bind(this),
toolsFactory: () => tools,
});
this.agentReady_ = true;

// ChatPanel.setAgent() force-enables the model selector, attachments,
// and thinking-level picker on its internal <agent-interface>. Dao
Expand Down
Loading