Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Overbill1683
Stable Diffusion Webui
提交
888b928f
S
Stable Diffusion Webui
项目概览
Overbill1683
/
Stable Diffusion Webui
9 个月 前同步成功
通知
1733
Star
80
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
分析
仓库
DevOps
项目成员
Pages
S
Stable Diffusion Webui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Pages
分析
分析
仓库分析
DevOps
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
提交
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
888b928f
编写于
12月 14, 2023
作者:
A
AUTOMATIC1111
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Merge pull request #14276 from AUTOMATIC1111/fix-styles
Fix styles
上级
b55f09c4
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
7 addition
and
24 deletion
+7
-24
modules/styles.py
modules/styles.py
+7
-24
未找到文件。
modules/styles.py
浏览文件 @
888b928f
...
...
@@ -98,10 +98,8 @@ class StyleDatabase:
self
.
path
=
path
folder
,
file
=
os
.
path
.
split
(
self
.
path
)
self
.
default_file
=
file
.
split
(
"*"
)[
0
]
+
".csv"
if
self
.
default_file
==
".csv"
:
self
.
default_file
=
"styles.csv"
self
.
default_path
=
os
.
path
.
join
(
folder
,
self
.
default_file
)
filename
,
_
,
ext
=
file
.
partition
(
'*'
)
self
.
default_path
=
os
.
path
.
join
(
folder
,
filename
+
ext
)
self
.
prompt_fields
=
[
field
for
field
in
PromptStyle
.
_fields
if
field
!=
"path"
]
...
...
@@ -155,10 +153,8 @@ class StyleDatabase:
row
[
"name"
],
prompt
,
negative_prompt
,
path
)
def
get_style_paths
(
self
)
->
list
():
"""
Returns a list of all distinct paths, including the default path, of
files that styles are loaded from."""
def
get_style_paths
(
self
)
->
set
:
"""Returns a set of all distinct paths of files that styles are loaded from."""
# Update any styles without a path to the default path
for
style
in
list
(
self
.
styles
.
values
()):
if
not
style
.
path
:
...
...
@@ -172,9 +168,9 @@ class StyleDatabase:
style_paths
.
add
(
style
.
path
)
# Remove any paths for styles that are just list dividers
style_paths
.
remove
(
"do_not_save"
)
style_paths
.
discard
(
"do_not_save"
)
return
list
(
style_paths
)
return
style_paths
def
get_style_prompts
(
self
,
styles
):
return
[
self
.
styles
.
get
(
x
,
self
.
no_style
).
prompt
for
x
in
styles
]
...
...
@@ -196,20 +192,7 @@ class StyleDatabase:
# The path argument is deprecated, but kept for backwards compatibility
_
=
path
# Update any styles without a path to the default path
for
style
in
list
(
self
.
styles
.
values
()):
if
not
style
.
path
:
self
.
styles
[
style
.
name
]
=
style
.
_replace
(
path
=
self
.
default_path
)
# Create a list of all distinct paths, including the default path
style_paths
=
set
()
style_paths
.
add
(
self
.
default_path
)
for
_
,
style
in
self
.
styles
.
items
():
if
style
.
path
:
style_paths
.
add
(
style
.
path
)
# Remove any paths for styles that are just list dividers
style_paths
.
remove
(
"do_not_save"
)
style_paths
=
self
.
get_style_paths
()
csv_names
=
[
os
.
path
.
split
(
path
)[
1
].
lower
()
for
path
in
style_paths
]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录