33PNGINFO_2_LIGHTDIFFUSIONFLOW = {}
44PNGINFO_CN_2_LIGHTDIFFUSIONFLOW = {}
55Image_Components_Key = {}
6+ LoRAs_In_Use = "loras_in_use"
7+ Flow_Save_mode = "All"
8+ Auto_Fix_Params = True
69
710class OutputPrompt_English :
811
@@ -27,17 +30,34 @@ def no_option(option_name, value):
2730 The option '<b style='color:Red;'>{ value } </b>' was not found!'''
2831
2932 def missing_extensions (ext_list :[]):
30- error_str = "Note: <b style='color:Orange;'>Found missing extensions.</b></p>"
31- for ext in ext_list :
32- error_str += "<p>- <b style='color:Orange;'>" + ext + "</b></p> "
33- error_str += "<b style='color:Orange;'>The above Extension Missing Reminder is for reference only. Please determine the necessary plugins based on your actual needs and specific conditions.</b></p> "
33+ if (Flow_Save_mode == "Core" ):
34+ error_str = "Note: <b style='color:Orange;'>The current flow file contains parameters for other plugins:</b></p>"
35+ for ext in ext_list :
36+ error_str += "<p>- <b style='color:Orange;'>" + ext + "</b></p> "
37+ error_str += "<b style='color:Orange;'>You can switch to 'ALL' mode to load more parameters. (This prompt is for reference only, please choose the plugin mode according to the actual situation.)</b></p> "
38+ else :
39+ error_str = "Note: <b style='color:Orange;'>Found missing extensions.</b></p>"
40+ for ext in ext_list :
41+ error_str += "<p>- <b style='color:Orange;'>" + ext + "</b></p> "
42+ error_str += "<b style='color:Orange;'>The above Extension Missing Reminder is for reference only. Please determine the necessary plugins based on your actual needs and specific conditions.</b></p> "
43+ return error_str
44+
45+ def missing_loras (loras_list :[]):
46+ error_str = "Note: <b style='color:Orange;'>Found missing LoRAs.</b></p>"
47+ for lora in loras_list :
48+ error_str += "<p>- <b style='color:Orange;'>" + lora + "</b></p> "
3449 return error_str
3550
3651 def click_to_download (file_name , file_url ):
3752 return f'''<p style="color:Orange;">Click to download \
3853 <a style ='text-decoration:underline;color:cornflowerblue;', target="_blank", href='{ file_url } '> { file_name } </a>
3954 '''
4055
56+ def note_for_save_mode ():
57+ return "Core mode only supports basic parameters for Text-to-Image and Image-to-Image, along with ControlNet parameters. \
58+ The All mode, on the other hand, aims to support as many parameters as possible on the page, \
59+ but the downside is that it may occasionally cause the UI to freeze with an infinite loading circle."
60+
4161class OutputPrompt_Chinese :
4262
4363 def startimport ():
@@ -64,10 +84,23 @@ def no_option(option_name, value):
6484 未找到选项'<b style='color:Red;'>{ value } </b>'!'''
6585
6686 def missing_extensions (ext_list :[]):
67- error_str = "注意, <b style='color:Orange;'>发现缺失的插件:</b></p>"
68- for ext in ext_list :
69- error_str += "<p>- <b style='color:Orange;'>" + ext + "</b></p> "
70- error_str += "<b style='color:Orange;'>以上插件缺失提示仅供参考,请注意辨别实际情况下您所需要安装的插件。</b></p> "
87+ global Flow_Save_mode
88+ if (Flow_Save_mode == "Core" ):
89+ error_str = "注意, <b style='color:Orange;'>当前flow文件含有其他插件参数:</b></p>"
90+ for ext in ext_list :
91+ error_str += "<p>- <b style='color:Orange;'>" + ext + "</b></p> "
92+ error_str += "<b style='color:Orange;'>可切换至'ALL'模式加载更多参数。(提示仅供参考,请根据实际情况选择插件模式。)</b></p> "
93+ else :
94+ error_str = "注意, <b style='color:Orange;'>发现缺失的插件:</b></p>"
95+ for ext in ext_list :
96+ error_str += "<p>- <b style='color:Orange;'>" + ext + "</b></p> "
97+ error_str += "<b style='color:Orange;'>以上插件缺失提示仅供参考,请注意辨别实际情况下您所需要安装的插件。</b></p> "
98+ return error_str
99+
100+ def missing_loras (loras_list :[]):
101+ error_str = "注意, <b style='color:Orange;'>发现缺失的LoRA模型:</b></p>"
102+ for lora in loras_list :
103+ error_str += "<p>- <b style='color:Orange;'>" + lora + "</b></p> "
71104 return error_str
72105
73106 def click_to_download (file_name , file_url ):
@@ -82,12 +115,16 @@ def click_to_download(file_name, file_url):
82115 <a style ='text-decoration:underline;color:cornflowerblue;', target="_blank", href='{ file_url } '> { name } </a>
83116 '''
84117
118+ def note_for_save_mode ():
119+ return "Core模式仅支持文生图和图生图的基本参数+ControlNet参数。All模式则会尽可能多的支持页面上的参数,但是缺点是有概率导致UI卡住,无限转圈。"
120+
121+
85122OutputPrompt = OutputPrompt_English
86123
87124# 改成函数调用,修改配置之后能及时刷新
88125def init ():
89126 global PNGINFO_2_LIGHTDIFFUSIONFLOW ,PNGINFO_CN_2_LIGHTDIFFUSIONFLOW
90- global OutputPrompt ,Image_Components_Key
127+ global OutputPrompt ,Flow_Save_mode , Auto_Fix_Params , Image_Components_Key
91128 # PNG Info的功能除了主要的选项以外其他的都靠第三方插件的主动支持,后续再考虑能否有优化的办法
92129 #print(parameters_copypaste.paste_fields)
93130 PNGINFO_2_LIGHTDIFFUSIONFLOW = {
@@ -133,40 +170,52 @@ def init():
133170 json_str = f .read ()
134171 webui_settings = json .loads (json_str )
135172
136- successed = False
173+ # 保存模式
174+ try :
175+ Flow_Save_mode = webui_settings ["lightdiffusionflow-mode" ]
176+ except :
177+ Flow_Save_mode = "Core"
178+
179+ # 自动纠正错误的参数
180+ try :
181+ Auto_Fix_Params = webui_settings ["lightdiffusionflow-auto-fix-params" ]
182+ except :
183+ Auto_Fix_Params = True
184+
185+ language_successed = False
137186 auto_language = False
138187 try :
139188 # 优先读取自己的设置
140189 if (webui_settings ['lightdiffusionflow-language' ] == "default" ):
141190 auto_language = True
142191 elif (webui_settings ['lightdiffusionflow-language' ] == "english" ):
143192 OutputPrompt = OutputPrompt_English
144- successed = True
193+ language_successed = True
145194 else :
146195 OutputPrompt = OutputPrompt_Chinese
147- successed = True
196+ language_successed = True
148197 except :
149198 OutputPrompt = OutputPrompt_English
150199
151200 # 如果是default就读取其他设置配合
152- if (auto_language and not successed ):
201+ if (auto_language and not language_successed ):
153202 # 自带的本地化文件
154203 localization_files = ["zh_CN" , "zh-Hans (Stable) [vladmandic]" , "zh-Hans (Stable)" ,
155204 "zh-Hans (Testing) [vladmandic]" , "zh-Hans (Testing)" ,"chinese-all-1024" ,"chinese-english-1024" ]
156205 try :
157206 # 如果用户使用了中文汉化文件,插件也默认显示中文
158207 localization_files .index (webui_settings ["localization" ])
159208 OutputPrompt = OutputPrompt_Chinese
160- successed = True
209+ language_successed = True
161210 except :
162211 pass
163212
164213 # 第三方翻译插件bilingual-localization
165- if (not successed ):
214+ if (not language_successed ):
166215 try :
167216 if (webui_settings ["bilingual_localization_enabled" ] and webui_settings ["bilingual_localization_file" ] != "None" ):
168217 OutputPrompt = OutputPrompt_Chinese
169- successed = True
218+ language_successed = True
170219 except :
171220 OutputPrompt = OutputPrompt_English
172221 except :
0 commit comments