Commit df47c496 authored by Jonathan Rohde's avatar Jonathan Rohde
Browse files

Merge branch 'refs/heads/dev' into feat/sqlalchemy-instead-of-peewee

# Conflicts:
#	backend/apps/webui/models/functions.py
#	backend/apps/webui/routers/chats.py
parents 827b1e58 cd9170ed
......@@ -14,7 +14,8 @@
exportFunctions,
getFunctionById,
getFunctions,
toggleFunctionById
toggleFunctionById,
toggleGlobalById
} from '$lib/apis/functions';
import ArrowDownTray from '../icons/ArrowDownTray.svelte';
......@@ -113,6 +114,22 @@
models.set(await getModels(localStorage.token));
}
};
const toggleGlobalHandler = async (func) => {
const res = await toggleGlobalById(localStorage.token, func.id).catch((error) => {
toast.error(error);
});
if (res) {
if (func.is_global) {
toast.success($i18n.t('Filter is now globally enabled'));
} else {
toast.success($i18n.t('Filter is now globally disabled'));
}
functions.set(await getFunctions(localStorage.token));
}
};
</script>
<svelte:head>
......@@ -259,6 +276,7 @@
</Tooltip>
<FunctionMenu
{func}
editHandler={() => {
goto(`/workspace/functions/edit?id=${encodeURIComponent(func.id)}`);
}}
......@@ -275,6 +293,11 @@
selectedFunction = func;
showDeleteConfirm = true;
}}
toggleGlobalHandler={() => {
if (func.type === 'filter') {
toggleGlobalHandler(func);
}
}}
onClose={() => {}}
>
<button
......@@ -286,13 +309,15 @@
</FunctionMenu>
<div class=" self-center mx-1">
<Switch
bind:state={func.is_active}
on:change={async (e) => {
toggleFunctionById(localStorage.token, func.id);
models.set(await getModels(localStorage.token));
}}
/>
<Tooltip content={func.is_active ? 'Enabled' : 'Disabled'}>
<Switch
bind:state={func.is_active}
on:change={async (e) => {
toggleFunctionById(localStorage.token, func.id);
models.set(await getModels(localStorage.token));
}}
/>
</Tooltip>
</div>
</div>
</div>
......
......@@ -5,21 +5,24 @@
import Dropdown from '$lib/components/common/Dropdown.svelte';
import GarbageBin from '$lib/components/icons/GarbageBin.svelte';
import Pencil from '$lib/components/icons/Pencil.svelte';
import Tooltip from '$lib/components/common/Tooltip.svelte';
import Tags from '$lib/components/chat/Tags.svelte';
import Share from '$lib/components/icons/Share.svelte';
import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte';
import DocumentDuplicate from '$lib/components/icons/DocumentDuplicate.svelte';
import ArrowDownTray from '$lib/components/icons/ArrowDownTray.svelte';
import Switch from '$lib/components/common/Switch.svelte';
import GlobeAlt from '$lib/components/icons/GlobeAlt.svelte';
const i18n = getContext('i18n');
export let func;
export let editHandler: Function;
export let shareHandler: Function;
export let cloneHandler: Function;
export let exportHandler: Function;
export let deleteHandler: Function;
export let toggleGlobalHandler: Function;
export let onClose: Function;
let show = false;
......@@ -45,6 +48,24 @@
align="start"
transition={flyAndScale}
>
{#if func.type === 'filter'}
<div
class="flex gap-2 justify-between items-center px-3 py-2 text-sm font-medium cursor-pointerrounded-md"
>
<div class="flex gap-2 items-center">
<GlobeAlt />
<div class="flex items-center">{$i18n.t('Global')}</div>
</div>
<div>
<Switch on:change={toggleGlobalHandler} bind:state={func.is_global} />
</div>
</div>
<hr class="border-gray-100 dark:border-gray-800 my-1" />
{/if}
<DropdownMenu.Item
class="flex gap-2 items-center px-3 py-2 text-sm font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-md"
on:click={() => {
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "وضع الملف",
"File not found.": "لم يتم العثور على الملف.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "تم اكتشاف انتحال بصمة الإصبع: غير قادر على استخدام الأحرف الأولى كصورة رمزية. الافتراضي لصورة الملف الشخصي الافتراضية.",
"Fluidly stream large external response chunks": "دفق قطع الاستجابة الخارجية الكبيرة بسلاسة",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "إنشاء استعلام بحث",
"Generation Info": "معلومات الجيل",
"Global": "",
"Good Response": "استجابة جيدة",
"Google PSE API Key": "مفتاح واجهة برمجة تطبيقات PSE من Google",
"Google PSE Engine Id": "معرف محرك PSE من Google",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "Файл Мод",
"File not found.": "Файл не е намерен.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Потвърждаване на отпечатък: Не може да се използва инициализационна буква като аватар. Потребителят се връща към стандартна аватарка.",
"Fluidly stream large external response chunks": "Плавно предаване на големи части от външен отговор",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "Генериране на заявка за търсене",
"Generation Info": "Информация за Генерация",
"Global": "",
"Good Response": "Добра отговор",
"Google PSE API Key": "Google PSE API ключ",
"Google PSE Engine Id": "Идентификатор на двигателя на Google PSE",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "ফাইল মোড",
"File not found.": "ফাইল পাওয়া যায়নি",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "ফিঙ্গারপ্রিন্ট স্পুফিং ধরা পড়েছে: অ্যাভাটার হিসেবে নামের আদ্যক্ষর ব্যবহার করা যাচ্ছে না। ডিফল্ট প্রোফাইল পিকচারে ফিরিয়ে নেয়া হচ্ছে।",
"Fluidly stream large external response chunks": "বড় এক্সটার্নাল রেসপন্স চাঙ্কগুলো মসৃণভাবে প্রবাহিত করুন",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "অনুসন্ধান ক্যোয়ারী তৈরি করা হচ্ছে",
"Generation Info": "জেনারেশন ইনফো",
"Global": "",
"Good Response": "ভালো সাড়া",
"Google PSE API Key": "গুগল পিএসই এপিআই কী",
"Google PSE Engine Id": "গুগল পিএসই ইঞ্জিন আইডি",
......
......@@ -261,6 +261,8 @@
"File": "Arxiu",
"File Mode": "Mode d'arxiu",
"File not found.": "No s'ha trobat l'arxiu.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "Filtres",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "S'ha detectat la suplantació d'identitat de l'empremta digital: no es poden utilitzar les inicials com a avatar. S'estableix la imatge de perfil predeterminada.",
"Fluidly stream large external response chunks": "Transmetre amb fluïdesa grans trossos de resposta externa",
......@@ -279,6 +281,7 @@
"Generate Image": "Generar imatge",
"Generating search query": "Generant consulta",
"Generation Info": "Informació sobre la generació",
"Global": "",
"Good Response": "Bona resposta",
"Google PSE API Key": "Clau API PSE de Google",
"Google PSE Engine Id": "Identificador del motor PSE de Google",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "File mode",
"File not found.": "Wala makit-an ang file.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "",
"Fluidly stream large external response chunks": "Hapsay nga paghatud sa daghang mga tipik sa eksternal nga mga tubag",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "",
"Generation Info": "",
"Global": "",
"Good Response": "",
"Google PSE API Key": "",
"Google PSE Engine Id": "",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "File Modus",
"File not found.": "Datei nicht gefunden.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Fingerprint spoofing erkannt: Initialen können nicht als Avatar verwendet werden. Es wird auf das Standardprofilbild zurückgegriffen.",
"Fluidly stream large external response chunks": "Große externe Antwortblöcke flüssig streamen",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "Suchanfrage generieren",
"Generation Info": "Generierungsinformationen",
"Global": "",
"Good Response": "Gute Antwort",
"Google PSE API Key": "Google PSE-API-Schlüssel",
"Google PSE Engine Id": "Google PSE-Engine-ID",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "Bark Mode",
"File not found.": "Bark not found.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Fingerprint dogeing: Unable to use initials as avatar. Defaulting to default doge image.",
"Fluidly stream large external response chunks": "Fluidly wow big chunks",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "",
"Generation Info": "",
"Global": "",
"Good Response": "",
"Google PSE API Key": "",
"Google PSE Engine Id": "",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "",
"File not found.": "",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "",
"Fluidly stream large external response chunks": "",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "",
"Generation Info": "",
"Global": "",
"Good Response": "",
"Google PSE API Key": "",
"Google PSE Engine Id": "",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "",
"File not found.": "",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "",
"Fluidly stream large external response chunks": "",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "",
"Generation Info": "",
"Global": "",
"Good Response": "",
"Google PSE API Key": "",
"Google PSE Engine Id": "",
......
This diff is collapsed.
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "حالت فایل",
"File not found.": "فایل یافت نشد.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "فانگ سرفیس شناسایی شد: نمی توان از نمایه شما به عنوان آواتار استفاده کرد. پیش فرض به عکس پروفایل پیش فرض برگشت داده شد.",
"Fluidly stream large external response chunks": "تکه های پاسخ خارجی بزرگ را به صورت سیال پخش کنید",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "در حال تولید پرسوجوی جستجو",
"Generation Info": "اطلاعات تولید",
"Global": "",
"Good Response": "پاسخ خوب",
"Google PSE API Key": "گوگل PSE API کلید",
"Google PSE Engine Id": "شناسه موتور PSE گوگل",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "Tiedostotila",
"File not found.": "Tiedostoa ei löytynyt.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Sormenjäljen väärentäminen havaittu: Ei voi käyttää alkukirjaimia avatarina. Käytetään oletusprofiilikuvaa.",
"Fluidly stream large external response chunks": "Virtaa suuria ulkoisia vastausosia joustavasti",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "Hakukyselyn luominen",
"Generation Info": "Generointitiedot",
"Global": "",
"Good Response": "Hyvä vastaus",
"Google PSE API Key": "Google PSE API -avain",
"Google PSE Engine Id": "Google PSE -moduulin tunnus",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "Mode fichier",
"File not found.": "Fichier introuvable.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Détection de falsification de empreinte digitale\u00a0: impossible d'utiliser les initiales comme avatar. Par défaut, l'image de profil par défaut est utilisée.",
"Fluidly stream large external response chunks": "Diffusez de manière fluide de gros morceaux de réponses externes",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "Génération d’une requête de recherche",
"Generation Info": "Informations de génération",
"Global": "",
"Good Response": "Bonne réponse",
"Google PSE API Key": "Clé d’API Google PSE",
"Google PSE Engine Id": "Id du moteur Google PSE",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "Mode Fichier",
"File not found.": "Fichier non trouvé.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Usurpation d'empreinte digitale détectée : Impossible d'utiliser les initiales comme avatar. L'image de profil par défaut sera utilisée.",
"Fluidly stream large external response chunks": "Diffusez de manière fluide de gros morceaux de réponses externes",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "Génération d’une requête de recherche",
"Generation Info": "Informations de la Génération",
"Global": "",
"Good Response": "Bonne Réponse",
"Google PSE API Key": "Clé API Google PSE",
"Google PSE Engine Id": "ID du moteur Google PSE",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "מצב קובץ",
"File not found.": "הקובץ לא נמצא.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "התגלתה הזיית טביעת אצבע: לא ניתן להשתמש בראשי תיבות כאווטאר. משתמש בתמונת פרופיל ברירת מחדל.",
"Fluidly stream large external response chunks": "שידור נתונים חיצוניים בקצב רציף",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "יצירת שאילתת חיפוש",
"Generation Info": "מידע על היצירה",
"Global": "",
"Good Response": "תגובה טובה",
"Google PSE API Key": "מפתח API של Google PSE",
"Google PSE Engine Id": "מזהה מנוע PSE של Google",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "फ़ाइल मोड",
"File not found.": "फ़ाइल प्राप्त नहीं हुई।",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "फ़िंगरप्रिंट स्पूफ़िंग का पता चला: प्रारंभिक अक्षरों को अवतार के रूप में उपयोग करने में असमर्थ। प्रोफ़ाइल छवि को डिफ़ॉल्ट पर डिफ़ॉल्ट किया जा रहा है.",
"Fluidly stream large external response chunks": "बड़े बाह्य प्रतिक्रिया खंडों को तरल रूप से प्रवाहित करें",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "खोज क्वेरी जनरेट करना",
"Generation Info": "जनरेशन की जानकारी",
"Global": "",
"Good Response": "अच्छी प्रतिक्रिया",
"Google PSE API Key": "Google PSE API कुंजी",
"Google PSE Engine Id": "Google PSE इंजन आईडी",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "Način datoteke",
"File not found.": "Datoteka nije pronađena.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Otkriveno krivotvorenje otisaka prstiju: Nemoguće je koristiti inicijale kao avatar. Postavljanje na zadanu profilnu sliku.",
"Fluidly stream large external response chunks": "Glavno strujanje velikih vanjskih dijelova odgovora",
......@@ -279,6 +281,7 @@
"Generate Image": "Gneriraj sliku",
"Generating search query": "Generiranje upita za pretraživanje",
"Generation Info": "Informacije o generaciji",
"Global": "",
"Good Response": "Dobar odgovor",
"Google PSE API Key": "Google PSE API ključ",
"Google PSE Engine Id": "ID Google PSE modula",
......
......@@ -261,6 +261,8 @@
"File": "",
"File Mode": "Modalità file",
"File not found.": "File non trovato.",
"Filter is now globally disabled": "",
"Filter is now globally enabled": "",
"Filters": "",
"Fingerprint spoofing detected: Unable to use initials as avatar. Defaulting to default profile image.": "Rilevato spoofing delle impronte digitali: impossibile utilizzare le iniziali come avatar. Ripristino all'immagine del profilo predefinita.",
"Fluidly stream large external response chunks": "Trasmetti in modo fluido blocchi di risposta esterni di grandi dimensioni",
......@@ -279,6 +281,7 @@
"Generate Image": "",
"Generating search query": "Generazione di query di ricerca",
"Generation Info": "Informazioni generazione",
"Global": "",
"Good Response": "Buona risposta",
"Google PSE API Key": "Chiave API PSE di Google",
"Google PSE Engine Id": "ID motore PSE di Google",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment