feat: 飞书消息记录完善 记录发送者ID、姓名、群信息

- FeishuService 新增 get_user_info() 根据 user_id 获取飞书用户姓名
- feishu_bot.py 处理消息时获取发送者姓名,日志格式改为:发送者=姓名(ID), 群=chat_id, 类型=群聊/私聊, 租户=xxx
- feishu_longconn_service.py 同样获取发送者姓名并记录
- Conversation.ip_address 存储 feishu:user_id:sender_name(扩大字段到200字符)
- Conversation.invocation_method 存储 feishu_bot(group) / feishu_longconn(p2p) 等详细来源
- ChatSession.source 同步记录详细来源信息
This commit is contained in:
2026-04-02 15:40:26 +08:00
parent 88a79d1936
commit c07cbf47c8
5 changed files with 71 additions and 23 deletions

View File

@@ -103,8 +103,8 @@ class ChatSession(Base):
title = Column(String(200), nullable=True) # 会话标题(取首条消息摘要)
status = Column(String(20), default="active") # active, ended
message_count = Column(Integer, default=0) # 消息轮数
source = Column(String(50), nullable=True) # 来源websocket, api, feishu
ip_address = Column(String(45), nullable=True)
source = Column(String(100), nullable=True) # 来源websocket, api, feishu_bot(group) 等
ip_address = Column(String(200), nullable=True) # IP地址或来源标识
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
ended_at = Column(DateTime, nullable=True)
@@ -143,8 +143,8 @@ class Conversation(Base):
confidence_score = Column(Float)
knowledge_used = Column(Text) # 使用的知识库条目
response_time = Column(Float) # 响应时间(秒)
ip_address = Column(String(45), nullable=True) # IP地址
invocation_method = Column(String(50), nullable=True) # 调用方式websocket, api等
ip_address = Column(String(200), nullable=True) # IP地址或来源标识(如 feishu:uid:name
invocation_method = Column(String(100), nullable=True) # 调用方式websocket, api, feishu_bot(group) 等)
# 系统优化字段
processing_time = Column(Float) # 处理时间