Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
S
Stable Diffusion Webui
管理
动态
成员
代码
仓库
分支
提交
标签
仓库图
比较修订版本
部署
模型注册表
分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
Show more breadcrumbs
Hunter0726
Stable Diffusion Webui
提交
5ed7daa3
未验证
提交
5ed7daa3
编辑于
1年前
作者:
AUTOMATIC1111
提交者:
GitHub
1年前
浏览文件
操作
下载
差异文件
Merge pull request #14120 from AUTOMATIC1111/protect-against-bad-ui-creation-scripts
catch uncaught exception with ui creation scripts
上级
ef1723ef
8a6e4bda
No related branches found
No related tags found
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
modules/scripts.py
+29
-25
29 个添加, 25 个删除
modules/scripts.py
有
29 个添加
和
25 个删除
modules/scripts.py
+
29
−
25
浏览文件 @
5ed7daa3
...
...
@@ -570,40 +570,44 @@ class ScriptRunner:
if
controls
is
None
:
return
script
.
name
=
wrap_call
(
script
.
title
,
script
.
filename
,
"
title
"
,
default
=
script
.
filename
).
lower
()
api_args
=
[]
try
:
script
.
name
=
wrap_call
(
script
.
title
,
script
.
filename
,
"
title
"
,
default
=
script
.
filename
).
lower
()
api_args
=
[]
for
control
in
controls
:
control
.
custom_script_source
=
os
.
path
.
basename
(
script
.
filename
)
for
control
in
controls
:
control
.
custom_script_source
=
os
.
path
.
basename
(
script
.
filename
)
arg_info
=
api_models
.
ScriptArg
(
label
=
control
.
label
or
""
)
arg_info
=
api_models
.
ScriptArg
(
label
=
control
.
label
or
""
)
for
field
in
(
"
value
"
,
"
minimum
"
,
"
maximum
"
,
"
step
"
):
v
=
getattr
(
control
,
field
,
None
)
if
v
is
not
None
:
setattr
(
arg_info
,
field
,
v
)
for
field
in
(
"
value
"
,
"
minimum
"
,
"
maximum
"
,
"
step
"
):
v
=
getattr
(
control
,
field
,
None
)
if
v
is
not
None
:
setattr
(
arg_info
,
field
,
v
)
choices
=
getattr
(
control
,
'
choices
'
,
None
)
# as of gradio 3.41, some items in choices are strings, and some are tuples where the first elem is the string
if
choices
is
not
None
:
arg_info
.
choices
=
[
x
[
0
]
if
isinstance
(
x
,
tuple
)
else
x
for
x
in
choices
]
choices
=
getattr
(
control
,
'
choices
'
,
None
)
# as of gradio 3.41, some items in choices are strings, and some are tuples where the first elem is the string
if
choices
is
not
None
:
arg_info
.
choices
=
[
x
[
0
]
if
isinstance
(
x
,
tuple
)
else
x
for
x
in
choices
]
api_args
.
append
(
arg_info
)
api_args
.
append
(
arg_info
)
script
.
api_info
=
api_models
.
ScriptInfo
(
name
=
script
.
name
,
is_img2img
=
script
.
is_img2img
,
is_alwayson
=
script
.
alwayson
,
args
=
api_args
,
)
script
.
api_info
=
api_models
.
ScriptInfo
(
name
=
script
.
name
,
is_img2img
=
script
.
is_img2img
,
is_alwayson
=
script
.
alwayson
,
args
=
api_args
,
)
if
script
.
infotext_fields
is
not
None
:
self
.
infotext_fields
+=
script
.
infotext_fields
if
script
.
infotext_fields
is
not
None
:
self
.
infotext_fields
+=
script
.
infotext_fields
if
script
.
paste_field_names
is
not
None
:
self
.
paste_field_names
+=
script
.
paste_field_names
if
script
.
paste_field_names
is
not
None
:
self
.
paste_field_names
+=
script
.
paste_field_names
self
.
inputs
+=
controls
script
.
args_to
=
len
(
self
.
inputs
)
self
.
inputs
+=
controls
script
.
args_to
=
len
(
self
.
inputs
)
except
Exception
:
errors
.
report
(
f
"
Error creating UI for
{
script
.
name
}
:
"
,
exc_info
=
True
)
def
setup_ui_for_section
(
self
,
section
,
scriptlist
=
None
):
if
scriptlist
is
None
:
...
...
This diff is collapsed.
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录