mirror of
https://github.com/open-webui/open-webui.git
synced 2026-01-02 14:45:18 +00:00
refac
Some checks are pending
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-slim-images (push) Blocked by required conditions
Python CI / Format Backend (push) Waiting to run
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Frontend Build / Format & Build Frontend (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Some checks are pending
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-slim-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-slim-images (push) Blocked by required conditions
Python CI / Format Backend (push) Waiting to run
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda126-images (push) Blocked by required conditions
Frontend Build / Format & Build Frontend (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/amd64, ubuntu-latest) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda126-image (linux/arm64, ubuntu-24.04-arm) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64, ubuntu-latest) (push) Waiting to run
This commit is contained in:
parent
4be99174be
commit
df106099a1
2 changed files with 22 additions and 2 deletions
|
|
@ -806,7 +806,20 @@ class ChatTable:
|
||||||
if filter.get("end_time"):
|
if filter.get("end_time"):
|
||||||
query = query.filter(Chat.created_at <= filter.get("end_time"))
|
query = query.filter(Chat.created_at <= filter.get("end_time"))
|
||||||
|
|
||||||
query = query.order_by(Chat.updated_at.desc())
|
order_by = filter.get("order_by")
|
||||||
|
direction = filter.get("direction")
|
||||||
|
|
||||||
|
if order_by and direction:
|
||||||
|
if hasattr(Chat, order_by):
|
||||||
|
if direction.lower() == "asc":
|
||||||
|
query = query.order_by(getattr(Chat, order_by).asc())
|
||||||
|
elif direction.lower() == "desc":
|
||||||
|
query = query.order_by(getattr(Chat, order_by).desc())
|
||||||
|
else:
|
||||||
|
query = query.order_by(Chat.updated_at.desc())
|
||||||
|
|
||||||
|
else:
|
||||||
|
query = query.order_by(Chat.updated_at.desc())
|
||||||
|
|
||||||
total = query.count()
|
total = query.count()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,7 @@ def get_session_user_chat_usage_stats(
|
||||||
@router.get("/stats/export", response_model=list[ChatStatsExport])
|
@router.get("/stats/export", response_model=list[ChatStatsExport])
|
||||||
async def export_chat_stats(
|
async def export_chat_stats(
|
||||||
request: Request,
|
request: Request,
|
||||||
|
chat_id: Optional[str] = None,
|
||||||
start_time: Optional[int] = None,
|
start_time: Optional[int] = None,
|
||||||
end_time: Optional[int] = None,
|
end_time: Optional[int] = None,
|
||||||
page: Optional[int] = 1,
|
page: Optional[int] = 1,
|
||||||
|
|
@ -226,7 +227,13 @@ async def export_chat_stats(
|
||||||
skip = (page - 1) * limit
|
skip = (page - 1) * limit
|
||||||
|
|
||||||
# Fetch chats with date filtering
|
# Fetch chats with date filtering
|
||||||
filter = {}
|
filter = {"order_by": "created_at", "direction": "asc"}
|
||||||
|
|
||||||
|
if chat_id:
|
||||||
|
chat = Chats.get_chat_by_id(chat_id)
|
||||||
|
if chat:
|
||||||
|
filter["start_time"] = chat.created_at
|
||||||
|
|
||||||
if start_time:
|
if start_time:
|
||||||
filter["start_time"] = start_time
|
filter["start_time"] = start_time
|
||||||
if end_time:
|
if end_time:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue