Skip to content

Commit

Permalink
Merge pull request #8 from kinoplan/bugfix/fix-input
Browse files Browse the repository at this point in the history
Fix input
  • Loading branch information
sarieved authored Nov 8, 2023
2 parents 5796751 + 36246db commit 8ec6dbb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 7 deletions.
17 changes: 16 additions & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import NewChat from './lib/NewChat.svelte'
import { chatsStorage, setGlobalSettingValueByKey } from './lib/Storage.svelte'
import { Modals, closeModal } from 'svelte-modals'
import { dispatchModalEsc } from './lib/Util.svelte'
import { dispatchModalEsc, checkModalEsc } from './lib/Util.svelte'
import { set as setOpenAI } from './lib/providers/openai/util.svelte'
import { hasActiveModels } from './lib/Models.svelte'
Expand Down Expand Up @@ -72,3 +72,18 @@
on:click={closeModal}
/>
</Modals>

<svelte:window
on:keydown={(e) => checkModalEsc(e)}
/>

<style>
.backdrop {
position: fixed;
top: 0;
bottom: 0;
right: 0;
left: 0;
background: transparent
}
</style>
22 changes: 16 additions & 6 deletions src/lib/Home.svelte
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<script lang="ts">
import { apiKeyStorage, globalStorage, lastChatId, getChat, started, checkStateChange } from './Storage.svelte'
import { apiKeyStorage, globalStorage, lastChatId, getChat, started, setGlobalSettingValueByKey, checkStateChange } from './Storage.svelte'
import Footer from './Footer.svelte'
import { replace } from 'svelte-spa-router'
import { afterUpdate, onMount } from 'svelte'
import { getPetalsBase, getPetalsWebsocket } from './ApiUtil.svelte'
import { set as setOpenAI } from './providers/openai/util.svelte'
import { hasActiveModels } from './Models.svelte'
$: apiKey = $apiKeyStorage
let showPetalsSettings = $globalStorage.enablePetals
let pedalsEndpoint = $globalStorage.pedalsEndpoint
let hasModels = hasActiveModels()
Expand All @@ -29,10 +32,17 @@ afterUpdate(() => {
$checkStateChange++
})
const setPetalsEnabled = (event: Event) => {
const el = (event.target as HTMLInputElement)
setGlobalSettingValueByKey('enablePetals', !!el.checked)
showPetalsSettings = $globalStorage.enablePetals
hasModels = hasActiveModels()
}
</script>

<section class="section">
<!--<article class="message">
<article class="message">
<div class="message-body">
<p class="mb-4">
<strong><a href="https://github.com/Niek/chatgpt-web" target="_blank">ChatGPT-web</a></strong>
Expand Down Expand Up @@ -94,11 +104,11 @@ afterUpdate(() => {
<article class="message" class:is-danger={!hasModels} class:is-warning={!showPetalsSettings} class:is-info={showPetalsSettings}>
<div class="message-body">
<label class="label" for="enablePetals">
<input
<input
type="checkbox"
class="checkbox"
class="checkbox"
id="enablePetals"
checked={!!$globalStorage.enablePetals}
checked={!!$globalStorage.enablePetals}
on:click={setPetalsEnabled}
>
Use Petals API and Models (Llama 2)
Expand Down Expand Up @@ -153,7 +163,7 @@ afterUpdate(() => {
</p>
{/if}
</div>
</article> -->
</article>
{#if apiKey}
<article class="message is-info">
<div class="message-body">
Expand Down

0 comments on commit 8ec6dbb

Please sign in to comment.