This commit is contained in:
雅诺狐
2025-08-16 23:48:07 +08:00
27 changed files with 1600 additions and 2728 deletions

View File

@@ -389,7 +389,7 @@ class EmojiManager:
self._scan_task = None
self.vlm = LLMRequest(model_set=model_config.model_task_config.vlm, request_type="emoji")
self.vlm = LLMRequest(model_set=model_config.model_task_config.emoji_vlm, request_type="emoji")
self.llm_emotion_judge = LLMRequest(
model_set=model_config.model_task_config.utils, request_type="emoji"
) # 更高的温度更少的token后续可以根据情绪来调整温度
@@ -914,7 +914,7 @@ class EmojiManager:
# from src.common.database.database_model_compat import Images
stmt = select(Images).where((Images.emoji_hash == image_hash) & (Images.type == "emoji"))
existing_image = session.execute(stmt).scalar_one_or_none()
existing_image = session.query(Images).filter((Images.emoji_hash == image_hash) & (Images.type == "emoji")).one_or_none()
if existing_image and existing_image.description:
existing_description = existing_image.description
logger.info(f"[复用描述] 找到已有详细描述: {existing_description[:50]}...")

View File

@@ -372,10 +372,19 @@ class StatisticOutputTask(AsyncTask):
model_class=LLMUsage,
filters={"timestamp": {"$gte": query_start_time}},
order_by="-timestamp"
)
) or []
for record in records:
record_timestamp = record['timestamp'] # 从字典中获取
if not isinstance(record, dict):
continue
record_timestamp = record.get('timestamp')
if isinstance(record_timestamp, str):
record_timestamp = datetime.fromisoformat(record_timestamp)
if not record_timestamp:
continue
for idx, (_, period_start) in enumerate(collect_period):
if record_timestamp >= period_start:
for period_key, _ in collect_period[idx:]:
@@ -478,11 +487,22 @@ class StatisticOutputTask(AsyncTask):
model_class=OnlineTime,
filters={"end_timestamp": {"$gte": query_start_time}},
order_by="-end_timestamp"
)
) or []
for record in records:
record_end_timestamp = record['end_timestamp']
record_start_timestamp = record['start_timestamp']
if not isinstance(record, dict):
continue
record_end_timestamp = record.get('end_timestamp')
if isinstance(record_end_timestamp, str):
record_end_timestamp = datetime.fromisoformat(record_end_timestamp)
record_start_timestamp = record.get('start_timestamp')
if isinstance(record_start_timestamp, str):
record_start_timestamp = datetime.fromisoformat(record_start_timestamp)
if not record_end_timestamp or not record_start_timestamp:
continue
for idx, (_, period_boundary_start) in enumerate(collect_period):
if record_end_timestamp >= period_boundary_start:
@@ -523,10 +543,15 @@ class StatisticOutputTask(AsyncTask):
model_class=Messages,
filters={"time": {"$gte": query_start_timestamp}},
order_by="-time"
)
) or []
for message in records:
message_time_ts = message['time'] # This is a float timestamp
if not isinstance(message, dict):
continue
message_time_ts = message.get('time') # This is a float timestamp
if not message_time_ts:
continue
chat_id = None
chat_name = None