|
@@ -456,4 +456,31 @@ class CallRecord(db.Model):
|
|
|
'create_time': self.create_time.isoformat() if self.create_time else None,
|
|
|
'update_by': self.update_by,
|
|
|
'update_time': self.update_time.isoformat() if self.update_time else None,
|
|
|
+ }
|
|
|
+
|
|
|
+class BotRecords(db.Model):
|
|
|
+ __tablename__ = 'botrecords'
|
|
|
+ __table_args__ = {'comment': '记录机器人会话信息'}
|
|
|
+
|
|
|
+ id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='主键')
|
|
|
+ session = db.Column(db.String(50), nullable=False, unique=True, comment='请求ID')
|
|
|
+ req_time = db.Column(db.DateTime, nullable=True, comment='来电时间')
|
|
|
+ uid = db.Column(db.String(20), nullable=True, comment='来电手机号')
|
|
|
+ bid = db.Column(db.String(20), nullable=True, comment='话术ID')
|
|
|
+ intent = db.Column(db.String(20), nullable=True, comment='意图')
|
|
|
+ contents = db.Column(db.Text, nullable=True, comment='内容')
|
|
|
+ dialog = db.Column(db.Text, nullable=True, comment='对话')
|
|
|
+ def __repr__(self):
|
|
|
+ return json.dumps(self.to_dict())
|
|
|
+
|
|
|
+ def to_dict(self):
|
|
|
+ return {
|
|
|
+ 'id': self.id,
|
|
|
+ 'session': self.session,
|
|
|
+ 'req_time': self.req_time.isoformat() if self.req_time else None,
|
|
|
+ 'uid': self.uid,
|
|
|
+ 'bid': self.bid,
|
|
|
+ 'intent': self.intent,
|
|
|
+ 'contents': self.contents,
|
|
|
+ 'dialog': self.dialog,
|
|
|
}
|