|
26 | 26 |
|
27 | 27 | const dispatch = createEventDispatcher(); |
28 | 28 |
|
29 | | - const i18n = getContext('i18n'); |
| 29 | + const i18n: any = getContext('i18n'); |
30 | 30 |
|
31 | 31 | let loading = false; |
32 | 32 |
|
|
616 | 616 | </div> |
617 | 617 |
|
618 | 618 | {#if config.COMFYUI_WORKFLOW} |
619 | | - <div class="mb-2.5"> |
620 | | - <div class="flex w-full justify-between items-center"> |
621 | | - <div class="text-xs pr-2 shrink-0"> |
622 | | - <div class=""> |
623 | | - {$i18n.t('ComfyUI Workflow Nodes')} |
624 | | - </div> |
625 | | - </div> |
626 | | - </div> |
627 | | - |
628 | | - <div class="mt-1 text-xs flex flex-col gap-1.5"> |
| 619 | + <AdminSettingField |
| 620 | + label={$i18n.t('ComfyUI Workflow Nodes')} |
| 621 | + description={$i18n.t('Map workflow node inputs used for image generation.')} |
| 622 | + > |
| 623 | + <div class="flex flex-col gap-1.5 text-xs"> |
629 | 624 | {#each REQUIRED_WORKFLOW_NODES as node} |
630 | 625 | <div class="flex w-full flex-col"> |
631 | 626 | <div class="shrink-0"> |
|
638 | 633 | <div class=""> |
639 | 634 | <Tooltip content={$i18n.t('Input Key (e.g. text, unet_name, steps)')}> |
640 | 635 | <input |
641 | | - class="py-1 w-24 text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300" |
| 636 | + class="{inputClass} w-24" |
642 | 637 | placeholder={$i18n.t('Key')} |
643 | 638 | bind:value={node.key} |
644 | 639 | required |
|
654 | 649 | placement="top-start" |
655 | 650 | > |
656 | 651 | <input |
657 | | - class="w-full py-1 text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300" |
| 652 | + class={inputClass} |
658 | 653 | placeholder={$i18n.t('Node Ids')} |
659 | 654 | bind:value={node.node_ids} |
660 | 655 | /> |
|
668 | 663 | <div class="mt-1 text-xs text-gray-400 dark:text-gray-500"> |
669 | 664 | {$i18n.t('*Prompt node ID(s) are required for image generation')} |
670 | 665 | </div> |
671 | | - </div> |
| 666 | + </AdminSettingField> |
672 | 667 | {/if} |
673 | 668 | {:else if config?.IMAGE_GENERATION_ENGINE === 'gemini'} |
674 | 669 | <AdminSettingField |
|
749 | 744 | </AdminSettingField> |
750 | 745 |
|
751 | 746 | <AdminSettingField label={$i18n.t('Image Size')}> |
752 | | - <input |
| 747 | + <input |
753 | 748 | class={inputClass} |
754 | 749 | placeholder={$i18n.t('Enter Image Size (e.g. 512x512)')} |
755 | 750 | bind:value={config.IMAGE_EDIT_SIZE} |
756 | | - /> |
| 751 | + /> |
757 | 752 | </AdminSettingField> |
758 | 753 | </div> |
759 | 754 | {/if} |
|
796 | 791 | placeholder={$i18n.t('Enter URL (e.g. http://127.0.0.1:7860/)')} |
797 | 792 | bind:value={config.IMAGES_EDIT_COMFYUI_BASE_URL} |
798 | 793 | /> |
799 | | - <button |
| 794 | + <button |
800 | 795 | class="shrink-0 text-gray-400 transition-colors hover:text-gray-900 dark:text-gray-600 dark:hover:text-white" |
801 | | - type="button" |
802 | | - aria-label="verify connection" |
803 | | - on:click={async () => { |
804 | | - await updateConfigHandler(); |
805 | | - const res = await verifyConfigUrl(localStorage.token).catch((error) => { |
806 | | - toast.error(`${error}`); |
807 | | - return null; |
808 | | - }); |
809 | | - |
810 | | - if (res) { |
811 | | - toast.success($i18n.t('Server connection verified')); |
812 | | - } |
813 | | - }} |
| 796 | + type="button" |
| 797 | + aria-label="verify connection" |
| 798 | + on:click={async () => { |
| 799 | + await updateConfigHandler(); |
| 800 | + const res = await verifyConfigUrl(localStorage.token).catch((error) => { |
| 801 | + toast.error(`${error}`); |
| 802 | + return null; |
| 803 | + }); |
| 804 | + |
| 805 | + if (res) { |
| 806 | + toast.success($i18n.t('Server connection verified')); |
| 807 | + } |
| 808 | + }} |
| 809 | + > |
| 810 | + <svg |
| 811 | + xmlns="http://www.w3.org/2000/svg" |
| 812 | + viewBox="0 0 20 20" |
| 813 | + fill="currentColor" |
| 814 | + class="w-4 h-4" |
814 | 815 | > |
815 | | - <svg |
816 | | - xmlns="http://www.w3.org/2000/svg" |
817 | | - viewBox="0 0 20 20" |
818 | | - fill="currentColor" |
819 | | - class="w-4 h-4" |
820 | | - > |
821 | | - <path |
822 | | - fill-rule="evenodd" |
823 | | - d="M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H3.989a.75.75 0 00-.75.75v4.242a.75.75 0 001.5 0v-2.43l.31.31a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm1.23-3.723a.75.75 0 00.219-.53V2.929a.75.75 0 00-1.5 0V5.36l-.31-.31A7 7 0 003.239 8.188a.75.75 0 101.448.389A5.5 5.5 0 0113.89 6.11l.311.31h-2.432a.75.75 0 000 1.5h4.243a.75.75 0 00.53-.219z" |
824 | | - clip-rule="evenodd" |
825 | | - /> |
826 | | - </svg> |
827 | | - </button> |
| 816 | + <path |
| 817 | + fill-rule="evenodd" |
| 818 | + d="M15.312 11.424a5.5 5.5 0 01-9.201 2.466l-.312-.311h2.433a.75.75 0 000-1.5H3.989a.75.75 0 00-.75.75v4.242a.75.75 0 001.5 0v-2.43l.31.31a7 7 0 0011.712-3.138.75.75 0 00-1.449-.39zm1.23-3.723a.75.75 0 00.219-.53V2.929a.75.75 0 00-1.5 0V5.36l-.31-.31A7 7 0 003.239 8.188a.75.75 0 101.448.389A5.5 5.5 0 0113.89 6.11l.311.31h-2.432a.75.75 0 000 1.5h4.243a.75.75 0 00.53-.219z" |
| 819 | + clip-rule="evenodd" |
| 820 | + /> |
| 821 | + </svg> |
| 822 | + </button> |
828 | 823 | </div> |
829 | 824 | </AdminSettingField> |
830 | 825 |
|
|
855 | 850 | e.target.value = null; |
856 | 851 | }; |
857 | 852 |
|
858 | | - reader.readAsText(file); |
859 | | - }} |
860 | | - /> |
| 853 | + reader.readAsText(file); |
| 854 | + }} |
| 855 | + /> |
861 | 856 | <AdminSettingRow |
862 | 857 | label={$i18n.t('ComfyUI Workflow')} |
863 | | - description={$i18n.t('Upload a workflow.json file exported as API format from ComfyUI.')} |
| 858 | + description={$i18n.t( |
| 859 | + 'Upload a workflow.json file exported as API format from ComfyUI.' |
| 860 | + )} |
864 | 861 | > |
865 | 862 | <div class="flex items-center justify-end gap-2"> |
866 | 863 | {#if config.IMAGES_EDIT_COMFYUI_WORKFLOW} |
|
906 | 903 | </div> |
907 | 904 |
|
908 | 905 | {#if config.IMAGES_EDIT_COMFYUI_WORKFLOW} |
909 | | - <div class="mb-2.5"> |
910 | | - <div class="flex w-full justify-between items-center"> |
911 | | - <div class="text-xs pr-2 shrink-0"> |
912 | | - <div class=""> |
913 | | - {$i18n.t('ComfyUI Workflow Nodes')} |
914 | | - </div> |
915 | | - </div> |
916 | | - </div> |
917 | | - |
918 | | - <div class="mt-1 text-xs flex flex-col gap-1.5"> |
| 906 | + <AdminSettingField |
| 907 | + label={$i18n.t('ComfyUI Workflow Nodes')} |
| 908 | + description={$i18n.t('Map workflow node inputs used for image edits.')} |
| 909 | + > |
| 910 | + <div class="flex flex-col gap-1.5 text-xs"> |
919 | 911 | {#each REQUIRED_EDIT_WORKFLOW_NODES as node} |
920 | 912 | <div class="flex w-full flex-col"> |
921 | 913 | <div class="shrink-0"> |
|
928 | 920 | <div class=""> |
929 | 921 | <Tooltip content={$i18n.t('Input Key (e.g. text, unet_name, steps)')}> |
930 | 922 | <input |
931 | | - class="py-1 w-24 text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300" |
| 923 | + class="{inputClass} w-24" |
932 | 924 | placeholder={$i18n.t('Key')} |
933 | 925 | bind:value={node.key} |
934 | 926 | required |
|
944 | 936 | placement="top-start" |
945 | 937 | > |
946 | 938 | <input |
947 | | - class="w-full py-1 text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300" |
| 939 | + class={inputClass} |
948 | 940 | placeholder={$i18n.t('Node Ids')} |
949 | 941 | bind:value={node.node_ids} |
950 | 942 | /> |
|
958 | 950 | <div class="mt-1 text-xs text-gray-400 dark:text-gray-500"> |
959 | 951 | {$i18n.t('*Prompt node ID(s) are required for image generation')} |
960 | 952 | </div> |
961 | | - </div> |
| 953 | + </AdminSettingField> |
962 | 954 | {/if} |
963 | 955 | {:else if config?.IMAGE_EDIT_ENGINE === 'gemini'} |
964 | | - <div class="mb-2.5"> |
965 | | - <div class="flex w-full justify-between items-center"> |
966 | | - <div class="text-xs pr-2 shrink-0"> |
967 | | - <div class=""> |
968 | | - {$i18n.t('Gemini Base URL')} |
969 | | - </div> |
970 | | - </div> |
971 | | - |
972 | | - <div class="flex w-full"> |
973 | | - <div class="flex-1"> |
974 | | - <input |
975 | | - class="w-full text-xs border border-gray-100/50 !bg-gray-50/40 outline-hidden dark:border-white/[0.04] dark:!bg-white/[0.03] dark:text-gray-300 text-right" |
976 | | - placeholder={$i18n.t('API Base URL')} |
977 | | - bind:value={config.IMAGES_EDIT_GEMINI_API_BASE_URL} |
978 | | - /> |
979 | | - </div> |
980 | | - </div> |
981 | | - </div> |
982 | | - </div> |
983 | | - |
984 | | - <div class="mb-2.5"> |
985 | | - <div class="flex w-full justify-between items-center"> |
986 | | - <div class="text-xs pr-2 shrink-0"> |
987 | | - <div class=""> |
988 | | - {$i18n.t('Gemini API Key')} |
989 | | - </div> |
990 | | - </div> |
| 956 | + <div class="grid grid-cols-1 gap-2 sm:grid-cols-2"> |
| 957 | + <AdminSettingField label={$i18n.t('Base URL')}> |
| 958 | + <input |
| 959 | + class={inputClass} |
| 960 | + placeholder={$i18n.t('API Base URL')} |
| 961 | + bind:value={config.IMAGES_EDIT_GEMINI_API_BASE_URL} |
| 962 | + /> |
| 963 | + </AdminSettingField> |
991 | 964 |
|
992 | | - <div class="flex w-full"> |
993 | | - <div class="flex-1"> |
994 | | - <SensitiveInput |
995 | | - variant="settings" |
996 | | - inputClassName="text-right w-full" |
997 | | - placeholder={$i18n.t('API Key')} |
998 | | - bind:value={config.IMAGES_EDIT_GEMINI_API_KEY} |
999 | | - required={true} |
1000 | | - /> |
1001 | | - </div> |
1002 | | - </div> |
1003 | | - </div> |
| 965 | + <AdminSettingField label={$i18n.t('API Key')}> |
| 966 | + <SensitiveInput |
| 967 | + variant="settings" |
| 968 | + placeholder={$i18n.t('API Key')} |
| 969 | + bind:value={config.IMAGES_EDIT_GEMINI_API_KEY} |
| 970 | + required={true} |
| 971 | + /> |
| 972 | + </AdminSettingField> |
1004 | 973 | </div> |
1005 | 974 | {/if} |
1006 | 975 | </AdminSettingSection> |
|
0 commit comments