forked from open-webui/open-webui
feat: download db from admin settings
This commit is contained in:
parent
6d854125cc
commit
edb63c2280
4 changed files with 144 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
from fastapi import APIRouter, UploadFile, File, BackgroundTasks
|
||||
from fastapi import Depends, HTTPException, status
|
||||
from starlette.responses import StreamingResponse
|
||||
from starlette.responses import StreamingResponse, FileResponse
|
||||
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
@ -9,6 +10,8 @@ import os
|
|||
import aiohttp
|
||||
import json
|
||||
|
||||
|
||||
from utils.utils import get_admin_user
|
||||
from utils.misc import calculate_sha256, get_gravatar_url
|
||||
|
||||
from config import OLLAMA_API_BASE_URL, DATA_DIR, UPLOAD_DIR
|
||||
|
@ -172,3 +175,13 @@ async def get_gravatar(
|
|||
email: str,
|
||||
):
|
||||
return get_gravatar_url(email)
|
||||
|
||||
|
||||
@router.get("/db/download")
|
||||
async def download_db(user=Depends(get_admin_user)):
|
||||
|
||||
return FileResponse(
|
||||
f"{DATA_DIR}/webui.db",
|
||||
media_type="application/octet-stream",
|
||||
filename="webui.db",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue