"docs/git@developer.sourcefind.cn:change/sglang.git" did not exist on "1df6eabd5d362b4e3ac53b8d195e0f8c14d22b54"
Commit 797ed9ac authored by Timothy J. Baek's avatar Timothy J. Baek
Browse files

feat: allow enabling after url is provided

parent d863e7e6
...@@ -43,8 +43,12 @@ async def get_enable_status(request: Request, user=Depends(get_admin_user)): ...@@ -43,8 +43,12 @@ async def get_enable_status(request: Request, user=Depends(get_admin_user)):
@app.get("/enabled/toggle", response_model=bool) @app.get("/enabled/toggle", response_model=bool)
async def toggle_enabled(request: Request, user=Depends(get_admin_user)): async def toggle_enabled(request: Request, user=Depends(get_admin_user)):
app.state.ENABLED = not app.state.ENABLED try:
return app.state.ENABLED r = requests.head(app.state.AUTOMATIC1111_BASE_URL)
app.state.ENABLED = not app.state.ENABLED
return app.state.ENABLED
except Exception as e:
raise HTTPException(status_code=r.status_code, detail=ERROR_MESSAGES.DEFAULT(e))
class UrlUpdateForm(BaseModel): class UrlUpdateForm(BaseModel):
......
...@@ -45,8 +45,13 @@ ...@@ -45,8 +45,13 @@
}; };
const toggleImageGeneration = async () => { const toggleImageGeneration = async () => {
enableImageGeneration = await toggleImageGenerationEnabledStatus(localStorage.token); if (AUTOMATIC1111_BASE_URL) {
config.set(await getBackendConfig(localStorage.token)); enableImageGeneration = await toggleImageGenerationEnabledStatus(localStorage.token);
config.set(await getBackendConfig(localStorage.token));
} else {
enableImageGeneration = false;
toast.error('AUTOMATIC1111_BASE_URL not provided');
}
}; };
onMount(async () => { onMount(async () => {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment