This commit is contained in:
Timothy J. Baek 2024-05-13 11:27:58 -10:00
parent 1888327a79
commit 7e0d3496b5
3 changed files with 30 additions and 28 deletions

View File

@ -309,31 +309,33 @@
copyToClipboard={copyToClipboardWithToast} copyToClipboard={copyToClipboardWithToast}
/> />
{:else} {:else}
<ResponseMessage {#key message.id}
{message} <ResponseMessage
modelfiles={selectedModelfiles} {message}
siblings={history.messages[message.parentId]?.childrenIds ?? []} modelfiles={selectedModelfiles}
isLastMessage={messageIdx + 1 === messages.length} siblings={history.messages[message.parentId]?.childrenIds ?? []}
{readOnly} isLastMessage={messageIdx + 1 === messages.length}
{updateChatMessages} {readOnly}
{confirmEditResponseMessage} {updateChatMessages}
{showPreviousMessage} {confirmEditResponseMessage}
{showNextMessage} {showPreviousMessage}
{rateMessage} {showNextMessage}
copyToClipboard={copyToClipboardWithToast} {rateMessage}
{continueGeneration} copyToClipboard={copyToClipboardWithToast}
{regenerateResponse} {continueGeneration}
on:save={async (e) => { {regenerateResponse}
console.log('save', e); on:save={async (e) => {
console.log('save', e);
const message = e.detail; const message = e.detail;
history.messages[message.id] = message; history.messages[message.id] = message;
await updateChatById(localStorage.token, chatId, { await updateChatById(localStorage.token, chatId, {
messages: messages, messages: messages,
history: history history: history
}); });
}} }}
/> />
{/key}
{/if} {/if}
</div> </div>
</div> </div>

View File

@ -39,9 +39,9 @@
let selectedReason = null; let selectedReason = null;
let comment = ''; let comment = '';
$: if (message.annotation.rating === 1) { $: if (message?.annotation?.rating === 1) {
reasons = LIKE_REASONS; reasons = LIKE_REASONS;
} else if (message.annotation.rating === -1) { } else if (message?.annotation?.rating === -1) {
reasons = DISLIKE_REASONS; reasons = DISLIKE_REASONS;
} }

View File

@ -65,8 +65,8 @@
let generatingImage = false; let generatingImage = false;
let showRateComment = false; let showRateComment = false;
let showCitationModal = false; let showCitationModal = false;
let selectedCitation = null; let selectedCitation = null;
$: tokens = marked.lexer(sanitizeResponseContent(message.content)); $: tokens = marked.lexer(sanitizeResponseContent(message.content));
@ -902,7 +902,7 @@
</div> </div>
{/if} {/if}
{#if showRateComment} {#if message.done && showRateComment}
<RateComment <RateComment
messageId={message.id} messageId={message.id}
bind:show={showRateComment} bind:show={showRateComment}