diff --git a/packages/frontend/core/src/blocksuite/ai/chat-panel/chat-panel-messages.ts b/packages/frontend/core/src/blocksuite/ai/chat-panel/chat-panel-messages.ts index e93ca62eee..424a53e0d7 100644 --- a/packages/frontend/core/src/blocksuite/ai/chat-panel/chat-panel-messages.ts +++ b/packages/frontend/core/src/blocksuite/ai/chat-panel/chat-panel-messages.ts @@ -235,7 +235,10 @@ export class ChatPanelMessages extends WithDisposable(ShadowlessElement) { @scroll=${() => this._debouncedOnScroll()} > ${filteredItems.length === 0 - ? html`
+ ? html`
${AffineIcon( isLoading ? 'var(--affine-icon-secondary)' diff --git a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts index 132807866d..7e49bf4bfb 100644 --- a/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts +++ b/packages/frontend/core/src/blocksuite/ai/chat-panel/index.ts @@ -400,7 +400,7 @@ export class ChatPanel extends SignalWatcher( .createSessionId=${this._createSessionId} .updateContext=${this.updateContext} .host=${this.host} - .isLoading=${this.isLoading || !this._isInitialized} + .isLoading=${this.isLoading} .previewSpecBuilder=${this.previewSpecBuilder} > (this._enabled$, false); + createSignalFromObservable( + this._enabled$, + undefined + ); this.enabled = enabled; this.disposables.push(enabledCleanup); const { signal: visible, cleanup: visibleCleanup } = - createSignalFromObservable(this._visible$, false); + createSignalFromObservable( + this._visible$, + undefined + ); this.visible = visible; this.disposables.push(visibleCleanup); } @@ -35,8 +42,10 @@ export class AINetworkSearchService extends Service { this.featureFlagService.flags.enable_ai_network_search.$; private readonly _enabled$ = LiveData.from( - this.globalStateService.globalState.watch(AI_NETWORK_SEARCH_KEY), - false + this.globalStateService.globalState + .watch(AI_NETWORK_SEARCH_KEY) + .pipe(map(v => (v === undefined ? true : v))), + undefined ); setEnabled = (enabled: boolean) => { diff --git a/tests/affine-cloud-copilot/e2e/basic/authority.spec.ts b/tests/affine-cloud-copilot/e2e/basic/authority.spec.ts index 7bf8ec4dff..68a51c1065 100644 --- a/tests/affine-cloud-copilot/e2e/basic/authority.spec.ts +++ b/tests/affine-cloud-copilot/e2e/basic/authority.spec.ts @@ -9,6 +9,12 @@ test.describe('AIBasic/Authority', () => { await utils.chatPanel.openChatPanel(page); }); + test('should show messages placeholder when no login', async ({ page }) => { + await expect( + page.getByTestId('chat-panel-messages-placeholder') + ).toBeVisible(); + }); + test('should show error & login button when no login', async ({ page, utils, diff --git a/tests/affine-cloud-copilot/e2e/utils/chat-panel-utils.ts b/tests/affine-cloud-copilot/e2e/utils/chat-panel-utils.ts index e550c54320..7b0550019b 100644 --- a/tests/affine-cloud-copilot/e2e/utils/chat-panel-utils.ts +++ b/tests/affine-cloud-copilot/e2e/utils/chat-panel-utils.ts @@ -33,6 +33,9 @@ export class ChatPanelUtils { } await page.getByTestId('sidebar-tab-chat').click(); await expect(page.getByTestId('sidebar-tab-content-chat')).toBeVisible(); + // TODO: remove this + // after network search is disabled by default + await this.disableNetworkSearch(page); } public static async typeChat(page: Page, content: string) { @@ -48,7 +51,6 @@ export class ChatPanelUtils { } public static async makeChat(page: Page, content: string) { - await this.openChatPanel(page); await this.typeChat(page, content); await page.keyboard.press('Enter'); }