From a7840b341599ec9333548ae99ca7b6cd21a9cce1 Mon Sep 17 00:00:00 2001 From: Shibani Basava Date: Tue, 13 Feb 2024 09:25:30 +0000 Subject: [PATCH] chore: fix tests and citations --- .../chat-component/src/components/chat-component.ts | 12 +++++++++--- .../chat-component/src/components/chat-context.ts | 3 ++- tests/e2e/webapp.spec.ts | 1 - 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/chat-component/src/components/chat-component.ts b/packages/chat-component/src/components/chat-component.ts index c1149c13..3c5b3351 100644 --- a/packages/chat-component/src/components/chat-component.ts +++ b/packages/chat-component/src/components/chat-component.ts @@ -56,7 +56,7 @@ export class ChatComponent extends LitElement { } @property({ type: String, attribute: 'data-api-url' }) - set apiUrl(value: string = chatHttpOptions.url) { + set apiUrl(value: string) { this.chatContext.apiUrl = value; } @@ -172,8 +172,14 @@ export class ChatComponent extends LitElement { handleCitationClick(event: CustomEvent): void { event?.preventDefault(); - this.chatContext.selectedCitation = event?.detail?.citation; - this.chatContext.selectedChatEntry = event?.detail?.chatThreadEntry; + const citation = event?.detail?.citation; + const chatThreadEntry = event?.detail?.chatThreadEntry; + if (citation) { + this.chatContext.selectedCitation = citation; + } + if (chatThreadEntry) { + this.chatContext.selectedChatEntry = chatThreadEntry; + } this.chatContext.setState('showCitations', true); } diff --git a/packages/chat-component/src/components/chat-context.ts b/packages/chat-component/src/components/chat-context.ts index 22a4173a..36732e81 100644 --- a/packages/chat-component/src/components/chat-context.ts +++ b/packages/chat-component/src/components/chat-context.ts @@ -1,4 +1,5 @@ import { type ReactiveController, type ReactiveControllerHost } from 'lit'; +import { chatHttpOptions } from '../config/global-config.js'; export class ChatContextController implements ReactiveController { host: ReactiveControllerHost; @@ -19,7 +20,7 @@ export class ChatContextController implements ReactiveController { private _selectedChatEntry: ChatThreadEntry | undefined = undefined; - private _apiUrl: string = ''; + private _apiUrl: string = chatHttpOptions.url; private _interactionModel: 'ask' | 'chat' = 'chat'; diff --git a/tests/e2e/webapp.spec.ts b/tests/e2e/webapp.spec.ts index 54a0042a..5a5568fc 100644 --- a/tests/e2e/webapp.spec.ts +++ b/tests/e2e/webapp.spec.ts @@ -438,7 +438,6 @@ test.describe('generate answer', () => { test('follow up questions', async ({ page }) => { const followupQuestions = page.getByTestId('followUpQuestion'); - await followupQuestions.waitFor(); await expect(followupQuestions).toHaveCount(3);