fix: openai issue

This commit is contained in:
Timothy J. Baek 2024-03-31 21:02:29 -07:00
parent 653a0ff02f
commit eda157e303
2 changed files with 10 additions and 10 deletions

View file

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

View file

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