Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
af167581
Commit
af167581
authored
Feb 24, 2024
by
Justin Firth
Browse files
Restore image steps setting when Settings modal is presented
parent
3fa79e59
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
src/lib/apis/images/index.ts
src/lib/apis/images/index.ts
+32
-0
src/lib/components/chat/Settings/Images.svelte
src/lib/components/chat/Settings/Images.svelte
+2
-0
No files found.
src/lib/apis/images/index.ts
View file @
af167581
...
@@ -198,6 +198,38 @@ export const updateImageSize = async (token: string = '', size: string) => {
...
@@ -198,6 +198,38 @@ export const updateImageSize = async (token: string = '', size: string) => {
return
res
.
IMAGE_SIZE
;
return
res
.
IMAGE_SIZE
;
};
};
export
const
getImageSteps
=
async
(
token
:
string
=
''
)
=>
{
let
error
=
null
;
const
res
=
await
fetch
(
`
${
IMAGES_API_BASE_URL
}
/steps`
,
{
method
:
'
GET
'
,
headers
:
{
Accept
:
'
application/json
'
,
'
Content-Type
'
:
'
application/json
'
,
...(
token
&&
{
authorization
:
`Bearer
${
token
}
`
})
}
})
.
then
(
async
(
res
)
=>
{
if
(
!
res
.
ok
)
throw
await
res
.
json
();
return
res
.
json
();
})
.
catch
((
err
)
=>
{
console
.
log
(
err
);
if
(
'
detail
'
in
err
)
{
error
=
err
.
detail
;
}
else
{
error
=
'
Server connection failed
'
;
}
return
null
;
});
if
(
error
)
{
throw
error
;
}
return
res
.
IMAGE_STEPS
;
};
export
const
updateImageSteps
=
async
(
token
:
string
=
''
,
steps
:
number
)
=>
{
export
const
updateImageSteps
=
async
(
token
:
string
=
''
,
steps
:
number
)
=>
{
let
error
=
null
;
let
error
=
null
;
...
...
src/lib/components/chat/Settings/Images.svelte
View file @
af167581
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
updateAUTOMATIC1111Url,
updateAUTOMATIC1111Url,
updateDefaultDiffusionModel,
updateDefaultDiffusionModel,
updateImageSize,
updateImageSize,
getImageSteps,
updateImageSteps
updateImageSteps
} from '$lib/apis/images';
} from '$lib/apis/images';
import { getBackendConfig } from '$lib/apis';
import { getBackendConfig } from '$lib/apis';
...
@@ -85,6 +86,7 @@
...
@@ -85,6 +86,7 @@
if (enableImageGeneration && AUTOMATIC1111_BASE_URL) {
if (enableImageGeneration && AUTOMATIC1111_BASE_URL) {
imageSize = await getImageSize(localStorage.token);
imageSize = await getImageSize(localStorage.token);
steps = await getImageSteps(localStorage.token);
getModels();
getModels();
}
}
}
}
...
...
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