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
3369fb27
Commit
3369fb27
authored
Aug 25, 2023
by
SpenserCai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support installed extensions list api
parent
a6cedafb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
modules/api/api.py
modules/api/api.py
+20
-0
modules/api/models.py
modules/api/models.py
+9
-0
No files found.
modules/api/api.py
View file @
3369fb27
...
...
@@ -243,6 +243,7 @@ class Api:
self
.
add_api_route
(
"/sdapi/v1/reload-checkpoint"
,
self
.
reloadapi
,
methods
=
[
"POST"
])
self
.
add_api_route
(
"/sdapi/v1/scripts"
,
self
.
get_scripts_list
,
methods
=
[
"GET"
],
response_model
=
models
.
ScriptsList
)
self
.
add_api_route
(
"/sdapi/v1/script-info"
,
self
.
get_script_info
,
methods
=
[
"GET"
],
response_model
=
List
[
models
.
ScriptInfo
])
self
.
add_api_route
(
"/sdapi/v1/extensions"
,
self
.
get_extensions_list
,
methods
=
[
"GET"
],
response_model
=
List
[
models
.
ExtensionItem
])
if
shared
.
cmd_opts
.
api_server_stop
:
self
.
add_api_route
(
"/sdapi/v1/server-kill"
,
self
.
kill_webui
,
methods
=
[
"POST"
])
...
...
@@ -769,6 +770,25 @@ class Api:
except
Exception
as
err
:
cuda
=
{
'error'
:
f
'{err}'
}
return
models
.
MemoryResponse
(
ram
=
ram
,
cuda
=
cuda
)
def
get_extensions_list
(
self
):
from
modules
import
extensions
extensions
.
list_extensions
()
ext_list
=
[]
for
ext
in
extensions
.
extensions
:
ext
:
extensions
.
Extension
ext
.
read_info_from_repo
()
if
ext
.
remote
is
not
None
:
ext_list
.
append
({
"name"
:
ext
.
name
,
"remote"
:
ext
.
remote
,
"branch"
:
ext
.
branch
,
"commit_hash"
:
ext
.
commit_hash
,
"commit_date"
:
ext
.
commit_date
,
"version"
:
ext
.
version
,
"enabled"
:
ext
.
enabled
})
return
ext_list
def
launch
(
self
,
server_name
,
port
,
root_path
):
self
.
app
.
include_router
(
self
.
router
)
...
...
modules/api/models.py
View file @
3369fb27
...
...
@@ -311,3 +311,12 @@ class ScriptInfo(BaseModel):
is_alwayson
:
bool
=
Field
(
default
=
None
,
title
=
"IsAlwayson"
,
description
=
"Flag specifying whether this script is an alwayson script"
)
is_img2img
:
bool
=
Field
(
default
=
None
,
title
=
"IsImg2img"
,
description
=
"Flag specifying whether this script is an img2img script"
)
args
:
List
[
ScriptArg
]
=
Field
(
title
=
"Arguments"
,
description
=
"List of script's arguments"
)
class
ExtensionItem
(
BaseModel
):
name
:
str
=
Field
(
title
=
"Name"
,
description
=
"Extension name"
)
remote
:
str
=
Field
(
title
=
"Remote"
,
description
=
"Extension Repository URL"
)
branch
:
str
=
Field
(
title
=
"Branch"
,
description
=
"Extension Repository Branch"
)
commit_hash
:
str
=
Field
(
title
=
"Commit Hash"
,
description
=
"Extension Repository Commit Hash"
)
version
:
str
=
Field
(
title
=
"Version"
,
description
=
"Extension Version"
)
commit_date
:
str
=
Field
(
title
=
"Commit Date"
,
description
=
"Extension Repository Commit Date"
)
enabled
:
bool
=
Field
(
title
=
"Enabled"
,
description
=
"Flag specifying whether this extension is enabled"
)
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