schema.go 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177
  1. // Code generated by ent, DO NOT EDIT.
  2. package migrate
  3. import (
  4. "entgo.io/ent/dialect/entsql"
  5. "entgo.io/ent/dialect/sql/schema"
  6. "entgo.io/ent/schema/field"
  7. )
  8. var (
  9. // AgentColumns holds the columns for the "agent" table.
  10. AgentColumns = []*schema.Column{
  11. {Name: "id", Type: field.TypeUint64, Increment: true},
  12. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  13. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  14. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  15. {Name: "name", Type: field.TypeString, Size: 255, Comment: "name | 角色名称"},
  16. {Name: "role", Type: field.TypeString, Comment: "role | 角色设定"},
  17. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  18. {Name: "background", Type: field.TypeString, Nullable: true, Comment: "background | 背景介绍", Default: ""},
  19. {Name: "examples", Type: field.TypeString, Nullable: true, Comment: "examples | 对话案例", Default: ""},
  20. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  21. {Name: "dataset_id", Type: field.TypeString, Size: 255, Comment: "dataset_id | 知识库ID", Default: ""},
  22. {Name: "collection_id", Type: field.TypeString, Size: 255, Comment: "collection_id | 集合ID", Default: ""},
  23. }
  24. // AgentTable holds the schema information for the "agent" table.
  25. AgentTable = &schema.Table{
  26. Name: "agent",
  27. Columns: AgentColumns,
  28. PrimaryKey: []*schema.Column{AgentColumns[0]},
  29. Indexes: []*schema.Index{
  30. {
  31. Name: "agent_organization_id",
  32. Unique: false,
  33. Columns: []*schema.Column{AgentColumns[9]},
  34. },
  35. },
  36. }
  37. // AgentBaseColumns holds the columns for the "agent_base" table.
  38. AgentBaseColumns = []*schema.Column{
  39. {Name: "id", Type: field.TypeString, Comment: "id"},
  40. {Name: "q", Type: field.TypeString, Nullable: true, Comment: "q", Default: ""},
  41. {Name: "a", Type: field.TypeString, Nullable: true, Comment: "a", Default: ""},
  42. {Name: "chunk_index", Type: field.TypeUint64, Comment: "chunk_index"},
  43. {Name: "indexes", Type: field.TypeJSON, Nullable: true, Comment: "indexes"},
  44. {Name: "dataset_id", Type: field.TypeString, Nullable: true, Comment: "dataset_id", Default: ""},
  45. {Name: "collection_id", Type: field.TypeString, Nullable: true, Comment: "collection_id", Default: ""},
  46. {Name: "source_name", Type: field.TypeString, Nullable: true, Comment: "source_name", Default: ""},
  47. {Name: "can_write", Type: field.TypeJSON, Nullable: true, Comment: "can_write"},
  48. {Name: "is_owner", Type: field.TypeJSON, Nullable: true, Comment: "is_owner"},
  49. }
  50. // AgentBaseTable holds the schema information for the "agent_base" table.
  51. AgentBaseTable = &schema.Table{
  52. Name: "agent_base",
  53. Columns: AgentBaseColumns,
  54. PrimaryKey: []*schema.Column{AgentBaseColumns[0]},
  55. }
  56. // AliyunAvatarColumns holds the columns for the "aliyun_avatar" table.
  57. AliyunAvatarColumns = []*schema.Column{
  58. {Name: "id", Type: field.TypeUint64, Increment: true},
  59. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  60. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  61. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  62. {Name: "user_id", Type: field.TypeUint64, Comment: "user_id | wx_card_user_id"},
  63. {Name: "biz_id", Type: field.TypeString, Comment: "biz_id | BizId"},
  64. {Name: "access_key_id", Type: field.TypeString, Comment: "access_key_id | AccessKeyId"},
  65. {Name: "access_key_secret", Type: field.TypeString, Comment: "access_key_secret | AccessKeySecret"},
  66. {Name: "app_id", Type: field.TypeString, Nullable: true, Comment: "app_id | AppId"},
  67. {Name: "tenant_id", Type: field.TypeUint64, Comment: "tenant_id | TenantId"},
  68. {Name: "response", Type: field.TypeString, Size: 2147483647, Comment: "response | 阿里云avatar响应"},
  69. {Name: "token", Type: field.TypeString, Comment: "token | Token", Default: ""},
  70. {Name: "session_id", Type: field.TypeString, Comment: "session_id | SessionId", Default: ""},
  71. }
  72. // AliyunAvatarTable holds the schema information for the "aliyun_avatar" table.
  73. AliyunAvatarTable = &schema.Table{
  74. Name: "aliyun_avatar",
  75. Columns: AliyunAvatarColumns,
  76. PrimaryKey: []*schema.Column{AliyunAvatarColumns[0]},
  77. Indexes: []*schema.Index{
  78. {
  79. Name: "aliyunavatar_user_id",
  80. Unique: false,
  81. Columns: []*schema.Column{AliyunAvatarColumns[4]},
  82. },
  83. },
  84. }
  85. // BatchMsgColumns holds the columns for the "batch_msg" table.
  86. BatchMsgColumns = []*schema.Column{
  87. {Name: "id", Type: field.TypeUint64, Increment: true},
  88. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  89. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  90. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  91. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "状态 0 未开始 1 开始发送 2 发送完成 3 发送中止"},
  92. {Name: "batch_no", Type: field.TypeString, Unique: true, Nullable: true, Comment: "批次号"},
  93. {Name: "task_name", Type: field.TypeString, Nullable: true, Comment: "任务名称", Default: ""},
  94. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  95. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "内容"},
  96. {Name: "tag", Type: field.TypeString, Nullable: true, Comment: "发送规则 all 全部 tag1,tag2 按tag发送"},
  97. {Name: "tagids", Type: field.TypeString, Nullable: true, Comment: "要发送的tagids"},
  98. {Name: "total", Type: field.TypeInt32, Nullable: true, Comment: "总数"},
  99. {Name: "success", Type: field.TypeInt32, Nullable: true, Comment: "成功数量"},
  100. {Name: "fail", Type: field.TypeInt32, Nullable: true, Comment: "失败数量"},
  101. {Name: "start_time", Type: field.TypeTime, Nullable: true, Comment: "开始时间"},
  102. {Name: "stop_time", Type: field.TypeTime, Nullable: true, Comment: "结束时间"},
  103. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  104. {Name: "type", Type: field.TypeInt32, Nullable: true, Comment: "发送类型 1-群发消息 2-群发朋友圈"},
  105. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  106. }
  107. // BatchMsgTable holds the schema information for the "batch_msg" table.
  108. BatchMsgTable = &schema.Table{
  109. Name: "batch_msg",
  110. Columns: BatchMsgColumns,
  111. PrimaryKey: []*schema.Column{BatchMsgColumns[0]},
  112. Indexes: []*schema.Index{
  113. {
  114. Name: "batchmsg_batch_no",
  115. Unique: true,
  116. Columns: []*schema.Column{BatchMsgColumns[5]},
  117. },
  118. {
  119. Name: "batchmsg_type",
  120. Unique: false,
  121. Columns: []*schema.Column{BatchMsgColumns[17]},
  122. },
  123. },
  124. }
  125. // CategoryColumns holds the columns for the "category" table.
  126. CategoryColumns = []*schema.Column{
  127. {Name: "id", Type: field.TypeUint64, Increment: true},
  128. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  129. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  130. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  131. {Name: "name", Type: field.TypeString, Size: 255, Comment: "name | 角色名称"},
  132. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  133. }
  134. // CategoryTable holds the schema information for the "category" table.
  135. CategoryTable = &schema.Table{
  136. Name: "category",
  137. Columns: CategoryColumns,
  138. PrimaryKey: []*schema.Column{CategoryColumns[0]},
  139. Indexes: []*schema.Index{
  140. {
  141. Name: "category_organization_id",
  142. Unique: false,
  143. Columns: []*schema.Column{CategoryColumns[5]},
  144. },
  145. },
  146. }
  147. // ChatRecordsColumns holds the columns for the "chat_records" table.
  148. ChatRecordsColumns = []*schema.Column{
  149. {Name: "id", Type: field.TypeUint64, Increment: true},
  150. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  151. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  152. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  153. {Name: "content", Type: field.TypeString, Comment: "内容", Default: ""},
  154. {Name: "content_type", Type: field.TypeUint8, Comment: "内容类型:1-提问 2-回答", Default: 1},
  155. {Name: "session_id", Type: field.TypeUint64, Comment: "会话ID", Default: 0},
  156. {Name: "user_id", Type: field.TypeUint64, Comment: "用户ID", Default: 0},
  157. {Name: "bot_id", Type: field.TypeUint64, Comment: "聊天ID", Default: 0},
  158. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序card 3-智能体", Default: 2},
  159. }
  160. // ChatRecordsTable holds the schema information for the "chat_records" table.
  161. ChatRecordsTable = &schema.Table{
  162. Name: "chat_records",
  163. Columns: ChatRecordsColumns,
  164. PrimaryKey: []*schema.Column{ChatRecordsColumns[0]},
  165. Indexes: []*schema.Index{
  166. {
  167. Name: "chatrecords_user_id_bot_id_bot_type",
  168. Unique: false,
  169. Columns: []*schema.Column{ChatRecordsColumns[7], ChatRecordsColumns[8], ChatRecordsColumns[9]},
  170. },
  171. {
  172. Name: "chatrecords_session_id",
  173. Unique: false,
  174. Columns: []*schema.Column{ChatRecordsColumns[6]},
  175. },
  176. },
  177. }
  178. // ChatSessionColumns holds the columns for the "chat_session" table.
  179. ChatSessionColumns = []*schema.Column{
  180. {Name: "id", Type: field.TypeUint64, Increment: true},
  181. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  182. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  183. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  184. {Name: "name", Type: field.TypeString, Comment: "名称", Default: ""},
  185. {Name: "user_id", Type: field.TypeUint64, Comment: "用户ID", Default: 0},
  186. {Name: "bot_id", Type: field.TypeUint64, Comment: "聊天ID", Default: 0},
  187. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序card 3-智能体", Default: 2},
  188. }
  189. // ChatSessionTable holds the schema information for the "chat_session" table.
  190. ChatSessionTable = &schema.Table{
  191. Name: "chat_session",
  192. Columns: ChatSessionColumns,
  193. PrimaryKey: []*schema.Column{ChatSessionColumns[0]},
  194. Indexes: []*schema.Index{
  195. {
  196. Name: "chatsession_user_id_bot_id_bot_type",
  197. Unique: false,
  198. Columns: []*schema.Column{ChatSessionColumns[5], ChatSessionColumns[6], ChatSessionColumns[7]},
  199. },
  200. },
  201. }
  202. // ContactColumns holds the columns for the "contact" table.
  203. ContactColumns = []*schema.Column{
  204. {Name: "id", Type: field.TypeUint64, Increment: true},
  205. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  206. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  207. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  208. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  209. {Name: "wx_wxid", Type: field.TypeString, Comment: "属主微信id", Default: ""},
  210. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "联系人类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  211. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  212. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  213. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称 群备注名称", Default: ""},
  214. {Name: "markname", Type: field.TypeString, Comment: "备注名", Default: ""},
  215. {Name: "headimg", Type: field.TypeString, Comment: "头像", Default: ""},
  216. {Name: "sex", Type: field.TypeInt, Comment: "性别 0未知 1男 2女", Default: 0},
  217. {Name: "starrole", Type: field.TypeString, Comment: "星标 65/67=星标 1/3=未星标", Default: ""},
  218. {Name: "dontseeit", Type: field.TypeInt, Comment: "不让他看我的朋友圈 0可以看 1不让看", Default: 0},
  219. {Name: "dontseeme", Type: field.TypeInt, Comment: "不看他的朋友圈 0可以看 1不看 1=开启了不看他 128/129=仅聊天", Default: 0},
  220. {Name: "lag", Type: field.TypeString, Comment: "所属标签id清单,多开会用逗号隔开", Default: ""},
  221. {Name: "gid", Type: field.TypeString, Comment: "群组id", Default: ""},
  222. {Name: "gname", Type: field.TypeString, Comment: "群组名称", Default: ""},
  223. {Name: "v3", Type: field.TypeString, Comment: "v3数据", Default: ""},
  224. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  225. }
  226. // ContactTable holds the schema information for the "contact" table.
  227. ContactTable = &schema.Table{
  228. Name: "contact",
  229. Columns: ContactColumns,
  230. PrimaryKey: []*schema.Column{ContactColumns[0]},
  231. Indexes: []*schema.Index{
  232. {
  233. Name: "contact_wx_wxid_wxid",
  234. Unique: true,
  235. Columns: []*schema.Column{ContactColumns[5], ContactColumns[7]},
  236. },
  237. {
  238. Name: "contact_wxid",
  239. Unique: false,
  240. Columns: []*schema.Column{ContactColumns[7]},
  241. },
  242. {
  243. Name: "contact_type",
  244. Unique: false,
  245. Columns: []*schema.Column{ContactColumns[6]},
  246. },
  247. {
  248. Name: "contact_gid",
  249. Unique: false,
  250. Columns: []*schema.Column{ContactColumns[17]},
  251. },
  252. },
  253. }
  254. // EmployeeColumns holds the columns for the "employee" table.
  255. EmployeeColumns = []*schema.Column{
  256. {Name: "id", Type: field.TypeUint64, Increment: true},
  257. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  258. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  259. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  260. {Name: "title", Type: field.TypeString, Size: 255, Comment: "title | 标题"},
  261. {Name: "avatar", Type: field.TypeString, Size: 1000, Comment: "avatar | 头像"},
  262. {Name: "tags", Type: field.TypeString, Size: 255, Comment: "tags | 个人标签"},
  263. {Name: "hire_count", Type: field.TypeInt, Comment: "hire_count | 被雇佣次数", Default: 0},
  264. {Name: "service_count", Type: field.TypeInt, Comment: "service_count | 已服务次数", Default: 0},
  265. {Name: "achievement_count", Type: field.TypeInt, Comment: "achievement_count | 业绩单数", Default: 0},
  266. {Name: "intro", Type: field.TypeString, Size: 1000, Comment: "intro | 个人介绍", Default: ""},
  267. {Name: "estimate", Type: field.TypeString, Size: 1000, Comment: "estimate | 自我评价", Default: ""},
  268. {Name: "skill", Type: field.TypeString, Size: 1000, Comment: "skill | 技能卡", Default: ""},
  269. {Name: "ability_type", Type: field.TypeString, Comment: "ability_type | 能力类型", Default: ""},
  270. {Name: "scene", Type: field.TypeString, Comment: "scene | 使用场景", Default: ""},
  271. {Name: "switch_in", Type: field.TypeString, Comment: "switch_in | 支持介入", Default: ""},
  272. {Name: "video_url", Type: field.TypeString, Size: 1000, Comment: "video_url | 视频地址", Default: ""},
  273. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  274. {Name: "category_id", Type: field.TypeUint64, Comment: "category_id | 分类ID"},
  275. {Name: "api_base", Type: field.TypeString, Comment: "api_base", Default: ""},
  276. {Name: "api_key", Type: field.TypeString, Comment: "api_key", Default: ""},
  277. {Name: "ai_info", Type: field.TypeString, Nullable: true, Comment: "AI信息"},
  278. {Name: "is_vip", Type: field.TypeInt, Comment: "是否VIP:0-否 1-是", Default: 0},
  279. {Name: "chat_url", Type: field.TypeString, Comment: "聊天URL"},
  280. }
  281. // EmployeeTable holds the schema information for the "employee" table.
  282. EmployeeTable = &schema.Table{
  283. Name: "employee",
  284. Columns: EmployeeColumns,
  285. PrimaryKey: []*schema.Column{EmployeeColumns[0]},
  286. Indexes: []*schema.Index{
  287. {
  288. Name: "employee_organization_id",
  289. Unique: false,
  290. Columns: []*schema.Column{EmployeeColumns[17]},
  291. },
  292. },
  293. }
  294. // EmployeeConfigColumns holds the columns for the "employee_config" table.
  295. EmployeeConfigColumns = []*schema.Column{
  296. {Name: "id", Type: field.TypeUint64, Increment: true},
  297. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  298. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  299. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  300. {Name: "stype", Type: field.TypeString, Comment: "类型:scene-场景 switch_in-接入方式", Default: ""},
  301. {Name: "title", Type: field.TypeString, Comment: "标题", Default: ""},
  302. {Name: "photo", Type: field.TypeString, Comment: "图片地址", Default: ""},
  303. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  304. }
  305. // EmployeeConfigTable holds the schema information for the "employee_config" table.
  306. EmployeeConfigTable = &schema.Table{
  307. Name: "employee_config",
  308. Columns: EmployeeConfigColumns,
  309. PrimaryKey: []*schema.Column{EmployeeConfigColumns[0]},
  310. Indexes: []*schema.Index{
  311. {
  312. Name: "employeeconfig_stype",
  313. Unique: false,
  314. Columns: []*schema.Column{EmployeeConfigColumns[4]},
  315. },
  316. },
  317. }
  318. // LabelColumns holds the columns for the "label" table.
  319. LabelColumns = []*schema.Column{
  320. {Name: "id", Type: field.TypeUint64, Increment: true},
  321. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  322. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  323. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  324. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  325. {Name: "name", Type: field.TypeString, Comment: "标签名称", Default: ""},
  326. {Name: "from", Type: field.TypeInt, Comment: "标签来源:1后台创建 2个微同步", Default: 1},
  327. {Name: "mode", Type: field.TypeInt, Comment: "标签模式:1动态 2静态", Default: 1},
  328. {Name: "conditions", Type: field.TypeString, Nullable: true, Comment: "标签的触达条件", Default: ""},
  329. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  330. }
  331. // LabelTable holds the schema information for the "label" table.
  332. LabelTable = &schema.Table{
  333. Name: "label",
  334. Columns: LabelColumns,
  335. PrimaryKey: []*schema.Column{LabelColumns[0]},
  336. Indexes: []*schema.Index{
  337. {
  338. Name: "label_name_from_mode",
  339. Unique: true,
  340. Columns: []*schema.Column{LabelColumns[5], LabelColumns[6], LabelColumns[7]},
  341. },
  342. },
  343. }
  344. // LabelRelationshipColumns holds the columns for the "label_relationship" table.
  345. LabelRelationshipColumns = []*schema.Column{
  346. {Name: "id", Type: field.TypeUint64, Increment: true},
  347. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  348. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  349. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  350. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  351. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  352. {Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
  353. {Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
  354. }
  355. // LabelRelationshipTable holds the schema information for the "label_relationship" table.
  356. LabelRelationshipTable = &schema.Table{
  357. Name: "label_relationship",
  358. Columns: LabelRelationshipColumns,
  359. PrimaryKey: []*schema.Column{LabelRelationshipColumns[0]},
  360. ForeignKeys: []*schema.ForeignKey{
  361. {
  362. Symbol: "label_relationship_contact_contact_relationships",
  363. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  364. RefColumns: []*schema.Column{ContactColumns[0]},
  365. OnDelete: schema.NoAction,
  366. },
  367. {
  368. Symbol: "label_relationship_label_label_relationships",
  369. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  370. RefColumns: []*schema.Column{LabelColumns[0]},
  371. OnDelete: schema.NoAction,
  372. },
  373. },
  374. Indexes: []*schema.Index{
  375. {
  376. Name: "labelrelationship_label_id",
  377. Unique: false,
  378. Columns: []*schema.Column{LabelRelationshipColumns[7]},
  379. },
  380. {
  381. Name: "labelrelationship_contact_id",
  382. Unique: false,
  383. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  384. },
  385. },
  386. }
  387. // MessagesColumns holds the columns for the "messages" table.
  388. MessagesColumns = []*schema.Column{
  389. {Name: "id", Type: field.TypeInt, Increment: true},
  390. {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""},
  391. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  392. {Name: "content", Type: field.TypeString, Comment: "微信消息内容", Default: ""},
  393. }
  394. // MessagesTable holds the schema information for the "messages" table.
  395. MessagesTable = &schema.Table{
  396. Name: "messages",
  397. Columns: MessagesColumns,
  398. PrimaryKey: []*schema.Column{MessagesColumns[0]},
  399. }
  400. // MessageRecordsColumns holds the columns for the "message_records" table.
  401. MessageRecordsColumns = []*schema.Column{
  402. {Name: "id", Type: field.TypeUint64, Increment: true},
  403. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  404. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  405. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  406. {Name: "bot_wxid", Type: field.TypeString, Comment: "机器人微信 id"},
  407. {Name: "contact_type", Type: field.TypeInt, Comment: "类型:1好友,2群组,3企业微信联系人", Default: 1},
  408. {Name: "contact_wxid", Type: field.TypeString, Comment: "接收方微信 id", Default: ""},
  409. {Name: "content_type", Type: field.TypeInt, Comment: "内容类型 1 文本 2 文件", Default: 1},
  410. {Name: "content", Type: field.TypeString, Comment: "发送内容", Default: ""},
  411. {Name: "meta", Type: field.TypeJSON, Nullable: true, Comment: "元数据"},
  412. {Name: "error_detail", Type: field.TypeString, Comment: "异常原因", Default: ""},
  413. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  414. {Name: "source_type", Type: field.TypeInt, Comment: "源类型 1 点发 2 群发 3 SOP", Default: 1},
  415. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  416. {Name: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"},
  417. {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1},
  418. {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1},
  419. }
  420. // MessageRecordsTable holds the schema information for the "message_records" table.
  421. MessageRecordsTable = &schema.Table{
  422. Name: "message_records",
  423. Columns: MessageRecordsColumns,
  424. PrimaryKey: []*schema.Column{MessageRecordsColumns[0]},
  425. ForeignKeys: []*schema.ForeignKey{
  426. {
  427. Symbol: "message_records_contact_contact_messages",
  428. Columns: []*schema.Column{MessageRecordsColumns[14]},
  429. RefColumns: []*schema.Column{ContactColumns[0]},
  430. OnDelete: schema.SetNull,
  431. },
  432. {
  433. Symbol: "message_records_sop_node_node_messages",
  434. Columns: []*schema.Column{MessageRecordsColumns[15]},
  435. RefColumns: []*schema.Column{SopNodeColumns[0]},
  436. OnDelete: schema.SetNull,
  437. },
  438. {
  439. Symbol: "message_records_sop_stage_stage_messages",
  440. Columns: []*schema.Column{MessageRecordsColumns[16]},
  441. RefColumns: []*schema.Column{SopStageColumns[0]},
  442. OnDelete: schema.SetNull,
  443. },
  444. },
  445. Indexes: []*schema.Index{
  446. {
  447. Name: "messagerecords_source_type",
  448. Unique: false,
  449. Columns: []*schema.Column{MessageRecordsColumns[12]},
  450. },
  451. },
  452. }
  453. // MsgColumns holds the columns for the "msg" table.
  454. MsgColumns = []*schema.Column{
  455. {Name: "id", Type: field.TypeUint64, Increment: true},
  456. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  457. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  458. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  459. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用"},
  460. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  461. {Name: "toid", Type: field.TypeString, Nullable: true, Comment: "接收人微信ID/群ID"},
  462. {Name: "msgtype", Type: field.TypeInt32, Nullable: true, Comment: "消息类型"},
  463. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "消息"},
  464. {Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号"},
  465. }
  466. // MsgTable holds the schema information for the "msg" table.
  467. MsgTable = &schema.Table{
  468. Name: "msg",
  469. Columns: MsgColumns,
  470. PrimaryKey: []*schema.Column{MsgColumns[0]},
  471. Indexes: []*schema.Index{
  472. {
  473. Name: "msg_batch_no",
  474. Unique: false,
  475. Columns: []*schema.Column{MsgColumns[9]},
  476. },
  477. {
  478. Name: "msg_id",
  479. Unique: false,
  480. Columns: []*schema.Column{MsgColumns[0]},
  481. },
  482. {
  483. Name: "msg_status",
  484. Unique: false,
  485. Columns: []*schema.Column{MsgColumns[4]},
  486. },
  487. },
  488. }
  489. // ServerColumns holds the columns for the "server" table.
  490. ServerColumns = []*schema.Column{
  491. {Name: "id", Type: field.TypeUint64, Increment: true},
  492. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  493. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  494. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  495. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  496. {Name: "name", Type: field.TypeString, Comment: "名称"},
  497. {Name: "public_ip", Type: field.TypeString, Comment: "公网ip"},
  498. {Name: "private_ip", Type: field.TypeString, Comment: "内网ip"},
  499. {Name: "admin_port", Type: field.TypeString, Comment: "管理端口"},
  500. }
  501. // ServerTable holds the schema information for the "server" table.
  502. ServerTable = &schema.Table{
  503. Name: "server",
  504. Columns: ServerColumns,
  505. PrimaryKey: []*schema.Column{ServerColumns[0]},
  506. Indexes: []*schema.Index{
  507. {
  508. Name: "server_name",
  509. Unique: false,
  510. Columns: []*schema.Column{ServerColumns[5]},
  511. },
  512. {
  513. Name: "server_private_ip",
  514. Unique: false,
  515. Columns: []*schema.Column{ServerColumns[7]},
  516. },
  517. {
  518. Name: "server_public_ip",
  519. Unique: true,
  520. Columns: []*schema.Column{ServerColumns[6]},
  521. },
  522. },
  523. }
  524. // SopNodeColumns holds the columns for the "sop_node" table.
  525. SopNodeColumns = []*schema.Column{
  526. {Name: "id", Type: field.TypeUint64, Increment: true},
  527. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  528. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  529. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  530. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  531. {Name: "parent_id", Type: field.TypeUint64, Comment: "父节点 ID"},
  532. {Name: "name", Type: field.TypeString, Comment: "节点名称", Default: ""},
  533. {Name: "condition_type", Type: field.TypeInt, Comment: "触发条件类型 1 客户回复后触发 2 超时后触发", Default: 1},
  534. {Name: "condition_list", Type: field.TypeJSON, Nullable: true, Comment: "触发语义列表 当为空时则代表用户回复任意内容后触发"},
  535. {Name: "no_reply_condition", Type: field.TypeUint64, Comment: "超时触发时间(分钟)", Default: 0},
  536. {Name: "no_reply_unit", Type: field.TypeString, Comment: "超时触发时间单位", Default: ""},
  537. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  538. {Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  539. {Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
  540. {Name: "action_forward", Type: field.TypeJSON, Nullable: true, Comment: "命中后转发的消息"},
  541. {Name: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"},
  542. }
  543. // SopNodeTable holds the schema information for the "sop_node" table.
  544. SopNodeTable = &schema.Table{
  545. Name: "sop_node",
  546. Columns: SopNodeColumns,
  547. PrimaryKey: []*schema.Column{SopNodeColumns[0]},
  548. ForeignKeys: []*schema.ForeignKey{
  549. {
  550. Symbol: "sop_node_sop_stage_stage_nodes",
  551. Columns: []*schema.Column{SopNodeColumns[15]},
  552. RefColumns: []*schema.Column{SopStageColumns[0]},
  553. OnDelete: schema.NoAction,
  554. },
  555. },
  556. Indexes: []*schema.Index{
  557. {
  558. Name: "sopnode_name",
  559. Unique: false,
  560. Columns: []*schema.Column{SopNodeColumns[6]},
  561. },
  562. },
  563. }
  564. // SopStageColumns holds the columns for the "sop_stage" table.
  565. SopStageColumns = []*schema.Column{
  566. {Name: "id", Type: field.TypeUint64, Increment: true},
  567. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  568. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  569. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  570. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  571. {Name: "name", Type: field.TypeString, Comment: "阶段名称", Default: ""},
  572. {Name: "condition_type", Type: field.TypeInt, Comment: "客群筛选条件类型 1 按标签筛选 2 按客户基本信息筛选", Default: 1},
  573. {Name: "condition_operator", Type: field.TypeInt, Comment: "筛选条件关系 1 满足所有条件(and) 2 满足任意条件(or)", Default: 1},
  574. {Name: "condition_list", Type: field.TypeJSON, Comment: "筛选条件列表"},
  575. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  576. {Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  577. {Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
  578. {Name: "action_forward", Type: field.TypeJSON, Nullable: true, Comment: "命中后转发的消息"},
  579. {Name: "index_sort", Type: field.TypeInt, Nullable: true, Comment: "阶段顺序", Default: 1},
  580. {Name: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"},
  581. }
  582. // SopStageTable holds the schema information for the "sop_stage" table.
  583. SopStageTable = &schema.Table{
  584. Name: "sop_stage",
  585. Columns: SopStageColumns,
  586. PrimaryKey: []*schema.Column{SopStageColumns[0]},
  587. ForeignKeys: []*schema.ForeignKey{
  588. {
  589. Symbol: "sop_stage_sop_task_task_stages",
  590. Columns: []*schema.Column{SopStageColumns[14]},
  591. RefColumns: []*schema.Column{SopTaskColumns[0]},
  592. OnDelete: schema.NoAction,
  593. },
  594. },
  595. Indexes: []*schema.Index{
  596. {
  597. Name: "sopstage_name",
  598. Unique: false,
  599. Columns: []*schema.Column{SopStageColumns[5]},
  600. },
  601. },
  602. }
  603. // SopTaskColumns holds the columns for the "sop_task" table.
  604. SopTaskColumns = []*schema.Column{
  605. {Name: "id", Type: field.TypeUint64, Increment: true},
  606. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  607. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  608. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  609. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  610. {Name: "name", Type: field.TypeString, Comment: "SOP 任务名称"},
  611. {Name: "bot_wxid_list", Type: field.TypeJSON, Nullable: true, Comment: "机器人微信 id 列表"},
  612. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3企业微信联系人", Default: 1},
  613. {Name: "plan_start_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划开始时间"},
  614. {Name: "plan_end_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划结束时间"},
  615. {Name: "creator_id", Type: field.TypeString, Nullable: true, Comment: "创建者 id"},
  616. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  617. {Name: "token", Type: field.TypeJSON, Nullable: true, Comment: "Token"},
  618. }
  619. // SopTaskTable holds the schema information for the "sop_task" table.
  620. SopTaskTable = &schema.Table{
  621. Name: "sop_task",
  622. Columns: SopTaskColumns,
  623. PrimaryKey: []*schema.Column{SopTaskColumns[0]},
  624. Indexes: []*schema.Index{
  625. {
  626. Name: "soptask_name",
  627. Unique: false,
  628. Columns: []*schema.Column{SopTaskColumns[5]},
  629. },
  630. {
  631. Name: "soptask_token",
  632. Unique: false,
  633. Columns: []*schema.Column{SopTaskColumns[12]},
  634. },
  635. },
  636. }
  637. // TokenColumns holds the columns for the "token" table.
  638. TokenColumns = []*schema.Column{
  639. {Name: "id", Type: field.TypeUint64, Increment: true},
  640. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  641. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  642. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  643. {Name: "expire_at", Type: field.TypeTime, Nullable: true, Comment: "过期时间"},
  644. {Name: "token", Type: field.TypeString, Nullable: true, Comment: "Token", Default: ""},
  645. {Name: "mac", Type: field.TypeString, Nullable: true, Comment: "Mac地址", Default: ""},
  646. {Name: "organization_id", Type: field.TypeUint64, Comment: "租户ID", Default: 0},
  647. {Name: "custom_agent_base", Type: field.TypeString, Nullable: true, Comment: "定制agent服务地址", Default: ""},
  648. {Name: "custom_agent_key", Type: field.TypeString, Nullable: true, Comment: "定制agent服务密钥", Default: ""},
  649. {Name: "openai_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  650. {Name: "openai_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  651. {Name: "agent_id", Type: field.TypeUint64, Comment: "智能体ID", Default: 0},
  652. }
  653. // TokenTable holds the schema information for the "token" table.
  654. TokenTable = &schema.Table{
  655. Name: "token",
  656. Columns: TokenColumns,
  657. PrimaryKey: []*schema.Column{TokenColumns[0]},
  658. ForeignKeys: []*schema.ForeignKey{
  659. {
  660. Symbol: "token_agent_token_agent",
  661. Columns: []*schema.Column{TokenColumns[12]},
  662. RefColumns: []*schema.Column{AgentColumns[0]},
  663. OnDelete: schema.NoAction,
  664. },
  665. },
  666. Indexes: []*schema.Index{
  667. {
  668. Name: "token_token",
  669. Unique: true,
  670. Columns: []*schema.Column{TokenColumns[5]},
  671. },
  672. },
  673. }
  674. // TutorialColumns holds the columns for the "tutorial" table.
  675. TutorialColumns = []*schema.Column{
  676. {Name: "id", Type: field.TypeUint64, Increment: true},
  677. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  678. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  679. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  680. {Name: "index", Type: field.TypeInt, Comment: "index | 序号"},
  681. {Name: "title", Type: field.TypeString, Comment: "title | 标题"},
  682. {Name: "content", Type: field.TypeString, Comment: "content | 内容"},
  683. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  684. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  685. }
  686. // TutorialTable holds the schema information for the "tutorial" table.
  687. TutorialTable = &schema.Table{
  688. Name: "tutorial",
  689. Columns: TutorialColumns,
  690. PrimaryKey: []*schema.Column{TutorialColumns[0]},
  691. ForeignKeys: []*schema.ForeignKey{
  692. {
  693. Symbol: "tutorial_employee_em_tutorial",
  694. Columns: []*schema.Column{TutorialColumns[8]},
  695. RefColumns: []*schema.Column{EmployeeColumns[0]},
  696. OnDelete: schema.NoAction,
  697. },
  698. },
  699. Indexes: []*schema.Index{
  700. {
  701. Name: "tutorial_employee_id",
  702. Unique: false,
  703. Columns: []*schema.Column{TutorialColumns[8]},
  704. },
  705. },
  706. }
  707. // UsageDetailColumns holds the columns for the "usage_detail" table.
  708. UsageDetailColumns = []*schema.Column{
  709. {Name: "id", Type: field.TypeUint64, Increment: true},
  710. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  711. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  712. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  713. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "1 微信 2 名片", Default: 1},
  714. {Name: "bot_id", Type: field.TypeString, Comment: "微信或名片id", Default: ""},
  715. {Name: "receiver_id", Type: field.TypeString, Comment: "微信id或open_id", Default: ""},
  716. {Name: "app", Type: field.TypeInt, Nullable: true, Comment: "1 cow-basic 2 cow-agent 3 cow-sop 4 mp-card 5 mp-employee", Default: 1},
  717. {Name: "session_id", Type: field.TypeUint64, Nullable: true, Comment: "名片会话id", Default: 1},
  718. {Name: "request", Type: field.TypeString, Comment: "请求内容", Default: ""},
  719. {Name: "response", Type: field.TypeString, Comment: "响应内容", Default: ""},
  720. {Name: "total_tokens", Type: field.TypeUint64, Nullable: true, Comment: "使用token总数", Default: 0},
  721. {Name: "prompt_tokens", Type: field.TypeUint64, Nullable: true, Comment: "请求token数", Default: 0},
  722. {Name: "completion_tokens", Type: field.TypeUint64, Nullable: true, Comment: "响应token数", Default: 0},
  723. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  724. }
  725. // UsageDetailTable holds the schema information for the "usage_detail" table.
  726. UsageDetailTable = &schema.Table{
  727. Name: "usage_detail",
  728. Columns: UsageDetailColumns,
  729. PrimaryKey: []*schema.Column{UsageDetailColumns[0]},
  730. Indexes: []*schema.Index{
  731. {
  732. Name: "usagedetail_bot_id",
  733. Unique: false,
  734. Columns: []*schema.Column{UsageDetailColumns[5]},
  735. },
  736. {
  737. Name: "usagedetail_organization_id",
  738. Unique: false,
  739. Columns: []*schema.Column{UsageDetailColumns[14]},
  740. },
  741. },
  742. }
  743. // UsageTotalColumns holds the columns for the "usage_total" table.
  744. UsageTotalColumns = []*schema.Column{
  745. {Name: "id", Type: field.TypeUint64, Increment: true},
  746. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  747. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  748. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  749. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "1 微信 2 名片", Default: 1},
  750. {Name: "bot_id", Type: field.TypeString, Comment: "微信或名片id", Default: ""},
  751. {Name: "total_tokens", Type: field.TypeUint64, Nullable: true, Comment: "使用token总数", Default: 0},
  752. {Name: "start_index", Type: field.TypeUint64, Nullable: true, Comment: "重制后的起始usage_detail 索引", Default: 0},
  753. {Name: "end_index", Type: field.TypeUint64, Nullable: true, Comment: "usage_detail 索引", Default: 0},
  754. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  755. }
  756. // UsageTotalTable holds the schema information for the "usage_total" table.
  757. UsageTotalTable = &schema.Table{
  758. Name: "usage_total",
  759. Columns: UsageTotalColumns,
  760. PrimaryKey: []*schema.Column{UsageTotalColumns[0]},
  761. Indexes: []*schema.Index{
  762. {
  763. Name: "usagetotal_bot_id",
  764. Unique: false,
  765. Columns: []*schema.Column{UsageTotalColumns[5]},
  766. },
  767. {
  768. Name: "usagetotal_organization_id",
  769. Unique: false,
  770. Columns: []*schema.Column{UsageTotalColumns[9]},
  771. },
  772. },
  773. }
  774. // WorkExperienceColumns holds the columns for the "work_experience" table.
  775. WorkExperienceColumns = []*schema.Column{
  776. {Name: "id", Type: field.TypeUint64, Increment: true},
  777. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  778. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  779. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  780. {Name: "start_date", Type: field.TypeTime, Comment: "start_date | 开始时间"},
  781. {Name: "end_date", Type: field.TypeTime, Comment: "end_date | 结束时间"},
  782. {Name: "company", Type: field.TypeString, Comment: "company | 公司名"},
  783. {Name: "experience", Type: field.TypeString, Size: 2147483647, Comment: "experience | 工作内容"},
  784. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  785. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  786. }
  787. // WorkExperienceTable holds the schema information for the "work_experience" table.
  788. WorkExperienceTable = &schema.Table{
  789. Name: "work_experience",
  790. Columns: WorkExperienceColumns,
  791. PrimaryKey: []*schema.Column{WorkExperienceColumns[0]},
  792. ForeignKeys: []*schema.ForeignKey{
  793. {
  794. Symbol: "work_experience_employee_em_work_experiences",
  795. Columns: []*schema.Column{WorkExperienceColumns[9]},
  796. RefColumns: []*schema.Column{EmployeeColumns[0]},
  797. OnDelete: schema.NoAction,
  798. },
  799. },
  800. Indexes: []*schema.Index{
  801. {
  802. Name: "workexperience_employee_id",
  803. Unique: false,
  804. Columns: []*schema.Column{WorkExperienceColumns[9]},
  805. },
  806. },
  807. }
  808. // WpChatroomColumns holds the columns for the "wp_chatroom" table.
  809. WpChatroomColumns = []*schema.Column{
  810. {Name: "id", Type: field.TypeUint64, Increment: true},
  811. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  812. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  813. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  814. {Name: "wx_wxid", Type: field.TypeString, Comment: "所属微信id", Default: ""},
  815. {Name: "chatroom_id", Type: field.TypeString, Comment: "群id", Default: ""},
  816. {Name: "nickname", Type: field.TypeString, Comment: "群昵称", Default: ""},
  817. {Name: "owner", Type: field.TypeString, Comment: "群主", Default: ""},
  818. {Name: "avatar", Type: field.TypeString, Comment: "群头像", Default: ""},
  819. {Name: "member_list", Type: field.TypeJSON, Comment: "群成员"},
  820. }
  821. // WpChatroomTable holds the schema information for the "wp_chatroom" table.
  822. WpChatroomTable = &schema.Table{
  823. Name: "wp_chatroom",
  824. Columns: WpChatroomColumns,
  825. PrimaryKey: []*schema.Column{WpChatroomColumns[0]},
  826. Indexes: []*schema.Index{
  827. {
  828. Name: "wpchatroom_wx_wxid_chatroom_id",
  829. Unique: false,
  830. Columns: []*schema.Column{WpChatroomColumns[4], WpChatroomColumns[5]},
  831. },
  832. },
  833. }
  834. // WpChatroomMemberColumns holds the columns for the "wp_chatroom_member" table.
  835. WpChatroomMemberColumns = []*schema.Column{
  836. {Name: "id", Type: field.TypeUint64, Increment: true},
  837. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  838. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  839. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  840. {Name: "wx_wxid", Type: field.TypeString, Comment: "所属微信id", Default: ""},
  841. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  842. {Name: "nickname", Type: field.TypeString, Comment: "群昵称", Default: ""},
  843. {Name: "avatar", Type: field.TypeString, Comment: "群头像", Default: ""},
  844. }
  845. // WpChatroomMemberTable holds the schema information for the "wp_chatroom_member" table.
  846. WpChatroomMemberTable = &schema.Table{
  847. Name: "wp_chatroom_member",
  848. Columns: WpChatroomMemberColumns,
  849. PrimaryKey: []*schema.Column{WpChatroomMemberColumns[0]},
  850. Indexes: []*schema.Index{
  851. {
  852. Name: "wpchatroommember_wx_wxid_wxid",
  853. Unique: false,
  854. Columns: []*schema.Column{WpChatroomMemberColumns[4], WpChatroomMemberColumns[5]},
  855. },
  856. },
  857. }
  858. // WxColumns holds the columns for the "wx" table.
  859. WxColumns = []*schema.Column{
  860. {Name: "id", Type: field.TypeUint64, Increment: true},
  861. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  862. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  863. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  864. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  865. {Name: "port", Type: field.TypeString, Comment: "端口号", Default: ""},
  866. {Name: "process_id", Type: field.TypeString, Comment: "进程号", Default: ""},
  867. {Name: "callback", Type: field.TypeString, Comment: "回调地址", Default: ""},
  868. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  869. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  870. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称", Default: ""},
  871. {Name: "tel", Type: field.TypeString, Comment: "手机号", Default: ""},
  872. {Name: "head_big", Type: field.TypeString, Comment: "微信头像", Default: ""},
  873. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  874. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  875. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  876. {Name: "allow_list", Type: field.TypeJSON, Comment: "白名单"},
  877. {Name: "group_allow_list", Type: field.TypeJSON, Comment: "群白名单"},
  878. {Name: "block_list", Type: field.TypeJSON, Comment: "黑名单"},
  879. {Name: "group_block_list", Type: field.TypeJSON, Comment: "群黑名单"},
  880. {Name: "agent_id", Type: field.TypeUint64, Comment: "模式ID", Default: 0},
  881. {Name: "agent_base_wx_agent", Type: field.TypeString, Nullable: true},
  882. {Name: "server_id", Type: field.TypeUint64, Nullable: true, Comment: "服务器id", Default: 0},
  883. }
  884. // WxTable holds the schema information for the "wx" table.
  885. WxTable = &schema.Table{
  886. Name: "wx",
  887. Columns: WxColumns,
  888. PrimaryKey: []*schema.Column{WxColumns[0]},
  889. ForeignKeys: []*schema.ForeignKey{
  890. {
  891. Symbol: "wx_agent_wx_agent",
  892. Columns: []*schema.Column{WxColumns[20]},
  893. RefColumns: []*schema.Column{AgentColumns[0]},
  894. OnDelete: schema.NoAction,
  895. },
  896. {
  897. Symbol: "wx_agent_base_wx_agent",
  898. Columns: []*schema.Column{WxColumns[21]},
  899. RefColumns: []*schema.Column{AgentBaseColumns[0]},
  900. OnDelete: schema.SetNull,
  901. },
  902. {
  903. Symbol: "wx_server_wxs",
  904. Columns: []*schema.Column{WxColumns[22]},
  905. RefColumns: []*schema.Column{ServerColumns[0]},
  906. OnDelete: schema.SetNull,
  907. },
  908. },
  909. Indexes: []*schema.Index{
  910. {
  911. Name: "wx_server_id_port",
  912. Unique: true,
  913. Columns: []*schema.Column{WxColumns[22], WxColumns[5]},
  914. },
  915. {
  916. Name: "wx_wxid",
  917. Unique: true,
  918. Columns: []*schema.Column{WxColumns[8]},
  919. },
  920. {
  921. Name: "wx_account",
  922. Unique: false,
  923. Columns: []*schema.Column{WxColumns[9]},
  924. },
  925. {
  926. Name: "wx_nickname",
  927. Unique: false,
  928. Columns: []*schema.Column{WxColumns[10]},
  929. },
  930. {
  931. Name: "wx_tel",
  932. Unique: false,
  933. Columns: []*schema.Column{WxColumns[11]},
  934. },
  935. },
  936. }
  937. // WxCardColumns holds the columns for the "wx_card" table.
  938. WxCardColumns = []*schema.Column{
  939. {Name: "id", Type: field.TypeUint64, Increment: true},
  940. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  941. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  942. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  943. {Name: "user_id", Type: field.TypeUint64, Nullable: true, Comment: "user表ID", Default: 0},
  944. {Name: "wx_user_id", Type: field.TypeUint64, Nullable: true, Comment: "wx表ID", Default: 0},
  945. {Name: "avatar", Type: field.TypeString, Comment: "头像", Default: ""},
  946. {Name: "logo", Type: field.TypeString, Comment: "logo", Default: ""},
  947. {Name: "name", Type: field.TypeString, Comment: "名称", Default: ""},
  948. {Name: "company", Type: field.TypeString, Comment: "公司", Default: ""},
  949. {Name: "address", Type: field.TypeString, Comment: "地址", Default: ""},
  950. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  951. {Name: "official_account", Type: field.TypeString, Comment: "公众号", Default: ""},
  952. {Name: "wechat_account", Type: field.TypeString, Comment: "微信号", Default: ""},
  953. {Name: "email", Type: field.TypeString, Nullable: true, Comment: "邮箱", Default: ""},
  954. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "fastgpt-base"},
  955. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "fastgpt-key"},
  956. {Name: "ai_info", Type: field.TypeString, Nullable: true, Comment: "AI信息"},
  957. {Name: "intro", Type: field.TypeString, Nullable: true, Comment: "个人介绍", Default: ""},
  958. }
  959. // WxCardTable holds the schema information for the "wx_card" table.
  960. WxCardTable = &schema.Table{
  961. Name: "wx_card",
  962. Columns: WxCardColumns,
  963. PrimaryKey: []*schema.Column{WxCardColumns[0]},
  964. Indexes: []*schema.Index{
  965. {
  966. Name: "wxcard_user_id",
  967. Unique: false,
  968. Columns: []*schema.Column{WxCardColumns[4]},
  969. },
  970. {
  971. Name: "wxcard_wx_user_id",
  972. Unique: false,
  973. Columns: []*schema.Column{WxCardColumns[5]},
  974. },
  975. },
  976. }
  977. // WxCardUserColumns holds the columns for the "wx_card_user" table.
  978. WxCardUserColumns = []*schema.Column{
  979. {Name: "id", Type: field.TypeUint64, Increment: true},
  980. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  981. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  982. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  983. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  984. {Name: "account", Type: field.TypeString, Comment: "微信号", Default: ""},
  985. {Name: "avatar", Type: field.TypeString, Comment: "头像", Default: ""},
  986. {Name: "nickname", Type: field.TypeString, Comment: "昵称", Default: ""},
  987. {Name: "remark", Type: field.TypeString, Comment: "备注名", Default: ""},
  988. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  989. {Name: "open_id", Type: field.TypeString, Comment: "OpenID", Default: ""},
  990. {Name: "union_id", Type: field.TypeString, Comment: "UnionID", Default: ""},
  991. {Name: "session_key", Type: field.TypeString, Comment: "SessionKey", Default: ""},
  992. {Name: "is_vip", Type: field.TypeInt, Comment: "是否VIP:0-否 1-是", Default: 0},
  993. }
  994. // WxCardUserTable holds the schema information for the "wx_card_user" table.
  995. WxCardUserTable = &schema.Table{
  996. Name: "wx_card_user",
  997. Columns: WxCardUserColumns,
  998. PrimaryKey: []*schema.Column{WxCardUserColumns[0]},
  999. Indexes: []*schema.Index{
  1000. {
  1001. Name: "wxcarduser_wxid_open_id",
  1002. Unique: false,
  1003. Columns: []*schema.Column{WxCardUserColumns[4], WxCardUserColumns[10]},
  1004. },
  1005. },
  1006. }
  1007. // WxCardVisitColumns holds the columns for the "wx_card_visit" table.
  1008. WxCardVisitColumns = []*schema.Column{
  1009. {Name: "id", Type: field.TypeUint64, Increment: true},
  1010. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1011. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1012. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1013. {Name: "user_id", Type: field.TypeUint64, Nullable: true, Comment: "user表ID", Default: 0},
  1014. {Name: "bot_id", Type: field.TypeUint64, Comment: "被访ID", Default: 0},
  1015. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序 3-智能体", Default: 0},
  1016. }
  1017. // WxCardVisitTable holds the schema information for the "wx_card_visit" table.
  1018. WxCardVisitTable = &schema.Table{
  1019. Name: "wx_card_visit",
  1020. Columns: WxCardVisitColumns,
  1021. PrimaryKey: []*schema.Column{WxCardVisitColumns[0]},
  1022. Indexes: []*schema.Index{
  1023. {
  1024. Name: "wxcardvisit_user_id",
  1025. Unique: false,
  1026. Columns: []*schema.Column{WxCardVisitColumns[4]},
  1027. },
  1028. {
  1029. Name: "wxcardvisit_bot_id_bot_type",
  1030. Unique: false,
  1031. Columns: []*schema.Column{WxCardVisitColumns[5], WxCardVisitColumns[6]},
  1032. },
  1033. },
  1034. }
  1035. // Tables holds all the tables in the schema.
  1036. Tables = []*schema.Table{
  1037. AgentTable,
  1038. AgentBaseTable,
  1039. AliyunAvatarTable,
  1040. BatchMsgTable,
  1041. CategoryTable,
  1042. ChatRecordsTable,
  1043. ChatSessionTable,
  1044. ContactTable,
  1045. EmployeeTable,
  1046. EmployeeConfigTable,
  1047. LabelTable,
  1048. LabelRelationshipTable,
  1049. MessagesTable,
  1050. MessageRecordsTable,
  1051. MsgTable,
  1052. ServerTable,
  1053. SopNodeTable,
  1054. SopStageTable,
  1055. SopTaskTable,
  1056. TokenTable,
  1057. TutorialTable,
  1058. UsageDetailTable,
  1059. UsageTotalTable,
  1060. WorkExperienceTable,
  1061. WpChatroomTable,
  1062. WpChatroomMemberTable,
  1063. WxTable,
  1064. WxCardTable,
  1065. WxCardUserTable,
  1066. WxCardVisitTable,
  1067. }
  1068. )
  1069. func init() {
  1070. AgentTable.Annotation = &entsql.Annotation{
  1071. Table: "agent",
  1072. }
  1073. AgentBaseTable.Annotation = &entsql.Annotation{
  1074. Table: "agent_base",
  1075. }
  1076. AliyunAvatarTable.Annotation = &entsql.Annotation{
  1077. Table: "aliyun_avatar",
  1078. }
  1079. BatchMsgTable.Annotation = &entsql.Annotation{
  1080. Table: "batch_msg",
  1081. }
  1082. CategoryTable.Annotation = &entsql.Annotation{
  1083. Table: "category",
  1084. }
  1085. ChatRecordsTable.Annotation = &entsql.Annotation{
  1086. Table: "chat_records",
  1087. }
  1088. ChatSessionTable.Annotation = &entsql.Annotation{
  1089. Table: "chat_session",
  1090. }
  1091. ContactTable.Annotation = &entsql.Annotation{
  1092. Table: "contact",
  1093. }
  1094. EmployeeTable.Annotation = &entsql.Annotation{
  1095. Table: "employee",
  1096. }
  1097. EmployeeConfigTable.Annotation = &entsql.Annotation{
  1098. Table: "employee_config",
  1099. }
  1100. LabelTable.Annotation = &entsql.Annotation{
  1101. Table: "label",
  1102. }
  1103. LabelRelationshipTable.ForeignKeys[0].RefTable = ContactTable
  1104. LabelRelationshipTable.ForeignKeys[1].RefTable = LabelTable
  1105. LabelRelationshipTable.Annotation = &entsql.Annotation{
  1106. Table: "label_relationship",
  1107. }
  1108. MessagesTable.Annotation = &entsql.Annotation{
  1109. Table: "messages",
  1110. }
  1111. MessageRecordsTable.ForeignKeys[0].RefTable = ContactTable
  1112. MessageRecordsTable.ForeignKeys[1].RefTable = SopNodeTable
  1113. MessageRecordsTable.ForeignKeys[2].RefTable = SopStageTable
  1114. MessageRecordsTable.Annotation = &entsql.Annotation{
  1115. Table: "message_records",
  1116. }
  1117. MsgTable.Annotation = &entsql.Annotation{
  1118. Table: "msg",
  1119. }
  1120. ServerTable.Annotation = &entsql.Annotation{
  1121. Table: "server",
  1122. }
  1123. SopNodeTable.ForeignKeys[0].RefTable = SopStageTable
  1124. SopNodeTable.Annotation = &entsql.Annotation{
  1125. Table: "sop_node",
  1126. }
  1127. SopStageTable.ForeignKeys[0].RefTable = SopTaskTable
  1128. SopStageTable.Annotation = &entsql.Annotation{
  1129. Table: "sop_stage",
  1130. }
  1131. SopTaskTable.Annotation = &entsql.Annotation{
  1132. Table: "sop_task",
  1133. }
  1134. TokenTable.ForeignKeys[0].RefTable = AgentTable
  1135. TokenTable.Annotation = &entsql.Annotation{
  1136. Table: "token",
  1137. }
  1138. TutorialTable.ForeignKeys[0].RefTable = EmployeeTable
  1139. TutorialTable.Annotation = &entsql.Annotation{
  1140. Table: "tutorial",
  1141. }
  1142. UsageDetailTable.Annotation = &entsql.Annotation{
  1143. Table: "usage_detail",
  1144. }
  1145. UsageTotalTable.Annotation = &entsql.Annotation{
  1146. Table: "usage_total",
  1147. }
  1148. WorkExperienceTable.ForeignKeys[0].RefTable = EmployeeTable
  1149. WorkExperienceTable.Annotation = &entsql.Annotation{
  1150. Table: "work_experience",
  1151. }
  1152. WpChatroomTable.Annotation = &entsql.Annotation{
  1153. Table: "wp_chatroom",
  1154. }
  1155. WpChatroomMemberTable.Annotation = &entsql.Annotation{
  1156. Table: "wp_chatroom_member",
  1157. }
  1158. WxTable.ForeignKeys[0].RefTable = AgentTable
  1159. WxTable.ForeignKeys[1].RefTable = AgentBaseTable
  1160. WxTable.ForeignKeys[2].RefTable = ServerTable
  1161. WxTable.Annotation = &entsql.Annotation{
  1162. Table: "wx",
  1163. }
  1164. WxCardTable.Annotation = &entsql.Annotation{
  1165. Table: "wx_card",
  1166. }
  1167. WxCardUserTable.Annotation = &entsql.Annotation{
  1168. Table: "wx_card_user",
  1169. }
  1170. WxCardVisitTable.Annotation = &entsql.Annotation{
  1171. Table: "wx_card_visit",
  1172. }
  1173. }