Add ability to hide summarized messages
This commit is contained in:
parent
3bf3db6b07
commit
e1fa2d9fde
|
@ -12,9 +12,11 @@
|
|||
faSquarePlus,
|
||||
faKey,
|
||||
faFileExport,
|
||||
faTrashCan
|
||||
faTrashCan,
|
||||
faEye,
|
||||
faEyeSlash
|
||||
} from '@fortawesome/free-solid-svg-icons/index'
|
||||
import { addChatFromJSON, chatsStorage, checkStateChange, clearChats, clearMessages, copyChat, showSetChatSettings } from './Storage.svelte'
|
||||
import { addChatFromJSON, chatsStorage, checkStateChange, clearChats, clearMessages, copyChat, globalStorage, setGlobalSettingValueByKey, showSetChatSettings } from './Storage.svelte'
|
||||
import { exportAsMarkdown, exportChatAsJSON } from './Export.svelte'
|
||||
import { applyProfile } from './Profiles.svelte'
|
||||
import { replace } from 'svelte-spa-router'
|
||||
|
@ -65,6 +67,11 @@
|
|||
$checkStateChange++ // signal chat page to start profile
|
||||
}
|
||||
|
||||
const toggleHideSummarized = () => {
|
||||
close()
|
||||
setGlobalSettingValueByKey('hideSummarized', !$globalStorage.hideSummarized)
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<div class="dropdown is-right" class:is-active={showChatMenu} use:clickOutside={() => { showChatMenu = false }}>
|
||||
|
@ -113,6 +120,14 @@
|
|||
<span class="menu-icon"><Fa icon={faTrashCan}/></span> Delete ALL Chats
|
||||
</a>
|
||||
<hr class="dropdown-divider">
|
||||
<a href={'#'} class="dropdown-item" on:click|preventDefault={() => { if (chatId) toggleHideSummarized() }}>
|
||||
{#if $globalStorage.hideSummarized}
|
||||
<span class="menu-icon"><Fa icon={faEye}/></span> Show Summarized Messages
|
||||
{:else}
|
||||
<span class="menu-icon"><Fa icon={faEyeSlash}/></span> Hide Summarized Messages
|
||||
{/if}
|
||||
</a>
|
||||
<hr class="dropdown-divider">
|
||||
<a href={'#/'} class="dropdown-item">
|
||||
<span><Fa icon={faKey}/></span> API Key
|
||||
</a>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<script lang="ts">
|
||||
// Iterate messages
|
||||
import type { Message, Chat } from './Types.svelte'
|
||||
import { chatsStorage } from './Storage.svelte'
|
||||
import { chatsStorage, globalStorage } from './Storage.svelte'
|
||||
import EditMessage from './EditMessage.svelte'
|
||||
|
||||
export let messages : Message[]
|
||||
|
@ -13,7 +13,7 @@
|
|||
</script>
|
||||
|
||||
{#each messages as message, i}
|
||||
{#if !(i === 0 && message.role === 'system' && !chatSettings.useSystemPrompt)}
|
||||
{#if !(message.summarized && $globalStorage.hideSummarized) && !(i === 0 && message.role === 'system' && !chatSettings.useSystemPrompt)}
|
||||
<EditMessage bind:message={message} chatId={chatId} />
|
||||
{/if}
|
||||
{/each}
|
||||
|
|
|
@ -343,6 +343,11 @@ const globalSettingsList:GlobalSetting[] = [
|
|||
key: 'defaultProfile',
|
||||
name: 'Default Profile',
|
||||
type: 'text'
|
||||
},
|
||||
{
|
||||
key: 'hideSummarized',
|
||||
name: 'Hide Summarized Messages',
|
||||
type: 'boolean'
|
||||
}
|
||||
]
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
export let checkStateChange = writable(0) // Trigger for Chat
|
||||
export let showSetChatSettings = writable(false) //
|
||||
|
||||
|
||||
const chatDefaults = getChatDefaults()
|
||||
|
||||
export const newChatID = (): number => {
|
||||
|
@ -312,7 +311,7 @@
|
|||
|
||||
export const setGlobalSettingValue = (setting: GlobalSetting, value) => {
|
||||
const store = get(globalStorage)
|
||||
store[setting.key] = cleanSettingValue(setting.type, value)
|
||||
store[setting.key as any] = cleanSettingValue(setting.type, value)
|
||||
globalStorage.set(store)
|
||||
}
|
||||
|
||||
|
|
|
@ -104,8 +104,9 @@
|
|||
|
||||
export type GlobalSettings = {
|
||||
profiles: Record<string, ChatSettings>;
|
||||
lastProfile?: string,
|
||||
defaultProfile?: string,
|
||||
lastProfile?: string;
|
||||
defaultProfile?: string;
|
||||
hideSummarized?: boolean;
|
||||
};
|
||||
|
||||
type SettingNumber = {
|
||||
|
|
Loading…
Reference in New Issue