From 465c5bd97a2a9304d709fea68605108cec905c91 Mon Sep 17 00:00:00 2001 From: DrSmoothl <1787882683@qq.com> Date: Wed, 22 Apr 2026 23:37:50 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=20EmojiResponse=20?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=EF=BC=8C=E6=B7=BB=E5=8A=A0=20format=20?= =?UTF-8?q?=E5=92=8C=20usage=5Fcount=20=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/webui/routers/emoji/schemas.py | 6 ++++++ src/webui/schemas/emoji.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/webui/routers/emoji/schemas.py b/src/webui/routers/emoji/schemas.py index 5841c28a..32402aa9 100644 --- a/src/webui/routers/emoji/schemas.py +++ b/src/webui/routers/emoji/schemas.py @@ -1,3 +1,4 @@ +from pathlib import Path from typing import Annotated, List, Optional from fastapi import File, Form, UploadFile @@ -19,9 +20,11 @@ class EmojiResponse(BaseModel): id: int full_path: str + format: str emoji_hash: str description: str query_count: int + usage_count: int is_registered: bool is_banned: bool emotion: Optional[str] @@ -145,13 +148,16 @@ def emoji_to_response(image: Images) -> EmojiResponse: if item not in deduped_emotions: deduped_emotions.append(item) emotion = ",".join(deduped_emotions) if deduped_emotions else None + image_format = Path(image.full_path).suffix.lower().lstrip(".") or "unknown" return EmojiResponse( id=image.id if image.id is not None else 0, full_path=image.full_path, + format=image_format, emoji_hash=image.image_hash, description=image.description, query_count=image.query_count, + usage_count=image.query_count, is_registered=image.is_registered, is_banned=image.is_banned, emotion=emotion, diff --git a/src/webui/schemas/emoji.py b/src/webui/schemas/emoji.py index 27937f09..2962e385 100644 --- a/src/webui/schemas/emoji.py +++ b/src/webui/schemas/emoji.py @@ -8,9 +8,11 @@ class EmojiResponse(BaseModel): id: int full_path: str + format: str emoji_hash: str description: str query_count: int + usage_count: int is_registered: bool is_banned: bool emotion: Optional[str]