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