mirror of
https://github.com/open-webui/open-webui
synced 2025-03-04 03:18:03 +00:00
refac
This commit is contained in:
parent
1902d4238b
commit
5bdb1c99bb
@ -18,6 +18,8 @@ from typing import Optional
|
|||||||
from aiocache import cached
|
from aiocache import cached
|
||||||
import aiohttp
|
import aiohttp
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
from fastapi import (
|
from fastapi import (
|
||||||
Depends,
|
Depends,
|
||||||
FastAPI,
|
FastAPI,
|
||||||
@ -29,8 +31,9 @@ from fastapi import (
|
|||||||
status,
|
status,
|
||||||
applications,
|
applications,
|
||||||
)
|
)
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
|
||||||
from fastapi.openapi.docs import get_swagger_ui_html
|
from fastapi.openapi.docs import get_swagger_ui_html
|
||||||
|
|
||||||
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.responses import JSONResponse, RedirectResponse
|
from fastapi.responses import JSONResponse, RedirectResponse
|
||||||
from fastapi.staticfiles import StaticFiles
|
from fastapi.staticfiles import StaticFiles
|
||||||
|
|
||||||
@ -1109,7 +1112,7 @@ app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
|
|||||||
app.mount("/cache", StaticFiles(directory=CACHE_DIR), name="cache")
|
app.mount("/cache", StaticFiles(directory=CACHE_DIR), name="cache")
|
||||||
|
|
||||||
|
|
||||||
def swagger_monkey_patch(*args, **kwargs):
|
def swagger_ui_html(*args, **kwargs):
|
||||||
return get_swagger_ui_html(
|
return get_swagger_ui_html(
|
||||||
*args,
|
*args,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
@ -1119,7 +1122,7 @@ def swagger_monkey_patch(*args, **kwargs):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
applications.get_swagger_ui_html = swagger_monkey_patch
|
applications.get_swagger_ui_html = swagger_ui_html
|
||||||
|
|
||||||
if os.path.exists(FRONTEND_BUILD_DIR):
|
if os.path.exists(FRONTEND_BUILD_DIR):
|
||||||
mimetypes.add_type("text/javascript", ".js")
|
mimetypes.add_type("text/javascript", ".js")
|
||||||
|
Loading…
Reference in New Issue
Block a user