Merge pull request #180 from Webifi/main
Fix delete all chats option and code highlighting while streaming #178
This commit is contained in:
commit
de64e59b6b
|
@ -74,6 +74,7 @@
|
|||
}
|
||||
|
||||
const confirmClearChats = () => {
|
||||
if (!sortedChats.length) return
|
||||
close()
|
||||
openModal(PromptConfirm, {
|
||||
title: 'Delete ALL Chat',
|
||||
|
@ -148,7 +149,7 @@
|
|||
<a href={'#'} class="dropdown-item" class:is-disabled={!chatId} on:click|preventDefault={() => { if (chatId) close(); delChat() }}>
|
||||
<span class="menu-icon"><Fa icon={faTrash}/></span> Delete Chat
|
||||
</a>
|
||||
<a href={'#'} class="dropdown-item" on:click|preventDefault={() => { if (chatId) confirmClearChats() }}>
|
||||
<a href={'#'} class="dropdown-item" class:is-disabled={$chatsStorage && !$chatsStorage[0]} on:click|preventDefault={() => { confirmClearChats() }}>
|
||||
<span class="menu-icon"><Fa icon={faTrashCan}/></span> Delete ALL Chats
|
||||
</a>
|
||||
<hr class="dropdown-divider">
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<script lang="ts">
|
||||
import Code from './Code.svelte'
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import { afterUpdate, createEventDispatcher, onMount } from 'svelte'
|
||||
import { deleteMessage, chatsStorage, deleteSummaryMessage, truncateFromMessage, submitExitingPromptsNow, saveChatStore, continueMessage } from './Storage.svelte'
|
||||
import { getPrice } from './Stats.svelte'
|
||||
import SvelteMarkdown from 'svelte-markdown'
|
||||
|
@ -37,6 +37,7 @@
|
|||
let original:string
|
||||
let defaultModel:Model
|
||||
let imageUrl:string
|
||||
let refreshCounter = 0
|
||||
|
||||
onMount(() => {
|
||||
defaultModel = chatSettings.model
|
||||
|
@ -47,6 +48,10 @@
|
|||
}
|
||||
})
|
||||
|
||||
afterUpdate(() => {
|
||||
if (message.content.slice(-5).match(/```/)) refreshCounter++
|
||||
})
|
||||
|
||||
const edit = () => {
|
||||
if (message.summarized || message.streaming || editing) return
|
||||
editing = true
|
||||
|
@ -224,11 +229,13 @@
|
|||
{#if message.summary && !message.summary.length}
|
||||
<p><b>Summarizing...</b></p>
|
||||
{/if}
|
||||
{#key refreshCounter}
|
||||
<SvelteMarkdown
|
||||
source={message.content}
|
||||
options={markdownOptions}
|
||||
renderers={{ code: Code, html: Code }}
|
||||
/>
|
||||
{/key}
|
||||
{#if imageUrl}
|
||||
<img src={imageUrl} alt="">
|
||||
{/if}
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
></div>
|
||||
{:else}
|
||||
<div class="level-item">
|
||||
<button on:click={() => { startNewChatWithWarning(activeChatId) }} class="panel-block button" title="Start new chat with default profile" class:is-disabled={!$apiKeyStorage}
|
||||
<button on:click={() => { $pinMainMenu = false; startNewChatWithWarning(activeChatId) }} class="panel-block button" title="Start new chat with default profile" class:is-disabled={!$apiKeyStorage}
|
||||
><span class="greyscale mr-2"><Fa icon={faSquarePlus} /></span> New chat</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
|
Loading…
Reference in New Issue