Ver Fonte

fix: openai issue

Timothy J. Baek há 1 ano atrás
pai
commit
eda157e303
2 ficheiros alterados com 10 adições e 10 exclusões
  1. 5 5
      src/routes/(app)/+page.svelte
  2. 5 5
      src/routes/(app)/c/[id]/+page.svelte

+ 5 - 5
src/routes/(app)/+page.svelte

@@ -520,11 +520,6 @@
 	const sendPromptOpenAI = async (model, userPrompt, responseMessageId, _chatId) => {
 		const responseMessage = history.messages[responseMessageId];
 
-		// Wait until history/message have been updated
-		await tick();
-
-		scrollToBottom();
-
 		const docs = messages
 			.filter((message) => message?.files ?? null)
 			.map((message) =>
@@ -593,6 +588,11 @@
 				: `${OPENAI_API_BASE_URL}`
 		);
 
+		// Wait until history/message have been updated
+		await tick();
+
+		scrollToBottom();
+
 		if (res && res.ok) {
 			const reader = res.body
 				.pipeThrough(new TextDecoderStream())

+ 5 - 5
src/routes/(app)/c/[id]/+page.svelte

@@ -536,11 +536,6 @@
 	const sendPromptOpenAI = async (model, userPrompt, responseMessageId, _chatId) => {
 		const responseMessage = history.messages[responseMessageId];
 
-		// Wait until history/message have been updated
-		await tick();
-
-		scrollToBottom();
-
 		const docs = messages
 			.filter((message) => message?.files ?? null)
 			.map((message) =>
@@ -607,6 +602,11 @@
 				: `${OPENAI_API_BASE_URL}`
 		);
 
+		// Wait until history/message have been updated
+		await tick();
+
+		scrollToBottom();
+
 		if (res && res.ok) {
 			const reader = res.body
 				.pipeThrough(new TextDecoderStream())