General.svelte 22 KB

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