Spaces:
Paused
Paused
Assistants: add reset to default model button (#1200)
Browse files
src/lib/components/chat/AssistantIntroduction.svelte
CHANGED
|
@@ -1,18 +1,23 @@
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { createEventDispatcher } from "svelte";
|
| 3 |
-
import IconGear from "~icons/bi/gear-fill";
|
| 4 |
import { base } from "$app/paths";
|
|
|
|
|
|
|
| 5 |
import type { Assistant } from "$lib/types/Assistant";
|
|
|
|
| 6 |
import { formatUserCount } from "$lib/utils/formatUserCount";
|
|
|
|
| 7 |
import IconInternet from "../icons/IconInternet.svelte";
|
| 8 |
import CarbonExport from "~icons/carbon/export";
|
| 9 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
|
|
|
| 10 |
import CarbonUserMultiple from "~icons/carbon/user-multiple";
|
| 11 |
|
| 12 |
import { share } from "$lib/utils/share";
|
| 13 |
import { env as envPublic } from "$env/dynamic/public";
|
| 14 |
import { page } from "$app/stores";
|
| 15 |
|
|
|
|
| 16 |
export let assistant: Pick<
|
| 17 |
Assistant,
|
| 18 |
| "avatar"
|
|
@@ -41,6 +46,8 @@
|
|
| 41 |
$: shareUrl = `${prefix}/assistant/${assistant?._id}`;
|
| 42 |
|
| 43 |
let isCopied = false;
|
|
|
|
|
|
|
| 44 |
</script>
|
| 45 |
|
| 46 |
<div class="flex h-full w-full flex-col content-center items-center justify-center pb-52">
|
|
@@ -135,6 +142,17 @@
|
|
| 135 |
>
|
| 136 |
</div>
|
| 137 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
</div>
|
| 139 |
{#if assistant.exampleInputs}
|
| 140 |
<div class="mx-auto mt-auto w-full gap-8 sm:-mb-8">
|
|
|
|
| 1 |
<script lang="ts">
|
| 2 |
import { createEventDispatcher } from "svelte";
|
|
|
|
| 3 |
import { base } from "$app/paths";
|
| 4 |
+
import { goto } from "$app/navigation";
|
| 5 |
+
import type { Model } from "$lib/types/Model";
|
| 6 |
import type { Assistant } from "$lib/types/Assistant";
|
| 7 |
+
import { useSettingsStore } from "$lib/stores/settings";
|
| 8 |
import { formatUserCount } from "$lib/utils/formatUserCount";
|
| 9 |
+
import IconGear from "~icons/bi/gear-fill";
|
| 10 |
import IconInternet from "../icons/IconInternet.svelte";
|
| 11 |
import CarbonExport from "~icons/carbon/export";
|
| 12 |
import CarbonCheckmark from "~icons/carbon/checkmark";
|
| 13 |
+
import CarbonRenew from "~icons/carbon/renew";
|
| 14 |
import CarbonUserMultiple from "~icons/carbon/user-multiple";
|
| 15 |
|
| 16 |
import { share } from "$lib/utils/share";
|
| 17 |
import { env as envPublic } from "$env/dynamic/public";
|
| 18 |
import { page } from "$app/stores";
|
| 19 |
|
| 20 |
+
export let models: Model[];
|
| 21 |
export let assistant: Pick<
|
| 22 |
Assistant,
|
| 23 |
| "avatar"
|
|
|
|
| 46 |
$: shareUrl = `${prefix}/assistant/${assistant?._id}`;
|
| 47 |
|
| 48 |
let isCopied = false;
|
| 49 |
+
|
| 50 |
+
const settings = useSettingsStore();
|
| 51 |
</script>
|
| 52 |
|
| 53 |
<div class="flex h-full w-full flex-col content-center items-center justify-center pb-52">
|
|
|
|
| 142 |
>
|
| 143 |
</div>
|
| 144 |
</div>
|
| 145 |
+
<button
|
| 146 |
+
on:click={() => {
|
| 147 |
+
settings.instantSet({
|
| 148 |
+
activeModel: models[0].name,
|
| 149 |
+
});
|
| 150 |
+
goto(`${base}/`);
|
| 151 |
+
}}
|
| 152 |
+
class="absolute -bottom-6 right-2 inline-flex items-center justify-center text-xs text-gray-600 underline hover:brightness-50 dark:text-gray-400 dark:hover:brightness-110"
|
| 153 |
+
>
|
| 154 |
+
<CarbonRenew class="mr-1.5 text-xxs" /> Reset to default model
|
| 155 |
+
</button>
|
| 156 |
</div>
|
| 157 |
{#if assistant.exampleInputs}
|
| 158 |
<div class="mx-auto mt-auto w-full gap-8 sm:-mb-8">
|
src/lib/components/chat/ChatWindow.svelte
CHANGED
|
@@ -214,6 +214,7 @@
|
|
| 214 |
/>
|
| 215 |
{:else}
|
| 216 |
<AssistantIntroduction
|
|
|
|
| 217 |
{assistant}
|
| 218 |
on:message={(ev) => {
|
| 219 |
if ($page.data.loginRequired) {
|
|
|
|
| 214 |
/>
|
| 215 |
{:else}
|
| 216 |
<AssistantIntroduction
|
| 217 |
+
{models}
|
| 218 |
{assistant}
|
| 219 |
on:message={(ev) => {
|
| 220 |
if ($page.data.loginRequired) {
|