| | |
| | | outputs = answer.get("outputs", {}) |
| | | if outputs: |
| | | message = outputs.get("output", "") |
| | | download_url = outputs.get("download_url", "") |
| | | download_url = outputs.get("download_url", "").rstrip("/") |
| | | else: |
| | | message = answer.get("error", "") |
| | | if download_url: |
| | |
| | | |
| | | |
| | | class SessionModel(Base): |
| | | __tablename__ = "sessions" |
| | | __tablename__ = "sessions_log" |
| | | id = Column(String(255), primary_key=True) |
| | | name = Column(String(255)) |
| | | agent_id = Column(String(255)) |
| | |
| | | tenant_id = Column(Integer) # 创建人 |
| | | message = Column(TEXT) # 说明 |
| | | conversation_id = Column(String(64)) |
| | | # workflow = Column(Integer, default=0) |
| | | workflow = Column(Integer, default=0) |
| | | |
| | | # to_dict 方法 |
| | | def to_dict(self): |
| | |
| | | 'name': self.name, |
| | | 'agent_type': self.agent_type, |
| | | 'agent_id': self.agent_id, |
| | | # 'workflow': self.workflow, |
| | | 'workflow': self.workflow if self.workflow else 0, |
| | | 'create_date': self.create_date.strftime("%Y-%m-%d %H:%M:%S"), |
| | | 'update_date': self.update_date.strftime("%Y-%m-%d %H:%M:%S"), |
| | | } |
| | |
| | | agent_id=agent_id, |
| | | agent_type=agent_type, |
| | | tenant_id=user_id, |
| | | # workflow=workflow_type, |
| | | workflow=workflow_type, |
| | | message=json.dumps([message]) |
| | | ) |
| | | self.db.add(new_session) |