- Fix delete agent 500: clean up FK records (agent_llm_logs, permissions, schedules, executions, team_members) and unbind goals/tasks before delete - Remove hardcoded personality templates in Android, replace with dynamic system prompt generation from name + description - Set promptSectionsEnabled=false to bypass PromptComposer for personality - Add Tencent Cloud Linux deployment guide (Docker Compose) - Accumulated backend service updates, frontend UI fixes, Android app changes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.4 KiB
Python
37 lines
1.4 KiB
Python
"""
|
|
执行日志模型
|
|
"""
|
|
from sqlalchemy import Column, String, Text, Integer, DateTime, JSON, ForeignKey, Index, func
|
|
from sqlalchemy.dialects.mysql import CHAR
|
|
from sqlalchemy.orm import relationship
|
|
from app.core.database import Base
|
|
import uuid
|
|
|
|
|
|
class ExecutionLog(Base):
|
|
"""执行日志表"""
|
|
__tablename__ = "execution_logs"
|
|
|
|
id = Column(CHAR(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="日志ID")
|
|
execution_id = Column(CHAR(36), ForeignKey("executions.id"), nullable=False, comment="执行ID")
|
|
node_id = Column(String(100), nullable=True, comment="节点ID")
|
|
node_type = Column(String(50), nullable=True, comment="节点类型")
|
|
level = Column(String(20), nullable=False, comment="日志级别: INFO/WARN/ERROR/DEBUG")
|
|
message = Column(Text, nullable=False, comment="日志消息")
|
|
data = Column(JSON, comment="附加数据")
|
|
timestamp = Column(DateTime, default=func.now(), comment="时间戳")
|
|
duration = Column(Integer, comment="执行耗时(ms)")
|
|
|
|
__table_args__ = (
|
|
Index("idx_exec_execution_id", "execution_id"),
|
|
Index("idx_exec_timestamp", "timestamp"),
|
|
Index("idx_exec_level", "level"),
|
|
Index("idx_exec_node_id", "node_id"),
|
|
)
|
|
|
|
# 关系
|
|
execution = relationship("Execution", backref="logs")
|
|
|
|
def __repr__(self):
|
|
return f"<ExecutionLog(id={self.id}, execution_id={self.execution_id}, level={self.level})>"
|