Thomas G. Lopes commited on
Commit
2cadf2a
·
1 Parent(s): e3dae79

type check fix

Browse files
src/lib/components/InferencePlayground/InferencePlaygroundProviderSelect.svelte CHANGED
@@ -11,7 +11,7 @@
11
  import { cn } from "$lib/utils/cn";
12
 
13
  export let conversation: Conversation;
14
- let classes: string | undefined;
15
  export { classes as class };
16
 
17
  async function loadProviders(modelId: string) {
 
11
  import { cn } from "$lib/utils/cn";
12
 
13
  export let conversation: Conversation;
14
+ let classes: string | undefined = undefined;
15
  export { classes as class };
16
 
17
  async function loadProviders(modelId: string) {
src/lib/stores/session.ts CHANGED
@@ -1,14 +1,13 @@
1
- import type { Conversation, Session } from "$lib/components/InferencePlayground/types";
2
  import { defaultGenerationConfig } from "$lib/components/InferencePlayground/generationConfigSettings";
3
  import {
4
  defaultSystemMessage,
5
  FEATURED_MODELS_IDS,
6
  } from "$lib/components/InferencePlayground/inferencePlaygroundUtils";
 
7
 
8
  import { models } from "$lib/stores/models";
9
- import { get, writable } from "svelte/store";
10
- import type { ChatCompletionInputMessage } from "@huggingface/tasks";
11
  import { partialSet, safePage } from "$lib/utils/store";
 
12
 
13
  export function createSessionStore() {
14
  let hasStarted = false;
@@ -16,10 +15,10 @@ export function createSessionStore() {
16
 
17
  // Init is needed, otherwise there are stale values coming from page.
18
  function init() {
19
- const startMessageUser: ChatCompletionInputMessage = { role: "user", content: "" };
20
  const modelIdsFromQueryParam = get(safePage)?.url?.searchParams?.get("modelId")?.split(",");
21
  const modelsFromQueryParam = modelIdsFromQueryParam?.map(id => get(models).find(model => model.id === id));
22
- const systemMessage: ChatCompletionInputMessage = {
23
  role: "system",
24
  content: modelIdsFromQueryParam?.[0] ? (defaultSystemMessage?.[modelIdsFromQueryParam[0]] ?? "") : "",
25
  };
 
 
1
  import { defaultGenerationConfig } from "$lib/components/InferencePlayground/generationConfigSettings";
2
  import {
3
  defaultSystemMessage,
4
  FEATURED_MODELS_IDS,
5
  } from "$lib/components/InferencePlayground/inferencePlaygroundUtils";
6
+ import type { Conversation, ConversationMessage, Session } from "$lib/components/InferencePlayground/types";
7
 
8
  import { models } from "$lib/stores/models";
 
 
9
  import { partialSet, safePage } from "$lib/utils/store";
10
+ import { get, writable } from "svelte/store";
11
 
12
  export function createSessionStore() {
13
  let hasStarted = false;
 
15
 
16
  // Init is needed, otherwise there are stale values coming from page.
17
  function init() {
18
+ const startMessageUser: ConversationMessage = { role: "user", content: "" };
19
  const modelIdsFromQueryParam = get(safePage)?.url?.searchParams?.get("modelId")?.split(",");
20
  const modelsFromQueryParam = modelIdsFromQueryParam?.map(id => get(models).find(model => model.id === id));
21
+ const systemMessage: ConversationMessage = {
22
  role: "system",
23
  content: modelIdsFromQueryParam?.[0] ? (defaultSystemMessage?.[modelIdsFromQueryParam[0]] ?? "") : "",
24
  };