Commit
•
12c3a5a
1
Parent(s):
ced1ef0
make models description dynamic (#169)
Browse filesCo-authored-by: Eliott C <[email protected]>
- .env +2 -0
- src/lib/components/ModelsModal.svelte +3 -1
- src/lib/server/models.ts +1 -1
- src/lib/types/Model.ts +7 -1
- src/routes/+layout.server.ts +1 -0
.env
CHANGED
@@ -10,6 +10,7 @@ MODELS=`[
|
|
10 |
{
|
11 |
"name": "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
|
12 |
"datasetName": "OpenAssistant/oasst1",
|
|
|
13 |
"websiteUrl": "https://open-assistant.io",
|
14 |
"userMessageToken": "<|prompter|>",
|
15 |
"assistantMessageToken": "<|assistant|>",
|
@@ -40,6 +41,7 @@ MODELS=`[
|
|
40 |
"name":"bigcode/starcoder",
|
41 |
"displayName":"BigCode/StarCoder",
|
42 |
"datasetName":"bigcode/the-stack-dedup",
|
|
|
43 |
"websiteUrl":"https://www.bigcode-project.org/",
|
44 |
"prepromptUrl": "https://huggingface.co/datasets/coyotte508/bigcodeprompt/raw/main/prompt.txt",
|
45 |
"promptExamples": [
|
|
|
10 |
{
|
11 |
"name": "OpenAssistant/oasst-sft-4-pythia-12b-epoch-3.5",
|
12 |
"datasetName": "OpenAssistant/oasst1",
|
13 |
+
"description": "A good alternative to ChatGPT",
|
14 |
"websiteUrl": "https://open-assistant.io",
|
15 |
"userMessageToken": "<|prompter|>",
|
16 |
"assistantMessageToken": "<|assistant|>",
|
|
|
41 |
"name":"bigcode/starcoder",
|
42 |
"displayName":"BigCode/StarCoder",
|
43 |
"datasetName":"bigcode/the-stack-dedup",
|
44 |
+
"description": "A good model for answering technical questions",
|
45 |
"websiteUrl":"https://www.bigcode-project.org/",
|
46 |
"prepromptUrl": "https://huggingface.co/datasets/coyotte508/bigcodeprompt/raw/main/prompt.txt",
|
47 |
"promptExamples": [
|
src/lib/components/ModelsModal.svelte
CHANGED
@@ -56,7 +56,9 @@
|
|
56 |
<span class="text-md block font-semibold leading-tight text-gray-800"
|
57 |
>{model.displayName}</span
|
58 |
>
|
59 |
-
|
|
|
|
|
60 |
</span>
|
61 |
<CarbonCheckmark
|
62 |
class="-mr-1 -mt-1 ml-auto shrink-0 text-xl {model.name === selectedModelName
|
|
|
56 |
<span class="text-md block font-semibold leading-tight text-gray-800"
|
57 |
>{model.displayName}</span
|
58 |
>
|
59 |
+
{#if model.description}
|
60 |
+
<span class="text-xs text-[#9FA8B5]">{model.description}</span>
|
61 |
+
{/if}
|
62 |
</span>
|
63 |
<CarbonCheckmark
|
64 |
class="-mr-1 -mt-1 ml-auto shrink-0 text-xl {model.name === selectedModelName
|
src/lib/server/models.ts
CHANGED
@@ -6,6 +6,7 @@ const modelsRaw = z
|
|
6 |
z.object({
|
7 |
name: z.string().min(1),
|
8 |
displayName: z.string().min(1).optional(),
|
|
|
9 |
websiteUrl: z.string().url().optional(),
|
10 |
datasetName: z.string().min(1).optional(),
|
11 |
userMessageToken: z.string().min(1),
|
@@ -47,7 +48,6 @@ export const models = await Promise.all(
|
|
47 |
...m,
|
48 |
displayName: m.displayName || m.name,
|
49 |
preprompt: m.prepromptUrl ? await fetch(m.prepromptUrl).then((r) => r.text()) : m.preprompt,
|
50 |
-
promptExamples: m.promptExamples || [],
|
51 |
}))
|
52 |
);
|
53 |
|
|
|
6 |
z.object({
|
7 |
name: z.string().min(1),
|
8 |
displayName: z.string().min(1).optional(),
|
9 |
+
description: z.string().min(1).optional(),
|
10 |
websiteUrl: z.string().url().optional(),
|
11 |
datasetName: z.string().min(1).optional(),
|
12 |
userMessageToken: z.string().min(1),
|
|
|
48 |
...m,
|
49 |
displayName: m.displayName || m.name,
|
50 |
preprompt: m.prepromptUrl ? await fetch(m.prepromptUrl).then((r) => r.text()) : m.preprompt,
|
|
|
51 |
}))
|
52 |
);
|
53 |
|
src/lib/types/Model.ts
CHANGED
@@ -2,5 +2,11 @@ import type { BackendModel } from "$lib/server/models";
|
|
2 |
|
3 |
export type Model = Pick<
|
4 |
BackendModel,
|
5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
>;
|
|
|
2 |
|
3 |
export type Model = Pick<
|
4 |
BackendModel,
|
5 |
+
| "name"
|
6 |
+
| "displayName"
|
7 |
+
| "websiteUrl"
|
8 |
+
| "datasetName"
|
9 |
+
| "promptExamples"
|
10 |
+
| "parameters"
|
11 |
+
| "description"
|
12 |
>;
|
src/routes/+layout.server.ts
CHANGED
@@ -40,6 +40,7 @@ export const load: LayoutServerLoad = async ({ locals, depends, url }) => {
|
|
40 |
websiteUrl: model.websiteUrl,
|
41 |
datasetName: model.datasetName,
|
42 |
displayName: model.displayName,
|
|
|
43 |
promptExamples: model.promptExamples,
|
44 |
parameters: model.parameters,
|
45 |
})),
|
|
|
40 |
websiteUrl: model.websiteUrl,
|
41 |
datasetName: model.datasetName,
|
42 |
displayName: model.displayName,
|
43 |
+
description: model.description,
|
44 |
promptExamples: model.promptExamples,
|
45 |
parameters: model.parameters,
|
46 |
})),
|