mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-12 03:48:33 +00:00
refac
This commit is contained in:
parent
352e1a12cc
commit
1283b2701e
3 changed files with 23 additions and 9 deletions
|
|
@ -49,7 +49,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div bind:this={list} class="flex flex-col gap-1.5">
|
||||
{#each entries as entry, index (entry)}
|
||||
{#each entries as entry (entry)}
|
||||
<div
|
||||
class="grid grid-cols-[minmax(0,1fr)_minmax(0,1fr)_1.5rem] items-center gap-2 rounded-lg border border-gray-100/40 px-2 py-1 transition focus-within:border-blue-400 dark:border-gray-850/50 dark:focus-within:border-blue-500"
|
||||
>
|
||||
|
|
@ -70,11 +70,19 @@
|
|||
entry.i18n = { ...entry.i18n, [locale]: { content: event.currentTarget.value } };
|
||||
}}
|
||||
></textarea>
|
||||
<Tooltip content={$i18n.t('Delete')}>
|
||||
<Tooltip
|
||||
content={`${$i18n.t('Delete')} · ${languages.find((language) => language.code === locale)?.title ?? locale}`}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={$i18n.t('Delete')}
|
||||
on:click={() => (entries = entries.filter((_, i) => i !== index))}
|
||||
aria-label={`${$i18n.t('Delete')} · ${languages.find((language) => language.code === locale)?.title ?? locale}`}
|
||||
on:click={() => {
|
||||
delete entry.i18n[locale];
|
||||
entries = entries.filter(
|
||||
(item) =>
|
||||
item !== entry || Object.values(item.i18n).some((text) => text.content.trim())
|
||||
);
|
||||
}}
|
||||
class="flex size-6 shrink-0 items-center justify-center text-gray-400 hover:text-gray-700 dark:text-gray-600 dark:hover:text-gray-300"
|
||||
>
|
||||
<XMark className="size-3.5" />
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import PromptSuggestions from './PromptSuggestions.svelte';
|
||||
import { resolveLocalizedPromptSuggestions } from '$lib/utils/localizedContent';
|
||||
|
||||
const i18n = getContext<any>('i18n');
|
||||
|
||||
|
|
@ -17,9 +18,7 @@
|
|||
locale !== '' && Array.isArray(localizedPromptSuggestions?.[locale]?.suggestion_prompts);
|
||||
|
||||
$: localePrompts = clone(
|
||||
hasCustomLocalePrompts
|
||||
? localizedPromptSuggestions[locale].suggestion_prompts
|
||||
: promptSuggestions
|
||||
resolveLocalizedPromptSuggestions(promptSuggestions, localizedPromptSuggestions, locale)
|
||||
);
|
||||
|
||||
const updateLocalePrompts = (suggestions) => {
|
||||
|
|
|
|||
|
|
@ -58,7 +58,8 @@
|
|||
import { copyToClipboard, extractInputVariables } from '$lib/utils';
|
||||
import {
|
||||
modelControlTranslationSource,
|
||||
pruneEmptyLocaleEntries
|
||||
pruneEmptyLocaleEntries,
|
||||
resolveLocalizedPromptSuggestions
|
||||
} from '$lib/utils/localizedContent';
|
||||
|
||||
const i18n: any = getContext('i18n');
|
||||
|
|
@ -1498,7 +1499,13 @@
|
|||
>
|
||||
{#if editingLocale}
|
||||
<LocalizedPromptSuggestions
|
||||
promptSuggestions={info.meta.suggestion_prompts ?? []}
|
||||
promptSuggestions={info.meta.suggestion_prompts ??
|
||||
resolveLocalizedPromptSuggestions(
|
||||
$config?.default_prompt_suggestions,
|
||||
$config?.default_prompt_suggestions_i18n ?? {},
|
||||
editingLocale,
|
||||
(key) => $i18n.t(key)
|
||||
)}
|
||||
bind:localizedPromptSuggestions={info.meta.i18n}
|
||||
locale={editingLocale}
|
||||
localeLabel={editingLocaleLabel}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue