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
84a6f211
Commit
84a6f211
authored
Nov 19, 2022
by
AUTOMATIC1111
Committed by
GitHub
Nov 19, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4358 from bamarillo/master
[API][Feature] Add Skip endpoint
parents
4b22ec41
7f63980e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
modules/api/api.py
modules/api/api.py
+8
-8
modules/api/models.py
modules/api/models.py
+3
-3
No files found.
modules/api/api.py
View file @
84a6f211
...
@@ -72,6 +72,7 @@ class Api:
...
@@ -72,6 +72,7 @@ class Api:
self
.
app
.
add_api_route
(
"/sdapi/v1/progress"
,
self
.
progressapi
,
methods
=
[
"GET"
],
response_model
=
ProgressResponse
)
self
.
app
.
add_api_route
(
"/sdapi/v1/progress"
,
self
.
progressapi
,
methods
=
[
"GET"
],
response_model
=
ProgressResponse
)
self
.
app
.
add_api_route
(
"/sdapi/v1/interrogate"
,
self
.
interrogateapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/interrogate"
,
self
.
interrogateapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/interrupt"
,
self
.
interruptapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/interrupt"
,
self
.
interruptapi
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/skip"
,
self
.
skip
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
get_config
,
methods
=
[
"GET"
],
response_model
=
OptionsModel
)
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
get_config
,
methods
=
[
"GET"
],
response_model
=
OptionsModel
)
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
set_config
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/options"
,
self
.
set_config
,
methods
=
[
"POST"
])
self
.
app
.
add_api_route
(
"/sdapi/v1/cmd-flags"
,
self
.
get_cmd_flags
,
methods
=
[
"GET"
],
response_model
=
FlagsModel
)
self
.
app
.
add_api_route
(
"/sdapi/v1/cmd-flags"
,
self
.
get_cmd_flags
,
methods
=
[
"GET"
],
response_model
=
FlagsModel
)
...
@@ -237,6 +238,9 @@ class Api:
...
@@ -237,6 +238,9 @@ class Api:
return
{}
return
{}
def
skip
(
self
):
shared
.
state
.
skip
()
def
get_config
(
self
):
def
get_config
(
self
):
options
=
{}
options
=
{}
for
key
in
shared
.
opts
.
data
.
keys
():
for
key
in
shared
.
opts
.
data
.
keys
():
...
@@ -248,14 +252,10 @@ class Api:
...
@@ -248,14 +252,10 @@ class Api:
return
options
return
options
def
set_config
(
self
,
req
:
OptionsModel
):
def
set_config
(
self
,
req
:
Dict
[
str
,
Any
]):
# currently req has all options fields even if you send a dict like { "send_seed": false }, which means it will
# overwrite all options with default values.
for
o
in
req
:
raise
RuntimeError
(
'Setting options via API is not supported'
)
setattr
(
shared
.
opts
,
o
,
req
[
o
])
reqDict
=
vars
(
req
)
for
o
in
reqDict
:
setattr
(
shared
.
opts
,
o
,
reqDict
[
o
])
shared
.
opts
.
save
(
shared
.
config_filename
)
shared
.
opts
.
save
(
shared
.
config_filename
)
return
return
...
...
modules/api/models.py
View file @
84a6f211
...
@@ -176,9 +176,9 @@ class InterrogateResponse(BaseModel):
...
@@ -176,9 +176,9 @@ class InterrogateResponse(BaseModel):
caption
:
str
=
Field
(
default
=
None
,
title
=
"Caption"
,
description
=
"The generated caption for the image."
)
caption
:
str
=
Field
(
default
=
None
,
title
=
"Caption"
,
description
=
"The generated caption for the image."
)
fields
=
{}
fields
=
{}
for
key
,
value
in
opts
.
data
.
items
():
for
key
,
metadata
in
opts
.
data_labels
.
items
():
metadata
=
opts
.
data_labels
.
get
(
key
)
value
=
opts
.
data
.
get
(
key
)
optType
=
opts
.
typemap
.
get
(
type
(
value
),
type
(
value
))
optType
=
opts
.
typemap
.
get
(
type
(
metadata
.
default
),
type
(
value
))
if
(
metadata
is
not
None
):
if
(
metadata
is
not
None
):
fields
.
update
({
key
:
(
Optional
[
optType
],
Field
(
fields
.
update
({
key
:
(
Optional
[
optType
],
Field
(
...
...
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