General.svelte 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719
  1. <script lang="ts">
  2. import DOMPurify from 'dompurify';
  3. import { getVersionUpdates, getWebhookUrl, updateWebhookUrl } from '$lib/apis';
  4. import {
  5. getAdminConfig,
  6. getLdapConfig,
  7. getLdapServer,
  8. updateAdminConfig,
  9. updateLdapConfig,
  10. updateLdapServer
  11. } from '$lib/apis/auths';
  12. import SensitiveInput from '$lib/components/common/SensitiveInput.svelte';
  13. import Switch from '$lib/components/common/Switch.svelte';
  14. import Tooltip from '$lib/components/common/Tooltip.svelte';
  15. import { WEBUI_BUILD_HASH, WEBUI_VERSION } from '$lib/constants';
  16. import { config, showChangelog } from '$lib/stores';
  17. import { compareVersion } from '$lib/utils';
  18. import { onMount, getContext } from 'svelte';
  19. import { toast } from 'svelte-sonner';
  20. import Textarea from '$lib/components/common/Textarea.svelte';
  21. const i18n = getContext('i18n');
  22. export let saveHandler: Function;
  23. let updateAvailable = null;
  24. let version = {
  25. current: '',
  26. latest: ''
  27. };
  28. let adminConfig = null;
  29. let webhookUrl = '';
  30. // LDAP
  31. let ENABLE_LDAP = false;
  32. let LDAP_SERVER = {
  33. label: '',
  34. host: '',
  35. port: '',
  36. attribute_for_mail: 'mail',
  37. attribute_for_username: 'uid',
  38. app_dn: '',
  39. app_dn_password: '',
  40. search_base: '',
  41. search_filters: '',
  42. use_tls: false,
  43. certificate_path: '',
  44. ciphers: ''
  45. };
  46. const checkForVersionUpdates = async () => {
  47. updateAvailable = null;
  48. version = await getVersionUpdates(localStorage.token).catch((error) => {
  49. return {
  50. current: WEBUI_VERSION,
  51. latest: WEBUI_VERSION
  52. };
  53. });
  54. console.log(version);
  55. updateAvailable = compareVersion(version.latest, version.current);
  56. console.log(updateAvailable);
  57. };
  58. const updateLdapServerHandler = async () => {
  59. if (!ENABLE_LDAP) return;
  60. const res = await updateLdapServer(localStorage.token, LDAP_SERVER).catch((error) => {
  61. toast.error(`${error}`);
  62. return null;
  63. });
  64. if (res) {
  65. toast.success($i18n.t('LDAP server updated'));
  66. }
  67. };
  68. const updateHandler = async () => {
  69. webhookUrl = await updateWebhookUrl(localStorage.token, webhookUrl);
  70. const res = await updateAdminConfig(localStorage.token, adminConfig);
  71. await updateLdapServerHandler();
  72. if (res) {
  73. saveHandler();
  74. } else {
  75. toast.error(i18n.t('Failed to update settings'));
  76. }
  77. };
  78. onMount(async () => {
  79. checkForVersionUpdates();
  80. await Promise.all([
  81. (async () => {
  82. adminConfig = await getAdminConfig(localStorage.token);
  83. })(),
  84. (async () => {
  85. webhookUrl = await getWebhookUrl(localStorage.token);
  86. })(),
  87. (async () => {
  88. LDAP_SERVER = await getLdapServer(localStorage.token);
  89. })()
  90. ]);
  91. const ldapConfig = await getLdapConfig(localStorage.token);
  92. ENABLE_LDAP = ldapConfig.ENABLE_LDAP;
  93. });
  94. </script>
  95. <form
  96. class="flex flex-col h-full justify-between space-y-3 text-sm"
  97. on:submit|preventDefault={async () => {
  98. updateHandler();
  99. }}
  100. >
  101. <div class="mt-0.5 space-y-3 overflow-y-scroll scrollbar-hidden h-full">
  102. {#if adminConfig !== null}
  103. <div class="">
  104. <div class="mb-3.5">
  105. <div class=" mb-2.5 text-base font-medium">{$i18n.t('General')}</div>
  106. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  107. <div class="mb-2.5">
  108. <div class=" mb-1 text-xs font-medium flex space-x-2 items-center">
  109. <div>
  110. {$i18n.t('Version')}
  111. </div>
  112. </div>
  113. <div class="flex w-full justify-between items-center">
  114. <div class="flex flex-col text-xs text-gray-700 dark:text-gray-200">
  115. <div class="flex gap-1">
  116. <Tooltip content={WEBUI_BUILD_HASH}>
  117. v{WEBUI_VERSION}
  118. </Tooltip>
  119. <a
  120. href="https://github.com/open-webui/open-webui/releases/tag/v{version.latest}"
  121. target="_blank"
  122. >
  123. {updateAvailable === null
  124. ? $i18n.t('Checking for updates...')
  125. : updateAvailable
  126. ? `(v${version.latest} ${$i18n.t('available!')})`
  127. : $i18n.t('(latest)')}
  128. </a>
  129. </div>
  130. <button
  131. class=" underline flex items-center space-x-1 text-xs text-gray-500 dark:text-gray-500"
  132. type="button"
  133. on:click={() => {
  134. showChangelog.set(true);
  135. }}
  136. >
  137. <div>{$i18n.t("See what's new")}</div>
  138. </button>
  139. </div>
  140. <button
  141. class=" text-xs px-3 py-1.5 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
  142. type="button"
  143. on:click={() => {
  144. checkForVersionUpdates();
  145. }}
  146. >
  147. {$i18n.t('Check for updates')}
  148. </button>
  149. </div>
  150. </div>
  151. <div class="mb-2.5">
  152. <div class="flex w-full justify-between items-center">
  153. <div class="text-xs pr-2">
  154. <div class="">
  155. {$i18n.t('Help')}
  156. </div>
  157. <div class=" text-xs text-gray-500">
  158. {$i18n.t('Discover how to use Open WebUI and seek support from the community.')}
  159. </div>
  160. </div>
  161. <a
  162. class="flex-shrink-0 text-xs font-medium underline"
  163. href="https://docs.openwebui.com/"
  164. target="_blank"
  165. >
  166. {$i18n.t('Documentation')}
  167. </a>
  168. </div>
  169. <div class="mt-1">
  170. <div class="flex space-x-1">
  171. <a href="https://discord.gg/5rJgQTnV4s" target="_blank">
  172. <img
  173. alt="Discord"
  174. src="https://img.shields.io/badge/Discord-Open_WebUI-blue?logo=discord&logoColor=white"
  175. />
  176. </a>
  177. <a href="https://twitter.com/OpenWebUI" target="_blank">
  178. <img
  179. alt="X (formerly Twitter) Follow"
  180. src="https://img.shields.io/twitter/follow/OpenWebUI"
  181. />
  182. </a>
  183. <a href="https://github.com/open-webui/open-webui" target="_blank">
  184. <img
  185. alt="Github Repo"
  186. src="https://img.shields.io/github/stars/open-webui/open-webui?style=social&label=Star us on Github"
  187. />
  188. </a>
  189. </div>
  190. </div>
  191. </div>
  192. <div class="mb-2.5">
  193. <div class="flex w-full justify-between items-center">
  194. <div class="text-xs pr-2">
  195. <div class="">
  196. {$i18n.t('License')}
  197. </div>
  198. {#if $config?.license_metadata}
  199. <a
  200. href="https://docs.openwebui.com/enterprise"
  201. target="_blank"
  202. class="text-gray-500 mt-0.5"
  203. >
  204. <span class=" capitalize text-black dark:text-white"
  205. >{$config?.license_metadata?.type}
  206. license</span
  207. >
  208. registered to
  209. <span class=" capitalize text-black dark:text-white"
  210. >{$config?.license_metadata?.organization_name}</span
  211. >
  212. for
  213. <span class=" font-medium text-black dark:text-white"
  214. >{$config?.license_metadata?.seats ?? 'Unlimited'} users.</span
  215. >
  216. </a>
  217. {#if $config?.license_metadata?.html}
  218. <div class="mt-0.5">
  219. {@html DOMPurify.sanitize($config?.license_metadata?.html)}
  220. </div>
  221. {/if}
  222. {:else}
  223. <a
  224. class=" text-xs hover:underline"
  225. href="https://docs.openwebui.com/enterprise"
  226. target="_blank"
  227. >
  228. <span class="text-gray-500">
  229. {$i18n.t(
  230. 'Upgrade to a licensed plan for enhanced capabilities, including custom theming and branding, and dedicated support.'
  231. )}
  232. </span>
  233. </a>
  234. {/if}
  235. </div>
  236. <!-- <button
  237. class="flex-shrink-0 text-xs px-3 py-1.5 bg-gray-50 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-800 transition rounded-lg font-medium"
  238. >
  239. {$i18n.t('Activate')}
  240. </button> -->
  241. </div>
  242. </div>
  243. </div>
  244. <div class="mb-3">
  245. <div class=" mb-2.5 text-base font-medium">{$i18n.t('Authentication')}</div>
  246. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  247. <div class=" mb-2.5 flex w-full justify-between">
  248. <div class=" self-center text-xs font-medium">{$i18n.t('Default User Role')}</div>
  249. <div class="flex items-center relative">
  250. <select
  251. class="dark:bg-gray-900 w-fit pr-8 rounded-sm px-2 text-xs bg-transparent outline-hidden text-right"
  252. bind:value={adminConfig.DEFAULT_USER_ROLE}
  253. placeholder="Select a role"
  254. >
  255. <option value="pending">{$i18n.t('pending')}</option>
  256. <option value="user">{$i18n.t('user')}</option>
  257. <option value="admin">{$i18n.t('admin')}</option>
  258. </select>
  259. </div>
  260. </div>
  261. <div class=" mb-2.5 flex w-full justify-between pr-2">
  262. <div class=" self-center text-xs font-medium">{$i18n.t('Enable New Sign Ups')}</div>
  263. <Switch bind:state={adminConfig.ENABLE_SIGNUP} />
  264. </div>
  265. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  266. <div class=" self-center text-xs font-medium">
  267. {$i18n.t('Show Admin Details in Account Pending Overlay')}
  268. </div>
  269. <Switch bind:state={adminConfig.SHOW_ADMIN_DETAILS} />
  270. </div>
  271. <div class="mb-2.5">
  272. <div class=" self-center text-xs font-medium mb-2">
  273. {$i18n.t('Pending User Overlay Title')}
  274. </div>
  275. <Textarea
  276. rows={2}
  277. placeholder={$i18n.t(
  278. 'Enter a title for the pending user info overlay. Leave empty for default.'
  279. )}
  280. bind:value={adminConfig.PENDING_USER_OVERLAY_TITLE}
  281. />
  282. </div>
  283. <div class="mb-2.5">
  284. <div class=" self-center text-xs font-medium mb-2">
  285. {$i18n.t('Pending User Overlay Content')}
  286. </div>
  287. <Textarea
  288. placeholder={$i18n.t(
  289. 'Enter content for the pending user info overlay. Leave empty for default.'
  290. )}
  291. bind:value={adminConfig.PENDING_USER_OVERLAY_CONTENT}
  292. />
  293. </div>
  294. <div class="mb-2.5 flex w-full justify-between pr-2">
  295. <div class=" self-center text-xs font-medium">{$i18n.t('Enable API Key')}</div>
  296. <Switch bind:state={adminConfig.ENABLE_API_KEY} />
  297. </div>
  298. {#if adminConfig?.ENABLE_API_KEY}
  299. <div class="mb-2.5 flex w-full justify-between pr-2">
  300. <div class=" self-center text-xs font-medium">
  301. {$i18n.t('API Key Endpoint Restrictions')}
  302. </div>
  303. <Switch bind:state={adminConfig.ENABLE_API_KEY_ENDPOINT_RESTRICTIONS} />
  304. </div>
  305. {#if adminConfig?.ENABLE_API_KEY_ENDPOINT_RESTRICTIONS}
  306. <div class=" flex w-full flex-col pr-2">
  307. <div class=" text-xs font-medium">
  308. {$i18n.t('Allowed Endpoints')}
  309. </div>
  310. <input
  311. class="w-full mt-1 rounded-lg text-sm dark:text-gray-300 bg-transparent outline-hidden"
  312. type="text"
  313. placeholder={`e.g.) /api/v1/messages, /api/v1/channels`}
  314. bind:value={adminConfig.API_KEY_ALLOWED_ENDPOINTS}
  315. />
  316. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  317. <!-- https://docs.openwebui.com/getting-started/advanced-topics/api-endpoints -->
  318. <a
  319. href="https://docs.openwebui.com/getting-started/api-endpoints"
  320. target="_blank"
  321. class=" text-gray-300 font-medium underline"
  322. >
  323. {$i18n.t('To learn more about available endpoints, visit our documentation.')}
  324. </a>
  325. </div>
  326. </div>
  327. {/if}
  328. {/if}
  329. <div class=" mb-2.5 w-full justify-between">
  330. <div class="flex w-full justify-between">
  331. <div class=" self-center text-xs font-medium">{$i18n.t('JWT Expiration')}</div>
  332. </div>
  333. <div class="flex mt-2 space-x-2">
  334. <input
  335. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  336. type="text"
  337. placeholder={`e.g.) "30m","1h", "10d". `}
  338. bind:value={adminConfig.JWT_EXPIRES_IN}
  339. />
  340. </div>
  341. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  342. {$i18n.t('Valid time units:')}
  343. <span class=" text-gray-300 font-medium"
  344. >{$i18n.t("'s', 'm', 'h', 'd', 'w' or '-1' for no expiration.")}</span
  345. >
  346. </div>
  347. </div>
  348. <div class=" space-y-3">
  349. <div class="mt-2 space-y-2 pr-1.5">
  350. <div class="flex justify-between items-center text-sm">
  351. <div class=" font-medium">{$i18n.t('LDAP')}</div>
  352. <div class="mt-1">
  353. <Switch
  354. bind:state={ENABLE_LDAP}
  355. on:change={async () => {
  356. updateLdapConfig(localStorage.token, ENABLE_LDAP);
  357. }}
  358. />
  359. </div>
  360. </div>
  361. {#if ENABLE_LDAP}
  362. <div class="flex flex-col gap-1">
  363. <div class="flex w-full gap-2">
  364. <div class="w-full">
  365. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  366. {$i18n.t('Label')}
  367. </div>
  368. <input
  369. class="w-full bg-transparent outline-hidden py-0.5"
  370. required
  371. placeholder={$i18n.t('Enter server label')}
  372. bind:value={LDAP_SERVER.label}
  373. />
  374. </div>
  375. <div class="w-full"></div>
  376. </div>
  377. <div class="flex w-full gap-2">
  378. <div class="w-full">
  379. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  380. {$i18n.t('Host')}
  381. </div>
  382. <input
  383. class="w-full bg-transparent outline-hidden py-0.5"
  384. required
  385. placeholder={$i18n.t('Enter server host')}
  386. bind:value={LDAP_SERVER.host}
  387. />
  388. </div>
  389. <div class="w-full">
  390. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  391. {$i18n.t('Port')}
  392. </div>
  393. <Tooltip
  394. placement="top-start"
  395. content={$i18n.t('Default to 389 or 636 if TLS is enabled')}
  396. className="w-full"
  397. >
  398. <input
  399. class="w-full bg-transparent outline-hidden py-0.5"
  400. type="number"
  401. placeholder={$i18n.t('Enter server port')}
  402. bind:value={LDAP_SERVER.port}
  403. />
  404. </Tooltip>
  405. </div>
  406. </div>
  407. <div class="flex w-full gap-2">
  408. <div class="w-full">
  409. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  410. {$i18n.t('Application DN')}
  411. </div>
  412. <Tooltip
  413. content={$i18n.t('The Application Account DN you bind with for search')}
  414. placement="top-start"
  415. >
  416. <input
  417. class="w-full bg-transparent outline-hidden py-0.5"
  418. required
  419. placeholder={$i18n.t('Enter Application DN')}
  420. bind:value={LDAP_SERVER.app_dn}
  421. />
  422. </Tooltip>
  423. </div>
  424. <div class="w-full">
  425. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  426. {$i18n.t('Application DN Password')}
  427. </div>
  428. <SensitiveInput
  429. placeholder={$i18n.t('Enter Application DN Password')}
  430. bind:value={LDAP_SERVER.app_dn_password}
  431. />
  432. </div>
  433. </div>
  434. <div class="flex w-full gap-2">
  435. <div class="w-full">
  436. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  437. {$i18n.t('Attribute for Mail')}
  438. </div>
  439. <Tooltip
  440. content={$i18n.t(
  441. 'The LDAP attribute that maps to the mail that users use to sign in.'
  442. )}
  443. placement="top-start"
  444. >
  445. <input
  446. class="w-full bg-transparent outline-hidden py-0.5"
  447. required
  448. placeholder={$i18n.t('Example: mail')}
  449. bind:value={LDAP_SERVER.attribute_for_mail}
  450. />
  451. </Tooltip>
  452. </div>
  453. </div>
  454. <div class="flex w-full gap-2">
  455. <div class="w-full">
  456. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  457. {$i18n.t('Attribute for Username')}
  458. </div>
  459. <Tooltip
  460. content={$i18n.t(
  461. 'The LDAP attribute that maps to the username that users use to sign in.'
  462. )}
  463. placement="top-start"
  464. >
  465. <input
  466. class="w-full bg-transparent outline-hidden py-0.5"
  467. required
  468. placeholder={$i18n.t(
  469. 'Example: sAMAccountName or uid or userPrincipalName'
  470. )}
  471. bind:value={LDAP_SERVER.attribute_for_username}
  472. />
  473. </Tooltip>
  474. </div>
  475. </div>
  476. <div class="flex w-full gap-2">
  477. <div class="w-full">
  478. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  479. {$i18n.t('Search Base')}
  480. </div>
  481. <Tooltip
  482. content={$i18n.t('The base to search for users')}
  483. placement="top-start"
  484. >
  485. <input
  486. class="w-full bg-transparent outline-hidden py-0.5"
  487. required
  488. placeholder={$i18n.t('Example: ou=users,dc=foo,dc=example')}
  489. bind:value={LDAP_SERVER.search_base}
  490. />
  491. </Tooltip>
  492. </div>
  493. </div>
  494. <div class="flex w-full gap-2">
  495. <div class="w-full">
  496. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  497. {$i18n.t('Search Filters')}
  498. </div>
  499. <input
  500. class="w-full bg-transparent outline-hidden py-0.5"
  501. placeholder={$i18n.t('Example: (&(objectClass=inetOrgPerson)(uid=%s))')}
  502. bind:value={LDAP_SERVER.search_filters}
  503. />
  504. </div>
  505. </div>
  506. <div class="text-xs text-gray-400 dark:text-gray-500">
  507. <a
  508. class=" text-gray-300 font-medium underline"
  509. href="https://ldap.com/ldap-filters/"
  510. target="_blank"
  511. >
  512. {$i18n.t('Click here for filter guides.')}
  513. </a>
  514. </div>
  515. <div>
  516. <div class="flex justify-between items-center text-sm">
  517. <div class=" font-medium">{$i18n.t('TLS')}</div>
  518. <div class="mt-1">
  519. <Switch bind:state={LDAP_SERVER.use_tls} />
  520. </div>
  521. </div>
  522. {#if LDAP_SERVER.use_tls}
  523. <div class="flex w-full gap-2">
  524. <div class="w-full">
  525. <div class=" self-center text-xs font-medium min-w-fit mb-1 mt-1">
  526. {$i18n.t('Certificate Path')}
  527. </div>
  528. <input
  529. class="w-full bg-transparent outline-hidden py-0.5"
  530. placeholder={$i18n.t('Enter certificate path')}
  531. bind:value={LDAP_SERVER.certificate_path}
  532. />
  533. </div>
  534. </div>
  535. <div class="flex justify-between items-center text-xs">
  536. <div class=" font-medium">Validate certificate</div>
  537. <div class="mt-1">
  538. <Switch bind:state={LDAP_SERVER.validate_cert} />
  539. </div>
  540. </div>
  541. <div class="flex w-full gap-2">
  542. <div class="w-full">
  543. <div class=" self-center text-xs font-medium min-w-fit mb-1">
  544. {$i18n.t('Ciphers')}
  545. </div>
  546. <Tooltip content={$i18n.t('Default to ALL')} placement="top-start">
  547. <input
  548. class="w-full bg-transparent outline-hidden py-0.5"
  549. placeholder={$i18n.t('Example: ALL')}
  550. bind:value={LDAP_SERVER.ciphers}
  551. />
  552. </Tooltip>
  553. </div>
  554. <div class="w-full"></div>
  555. </div>
  556. {/if}
  557. </div>
  558. </div>
  559. {/if}
  560. </div>
  561. </div>
  562. </div>
  563. <div class="mb-3">
  564. <div class=" mb-2.5 text-base font-medium">{$i18n.t('Features')}</div>
  565. <hr class=" border-gray-100 dark:border-gray-850 my-2" />
  566. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  567. <div class=" self-center text-xs font-medium">
  568. {$i18n.t('Enable Community Sharing')}
  569. </div>
  570. <Switch bind:state={adminConfig.ENABLE_COMMUNITY_SHARING} />
  571. </div>
  572. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  573. <div class=" self-center text-xs font-medium">{$i18n.t('Enable Message Rating')}</div>
  574. <Switch bind:state={adminConfig.ENABLE_MESSAGE_RATING} />
  575. </div>
  576. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  577. <div class=" self-center text-xs font-medium">
  578. {$i18n.t('Notes')} ({$i18n.t('Beta')})
  579. </div>
  580. <Switch bind:state={adminConfig.ENABLE_NOTES} />
  581. </div>
  582. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  583. <div class=" self-center text-xs font-medium">
  584. {$i18n.t('Channels')} ({$i18n.t('Beta')})
  585. </div>
  586. <Switch bind:state={adminConfig.ENABLE_CHANNELS} />
  587. </div>
  588. <div class="mb-2.5 flex w-full items-center justify-between pr-2">
  589. <div class=" self-center text-xs font-medium">
  590. {$i18n.t('User Webhooks')}
  591. </div>
  592. <Switch bind:state={adminConfig.ENABLE_USER_WEBHOOKS} />
  593. </div>
  594. <div class="mb-2.5">
  595. <div class=" self-center text-xs font-medium mb-2">
  596. {$i18n.t('Response Watermark')}
  597. </div>
  598. <Textarea
  599. placeholder={$i18n.t('Enter a watermark for the response. Leave empty for none.')}
  600. bind:value={adminConfig.RESPONSE_WATERMARK}
  601. />
  602. </div>
  603. <div class="mb-2.5 w-full justify-between">
  604. <div class="flex w-full justify-between">
  605. <div class=" self-center text-xs font-medium">{$i18n.t('WebUI URL')}</div>
  606. </div>
  607. <div class="flex mt-2 space-x-2">
  608. <input
  609. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  610. type="text"
  611. placeholder={`e.g.) "http://localhost:3000"`}
  612. bind:value={adminConfig.WEBUI_URL}
  613. />
  614. </div>
  615. <div class="mt-2 text-xs text-gray-400 dark:text-gray-500">
  616. {$i18n.t(
  617. 'Enter the public URL of your WebUI. This URL will be used to generate links in the notifications.'
  618. )}
  619. </div>
  620. </div>
  621. <div class=" w-full justify-between">
  622. <div class="flex w-full justify-between">
  623. <div class=" self-center text-xs font-medium">{$i18n.t('Webhook URL')}</div>
  624. </div>
  625. <div class="flex mt-2 space-x-2">
  626. <input
  627. class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-hidden"
  628. type="text"
  629. placeholder={`https://example.com/webhook`}
  630. bind:value={webhookUrl}
  631. />
  632. </div>
  633. </div>
  634. </div>
  635. </div>
  636. {/if}
  637. </div>
  638. <div class="flex justify-end pt-3 text-sm font-medium">
  639. <button
  640. 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"
  641. type="submit"
  642. >
  643. {$i18n.t('Save')}
  644. </button>
  645. </div>
  646. </form>