Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support for on prem #3

Merged
merged 9 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Use .env.local to change these variables
# DO NOT EDIT THIS FILE WITH SENSITIVE DATA

MONGODB_URL=#your mongodb URL here
MONGODB_URL=mongodb://localhost:27017/#your mongodb URL here
MONGODB_DB_NAME=chat-ui
MONGODB_DIRECT_CONNECTION=false

Expand Down
36 changes: 17 additions & 19 deletions src/lib/components/chat/ChatIntroduction.svelte
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<script lang="ts">
import { PUBLIC_APP_NAME, PUBLIC_VERSION } from "$env/static/public";
import { PUBLIC_APP_NAME } from "$env/static/public";
import { PUBLIC_ANNOUNCEMENT_BANNERS } from "$env/static/public";
import { PUBLIC_APP_DESCRIPTION } from "$env/static/public";
import Logo from "$lib/components/icons/Logo.svelte";
import { createEventDispatcher } from "svelte";
import IconGear from "~icons/bi/gear-fill";
import CarbonArrowUpRight from "~icons/carbon/arrow-up-right";
import AnnouncementBanner from "../AnnouncementBanner.svelte";
import type { Model } from "$lib/types/Model";
import ModelCardMetadata from "../ModelCardMetadata.svelte";
import { findCurrentModel } from "$lib/utils/models";
import { base } from "$app/paths";
import { useSettingsStore } from "$lib/stores/settings";
Expand All @@ -33,11 +31,11 @@
<div class="mb-3 flex items-center text-2xl font-semibold">
<Logo classNames="mr-1 flex-none" />
{PUBLIC_APP_NAME}
<div
<!-- <div
class="ml-3 flex h-6 items-center rounded-lg border border-gray-100 bg-gray-50 px-2 text-base text-gray-400 dark:border-gray-700/60 dark:bg-gray-800"
>
v{PUBLIC_VERSION}
</div>
</div> -->
</div>
<p class="text-base text-gray-600 dark:text-gray-400">
{PUBLIC_APP_DESCRIPTION ||
Expand All @@ -48,28 +46,28 @@
<div class="lg:col-span-2 lg:pl-24">
{#each announcementBanners as banner}
<AnnouncementBanner classNames="mb-4" title={banner.title}>
<a
<!-- <a
target="_blank"
href={banner.linkHref}
class="mr-2 flex items-center underline hover:no-underline"
><CarbonArrowUpRight class="mr-1.5 text-xs" /> {banner.linkTitle}</a
>
> -->
</AnnouncementBanner>
{/each}
<div class="overflow-hidden rounded-xl border dark:border-gray-800">
<div class="flex p-3">
<div>
<div class="text-sm text-gray-600 dark:text-gray-400">Current Model</div>
<div class="font-semibold">{currentModel.displayName}</div>
<a href="{base}/settings/{currentModel.id}">
<div
class="overflow-hidden rounded-xl border hover:bg-gray-100 dark:border-gray-600 dark:border-gray-800 dark:bg-gray-800 dark:hover:bg-gray-600"
>
<div class="flex p-3">
<div>
<div class="text-sm text-gray-600 dark:text-gray-400">Current Model</div>
<div class="font-semibold">{currentModel.displayName}</div>
</div>
<div class="btn ml-auto flex h-7 w-7 self-start rounded-full"><IconGear /></div>
</div>
<a
href="{base}/settings/{currentModel.id}"
class="btn ml-auto flex h-7 w-7 self-start rounded-full bg-gray-100 p-1 text-xs hover:bg-gray-100 dark:border-gray-600 dark:bg-gray-800 dark:hover:bg-gray-600"
><IconGear /></a
>
<!-- <ModelCardMetadata variant="dark" model={currentModel} /> -->
</div>
<ModelCardMetadata variant="dark" model={currentModel} />
</div>
</a>
</div>
{#if currentModelMetadata.promptExamples}
<div class="lg:col-span-3 lg:mt-6">
Expand Down
6 changes: 5 additions & 1 deletion src/lib/components/chat/ChatMessage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import { afterUpdate, createEventDispatcher } from "svelte";
import { deepestChild } from "$lib/utils/deepestChild";
import { page } from "$app/stores";
import { base } from "$app/paths";
import { PUBLIC_ORIGIN } from "$env/static/public";
import { PUBLIC_APP_ASSETS } from "$env/static/public";

import CodeBlock from "../CodeBlock.svelte";
import CopyToClipBoardBtn from "../CopyToClipBoardBtn.svelte";
Expand Down Expand Up @@ -140,7 +143,8 @@
>
<img
alt=""
src="https://huggingface.co/avatars/2edb18bd0206c16b433841a47f53fa8e.svg"
src="{PUBLIC_ORIGIN ||
$page.url.origin}{base}/{PUBLIC_APP_ASSETS}/2edb18bd0206c16b433841a47f53fa8e.svg"
class="mt-5 h-3 w-3 flex-none select-none rounded-full shadow-lg"
/>
<div
Expand Down
10 changes: 3 additions & 7 deletions src/lib/components/chat/ChatWindow.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -216,13 +216,9 @@
class="mt-2 flex justify-between self-stretch px-1 text-xs text-gray-400/90 max-md:mb-2 max-sm:gap-2"
>
<p>
Model: <a
href={currentModel.modelUrl || "https://huggingface.co/" + currentModel.name}
target="_blank"
rel="noreferrer"
class="hover:underline">{currentModel.displayName}</a
> <span class="max-sm:hidden">·</span><br class="sm:hidden" /> Generated content may be inaccurate
or false.
Model: {currentModel.displayName}<span class="max-sm:hidden">·</span><br
class="sm:hidden"
/> Generated content may be inaccurate or false.
</p>
{#if messages.length}
<button
Expand Down
11 changes: 3 additions & 8 deletions src/routes/conversation/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import type { MessageUpdate, WebSearchUpdate } from "$lib/types/MessageUpdate";
import titleUpdate from "$lib/stores/titleUpdate";
import file2base64 from "$lib/utils/file2base64";
import { PUBLIC_APP_NAME } from "$env/static/public";
export let data;

let messages = data.messages;
Expand Down Expand Up @@ -308,17 +309,11 @@
}

$: $page.params.id, (($isAborted = true), (loading = false));
$: title = data.conversations.find((conv) => conv.id === $page.params.id)?.title ?? data.title;
// $: title = data.conversations.find((conv) => conv.id === $page.params.id)?.title ?? data.title;
</script>

<svelte:head>
<title>{title}</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
integrity="sha384-GvrOXuhMATgEsSwCs4smul74iXGOixntILdUW9XmUC6+HX0sLNAK3q71HotJqlAn"
crossorigin="anonymous"
/>
<title>{PUBLIC_APP_NAME}</title>
</svelte:head>

<ChatWindow
Expand Down
5 changes: 2 additions & 3 deletions src/routes/settings/[...model]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import type { BackendModel } from "$lib/server/models";
import { useSettingsStore } from "$lib/stores/settings";
import CopyToClipBoardBtn from "$lib/components/CopyToClipBoardBtn.svelte";
import CarbonArrowUpRight from "~icons/carbon/arrow-up-right";
import CarbonLink from "~icons/carbon/link";

const settings = useSettingsStore();
Expand Down Expand Up @@ -41,7 +40,7 @@
</div>

<div class="flex flex-wrap items-center gap-2 md:gap-4">
<a
<!-- <a
href={model.modelUrl || "https://huggingface.co/" + model.name}
target="_blank"
rel="noreferrer"
Expand Down Expand Up @@ -73,7 +72,7 @@
<CarbonArrowUpRight class="mr-1.5 shrink-0 text-xs " />
Model website
</a>
{/if}
{/if} -->
<CopyToClipBoardBtn
value="{PUBLIC_ORIGIN || $page.url.origin}{base}?model={model.id}"
classNames="!border-none !shadow-none !py-0 !px-1 !rounded-md"
Expand Down
1 change: 1 addition & 0 deletions static/chatui/2edb18bd0206c16b433841a47f53fa8e.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.