Interface.svelte 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <script lang="ts">
  2. import fileSaver from 'file-saver';
  3. const { saveAs } = fileSaver;
  4. import { v4 as uuidv4 } from 'uuid';
  5. import { toast } from 'svelte-sonner';
  6. import { getBackendConfig, getModels, getTaskConfig, updateTaskConfig } from '$lib/apis';
  7. import { setDefaultPromptSuggestions } from '$lib/apis/configs';
  8. import { config, settings, user } from '$lib/stores';
  9. import { createEventDispatcher, onMount, getContext } from 'svelte';
  10. import { banners as _banners } from '$lib/stores';
  11. import type { Banner } from '$lib/types';
  12. import { getBaseModels } from '$lib/apis/models';
  13. import { getBanners, setBanners } from '$lib/apis/configs';
  14. import Tooltip from '$lib/components/common/Tooltip.svelte';
  15. import Switch from '$lib/components/common/Switch.svelte';
  16. import Textarea from '$lib/components/common/Textarea.svelte';
  17. import Spinner from '$lib/components/common/Spinner.svelte';
  18. import Banners from './Interface/Banners.svelte';
  19. const dispatch = createEventDispatcher();
  20. const i18n = getContext('i18n');
  21. let taskConfig = {
  22. TASK_MODEL: '',
  23. TASK_MODEL_EXTERNAL: '',
  24. ENABLE_TITLE_GENERATION: true,
  25. TITLE_GENERATION_PROMPT_TEMPLATE: '',
  26. ENABLE_FOLLOW_UP_GENERATION: true,
  27. FOLLOW_UP_GENERATION_PROMPT_TEMPLATE: '',
  28. IMAGE_PROMPT_GENERATION_PROMPT_TEMPLATE: '',
  29. ENABLE_AUTOCOMPLETE_GENERATION: true,
  30. AUTOCOMPLETE_GENERATION_INPUT_MAX_LENGTH: -1,
  31. TAGS_GENERATION_PROMPT_TEMPLATE: '',
  32. ENABLE_TAGS_GENERATION: true,
  33. ENABLE_SEARCH_QUERY_GENERATION: true,
  34. ENABLE_RETRIEVAL_QUERY_GENERATION: true,
  35. QUERY_GENERATION_PROMPT_TEMPLATE: '',
  36. TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE: ''
  37. };
  38. let promptSuggestions = [];
  39. let banners: Banner[] = [];
  40. const updateInterfaceHandler = async () => {
  41. taskConfig = await updateTaskConfig(localStorage.token, taskConfig);
  42. promptSuggestions = promptSuggestions.filter((p) => p.content !== '');
  43. promptSuggestions = await setDefaultPromptSuggestions(localStorage.token, promptSuggestions);
  44. await updateBanners();
  45. await config.set(await getBackendConfig());
  46. };
  47. onMount(async () => {
  48. await init();
  49. taskConfig = await getTaskConfig(localStorage.token);
  50. promptSuggestions = $config?.default_prompt_suggestions ?? [];
  51. banners = await getBanners(localStorage.token);
  52. });
  53. const updateBanners = async () => {
  54. _banners.set(await setBanners(localStorage.token, banners));
  55. };
  56. let workspaceModels = null;
  57. let baseModels = null;
  58. let models = null;
  59. const init = async () => {
  60. workspaceModels = await getBaseModels(localStorage.token);
  61. baseModels = await getModels(localStorage.token, null, false);
  62. models = baseModels.map((m) => {
  63. const workspaceModel = workspaceModels.find((wm) => wm.id === m.id);
  64. if (workspaceModel) {
  65. return {
  66. ...m,
  67. ...workspaceModel
  68. };
  69. } else {
  70. return {
  71. ...m,
  72. id: m.id,
  73. name: m.name,
  74. is_active: true
  75. };
  76. }
  77. });
  78. console.debug('models', models);
  79. };
  80. </script>
  81. {#if models !== null && taskConfig}
  82. <form
  83. class="flex flex-col h-full justify-between space-y-3 text-sm"
  84. on:submit|preventDefault={() => {
  85. updateInterfaceHandler();
  86. dispatch('save');
  87. }}
  88. >
  89. <div class=" overflow-y-scroll scrollbar-hidden h-full pr-1.5">
  90. <div class="mb-3.5">
  91. <div class=" mb-2.5 text-base font-medium">{$i18n.t('Tasks')}</div>
  92. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  93. <div class=" mb-2 font-medium flex items-center">
  94. <div class=" text-xs mr-1">{$i18n.t('Task Model')}</div>
  95. <Tooltip
  96. content={$i18n.t(
  97. 'A task model is used when performing tasks such as generating titles for chats and web search queries'
  98. )}
  99. >
  100. <svg
  101. xmlns="http://www.w3.org/2000/svg"
  102. fill="none"
  103. viewBox="0 0 24 24"
  104. stroke-width="1.5"
  105. stroke="currentColor"
  106. class="size-3.5"
  107. >
  108. <path
  109. stroke-linecap="round"
  110. stroke-linejoin="round"
  111. 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"
  112. />
  113. </svg>
  114. </Tooltip>
  115. </div>
  116. <div class=" mb-2.5 flex w-full gap-2">
  117. <div class="flex-1">
  118. <div class=" text-xs mb-1">{$i18n.t('Local Task Model')}</div>
  119. <select
  120. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  121. bind:value={taskConfig.TASK_MODEL}
  122. placeholder={$i18n.t('Select a model')}
  123. on:change={() => {
  124. if (taskConfig.TASK_MODEL) {
  125. const model = models.find((m) => m.id === taskConfig.TASK_MODEL);
  126. if (model) {
  127. if (model?.access_control !== null) {
  128. toast.error(
  129. $i18n.t(
  130. 'This model is not publicly available. Please select another model.'
  131. )
  132. );
  133. }
  134. taskConfig.TASK_MODEL = model.id;
  135. } else {
  136. taskConfig.TASK_MODEL = '';
  137. }
  138. }
  139. }}
  140. >
  141. <option value="" selected>{$i18n.t('Current Model')}</option>
  142. {#each models as model}
  143. <option value={model.id} class="bg-gray-100 dark:bg-gray-700">
  144. {model.name}
  145. {model?.connection_type === 'local' ? `(${$i18n.t('Local')})` : ''}
  146. </option>
  147. {/each}
  148. </select>
  149. </div>
  150. <div class="flex-1">
  151. <div class=" text-xs mb-1">{$i18n.t('External Task Model')}</div>
  152. <select
  153. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  154. bind:value={taskConfig.TASK_MODEL_EXTERNAL}
  155. placeholder={$i18n.t('Select a model')}
  156. on:change={() => {
  157. if (taskConfig.TASK_MODEL_EXTERNAL) {
  158. const model = models.find((m) => m.id === taskConfig.TASK_MODEL_EXTERNAL);
  159. if (model) {
  160. if (model?.access_control !== null) {
  161. toast.error(
  162. $i18n.t(
  163. 'This model is not publicly available. Please select another model.'
  164. )
  165. );
  166. }
  167. taskConfig.TASK_MODEL_EXTERNAL = model.id;
  168. } else {
  169. taskConfig.TASK_MODEL_EXTERNAL = '';
  170. }
  171. }
  172. }}
  173. >
  174. <option value="" selected>{$i18n.t('Current Model')}</option>
  175. {#each models as model}
  176. <option value={model.id} class="bg-gray-100 dark:bg-gray-700">
  177. {model.name}
  178. {model?.connection_type === 'local' ? `(${$i18n.t('Local')})` : ''}
  179. </option>
  180. {/each}
  181. </select>
  182. </div>
  183. </div>
  184. <div class="mb-2.5 flex w-full items-center justify-between">
  185. <div class=" self-center text-xs font-medium">
  186. {$i18n.t('Title Generation')}
  187. </div>
  188. <Switch bind:state={taskConfig.ENABLE_TITLE_GENERATION} />
  189. </div>
  190. {#if taskConfig.ENABLE_TITLE_GENERATION}
  191. <div class="mb-2.5">
  192. <div class=" mb-1 text-xs font-medium">{$i18n.t('Title Generation Prompt')}</div>
  193. <Tooltip
  194. content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
  195. placement="top-start"
  196. >
  197. <Textarea
  198. bind:value={taskConfig.TITLE_GENERATION_PROMPT_TEMPLATE}
  199. placeholder={$i18n.t(
  200. 'Leave empty to use the default prompt, or enter a custom prompt'
  201. )}
  202. />
  203. </Tooltip>
  204. </div>
  205. {/if}
  206. <div class="mb-2.5 flex w-full items-center justify-between">
  207. <div class=" self-center text-xs font-medium">
  208. {$i18n.t('Follow Up Generation')}
  209. </div>
  210. <Switch bind:state={taskConfig.ENABLE_FOLLOW_UP_GENERATION} />
  211. </div>
  212. {#if taskConfig.ENABLE_FOLLOW_UP_GENERATION}
  213. <div class="mb-2.5">
  214. <div class=" mb-1 text-xs font-medium">{$i18n.t('Follow Up Generation Prompt')}</div>
  215. <Tooltip
  216. content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
  217. placement="top-start"
  218. >
  219. <Textarea
  220. bind:value={taskConfig.FOLLOW_UP_GENERATION_PROMPT_TEMPLATE}
  221. placeholder={$i18n.t(
  222. 'Leave empty to use the default prompt, or enter a custom prompt'
  223. )}
  224. />
  225. </Tooltip>
  226. </div>
  227. {/if}
  228. <div class="mb-2.5 flex w-full items-center justify-between">
  229. <div class=" self-center text-xs font-medium">
  230. {$i18n.t('Tags Generation')}
  231. </div>
  232. <Switch bind:state={taskConfig.ENABLE_TAGS_GENERATION} />
  233. </div>
  234. {#if taskConfig.ENABLE_TAGS_GENERATION}
  235. <div class="mb-2.5">
  236. <div class=" mb-1 text-xs font-medium">{$i18n.t('Tags Generation Prompt')}</div>
  237. <Tooltip
  238. content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
  239. placement="top-start"
  240. >
  241. <Textarea
  242. bind:value={taskConfig.TAGS_GENERATION_PROMPT_TEMPLATE}
  243. placeholder={$i18n.t(
  244. 'Leave empty to use the default prompt, or enter a custom prompt'
  245. )}
  246. />
  247. </Tooltip>
  248. </div>
  249. {/if}
  250. <div class="mb-2.5 flex w-full items-center justify-between">
  251. <div class=" self-center text-xs font-medium">
  252. {$i18n.t('Retrieval Query Generation')}
  253. </div>
  254. <Switch bind:state={taskConfig.ENABLE_RETRIEVAL_QUERY_GENERATION} />
  255. </div>
  256. <div class="mb-2.5 flex w-full items-center justify-between">
  257. <div class=" self-center text-xs font-medium">
  258. {$i18n.t('Web Search Query Generation')}
  259. </div>
  260. <Switch bind:state={taskConfig.ENABLE_SEARCH_QUERY_GENERATION} />
  261. </div>
  262. <div class="mb-2.5">
  263. <div class=" mb-1 text-xs font-medium">{$i18n.t('Query Generation Prompt')}</div>
  264. <Tooltip
  265. content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
  266. placement="top-start"
  267. >
  268. <Textarea
  269. bind:value={taskConfig.QUERY_GENERATION_PROMPT_TEMPLATE}
  270. placeholder={$i18n.t(
  271. 'Leave empty to use the default prompt, or enter a custom prompt'
  272. )}
  273. />
  274. </Tooltip>
  275. </div>
  276. <div class="mb-2.5 flex w-full items-center justify-between">
  277. <div class=" self-center text-xs font-medium">
  278. {$i18n.t('Autocomplete Generation')}
  279. </div>
  280. <Tooltip content={$i18n.t('Enable autocomplete generation for chat messages')}>
  281. <Switch bind:state={taskConfig.ENABLE_AUTOCOMPLETE_GENERATION} />
  282. </Tooltip>
  283. </div>
  284. {#if taskConfig.ENABLE_AUTOCOMPLETE_GENERATION}
  285. <div class="mb-2.5">
  286. <div class=" mb-1 text-xs font-medium">
  287. {$i18n.t('Autocomplete Generation Input Max Length')}
  288. </div>
  289. <Tooltip
  290. content={$i18n.t('Character limit for autocomplete generation input')}
  291. placement="top-start"
  292. >
  293. <input
  294. class="w-full outline-hidden bg-transparent"
  295. bind:value={taskConfig.AUTOCOMPLETE_GENERATION_INPUT_MAX_LENGTH}
  296. placeholder={$i18n.t('-1 for no limit, or a positive integer for a specific limit')}
  297. />
  298. </Tooltip>
  299. </div>
  300. {/if}
  301. <div class="mb-2.5">
  302. <div class=" mb-1 text-xs font-medium">{$i18n.t('Image Prompt Generation Prompt')}</div>
  303. <Tooltip
  304. content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
  305. placement="top-start"
  306. >
  307. <Textarea
  308. bind:value={taskConfig.IMAGE_PROMPT_GENERATION_PROMPT_TEMPLATE}
  309. placeholder={$i18n.t(
  310. 'Leave empty to use the default prompt, or enter a custom prompt'
  311. )}
  312. />
  313. </Tooltip>
  314. </div>
  315. <div class="mb-2.5">
  316. <div class=" mb-1 text-xs font-medium">{$i18n.t('Tools Function Calling Prompt')}</div>
  317. <Tooltip
  318. content={$i18n.t('Leave empty to use the default prompt, or enter a custom prompt')}
  319. placement="top-start"
  320. >
  321. <Textarea
  322. bind:value={taskConfig.TOOLS_FUNCTION_CALLING_PROMPT_TEMPLATE}
  323. placeholder={$i18n.t(
  324. 'Leave empty to use the default prompt, or enter a custom prompt'
  325. )}
  326. />
  327. </Tooltip>
  328. </div>
  329. </div>
  330. <div class="mb-3.5">
  331. <div class=" mb-2.5 text-base font-medium">{$i18n.t('UI')}</div>
  332. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  333. <div class="mb-2.5">
  334. <div class="flex w-full justify-between">
  335. <div class=" self-center text-sm">
  336. {$i18n.t('Banners')}
  337. </div>
  338. <button
  339. class="p-1 px-3 text-xs flex rounded-sm transition"
  340. type="button"
  341. on:click={() => {
  342. if (banners.length === 0 || banners.at(-1).content !== '') {
  343. banners = [
  344. ...banners,
  345. {
  346. id: uuidv4(),
  347. type: '',
  348. title: '',
  349. content: '',
  350. dismissible: true,
  351. timestamp: Math.floor(Date.now() / 1000)
  352. }
  353. ];
  354. }
  355. }}
  356. >
  357. <svg
  358. xmlns="http://www.w3.org/2000/svg"
  359. viewBox="0 0 20 20"
  360. fill="currentColor"
  361. class="w-4 h-4"
  362. >
  363. <path
  364. d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z"
  365. />
  366. </svg>
  367. </button>
  368. </div>
  369. <Banners bind:banners />
  370. </div>
  371. {#if $user?.role === 'admin'}
  372. <div class=" space-y-3">
  373. <div class="flex w-full justify-between mb-2">
  374. <div class=" self-center text-sm">
  375. {$i18n.t('Default Prompt Suggestions')}
  376. </div>
  377. <button
  378. class="p-1 px-3 text-xs flex rounded-sm transition"
  379. type="button"
  380. on:click={() => {
  381. if (promptSuggestions.length === 0 || promptSuggestions.at(-1).content !== '') {
  382. promptSuggestions = [...promptSuggestions, { content: '', title: ['', ''] }];
  383. }
  384. }}
  385. >
  386. <svg
  387. xmlns="http://www.w3.org/2000/svg"
  388. viewBox="0 0 20 20"
  389. fill="currentColor"
  390. class="w-4 h-4"
  391. >
  392. <path
  393. d="M10.75 4.75a.75.75 0 00-1.5 0v4.5h-4.5a.75.75 0 000 1.5h4.5v4.5a.75.75 0 001.5 0v-4.5h4.5a.75.75 0 000-1.5h-4.5v-4.5z"
  394. />
  395. </svg>
  396. </button>
  397. </div>
  398. <div class="grid lg:grid-cols-2 flex-col gap-1.5">
  399. {#each promptSuggestions as prompt, promptIdx}
  400. <div
  401. class=" flex border border-gray-100 dark:border-none dark:bg-gray-850 rounded-xl py-1.5"
  402. >
  403. <div class="flex flex-col flex-1 pl-1">
  404. <div class="flex border-b border-gray-100 dark:border-gray-850 w-full">
  405. <input
  406. class="px-3 py-1.5 text-xs w-full bg-transparent outline-hidden border-r border-gray-100 dark:border-gray-850"
  407. placeholder={$i18n.t('Title (e.g. Tell me a fun fact)')}
  408. bind:value={prompt.title[0]}
  409. />
  410. <input
  411. class="px-3 py-1.5 text-xs w-full bg-transparent outline-hidden border-r border-gray-100 dark:border-gray-850"
  412. placeholder={$i18n.t('Subtitle (e.g. about the Roman Empire)')}
  413. bind:value={prompt.title[1]}
  414. />
  415. </div>
  416. <textarea
  417. class="px-3 py-1.5 text-xs w-full bg-transparent outline-hidden border-r border-gray-100 dark:border-gray-850 resize-none"
  418. placeholder={$i18n.t(
  419. 'Prompt (e.g. Tell me a fun fact about the Roman Empire)'
  420. )}
  421. rows="3"
  422. bind:value={prompt.content}
  423. />
  424. </div>
  425. <button
  426. class="px-3"
  427. type="button"
  428. on:click={() => {
  429. promptSuggestions.splice(promptIdx, 1);
  430. promptSuggestions = promptSuggestions;
  431. }}
  432. >
  433. <svg
  434. xmlns="http://www.w3.org/2000/svg"
  435. viewBox="0 0 20 20"
  436. fill="currentColor"
  437. class="w-4 h-4"
  438. >
  439. <path
  440. d="M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"
  441. />
  442. </svg>
  443. </button>
  444. </div>
  445. {/each}
  446. </div>
  447. {#if promptSuggestions.length > 0}
  448. <div class="text-xs text-left w-full mt-2">
  449. {$i18n.t('Adjusting these settings will apply changes universally to all users.')}
  450. </div>
  451. {/if}
  452. <div class="flex items-center justify-end space-x-2 mt-2">
  453. <input
  454. id="prompt-suggestions-import-input"
  455. type="file"
  456. accept=".json"
  457. hidden
  458. on:change={(e) => {
  459. const files = e.target.files;
  460. if (!files || files.length === 0) {
  461. return;
  462. }
  463. console.log(files);
  464. let reader = new FileReader();
  465. reader.onload = async (event) => {
  466. try {
  467. let suggestions = JSON.parse(event.target.result);
  468. suggestions = suggestions.map((s) => {
  469. if (typeof s.title === 'string') {
  470. s.title = [s.title, ''];
  471. } else if (!Array.isArray(s.title)) {
  472. s.title = ['', ''];
  473. }
  474. return s;
  475. });
  476. promptSuggestions = [...promptSuggestions, ...suggestions];
  477. } catch (error) {
  478. toast.error($i18n.t('Invalid JSON file'));
  479. return;
  480. }
  481. };
  482. reader.readAsText(files[0]);
  483. e.target.value = ''; // Reset the input value
  484. }}
  485. />
  486. <button
  487. class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
  488. type="button"
  489. on:click={() => {
  490. const input = document.getElementById('prompt-suggestions-import-input');
  491. if (input) {
  492. input.click();
  493. }
  494. }}
  495. >
  496. <div class=" self-center mr-2 font-medium line-clamp-1">
  497. {$i18n.t('Import Prompt Suggestions')}
  498. </div>
  499. <div class=" self-center">
  500. <svg
  501. xmlns="http://www.w3.org/2000/svg"
  502. viewBox="0 0 16 16"
  503. fill="currentColor"
  504. class="w-3.5 h-3.5"
  505. >
  506. <path
  507. fill-rule="evenodd"
  508. d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm4 9.5a.75.75 0 0 1-.75-.75V8.06l-.72.72a.75.75 0 0 1-1.06-1.06l2-2a.75.75 0 0 1 1.06 0l2 2a.75.75 0 1 1-1.06 1.06l-.72-.72v2.69a.75.75 0 0 1-.75.75Z"
  509. clip-rule="evenodd"
  510. />
  511. </svg>
  512. </div>
  513. </button>
  514. {#if promptSuggestions.length}
  515. <button
  516. class="flex text-xs items-center space-x-1 px-3 py-1.5 rounded-xl bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
  517. type="button"
  518. on:click={async () => {
  519. let blob = new Blob([JSON.stringify(promptSuggestions)], {
  520. type: 'application/json'
  521. });
  522. saveAs(blob, `prompt-suggestions-export-${Date.now()}.json`);
  523. }}
  524. >
  525. <div class=" self-center mr-2 font-medium line-clamp-1">
  526. {$i18n.t('Export Prompt Suggestions')} ({promptSuggestions.length})
  527. </div>
  528. <div class=" self-center">
  529. <svg
  530. xmlns="http://www.w3.org/2000/svg"
  531. viewBox="0 0 16 16"
  532. fill="currentColor"
  533. class="w-3.5 h-3.5"
  534. >
  535. <path
  536. fill-rule="evenodd"
  537. d="M4 2a1.5 1.5 0 0 0-1.5 1.5v9A1.5 1.5 0 0 0 4 14h8a1.5 1.5 0 0 0 1.5-1.5V6.621a1.5 1.5 0 0 0-.44-1.06L9.94 2.439A1.5 1.5 0 0 0 8.878 2H4Zm4 3.5a.75.75 0 0 1 .75.75v2.69l.72-.72a.75.75 0 1 1 1.06 1.06l-2 2a.75.75 0 0 1-1.06 0l-2-2a.75.75 0 0 1 1.06-1.06l.72.72V6.25A.75.75 0 0 1 8 5.5Z"
  538. clip-rule="evenodd"
  539. />
  540. </svg>
  541. </div>
  542. </button>
  543. {/if}
  544. </div>
  545. </div>
  546. {/if}
  547. </div>
  548. </div>
  549. <div class="flex justify-end text-sm font-medium">
  550. <button
  551. class="px-3.5 py-1.5 text-sm font-medium bg-black hover:bg-gray-900 text-white dark:bg-white dark:text-black dark:hover:bg-gray-100 transition rounded-full"
  552. type="submit"
  553. >
  554. {$i18n.t('Save')}
  555. </button>
  556. </div>
  557. </form>
  558. {:else}
  559. <div class=" h-full w-full flex justify-center items-center">
  560. <Spinner className="size-5" />
  561. </div>
  562. {/if}