feat: 在获取聊天流时添加创建时间和最后活跃时间字段
This commit is contained in:
@@ -444,10 +444,13 @@ class ChatManager:
|
||||
return stream
|
||||
|
||||
# 使用优化后的API查询(带缓存)
|
||||
current_time = time.time()
|
||||
model_instance, _ = await get_or_create_chat_stream(
|
||||
stream_id=stream_id,
|
||||
platform=platform,
|
||||
defaults={
|
||||
"create_time": current_time,
|
||||
"last_active_time": current_time,
|
||||
"user_platform": user_info.platform if user_info else platform,
|
||||
"user_id": user_info.user_id if user_info else "",
|
||||
"user_nickname": user_info.user_nickname if user_info else "",
|
||||
|
||||
@@ -257,14 +257,20 @@ class RelationshipFetcher:
|
||||
"""
|
||||
try:
|
||||
from src.common.database.api.specialized import get_or_create_chat_stream
|
||||
import time
|
||||
|
||||
# 使用优化后的API(带缓存)
|
||||
# 从stream_id解析platform,或使用默认值
|
||||
platform = stream_id.split("_")[0] if "_" in stream_id else "unknown"
|
||||
current_time = time.time()
|
||||
|
||||
stream, _ = await get_or_create_chat_stream(
|
||||
stream_id=stream_id,
|
||||
platform=platform,
|
||||
defaults={
|
||||
"create_time": current_time,
|
||||
"last_active_time": current_time,
|
||||
},
|
||||
)
|
||||
|
||||
if not stream:
|
||||
|
||||
Reference in New Issue
Block a user