agent_model.py 712 B

123456789101112131415161718192021222324252627
  1. from enum import IntEnum
  2. from sqlalchemy import Column, String, Enum as SQLAlchemyEnum, Integer
  3. from app.models.base_model import Base
  4. class AgentType(IntEnum):
  5. RAGFLOW = 1
  6. BISHENG = 2
  7. BASIC = 3
  8. class AgentModel(Base):
  9. __tablename__ = "agent"
  10. id = Column(String(255), primary_key=True)
  11. name = Column(String(255))
  12. sort = Column(Integer, default=0, nullable=False)
  13. agent_type = Column(SQLAlchemyEnum(AgentType), nullable=False)
  14. type = Column(String(255), nullable=False)
  15. # to_dict 方法
  16. def to_dict(self):
  17. return {
  18. 'id': self.id,
  19. 'name': self.name,
  20. 'agent_type': self.agent_type,
  21. 'type': self.type
  22. }