Keep loading prompt after summary

This commit is contained in:
Webifi 2023-08-25 00:24:26 -05:00
parent d4e12b49fb
commit a8e7ad0ff6
2 changed files with 4 additions and 12 deletions

View File

@ -313,6 +313,8 @@
} catch (e) { } catch (e) {
console.error('Error generating name suggestion', e, e.stack) console.error('Error generating name suggestion', e, e.stack)
} }
chatRequest.updating = false
chatRequest.updatingMessage = ''
if (response.hasError()) { if (response.hasError()) {
addMessage(chatId, { addMessage(chatId, {
role: 'error', role: 'error',

View File

@ -37,8 +37,8 @@ export const chatRequest = async (
* We'll get the response a token at a time, as soon as they are ready * We'll get the response a token at a time, as soon as they are ready
*/ */
chatResponse.onFinish(() => { chatResponse.onFinish(() => {
chatRequest.updating = false // chatRequest.updating = false
chatRequest.updatingMessage = '' // chatRequest.updatingMessage = ''
}) })
fetchEventSource(getEndpoint(model), { fetchEventSource(getEndpoint(model), {
...fetchOptions, ...fetchOptions,
@ -59,8 +59,6 @@ export const chatRequest = async (
} }
}, },
onclose () { onclose () {
chatRequest.updating = false
chatRequest.updatingMessage = ''
chatResponse.updateFromClose() chatResponse.updateFromClose()
}, },
onerror (err) { onerror (err) {
@ -76,8 +74,6 @@ export const chatRequest = async (
} }
} }
}).catch(err => { }).catch(err => {
chatRequest.updating = false
chatRequest.updatingMessage = ''
chatResponse.updateFromError(err.message) chatResponse.updateFromError(err.message)
}) })
} else { } else {
@ -90,9 +86,6 @@ export const chatRequest = async (
await chatRequest.handleError(response) await chatRequest.handleError(response)
} else { } else {
const json = await response.json() const json = await response.json()
// Remove updating indicator
chatRequest.updating = false
chatRequest.updatingMessage = ''
chatResponse.updateFromSyncResponse(json) chatResponse.updateFromSyncResponse(json)
} }
} }
@ -156,9 +149,6 @@ export const imageRequest = async (
await chatRequest.handleError(response) await chatRequest.handleError(response)
} else { } else {
const json = await response.json() const json = await response.json()
// Remove updating indicator
chatRequest.updating = false
chatRequest.updatingMessage = ''
// console.log('image json', json, json?.data[0]) // console.log('image json', json, json?.data[0])
const images = json?.data.map(d => d.b64_json) const images = json?.data.map(d => d.b64_json)
chatResponse.updateImageFromSyncResponse(images, prompt, imageModel) chatResponse.updateImageFromSyncResponse(images, prompt, imageModel)