From d23473a305bf825940cffee0bc60da8e62b772ad Mon Sep 17 00:00:00 2001 From: codewithcheese Date: Thu, 1 Aug 2024 23:57:57 +1000 Subject: [PATCH] Fix onSubmit return promise used by test to wait for response --- src/lib/chat-service.svelte.ts | 2 +- src/routes/(app)/chat/[id]/revise/RevisePage.svelte | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/chat-service.svelte.ts b/src/lib/chat-service.svelte.ts index a882aec..ec80b99 100644 --- a/src/lib/chat-service.svelte.ts +++ b/src/lib/chat-service.svelte.ts @@ -417,7 +417,7 @@ export class ChatService { } submit(requestOptions: ChatRequestOptions = {}) { - this.triggerRequest(this.createChatRequest(requestOptions)); + return this.triggerRequest(this.createChatRequest(requestOptions)); } handleOnFinish = () => { diff --git a/src/routes/(app)/chat/[id]/revise/RevisePage.svelte b/src/routes/(app)/chat/[id]/revise/RevisePage.svelte index c2176c2..d80ea9c 100644 --- a/src/routes/(app)/chat/[id]/revise/RevisePage.svelte +++ b/src/routes/(app)/chat/[id]/revise/RevisePage.svelte @@ -97,7 +97,7 @@ if (lastMessage && lastMessage.role === "assistant") { chatService.messages.pop(); } - return chatService.submit({ + chatService.submit({ options: { body: { providerId: model.service.providerId, @@ -107,6 +107,7 @@ }, }, }); + return true; } onMount(() => {