Skip to content

Commit

Permalink
fix: disable preset dropdown and memory restore when sysprompt is locked
Browse files Browse the repository at this point in the history
  • Loading branch information
Fortyseven committed Aug 20, 2024
1 parent 3f9ccc3 commit 1d169b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/TabPages/Presets/PresetMemory.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import { chatState } from '$stores/chatState';
import { appState } from '$stores/stores';
import { ArrowUpLeft, TextNewLine } from 'carbon-icons-svelte';
let saved_prompt = undefined;
Expand Down Expand Up @@ -29,7 +30,8 @@
class="grid-cols-1"
on:click={restoreMemory}
title={saved_prompt?.slice(0, 20) + '...'}
disabled={!saved_prompt}><ArrowUpLeft /></button
disabled={!saved_prompt || $appState.ui.lock_system}
><ArrowUpLeft /></button
>
</div>

Expand Down
13 changes: 12 additions & 1 deletion src/components/TabPages/Presets/Presets__TextArea.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { chatState } from '$stores/chatState';
import SYSTEM_PROMPTS from '../../../preset-prompts';
import { appState } from '$stores/stores';
export let value;
Expand Down Expand Up @@ -54,7 +55,12 @@
{...$$restProps}
/>
<div class="mt-4 grid grid-cols-6 gap-4 place-content-center">
<select on:change={usePrompt} bind:this={selectEl} class="col-span-5">
<select
on:change={usePrompt}
bind:this={selectEl}
class="col-span-5"
disabled={$appState.ui.lock_system}
>
<option value="">Custom</option>
{#each Object.keys(SYSTEM_PROMPTS) as key}
<option value={key}>{SYSTEM_PROMPTS[key].name}</option>
Expand All @@ -79,6 +85,11 @@
outline: none;
}
}
select:disabled {
opacity: 0.25;
}
// button {
// @apply transition-all;
// @apply duration-300;
Expand Down

0 comments on commit 1d169b7

Please sign in to comment.