Bläddra i källkod

feat: show desc in model selector

Timothy J. Baek 11 månader sedan
förälder
incheckning
331941dbc1

+ 1 - 1
src/lib/components/chat/Messages/Placeholder.svelte

@@ -65,7 +65,7 @@
 
 				<div in:fade={{ duration: 200, delay: 200 }}>
 					{#if models[selectedModelIdx]?.info}
-						<div class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400">
+						<div class="mt-0.5 text-base font-normal text-gray-500 dark:text-gray-400 line-clamp-3">
 							{models[selectedModelIdx]?.info?.meta?.description}
 						</div>
 						{#if models[selectedModelIdx]?.info?.meta?.user}

+ 28 - 39
src/lib/components/chat/ModelSelector/Selector.svelte

@@ -246,13 +246,29 @@
 						}}
 					>
 						<div class="flex items-center gap-2">
-							<div class="line-clamp-1">
-								{item.label}
-
-								{#if item.model.owned_by === 'ollama'}
-									<span class=" text-xs font-medium text-gray-600 dark:text-gray-400"
-										>{item.model.ollama?.details?.parameter_size ?? ''}</span
-									>
+							<div class="flex items-center">
+								<div class="line-clamp-1">
+									{item.label}
+								</div>
+								{#if item.model.owned_by === 'ollama' && (item.model.ollama?.details?.parameter_size ?? '') !== ''}
+									<div class="flex ml-1 items-center">
+										<Tooltip
+											content={`${
+												item.model.ollama?.details?.quantization_level
+													? item.model.ollama?.details?.quantization_level + ' '
+													: ''
+											}${
+												item.model.ollama?.size
+													? `(${(item.model.ollama?.size / 1024 ** 3).toFixed(1)}GB)`
+													: ''
+											}`}
+											className="self-end"
+										>
+											<span class=" text-xs font-medium text-gray-600 dark:text-gray-400"
+												>{item.model.ollama?.details?.parameter_size ?? ''}</span
+											>
+										</Tooltip>
+									</div>
 								{/if}
 							</div>
 
@@ -280,40 +296,12 @@
 										</svg>
 									</div>
 								</Tooltip>
-							{:else if item.model.owned_by === 'ollama'}
-								<Tooltip
-									content={`${
-										item.model.ollama?.details?.quantization_level
-											? item.model.ollama?.details?.quantization_level + ' '
-											: ''
-									}${
-										item.model.ollama?.size
-											? `(${(item.model.ollama?.size / 1024 ** 3).toFixed(1)}GB)`
-											: ''
-									}`}
-								>
-									<div class="">
-										<svg
-											xmlns="http://www.w3.org/2000/svg"
-											fill="none"
-											viewBox="0 0 24 24"
-											stroke-width="1.5"
-											stroke="currentColor"
-											class="w-4 h-4"
-										>
-											<path
-												stroke-linecap="round"
-												stroke-linejoin="round"
-												d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"
-											/>
-										</svg>
-									</div>
-								</Tooltip>
 							{/if}
-							{#if item.info?.custom_info?.meta.description}
+
+							{#if item.model?.info?.meta?.description}
 								<Tooltip
 									content={`${sanitizeResponseContent(
-										item.info.custom_info?.meta.description
+										item.model?.info?.meta?.description
 									).replaceAll('\n', '<br>')}`}
 								>
 									<div class="">
@@ -328,13 +316,14 @@
 											<path
 												stroke-linecap="round"
 												stroke-linejoin="round"
-												d="M9.879 7.519c1.171-1.025 3.071-1.025 4.242 0 1.172 1.025 1.172 2.687 0 3.712-.203.179-.43.326-.67.442-.745.361-1.45.999-1.45 1.827v.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 5.25h.008v.008H12v-.008Z"
+												d="m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"
 											/>
 										</svg>
 									</div>
 								</Tooltip>
 							{/if}
 						</div>
+
 						{#if value === item.value}
 							<div class="ml-auto">
 								<Check />