|
@@ -1,15 +1,27 @@
|
|
|
-from enum import IntEnum
|
|
|
|
|
-from sqlalchemy import Column, String, Enum as SQLAlchemyEnum
|
|
|
|
|
|
|
+from enum import IntEnum, StrEnum
|
|
|
|
|
+from sqlalchemy import Column, String, Enum as SQLAlchemyEnum, Integer
|
|
|
from app.models.base_model import Base
|
|
from app.models.base_model import Base
|
|
|
|
|
|
|
|
|
|
|
|
|
class AgentType(IntEnum):
|
|
class AgentType(IntEnum):
|
|
|
RAGFLOW = 1
|
|
RAGFLOW = 1
|
|
|
BISHENG = 2
|
|
BISHENG = 2
|
|
|
|
|
+ BASIC = 3
|
|
|
|
|
|
|
|
|
|
|
|
|
class AgentModel(Base):
|
|
class AgentModel(Base):
|
|
|
__tablename__ = "agent"
|
|
__tablename__ = "agent"
|
|
|
- id = Column(String(255), primary_key=True, index=True)
|
|
|
|
|
- name = Column(String(255), index=True)
|
|
|
|
|
- agent_type = Column(SQLAlchemyEnum(AgentType), nullable=False) # 1 ragflow 2 bisheng
|
|
|
|
|
|
|
+ id = Column(String(255), primary_key=True)
|
|
|
|
|
+ name = Column(String(255))
|
|
|
|
|
+ sort = Column(Integer, default=0, nullable=False)
|
|
|
|
|
+ agent_type = Column(SQLAlchemyEnum(AgentType), nullable=False)
|
|
|
|
|
+ type = Column(String(255), nullable=False)
|
|
|
|
|
+
|
|
|
|
|
+ # to_dict 方法
|
|
|
|
|
+ def to_dict(self):
|
|
|
|
|
+ return {
|
|
|
|
|
+ 'id': self.id,
|
|
|
|
|
+ 'name': self.name,
|
|
|
|
|
+ 'agent_type': self.agent_type,
|
|
|
|
|
+ 'type': self.type
|
|
|
|
|
+ }
|