Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanatkn committed Feb 26, 2025
1 parent 4b98e84 commit c0448f3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/lib/Bit_Stats.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<div class="flex justify_content_space_between gap_sm font_mono">
<span title="the token count is currently approximated and inaccurate"
>~{print_number_with_separators(token_count + '', ',')} token{token_count === 1
>{print_number_with_separators(token_count + '', ',')} token{token_count === 1
? ''
: 's'}</span
>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Chat_View.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import Model_Selector from '$lib/Model_Selector.svelte';
import Chat_Tape from '$lib/Chat_Tape.svelte';
import {zzz_context} from '$lib/zzz.svelte.js';
import {GLYPH_TAPE, GLYPH_PROMPT} from '$lib/constants.js';
import {GLYPH_TAPE, GLYPH_PROMPT, GLYPH_REMOVE} from '$lib/constants.js';
import {zzz_config} from '$lib/zzz_config.js';
import Clear_Restore_Button from '$lib/Clear_Restore_Button.svelte';
import Bit_Stats from '$lib/Bit_Stats.svelte';
Expand Down Expand Up @@ -185,7 +185,7 @@
onclick={() => chat.remove_all_tapes()}
attrs={{disabled: !count, class: 'plain'}}
>
🗙 <span class="ml_xs">remove all tapes</span>
{GLYPH_REMOVE} <span class="ml_xs">remove all tapes</span>
</Confirm_Button>
</div>
<!-- TODO duplicate tape button -->
Expand Down
6 changes: 4 additions & 2 deletions src/lib/Confirm_Button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import type {SvelteHTMLElements} from 'svelte/elements';
import type {Snippet} from 'svelte';
import {GLYPH_REMOVE} from '$lib/constants.js';
interface Props {
onclick: () => void;
attrs?: SvelteHTMLElements['button'];
Expand Down Expand Up @@ -57,7 +59,7 @@
? 'plain'
: ''} {!children && confirming && !attrs?.class?.includes('size_sm') ? 'size_sm' : ''}"
>
{#if children}{@render children(confirming)}{:else}🗙{/if}
{#if children}{@render children(confirming)}{:else}{GLYPH_REMOVE}{/if}
</button>
{/if}
{#if confirming}
Expand All @@ -75,7 +77,7 @@
out:scale={{duration: 200}}
{...confirm_button_attrs}
>
<div class="icon">🗙</div>
<div class="icon">{GLYPH_REMOVE}</div>
</button>
{/if}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/lib/Dashboard_Prompts.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import Nav_Link from '$lib/Nav_Link.svelte';
import Text_Icon from '$lib/Text_Icon.svelte';
import Bit_View from '$lib/Bit_View.svelte';
import {GLYPH_BIT, GLYPH_PROMPT} from '$lib/constants.js';
import {GLYPH_BIT, GLYPH_PROMPT, GLYPH_REMOVE} from '$lib/constants.js';
import {zzz_context} from '$lib/zzz.svelte.js';
import Prompt_Stats from '$lib/Prompt_Stats.svelte';
import Bit_List from '$lib/Bit_List.svelte';
Expand Down Expand Up @@ -127,7 +127,7 @@
onclick={() => zzz.prompts.selected?.remove_all_bits()}
attrs={{disabled: !zzz.prompts.selected.bits.length, class: 'plain'}}
>
🗙 remove all bits
{GLYPH_REMOVE} remove all bits
</Confirm_Button>
</div>
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/lib/File_View.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import File_Info from '$lib/File_Info.svelte';
import File_Summary from '$lib/File_Summary.svelte';
import {zzz_context} from '$lib/zzz.svelte.js';
import {GLYPH_REMOVE} from '$lib/constants.js';
interface Props {
// TODO more efficient data structures, reactive source files
Expand Down Expand Up @@ -63,7 +64,7 @@
}
}}
>
{#snippet icon()}🗙{/snippet}
{#snippet icon()}{GLYPH_REMOVE}{/snippet}
<span>Delete file</span>
</Contextmenu_Entry>
{:else}
Expand Down
3 changes: 2 additions & 1 deletion src/lib/Xml_Attribute.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import type {Xml_Attribute} from '$lib/prompt.svelte.js';
import {GLYPH_REMOVE} from '$lib/constants.js';
interface Props {
attribute: Xml_Attribute;
Expand Down Expand Up @@ -29,5 +30,5 @@
value={attribute.value}
oninput={(e) => onupdate({value: e.currentTarget.value})}
/>
<button type="button" class="plain compact" onclick={onremove}>🗙</button>
<button type="button" class="plain compact" onclick={onremove}>{GLYPH_REMOVE}</button>
</div>
2 changes: 2 additions & 0 deletions src/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const GLYPH_REMOVE = '⨉'; // ⨉ ✕ 🗙 ⤫ ⤬

export const GLYPH_CHAT = '⌸';
export const GLYPH_TAPE = '☷';
export const GLYPH_FILE = '⏚'; // ⏚ ⧈ ⊞ ⧉ ⌺ ▤
Expand Down
5 changes: 2 additions & 3 deletions src/lib/zzz.svelte.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,9 @@ export class Zzz {
// TODO store state granularly for each provider

constructor(options: Zzz_Options) {
const {client, data = new Zzz_Data()} = options;
this.client = client;
this.client = options.client;
this.completion_threads = options.completion_threads ?? new Completion_Threads({zzz: this});
this.data = data;
this.data = options.data ?? new Zzz_Data();
// TODO move this? options? same with models below?
this.add_providers(zzz_config.providers);
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/zzz_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ export interface Zzz_Client_Options {
receive: (message: Server_Message) => void;
}

// TODO either rename/refactor/remove
// TODO either rename/refactor/remove - maybe `Messages`?

// TODO reactive?
export class Zzz_Client {
#send: (message: Client_Message) => void;
#receive: (message: Server_Message) => void;

constructor(options: Zzz_Client_Options) {
console.log('[zzz_client] creating');
this.#send = options.send;
this.#receive = options.receive;
}
Expand Down

0 comments on commit c0448f3

Please sign in to comment.