Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
Stable Diffusion Webui
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
novelai-storage
Stable Diffusion Webui
Commits
888b928f
Commit
888b928f
authored
Dec 14, 2023
by
AUTOMATIC1111
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge pull request #14276 from AUTOMATIC1111/fix-styles
Fix styles
parent
b55f09c4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
24 deletions
+7
-24
modules/styles.py
modules/styles.py
+7
-24
No files found.
modules/styles.py
View file @
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
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment