refac: model editor
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Python CI / Format Backend (3.11) (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
Integration Test / Run Cypress Integration Tests (push) Waiting to run
Integration Test / Run Migration Tests (push) Waiting to run

This commit is contained in:
Timothy Jaeryang Baek 2025-01-20 23:44:47 -08:00
parent 94d0f84c0c
commit 6408452e8f

View File

@ -45,6 +45,8 @@
let id = '';
let name = '';
let enableDescription = true;
$: if (!edit) {
if (name) {
id = name
@ -115,6 +117,12 @@
info.access_control = accessControl;
info.meta.capabilities = capabilities;
if (enableDescription) {
info.meta.description = info.meta.description.trim() === '' ? null : info.meta.description;
} else {
info.meta.description = null;
}
if (knowledge.length > 0) {
info.meta.knowledge = knowledge;
} else {
@ -178,6 +186,8 @@
id = model.id;
enableDescription = model?.meta?.description !== null;
if (model.base_model_id) {
const base_model = $models
.filter((m) => !m?.preset && !(m?.arena ?? false))
@ -479,14 +489,10 @@
class="p-1 text-xs flex rounded transition"
type="button"
on:click={() => {
if (info.meta.description === null) {
info.meta.description = '';
} else {
info.meta.description = null;
}
enableDescription = !enableDescription;
}}
>
{#if info.meta.description === null}
{#if !enableDescription}
<span class="ml-2 self-center">{$i18n.t('Default')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('Custom')}</span>
@ -494,17 +500,16 @@
</button>
</div>
{#if info.meta.description !== null}
{#if enableDescription}
<Textarea
className=" text-sm w-full bg-transparent outline-none resize-none overflow-y-hidden "
placeholder={$i18n.t('Add a short description about what this model does')}
rows={3}
bind:value={info.meta.description}
/>
{/if}
</div>
<div class="my-1">
<div class=" mt-2 my-1">
<div class="">
<Tags
tags={info?.meta?.tags ?? []}