+
{#if !assistantMode}
{/if}
@@ -393,31 +392,15 @@
maxRows={10}
innerWrappedClass="p-px bg-white dark:bg-gray-700"
/>
-
{#if !$isLoading && $status !== 'in_progress'}
-
+ Send message
-
-
Send message
-
{:else}
-
Cancel message
+
Cancel message
{/if}
diff --git a/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/ChatPageWithToast.test.svelte b/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/ChatPageWithToast.test.svelte
index 0936665cf..0406985a5 100644
--- a/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/ChatPageWithToast.test.svelte
+++ b/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/ChatPageWithToast.test.svelte
@@ -1,12 +1,9 @@
-
+
diff --git a/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/chatpage.test.ts b/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/chatpage.test.ts
index 21857b0e8..eea671ab2 100644
--- a/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/chatpage.test.ts
+++ b/src/leapfrogai_ui/src/routes/chat/(dashboard)/[[thread_id]]/chatpage.test.ts
@@ -21,17 +21,10 @@ import { mockOpenAI } from '../../../../../vitest-setup';
import { ERROR_GETTING_AI_RESPONSE_TOAST, ERROR_SAVING_MSG_TOAST } from '$constants/toastMessages';
import { faker } from '@faker-js/faker';
-import type { LFThread } from '$lib/types/threads';
-import type { LFAssistant } from '$lib/types/assistants';
import { delay } from '$helpers/chatHelpers';
import { mockGetFiles } from '$lib/mocks/file-mocks';
import { threadsStore } from '$stores';
-type LayoutServerLoad = {
- threads: LFThread[];
- assistants: LFAssistant[];
-} | null;
-let data: LayoutServerLoad;
const question = 'What is AI?';
const assistant1 = getFakeAssistant();
@@ -71,7 +64,7 @@ describe('when there is an active thread selected', () => {
});
it('it renders all the messages', async () => {
- render(ChatPage, { data });
+ render(ChatPage);
for (let i = 0; i < fakeThreads[0].messages!.length; i++) {
await screen.findByText(getMessageText(fakeThreads[0].messages![i]));
@@ -79,7 +72,7 @@ describe('when there is an active thread selected', () => {
});
test('the send button is disabled when there is no text in the input', () => {
- render(ChatPage, { data });
+ render(ChatPage);
const submitBtn = screen.getByTestId('send message');
expect(submitBtn).toHaveProperty('disabled', true);
});
@@ -88,7 +81,7 @@ describe('when there is an active thread selected', () => {
mockChatCompletion();
mockNewMessage();
- const { getByTestId } = render(ChatPage, { data });
+ const { getByTestId } = render(ChatPage);
const input = getByTestId('chat-input') as HTMLInputElement;
const submitBtn = getByTestId('send message');
@@ -109,7 +102,7 @@ describe('when there is an active thread selected', () => {
mockNewMessage();
mockChatCompletion({ delayTime });
- const { getByTestId } = render(ChatPage, { data });
+ const { getByTestId } = render(ChatPage);
const input = getByTestId('chat-input') as HTMLInputElement;
const submitBtn = getByTestId('send message');
@@ -125,7 +118,7 @@ describe('when there is an active thread selected', () => {
});
it('disables the send button if the message length is too long', async () => {
- const { getByTestId } = render(ChatPage, { data });
+ const { getByTestId } = render(ChatPage);
const input = getByTestId('chat-input') as HTMLInputElement;
const submitBtn = getByTestId('send message');
const limitText = faker.string.alpha({ length: 101 });
@@ -139,7 +132,7 @@ describe('when there is an active thread selected', () => {
it.skip('displays a toast error notification when there is an error with the AI response', async () => {
mockChatCompletionError();
mockNewMessage();
- const { getByTestId } = render(ChatPageWithToast, { data });
+ const { getByTestId } = render(ChatPageWithToast);
const input = getByTestId('chat-input') as HTMLInputElement;
const submitBtn = getByTestId('send message');
@@ -152,7 +145,7 @@ describe('when there is an active thread selected', () => {
it('displays an error message when there is an error saving the response', async () => {
mockNewMessageError();
- const { getByTestId } = render(ChatPageWithToast, { data });
+ const { getByTestId } = render(ChatPageWithToast);
const input = getByTestId('chat-input') as HTMLInputElement;
const submitBtn = getByTestId('send message');
@@ -173,7 +166,7 @@ describe('when there is an active thread selected', () => {
});
mockNewMessage();
- const { getByTestId } = render(ChatPageWithToast, { data });
+ const { getByTestId } = render(ChatPageWithToast);
const input = getByTestId('chat-input') as HTMLInputElement;
const submitBtn = getByTestId('send message');
@@ -190,7 +183,7 @@ describe('when there is an active thread selected', () => {
it('has a button to go to the assistants management page in the assistant dropdown', async () => {
const goToSpy = vi.spyOn(navigation, 'goto');
- const { getByRole, getByTestId } = render(ChatPage, { data });
+ const { getByRole, getByTestId } = render(ChatPage);
const assistantSelect = getByTestId('assistants-select-btn');
await userEvent.click(assistantSelect);
diff --git a/src/leapfrogai_ui/tests/chat.test.ts b/src/leapfrogai_ui/tests/chat.test.ts
index e4d6c1fb3..f1b181055 100644
--- a/src/leapfrogai_ui/tests/chat.test.ts
+++ b/src/leapfrogai_ui/tests/chat.test.ts
@@ -57,7 +57,7 @@ test('it saves in progress responses when interrupted by changing threads', asyn
await sendMessage(page, uniqueLongMessagePrompt);
await expect(messages).toHaveCount(2);
- await page.getByText('New Chat').click();
+ await page.getByText('New chat').click();
await expect(messages).toHaveCount(0);
await page.getByText(uniqueLongMessagePrompt).click(); // switch back to original thread
await expect(messages).toHaveCount(2);
diff --git a/src/leapfrogai_ui/tests/helpers/threadHelpers.ts b/src/leapfrogai_ui/tests/helpers/threadHelpers.ts
index 12c81ffae..6fa2fea47 100644
--- a/src/leapfrogai_ui/tests/helpers/threadHelpers.ts
+++ b/src/leapfrogai_ui/tests/helpers/threadHelpers.ts
@@ -4,6 +4,8 @@ import type { Profile } from '$lib/types/profile';
import { supabase } from './helpers';
export const clickToDeleteThread = async (page: Page, label: string) => {
+ const threads = page.getByTestId('threads');
+ await threads.getByText(label).hover();
await page.getByTestId(`thread-menu-btn-${label}`).click();
await page.getByRole('button', { name: /delete/i }).click();
const deleteBtns = await page.getByRole('button', { name: /delete/i }).all();
diff --git a/src/leapfrogai_ui/tests/sidebar.test.ts b/src/leapfrogai_ui/tests/sidebar.test.ts
index ce95521c4..1d5ad8b98 100644
--- a/src/leapfrogai_ui/tests/sidebar.test.ts
+++ b/src/leapfrogai_ui/tests/sidebar.test.ts
@@ -33,6 +33,8 @@ test('can edit thread labels', async ({ page, openAIClient }) => {
await sendMessage(page, newMessage1);
await expect(messages).toHaveCount(2);
+ const threads = page.getByTestId('threads');
+ await threads.getByText(newMessage1).hover();
const threadMenuBtn = page.getByTestId(`thread-menu-btn-${newMessage1}`);
await threadMenuBtn.click();
@@ -60,7 +62,7 @@ test('Can switch threads', async ({ page, openAIClient }) => {
await waitForResponseToComplete(page);
await expect(messages).toHaveCount(4);
- await page.getByText('New Chat').click();
+ await page.getByText('New chat').click();
await expect(messages).toHaveCount(0);
await sendMessage(page, newMessage3);
await waitForResponseToComplete(page);