Thomas G. Lopes commited on
Commit
b1426d3
Β·
1 Parent(s): f48efbb

change casing

Browse files
Files changed (22) hide show
  1. src/lib/components/{Avatar.svelte β†’ avatar.svelte} +0 -0
  2. src/lib/components/{DebugMenu.svelte β†’ debug-menu.svelte} +4 -4
  3. src/lib/components/{Icons/IconProvider.svelte β†’ icons/icon-provider.svelte} +0 -0
  4. src/lib/components/{InferencePlayground/InferencePlaygroundCodeSnippets.svelte β†’ inference-playground/code-snippets.svelte} +1 -5
  5. src/lib/components/{InferencePlayground/InferencePlaygroundConversationHeader.svelte β†’ inference-playground/conversation-header.svelte} +3 -3
  6. src/lib/components/{InferencePlayground/InferencePlaygroundConversation.svelte β†’ inference-playground/conversation.svelte} +1 -1
  7. src/lib/components/{InferencePlayground/generationConfigSettings.ts β†’ inference-playground/generation-config-settings.ts} +0 -0
  8. src/lib/components/{InferencePlayground/InferencePlaygroundGenerationConfig.svelte β†’ inference-playground/generation-config.svelte} +2 -2
  9. src/lib/components/{InferencePlayground/InferencePlaygroundHFTokenModal.svelte β†’ inference-playground/hf-token-modal.svelte} +0 -0
  10. src/lib/components/{InferencePlayground β†’ inference-playground}/message.svelte +0 -0
  11. src/lib/components/{InferencePlayground/InferencePlaygroundModelSelectorModal.svelte β†’ inference-playground/model-selector-modal.svelte} +0 -0
  12. src/lib/components/{InferencePlayground/InferencePlaygroundModelSelector.svelte β†’ inference-playground/model-selector.svelte} +3 -3
  13. src/lib/components/{InferencePlayground/InferencePlayground.svelte β†’ inference-playground/playground.svelte} +9 -13
  14. src/lib/components/{InferencePlayground/InferencePlaygroundProjectSelect.svelte β†’ inference-playground/project-select.svelte} +1 -1
  15. src/lib/components/{InferencePlayground β†’ inference-playground}/provider-select.svelte +1 -1
  16. src/lib/components/{InferencePlayground/inferencePlaygroundUtils.ts β†’ inference-playground/utils.ts} +0 -0
  17. src/lib/components/{Prompts.svelte β†’ prompts.svelte} +0 -0
  18. src/lib/stores/session.ts +1 -1
  19. src/lib/types.ts +1 -1
  20. src/lib/utils/effect.ts +0 -51
  21. src/routes/+layout.svelte +2 -2
  22. src/routes/+page.svelte +2 -2
src/lib/components/{Avatar.svelte β†’ avatar.svelte} RENAMED
File without changes
src/lib/components/{DebugMenu.svelte β†’ debug-menu.svelte} RENAMED
@@ -2,7 +2,7 @@
2
  import { dev } from "$app/environment";
3
  import { session } from "$lib/stores/session.js";
4
  import { createPopover } from "@melt-ui/svelte";
5
- import { prompt } from "./Prompts.svelte";
6
  import { token } from "$lib/stores/token.js";
7
  import { compareStr } from "$lib/utils/compare.js";
8
  import type { ToastData } from "./toaster.svelte.js";
@@ -65,10 +65,10 @@
65
  },
66
  ];
67
 
68
- addToast({
69
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
- data: toastData[Math.floor(Math.random() * toastData.length)]!,
71
- });
72
  },
73
  },
74
  ].toSorted((a, b) => compareStr(a.label, b.label));
 
2
  import { dev } from "$app/environment";
3
  import { session } from "$lib/stores/session.js";
4
  import { createPopover } from "@melt-ui/svelte";
5
+ import { prompt } from "./prompts.svelte";
6
  import { token } from "$lib/stores/token.js";
7
  import { compareStr } from "$lib/utils/compare.js";
8
  import type { ToastData } from "./toaster.svelte.js";
 
65
  },
66
  ];
67
 
68
+ addToast(
69
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
70
+ toastData[Math.floor(Math.random() * toastData.length)]!
71
+ );
72
  },
73
  },
74
  ].toSorted((a, b) => compareStr(a.label, b.label));
src/lib/components/{Icons/IconProvider.svelte β†’ icons/icon-provider.svelte} RENAMED
File without changes
src/lib/components/{InferencePlayground/InferencePlaygroundCodeSnippets.svelte β†’ inference-playground/code-snippets.svelte} RENAMED
@@ -12,11 +12,7 @@
12
  import type { InferenceProvider } from "@huggingface/inference";
13
  import IconCopyCode from "~icons/carbon/copy";
14
  import IconExternal from "~icons/carbon/arrow-up-right";
15
- import {
16
- getInferenceSnippet,
17
- type GetInferenceSnippetReturn,
18
- type InferenceSnippetLanguage,
19
- } from "./inferencePlaygroundUtils.js";
20
 
21
  hljs.registerLanguage("javascript", javascript);
22
  hljs.registerLanguage("python", python);
 
12
  import type { InferenceProvider } from "@huggingface/inference";
13
  import IconCopyCode from "~icons/carbon/copy";
14
  import IconExternal from "~icons/carbon/arrow-up-right";
15
+ import { getInferenceSnippet, type GetInferenceSnippetReturn, type InferenceSnippetLanguage } from "./utils.js";
 
 
 
 
16
 
17
  hljs.registerLanguage("javascript", javascript);
18
  hljs.registerLanguage("python", python);
src/lib/components/{InferencePlayground/InferencePlaygroundConversationHeader.svelte β†’ inference-playground/conversation-header.svelte} RENAMED
@@ -4,10 +4,10 @@
4
  import { createEventDispatcher } from "svelte";
5
 
6
  import { models } from "$lib/stores/models.js";
7
- import Avatar from "../Avatar.svelte";
8
  import IconCog from "~icons/carbon/settings";
9
- import GenerationConfig from "./InferencePlaygroundGenerationConfig.svelte";
10
- import ModelSelectorModal from "./InferencePlaygroundModelSelectorModal.svelte";
11
  import ProviderSelect from "./provider-select.svelte";
12
 
13
  export let conversation: Conversation;
 
4
  import { createEventDispatcher } from "svelte";
5
 
6
  import { models } from "$lib/stores/models.js";
7
+ import Avatar from "../avatar.svelte";
8
  import IconCog from "~icons/carbon/settings";
9
+ import GenerationConfig from "./generation-config.svelte";
10
+ import ModelSelectorModal from "./model-selector-modal.svelte";
11
  import ProviderSelect from "./provider-select.svelte";
12
 
13
  export let conversation: Conversation;
src/lib/components/{InferencePlayground/InferencePlaygroundConversation.svelte β†’ inference-playground/conversation.svelte} RENAMED
@@ -4,7 +4,7 @@
4
  import type { Conversation } from "$lib/types.js";
5
 
6
  import IconPlus from "~icons/carbon/add";
7
- import CodeSnippets from "./InferencePlaygroundCodeSnippets.svelte";
8
  import Message from "./message.svelte";
9
 
10
  interface Props {
 
4
  import type { Conversation } from "$lib/types.js";
5
 
6
  import IconPlus from "~icons/carbon/add";
7
+ import CodeSnippets from "./code-snippets.svelte";
8
  import Message from "./message.svelte";
9
 
10
  interface Props {
src/lib/components/{InferencePlayground/generationConfigSettings.ts β†’ inference-playground/generation-config-settings.ts} RENAMED
File without changes
src/lib/components/{InferencePlayground/InferencePlaygroundGenerationConfig.svelte β†’ inference-playground/generation-config.svelte} RENAMED
@@ -1,8 +1,8 @@
1
  <script lang="ts">
2
  import type { Conversation } from "$lib/types.js";
3
 
4
- import { GENERATION_CONFIG_KEYS, GENERATION_CONFIG_SETTINGS } from "./generationConfigSettings.js";
5
- import { customMaxTokens } from "./inferencePlaygroundUtils.js";
6
 
7
  export let conversation: Conversation;
8
  export let classNames = "";
 
1
  <script lang="ts">
2
  import type { Conversation } from "$lib/types.js";
3
 
4
+ import { GENERATION_CONFIG_KEYS, GENERATION_CONFIG_SETTINGS } from "./generation-config-settings.js";
5
+ import { customMaxTokens } from "./utils.js";
6
 
7
  export let conversation: Conversation;
8
  export let classNames = "";
src/lib/components/{InferencePlayground/InferencePlaygroundHFTokenModal.svelte β†’ inference-playground/hf-token-modal.svelte} RENAMED
File without changes
src/lib/components/{InferencePlayground β†’ inference-playground}/message.svelte RENAMED
File without changes
src/lib/components/{InferencePlayground/InferencePlaygroundModelSelectorModal.svelte β†’ inference-playground/model-selector-modal.svelte} RENAMED
File without changes
src/lib/components/{InferencePlayground/InferencePlaygroundModelSelector.svelte β†’ inference-playground/model-selector.svelte} RENAMED
@@ -3,10 +3,10 @@
3
 
4
  import { models } from "$lib/stores/models.js";
5
  import IconCaret from "~icons/carbon/chevron-down";
6
- import Avatar from "../Avatar.svelte";
7
- import ModelSelectorModal from "./InferencePlaygroundModelSelectorModal.svelte";
8
  import ProviderSelect from "./provider-select.svelte";
9
- import { defaultSystemMessage } from "./inferencePlaygroundUtils.js";
10
 
11
  export let conversation: Conversation;
12
 
 
3
 
4
  import { models } from "$lib/stores/models.js";
5
  import IconCaret from "~icons/carbon/chevron-down";
6
+ import Avatar from "../avatar.svelte";
7
+ import ModelSelectorModal from "./model-selector-modal.svelte";
8
  import ProviderSelect from "./provider-select.svelte";
9
+ import { defaultSystemMessage } from "./utils.js";
10
 
11
  export let conversation: Conversation;
12
 
src/lib/components/{InferencePlayground/InferencePlayground.svelte β†’ inference-playground/playground.svelte} RENAMED
@@ -1,11 +1,7 @@
1
  <script lang="ts">
2
  import type { Conversation, ConversationMessage, ModelWithTokenizer } from "$lib/types.js";
3
 
4
- import {
5
- handleNonStreamingResponse,
6
- handleStreamingResponse,
7
- isSystemPromptSupported,
8
- } from "./inferencePlaygroundUtils.js";
9
 
10
  import { models } from "$lib/stores/models.js";
11
  import { project, session } from "$lib/stores/session.js";
@@ -18,13 +14,13 @@
18
  import IconCompare from "~icons/carbon/compare";
19
  import IconInfo from "~icons/carbon/information";
20
  import { default as IconDelete, default as IconThrashcan } from "~icons/carbon/trash-can";
21
- import PlaygroundConversation from "./InferencePlaygroundConversation.svelte";
22
- import PlaygroundConversationHeader from "./InferencePlaygroundConversationHeader.svelte";
23
- import GenerationConfig from "./InferencePlaygroundGenerationConfig.svelte";
24
- import HFTokenModal from "./InferencePlaygroundHFTokenModal.svelte";
25
- import ModelSelector from "./InferencePlaygroundModelSelector.svelte";
26
- import ModelSelectorModal from "./InferencePlaygroundModelSelectorModal.svelte";
27
- import InferencePlaygroundProjectSelect from "./InferencePlaygroundProjectSelect.svelte";
28
  import { addToast } from "../toaster.svelte.js";
29
 
30
  const startMessageUser: ConversationMessage = { role: "user", content: "" };
@@ -221,7 +217,7 @@
221
  >
222
  <div class="flex flex-col gap-2 overflow-y-auto py-3 pr-3 max-md:pl-3">
223
  <div class="pl-2">
224
- <InferencePlaygroundProjectSelect />
225
  </div>
226
  <div
227
  class="relative flex flex-1 flex-col gap-6 overflow-y-hidden rounded-r-xl border-x border-y border-gray-200/80 bg-linear-to-b from-white via-white p-3 shadow-xs max-md:rounded-xl dark:border-white/5 dark:from-gray-800/40 dark:via-gray-800/40"
 
1
  <script lang="ts">
2
  import type { Conversation, ConversationMessage, ModelWithTokenizer } from "$lib/types.js";
3
 
4
+ import { handleNonStreamingResponse, handleStreamingResponse, isSystemPromptSupported } from "./utils.js";
 
 
 
 
5
 
6
  import { models } from "$lib/stores/models.js";
7
  import { project, session } from "$lib/stores/session.js";
 
14
  import IconCompare from "~icons/carbon/compare";
15
  import IconInfo from "~icons/carbon/information";
16
  import { default as IconDelete, default as IconThrashcan } from "~icons/carbon/trash-can";
17
+ import PlaygroundConversation from "./conversation.svelte";
18
+ import PlaygroundConversationHeader from "./conversation-header.svelte";
19
+ import GenerationConfig from "./generation-config.svelte";
20
+ import HFTokenModal from "./hf-token-modal.svelte";
21
+ import ModelSelector from "./model-selector.svelte";
22
+ import ModelSelectorModal from "./model-selector-modal.svelte";
23
+ import ProjectSelect from "./project-select.svelte";
24
  import { addToast } from "../toaster.svelte.js";
25
 
26
  const startMessageUser: ConversationMessage = { role: "user", content: "" };
 
217
  >
218
  <div class="flex flex-col gap-2 overflow-y-auto py-3 pr-3 max-md:pl-3">
219
  <div class="pl-2">
220
+ <ProjectSelect />
221
  </div>
222
  <div
223
  class="relative flex flex-1 flex-col gap-6 overflow-y-hidden rounded-r-xl border-x border-y border-gray-200/80 bg-linear-to-b from-white via-white p-3 shadow-xs max-md:rounded-xl dark:border-white/5 dark:from-gray-800/40 dark:via-gray-800/40"
src/lib/components/{InferencePlayground/InferencePlaygroundProjectSelect.svelte β†’ inference-playground/project-select.svelte} RENAMED
@@ -7,7 +7,7 @@
7
  import IconEdit from "~icons/carbon/edit";
8
  import IconSave from "~icons/carbon/save";
9
  import IconDelete from "~icons/carbon/trash-can";
10
- import { prompt } from "../Prompts.svelte";
11
 
12
  interface Props {
13
  class?: string;
 
7
  import IconEdit from "~icons/carbon/edit";
8
  import IconSave from "~icons/carbon/save";
9
  import IconDelete from "~icons/carbon/trash-can";
10
+ import { prompt } from "../prompts.svelte";
11
 
12
  interface Props {
13
  class?: string;
src/lib/components/{InferencePlayground β†’ inference-playground}/provider-select.svelte RENAMED
@@ -5,7 +5,7 @@
5
  import { cn } from "$lib/utils/cn.js";
6
  import { createSelect, createSync } from "@melt-ui/svelte";
7
  import IconCaret from "~icons/carbon/chevron-down";
8
- import IconProvider from "../Icons/IconProvider.svelte";
9
 
10
  export let conversation: Conversation;
11
  let classes: string | undefined = undefined;
 
5
  import { cn } from "$lib/utils/cn.js";
6
  import { createSelect, createSync } from "@melt-ui/svelte";
7
  import IconCaret from "~icons/carbon/chevron-down";
8
+ import IconProvider from "../icons/icon-provider.svelte";
9
 
10
  export let conversation: Conversation;
11
  let classes: string | undefined = undefined;
src/lib/components/{InferencePlayground/inferencePlaygroundUtils.ts β†’ inference-playground/utils.ts} RENAMED
File without changes
src/lib/components/{Prompts.svelte β†’ prompts.svelte} RENAMED
File without changes
src/lib/stores/session.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { defaultGenerationConfig } from "$lib/components/InferencePlayground/generationConfigSettings.js";
2
  import { models } from "$lib/stores/models.js";
3
  import {
4
  PipelineTag,
 
1
+ import { defaultGenerationConfig } from "$lib/components/inference-playground/generation-config-settings.js";
2
  import { models } from "$lib/stores/models.js";
3
  import {
4
  PipelineTag,
src/lib/types.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { GenerationConfig } from "$lib/components/InferencePlayground/generationConfigSettings.js";
2
  import type { ChatCompletionInputMessage } from "@huggingface/tasks";
3
 
4
  export type ConversationMessage = Omit<ChatCompletionInputMessage, "content"> & { content?: string };
 
1
+ import type { GenerationConfig } from "$lib/components/inference-playground/generation-config-settings.js";
2
  import type { ChatCompletionInputMessage } from "@huggingface/tasks";
3
 
4
  export type ConversationMessage = Omit<ChatCompletionInputMessage, "content"> & { content?: string };
src/lib/utils/effect.ts DELETED
@@ -1,51 +0,0 @@
1
- import type { Stores, StoresValues } from "svelte/store";
2
- import { derived } from "svelte/store";
3
- import { safeOnDestroy } from "./lifecycle.js";
4
- import { noop } from "./noop.js";
5
-
6
- type EffectOptions = {
7
- /**
8
- * Whether to skip the first run
9
- * @default undefined
10
- */
11
- skipFirstRun?: boolean;
12
- };
13
-
14
- /**
15
- * A utility function that creates an effect from a set of stores and a function.
16
- * The effect is automatically cleaned up when the component is destroyed.
17
- *
18
- * @template S - The type of the stores object
19
- * @param stores - The stores object to derive from
20
- * @param fn - The function to run when the stores change
21
- * @param opts {@link EffectOptions}
22
- * @returns A function that can be used to unsubscribe the effect
23
- */
24
- export function effect<S extends Stores>(
25
- stores: S,
26
- fn: (values: StoresValues<S>) => (() => void) | void,
27
- opts: EffectOptions = {}
28
- ): () => void {
29
- const { skipFirstRun } = opts;
30
- let isFirstRun = true;
31
- let cb: (() => void) | void = undefined;
32
-
33
- // Create a derived store that contains the stores object and an onUnsubscribe function
34
- const destroy = derived(stores, stores => {
35
- cb?.();
36
- if (isFirstRun && skipFirstRun) {
37
- isFirstRun = false;
38
- } else {
39
- cb = fn(stores);
40
- }
41
- }).subscribe(noop);
42
-
43
- const unsub = () => {
44
- destroy();
45
- cb?.();
46
- };
47
-
48
- // Automatically unsubscribe the effect when the component is destroyed
49
- safeOnDestroy(unsub);
50
- return unsub;
51
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/routes/+layout.svelte CHANGED
@@ -1,7 +1,7 @@
1
  <script lang="ts">
2
  import "../app.css";
3
- import DebugMenu from "$lib/components/DebugMenu.svelte";
4
- import Prompts from "$lib/components/Prompts.svelte";
5
  import Toaster from "$lib/components/toaster.svelte";
6
  </script>
7
 
 
1
  <script lang="ts">
2
  import "../app.css";
3
+ import DebugMenu from "$lib/components/debug-menu.svelte";
4
+ import Prompts from "$lib/components/prompts.svelte";
5
  import Toaster from "$lib/components/toaster.svelte";
6
  </script>
7
 
src/routes/+page.svelte CHANGED
@@ -1,5 +1,5 @@
1
  <script lang="ts">
2
- import InferencePlayground from "$lib/components/InferencePlayground/InferencePlayground.svelte";
3
  </script>
4
 
5
- <InferencePlayground />
 
1
  <script lang="ts">
2
+ import Playground from "$lib/components/inference-playground/playground.svelte";
3
  </script>
4
 
5
+ <Playground />