mirror of
https://github.com/open-webui/open-webui.git
synced 2026-01-02 14:45:18 +00:00
refac
This commit is contained in:
parent
51dd488417
commit
39a2b9789c
2 changed files with 4 additions and 0 deletions
|
|
@ -218,6 +218,7 @@ class MessageStats(BaseModel):
|
|||
token_count: Optional[int] = None
|
||||
timestamp: Optional[int] = None
|
||||
rating: Optional[int] = None # Derived from message.annotation.rating
|
||||
tags: Optional[list[str]] = None # Derived from message.annotation.tags
|
||||
|
||||
|
||||
class ChatHistoryStats(BaseModel):
|
||||
|
|
|
|||
|
|
@ -274,6 +274,8 @@ async def export_chat_stats(
|
|||
|
||||
# Extract rating safely
|
||||
rating = message.get("annotation", {}).get("rating")
|
||||
tags = message.get("annotation", {}).get("tags")
|
||||
|
||||
message_stat = MessageStats(
|
||||
id=message.get("id"),
|
||||
role=message.get("role"),
|
||||
|
|
@ -282,6 +284,7 @@ async def export_chat_stats(
|
|||
content_length=content_length,
|
||||
token_count=None, # Populate if available, e.g. message.get("info", {}).get("token_count")
|
||||
rating=rating,
|
||||
tags=tags,
|
||||
)
|
||||
|
||||
export_messages[key] = message_stat
|
||||
|
|
|
|||
Loading…
Reference in a new issue