enh: model desc md support

This commit is contained in:
Timothy J. Baek 2024-06-15 04:32:18 -06:00
parent dfa2cf9e6d
commit fe9685867e
3 changed files with 13 additions and 3 deletions

View File

@ -28,6 +28,10 @@ math {
@apply rounded-lg; @apply rounded-lg;
} }
.markdown a {
@apply underline;
}
ol > li { ol > li {
counter-increment: list-number; counter-increment: list-number;
display: block; display: block;

View File

@ -1,5 +1,7 @@
<script lang="ts"> <script lang="ts">
import { WEBUI_BASE_URL } from '$lib/constants'; import { WEBUI_BASE_URL } from '$lib/constants';
import { marked } from 'marked';
import { config, user, models as _models } from '$lib/stores'; import { config, user, models as _models } from '$lib/stores';
import { onMount, getContext } from 'svelte'; import { onMount, getContext } from 'svelte';
@ -65,8 +67,10 @@
<div in:fade={{ duration: 200, delay: 200 }}> <div in:fade={{ duration: 200, delay: 200 }}>
{#if models[selectedModelIdx]?.info?.meta?.description ?? null} {#if models[selectedModelIdx]?.info?.meta?.description ?? null}
<div class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400 line-clamp-3"> <div
{models[selectedModelIdx]?.info?.meta?.description} class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400 line-clamp-3 markdown"
>
{@html marked.parse(models[selectedModelIdx]?.info?.meta?.description)}
</div> </div>
{#if models[selectedModelIdx]?.info?.meta?.user} {#if models[selectedModelIdx]?.info?.meta?.user}
<div class="mt-0.5 text-sm font-normal text-gray-400 dark:text-gray-500"> <div class="mt-0.5 text-sm font-normal text-gray-400 dark:text-gray-500">

View File

@ -1,5 +1,7 @@
<script lang="ts"> <script lang="ts">
import { onDestroy } from 'svelte'; import { onDestroy } from 'svelte';
import { marked } from 'marked';
import tippy from 'tippy.js'; import tippy from 'tippy.js';
export let placement = 'top'; export let placement = 'top';
@ -15,7 +17,7 @@
tooltipInstance.setContent(content); tooltipInstance.setContent(content);
} else { } else {
tooltipInstance = tippy(tooltipElement, { tooltipInstance = tippy(tooltipElement, {
content: content, content: marked.parse(content),
placement: placement, placement: placement,
allowHTML: true, allowHTML: true,
touch: touch touch: touch