mirror of
https://github.com/open-webui/open-webui
synced 2025-06-11 17:02:47 +00:00
refac: styling
This commit is contained in:
parent
f6fb522269
commit
9ea9e8478a
@ -184,7 +184,7 @@
|
|||||||
</title>
|
</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="flex flex-col gap-0.5 mt-1 mb-2">
|
<div class="flex flex-col gap-1 mt-1.5 mb-2">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class="flex md:self-center text-xl items-center font-medium px-0.5">
|
<div class="flex md:self-center text-xl items-center font-medium px-0.5">
|
||||||
{$i18n.t('Functions')}
|
{$i18n.t('Functions')}
|
||||||
|
@ -75,7 +75,7 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="flex flex-col gap-0.5 mt-1 mb-2">
|
<div class="flex flex-col gap-1 mt-1.5 mb-2">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class="flex md:self-center text-xl font-medium px-0.5 items-center">
|
<div class="flex md:self-center text-xl font-medium px-0.5 items-center">
|
||||||
{$i18n.t('Knowledge')}
|
{$i18n.t('Knowledge')}
|
||||||
|
@ -306,7 +306,7 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div class="flex flex-col gap-0.5 mt-1 mb-2">
|
<div class="flex flex-col gap-1 mt-1.5 mb-2">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class="flex items-center md:self-center text-xl font-medium px-0.5">
|
<div class="flex items-center md:self-center text-xl font-medium px-0.5">
|
||||||
{$i18n.t('Models')}
|
{$i18n.t('Models')}
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
<div class="flex w-full justify-between mb-1">
|
<div class="flex w-full justify-between mb-1">
|
||||||
<div class=" self-center text-sm font-semibold">{$i18n.t('Capabilities')}</div>
|
<div class=" self-center text-sm font-semibold">{$i18n.t('Capabilities')}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col">
|
<div class="flex">
|
||||||
{#each Object.keys(capabilities) as capability}
|
{#each Object.keys(capabilities) as capability}
|
||||||
<div class=" flex items-center gap-2">
|
<div class=" flex items-center gap-2 mr-3">
|
||||||
<Checkbox
|
<Checkbox
|
||||||
state={capabilities[capability] ? 'checked' : 'unchecked'}
|
state={capabilities[capability] ? 'checked' : 'unchecked'}
|
||||||
on:change={(e) => {
|
on:change={(e) => {
|
||||||
|
@ -149,19 +149,6 @@
|
|||||||
await tick();
|
await tick();
|
||||||
|
|
||||||
id = model.id;
|
id = model.id;
|
||||||
info = {
|
|
||||||
...info,
|
|
||||||
...JSON.parse(
|
|
||||||
JSON.stringify(
|
|
||||||
model?.info
|
|
||||||
? model?.info
|
|
||||||
: {
|
|
||||||
id: model.id,
|
|
||||||
name: model.name
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
if (model.info.base_model_id) {
|
if (model.info.base_model_id) {
|
||||||
const base_model = $models
|
const base_model = $models
|
||||||
@ -214,7 +201,16 @@
|
|||||||
|
|
||||||
info = {
|
info = {
|
||||||
...info,
|
...info,
|
||||||
...model.info
|
...JSON.parse(
|
||||||
|
JSON.stringify(
|
||||||
|
model?.info
|
||||||
|
? model?.info
|
||||||
|
: {
|
||||||
|
id: model.id,
|
||||||
|
name: model.name
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log(model);
|
console.log(model);
|
||||||
@ -290,42 +286,17 @@
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<button
|
|
||||||
class="flex space-x-1"
|
|
||||||
on:click={() => {
|
|
||||||
goto('/workspace/models');
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div class=" self-center">
|
|
||||||
<svg
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
viewBox="0 0 20 20"
|
|
||||||
fill="currentColor"
|
|
||||||
class="w-4 h-4"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill-rule="evenodd"
|
|
||||||
d="M17 10a.75.75 0 01-.75.75H5.612l4.158 3.96a.75.75 0 11-1.04 1.08l-5.5-5.25a.75.75 0 010-1.08l5.5-5.25a.75.75 0 111.04 1.08L5.612 9.25H16.25A.75.75 0 0117 10z"
|
|
||||||
clip-rule="evenodd"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<div class=" self-center font-medium text-sm">{$i18n.t('Back')}</div>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{#if !edit || model}
|
{#if !edit || model}
|
||||||
<form
|
<form
|
||||||
class="flex flex-col max-w-2xl mx-auto mt-4 mb-10"
|
class="flex flex-col md:flex-row mx-auto gap-3 md:gap-6"
|
||||||
on:submit|preventDefault={() => {
|
on:submit|preventDefault={() => {
|
||||||
submitHandler();
|
submitHandler();
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class="flex justify-center my-4">
|
<div class="self-center md:self-start flex justify-center my-2 flex-shrink-0">
|
||||||
<div class="self-center">
|
<div class="self-center">
|
||||||
<button
|
<button
|
||||||
class=" {info.meta.profile_image_url
|
class="rounded-2xl flex flex-shrink-0 items-center bg-white"
|
||||||
? ''
|
|
||||||
: 'p-4'} rounded-full border border-dashed border-gray-200 flex items-center"
|
|
||||||
type="button"
|
type="button"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
filesInputElement.click();
|
filesInputElement.click();
|
||||||
@ -334,35 +305,27 @@
|
|||||||
{#if info.meta.profile_image_url}
|
{#if info.meta.profile_image_url}
|
||||||
<img
|
<img
|
||||||
src={info.meta.profile_image_url}
|
src={info.meta.profile_image_url}
|
||||||
alt="modelfile profile"
|
alt="model profile"
|
||||||
class=" rounded-full size-16 object-cover"
|
class="rounded-lg size-64 object-cover shrink-0"
|
||||||
/>
|
/>
|
||||||
{:else}
|
{:else}
|
||||||
<svg
|
<img
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
src="/static/favicon.png"
|
||||||
viewBox="0 0 24 24"
|
alt="model profile"
|
||||||
fill="currentColor"
|
class=" rounded-lg size-64 object-cover shrink-0"
|
||||||
class="size-8"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
fill-rule="evenodd"
|
|
||||||
d="M12 3.75a.75.75 0 01.75.75v6.75h6.75a.75.75 0 010 1.5h-6.75v6.75a.75.75 0 01-1.5 0v-6.75H4.5a.75.75 0 010-1.5h6.75V4.5a.75.75 0 01.75-.75z"
|
|
||||||
clip-rule="evenodd"
|
|
||||||
/>
|
/>
|
||||||
</svg>
|
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-2 my-1 flex space-x-2">
|
<div>
|
||||||
|
<div class="mt-2 my-2 flex flex-col">
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<div class=" text-sm font-semibold mb-1">{$i18n.t('Name')}*</div>
|
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
|
class="text-3xl font-semibold w-full bg-transparent outline-none"
|
||||||
placeholder={$i18n.t('Name your model')}
|
placeholder={$i18n.t('Model Name')}
|
||||||
bind:value={name}
|
bind:value={name}
|
||||||
required
|
required
|
||||||
/>
|
/>
|
||||||
@ -370,12 +333,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex-1">
|
<div class="flex-1">
|
||||||
<div class=" text-sm font-semibold mb-1">{$i18n.t('Model ID')}*</div>
|
<!-- <div class=" text-sm font-semibold">{$i18n.t('Model ID')}*</div> -->
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<input
|
<input
|
||||||
class="px-3 py-1.5 text-sm w-full bg-transparent disabled:text-gray-500 border dark:border-gray-600 outline-none rounded-lg"
|
class="text-xs w-full bg-transparent text-gray-500 outline-none rounded-lg"
|
||||||
placeholder={$i18n.t('Add a model id')}
|
placeholder={$i18n.t('Model ID')}
|
||||||
value={id}
|
value={id}
|
||||||
disabled={edit}
|
disabled={edit}
|
||||||
required
|
required
|
||||||
@ -390,7 +352,7 @@
|
|||||||
|
|
||||||
<div>
|
<div>
|
||||||
<select
|
<select
|
||||||
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
|
class="text-sm w-full bg-transparent outline-none rounded-lg"
|
||||||
placeholder="Select a base model (e.g. llama3, gpt-4o)"
|
placeholder="Select a base model (e.g. llama3, gpt-4o)"
|
||||||
bind:value={info.base_model_id}
|
bind:value={info.base_model_id}
|
||||||
on:change={(e) => {
|
on:change={(e) => {
|
||||||
@ -398,7 +360,8 @@
|
|||||||
}}
|
}}
|
||||||
required
|
required
|
||||||
>
|
>
|
||||||
<option value={null} class=" text-gray-900">{$i18n.t('Select a base model')}</option>
|
<option value={null} class=" text-gray-900">{$i18n.t('Select a base model')}</option
|
||||||
|
>
|
||||||
{#each $models.filter((m) => (model ? m.id !== model.id : true) && !m?.preset && m?.owned_by !== 'arena') as model}
|
{#each $models.filter((m) => (model ? m.id !== model.id : true) && !m?.preset && m?.owned_by !== 'arena') as model}
|
||||||
<option value={model.id} class=" text-gray-900">{model.name}</option>
|
<option value={model.id} class=" text-gray-900">{model.name}</option>
|
||||||
{/each}
|
{/each}
|
||||||
@ -408,7 +371,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="my-1">
|
<div class="my-1">
|
||||||
<div class="flex w-full justify-between items-center">
|
<div class="mb-1 flex w-full justify-between items-center">
|
||||||
<div class=" self-center text-sm font-semibold">{$i18n.t('Description')}</div>
|
<div class=" self-center text-sm font-semibold">{$i18n.t('Description')}</div>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
@ -431,16 +394,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{#if info.meta.description !== null}
|
{#if info.meta.description !== null}
|
||||||
<textarea
|
<Textarea
|
||||||
class="mt-1 px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
|
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')}
|
placeholder={$i18n.t('Add a short description about what this model does')}
|
||||||
|
rows={3}
|
||||||
bind:value={info.meta.description}
|
bind:value={info.meta.description}
|
||||||
row="3"
|
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr class=" dark:border-gray-850 my-1" />
|
<hr class=" dark:border-gray-850 my-1.5" />
|
||||||
|
|
||||||
<div class="my-2">
|
<div class="my-2">
|
||||||
<div class="flex w-full justify-between">
|
<div class="flex w-full justify-between">
|
||||||
@ -454,7 +417,7 @@
|
|||||||
<div class=" text-xs font-semibold mb-2">{$i18n.t('System Prompt')}</div>
|
<div class=" text-xs font-semibold mb-2">{$i18n.t('System Prompt')}</div>
|
||||||
<div>
|
<div>
|
||||||
<Textarea
|
<Textarea
|
||||||
className="px-3 py-2 text-sm w-full bg-transparent border dark:border-gray-600 outline-none resize-none overflow-y-hidden rounded-lg "
|
className=" text-sm w-full bg-transparent outline-none resize-none overflow-y-hidden "
|
||||||
placeholder={`Write your model system prompt content here\ne.g.) You are Mario from Super Mario Bros, acting as an assistant.`}
|
placeholder={`Write your model system prompt content here\ne.g.) You are Mario from Super Mario Bros, acting as an assistant.`}
|
||||||
rows={4}
|
rows={4}
|
||||||
bind:value={info.params.system}
|
bind:value={info.params.system}
|
||||||
@ -531,7 +494,10 @@
|
|||||||
info.meta.suggestion_prompts.length === 0 ||
|
info.meta.suggestion_prompts.length === 0 ||
|
||||||
info.meta.suggestion_prompts.at(-1).content !== ''
|
info.meta.suggestion_prompts.at(-1).content !== ''
|
||||||
) {
|
) {
|
||||||
info.meta.suggestion_prompts = [...info.meta.suggestion_prompts, { content: '' }];
|
info.meta.suggestion_prompts = [
|
||||||
|
...info.meta.suggestion_prompts,
|
||||||
|
{ content: '' }
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
@ -588,6 +554,8 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class=" dark:border-gray-850 my-1.5" />
|
||||||
|
|
||||||
<div class="my-2">
|
<div class="my-2">
|
||||||
<Knowledge bind:selectedKnowledge={knowledge} collections={$knowledgeCollections} />
|
<Knowledge bind:selectedKnowledge={knowledge} collections={$knowledgeCollections} />
|
||||||
</div>
|
</div>
|
||||||
@ -660,7 +628,7 @@
|
|||||||
{#if showPreview}
|
{#if showPreview}
|
||||||
<div>
|
<div>
|
||||||
<textarea
|
<textarea
|
||||||
class="px-3 py-1.5 text-sm w-full bg-transparent border dark:border-gray-600 outline-none rounded-lg"
|
class="text-sm w-full bg-transparent outline-none resize-none"
|
||||||
rows="10"
|
rows="10"
|
||||||
value={JSON.stringify(info, null, 2)}
|
value={JSON.stringify(info, null, 2)}
|
||||||
disabled
|
disabled
|
||||||
@ -674,7 +642,7 @@
|
|||||||
<button
|
<button
|
||||||
class=" text-sm px-3 py-2 transition rounded-xl {loading
|
class=" text-sm px-3 py-2 transition rounded-xl {loading
|
||||||
? ' cursor-not-allowed bg-gray-100 dark:bg-gray-800'
|
? ' cursor-not-allowed bg-gray-100 dark:bg-gray-800'
|
||||||
: ' bg-gray-50 hover:bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-800'} flex"
|
: ' bg-gray-50 hover:bg-gray-100 dark:bg-white dark:hover:bg-gray-100 dark:text-black'} flex w-full justify-center"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
>
|
>
|
||||||
@ -715,6 +683,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</DeleteConfirmDialog>
|
</DeleteConfirmDialog>
|
||||||
|
|
||||||
<div class="flex flex-col gap-0.5 mt-1 mb-2">
|
<div class="flex flex-col gap-1 mt-1.5 mb-2">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class="flex md:self-center text-xl font-medium px-0.5 items-center">
|
<div class="flex md:self-center text-xl font-medium px-0.5 items-center">
|
||||||
{$i18n.t('Prompts')}
|
{$i18n.t('Prompts')}
|
||||||
|
@ -156,7 +156,7 @@
|
|||||||
</title>
|
</title>
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<div class="flex flex-col gap-0.5 mt-1 mb-2">
|
<div class="flex flex-col gap-1 mt-1.5 mb-2">
|
||||||
<div class="flex justify-between items-center">
|
<div class="flex justify-between items-center">
|
||||||
<div class="flex md:self-center text-xl font-medium px-0.5 items-center">
|
<div class="flex md:self-center text-xl font-medium px-0.5 items-center">
|
||||||
{$i18n.t('Tools')}
|
{$i18n.t('Tools')}
|
||||||
|
Loading…
Reference in New Issue
Block a user