schema.go 90 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834
  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. // AddWechatFriendLogColumns holds the columns for the "add_wechat_friend_log" table.
  10. AddWechatFriendLogColumns = []*schema.Column{
  11. {Name: "id", Type: field.TypeInt64, Increment: true},
  12. {Name: "owner_wx_id", Type: field.TypeString, Size: 64, Default: ""},
  13. {Name: "owner_wx_type", Type: field.TypeInt, Default: 1},
  14. {Name: "find_content", Type: field.TypeString, Size: 64, Default: ""},
  15. {Name: "message", Type: field.TypeString, Size: 255, Default: ""},
  16. {Name: "find_request", Type: field.TypeJSON, Nullable: true},
  17. {Name: "find_result", Type: field.TypeJSON, Nullable: true},
  18. {Name: "is_can_add", Type: field.TypeInt, Default: 0},
  19. {Name: "task_count", Type: field.TypeInt, Default: 0},
  20. {Name: "task_id", Type: field.TypeInt64, Default: 0},
  21. {Name: "add_request", Type: field.TypeJSON, Nullable: true},
  22. {Name: "add_result", Type: field.TypeJSON, Nullable: true},
  23. {Name: "created_at", Type: field.TypeInt64},
  24. {Name: "updated_at", Type: field.TypeInt64},
  25. }
  26. // AddWechatFriendLogTable holds the schema information for the "add_wechat_friend_log" table.
  27. AddWechatFriendLogTable = &schema.Table{
  28. Name: "add_wechat_friend_log",
  29. Columns: AddWechatFriendLogColumns,
  30. PrimaryKey: []*schema.Column{AddWechatFriendLogColumns[0]},
  31. Indexes: []*schema.Index{
  32. {
  33. Name: "addwechatfriendlog_owner_wx_id_is_can_add",
  34. Unique: false,
  35. Columns: []*schema.Column{AddWechatFriendLogColumns[1], AddWechatFriendLogColumns[7]},
  36. },
  37. },
  38. }
  39. // AgentColumns holds the columns for the "agent" table.
  40. AgentColumns = []*schema.Column{
  41. {Name: "id", Type: field.TypeUint64, Increment: true},
  42. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  43. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  44. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  45. {Name: "name", Type: field.TypeString, Size: 255, Comment: "name | 角色名称"},
  46. {Name: "role", Type: field.TypeString, Nullable: true, Comment: "role | 角色设定", Default: ""},
  47. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  48. {Name: "background", Type: field.TypeString, Nullable: true, Comment: "background | 背景介绍", Default: ""},
  49. {Name: "examples", Type: field.TypeString, Nullable: true, Comment: "examples | 对话案例", Default: ""},
  50. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  51. {Name: "dataset_id", Type: field.TypeString, Size: 255, Comment: "dataset_id | 知识库ID", Default: ""},
  52. {Name: "collection_id", Type: field.TypeString, Size: 255, Comment: "collection_id | 集合ID", Default: ""},
  53. {Name: "model", Type: field.TypeString, Nullable: true, Comment: "model | 模型", Default: ""},
  54. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "api_base | api_base", Default: ""},
  55. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "api_key | api_key", Default: ""},
  56. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "type | 类型 1. 内置 2. 接入", Default: 1},
  57. }
  58. // AgentTable holds the schema information for the "agent" table.
  59. AgentTable = &schema.Table{
  60. Name: "agent",
  61. Columns: AgentColumns,
  62. PrimaryKey: []*schema.Column{AgentColumns[0]},
  63. Indexes: []*schema.Index{
  64. {
  65. Name: "agent_organization_id",
  66. Unique: false,
  67. Columns: []*schema.Column{AgentColumns[9]},
  68. },
  69. },
  70. }
  71. // AgentBaseColumns holds the columns for the "agent_base" table.
  72. AgentBaseColumns = []*schema.Column{
  73. {Name: "id", Type: field.TypeString, Comment: "id"},
  74. {Name: "q", Type: field.TypeString, Nullable: true, Comment: "q", Default: ""},
  75. {Name: "a", Type: field.TypeString, Nullable: true, Comment: "a", Default: ""},
  76. {Name: "chunk_index", Type: field.TypeUint64, Comment: "chunk_index"},
  77. {Name: "indexes", Type: field.TypeJSON, Nullable: true, Comment: "indexes"},
  78. {Name: "dataset_id", Type: field.TypeString, Nullable: true, Comment: "dataset_id", Default: ""},
  79. {Name: "collection_id", Type: field.TypeString, Nullable: true, Comment: "collection_id", Default: ""},
  80. {Name: "source_name", Type: field.TypeString, Nullable: true, Comment: "source_name", Default: ""},
  81. {Name: "can_write", Type: field.TypeJSON, Nullable: true, Comment: "can_write"},
  82. {Name: "is_owner", Type: field.TypeJSON, Nullable: true, Comment: "is_owner"},
  83. }
  84. // AgentBaseTable holds the schema information for the "agent_base" table.
  85. AgentBaseTable = &schema.Table{
  86. Name: "agent_base",
  87. Columns: AgentBaseColumns,
  88. PrimaryKey: []*schema.Column{AgentBaseColumns[0]},
  89. }
  90. // AliyunAvatarColumns holds the columns for the "aliyun_avatar" table.
  91. AliyunAvatarColumns = []*schema.Column{
  92. {Name: "id", Type: field.TypeUint64, Increment: true},
  93. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  94. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  95. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  96. {Name: "user_id", Type: field.TypeUint64, Comment: "user_id | wx_card_user_id"},
  97. {Name: "biz_id", Type: field.TypeString, Comment: "biz_id | BizId"},
  98. {Name: "access_key_id", Type: field.TypeString, Comment: "access_key_id | AccessKeyId"},
  99. {Name: "access_key_secret", Type: field.TypeString, Comment: "access_key_secret | AccessKeySecret"},
  100. {Name: "app_id", Type: field.TypeString, Nullable: true, Comment: "app_id | AppId"},
  101. {Name: "tenant_id", Type: field.TypeUint64, Comment: "tenant_id | TenantId"},
  102. {Name: "response", Type: field.TypeString, Size: 2147483647, Comment: "response | 阿里云avatar响应"},
  103. {Name: "token", Type: field.TypeString, Comment: "token | Token", Default: ""},
  104. {Name: "session_id", Type: field.TypeString, Comment: "session_id | SessionId", Default: ""},
  105. }
  106. // AliyunAvatarTable holds the schema information for the "aliyun_avatar" table.
  107. AliyunAvatarTable = &schema.Table{
  108. Name: "aliyun_avatar",
  109. Columns: AliyunAvatarColumns,
  110. PrimaryKey: []*schema.Column{AliyunAvatarColumns[0]},
  111. Indexes: []*schema.Index{
  112. {
  113. Name: "aliyunavatar_user_id",
  114. Unique: false,
  115. Columns: []*schema.Column{AliyunAvatarColumns[4]},
  116. },
  117. },
  118. }
  119. // AllocAgentColumns holds the columns for the "alloc_agent" table.
  120. AllocAgentColumns = []*schema.Column{
  121. {Name: "id", Type: field.TypeUint64, Increment: true},
  122. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  123. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  124. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  125. {Name: "user_id", Type: field.TypeString, Nullable: true, Comment: "user_id | 前台用户ID", Default: ""},
  126. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "organization_id | 租户ID", Default: 0},
  127. {Name: "agents", Type: field.TypeJSON, Comment: "agents | 分配的智能体IDs"},
  128. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  129. }
  130. // AllocAgentTable holds the schema information for the "alloc_agent" table.
  131. AllocAgentTable = &schema.Table{
  132. Name: "alloc_agent",
  133. Columns: AllocAgentColumns,
  134. PrimaryKey: []*schema.Column{AllocAgentColumns[0]},
  135. Indexes: []*schema.Index{
  136. {
  137. Name: "allocagent_organization_id",
  138. Unique: false,
  139. Columns: []*schema.Column{AllocAgentColumns[5]},
  140. },
  141. {
  142. Name: "allocagent_user_id",
  143. Unique: false,
  144. Columns: []*schema.Column{AllocAgentColumns[4]},
  145. },
  146. },
  147. }
  148. // APIKeyColumns holds the columns for the "api_key" table.
  149. APIKeyColumns = []*schema.Column{
  150. {Name: "id", Type: field.TypeUint64, Increment: true},
  151. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  152. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  153. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  154. {Name: "title", Type: field.TypeString, Nullable: true, Comment: "Title", Default: ""},
  155. {Name: "key", Type: field.TypeString, Nullable: true, Comment: "Key", Default: ""},
  156. {Name: "organization_id", Type: field.TypeUint64, Comment: "租户ID", Default: 0},
  157. {Name: "custom_agent_base", Type: field.TypeString, Nullable: true, Comment: "定制agent服务地址", Default: ""},
  158. {Name: "custom_agent_key", Type: field.TypeString, Nullable: true, Comment: "定制agent服务密钥", Default: ""},
  159. {Name: "openai_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  160. {Name: "openai_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  161. {Name: "agent_id", Type: field.TypeUint64, Comment: "智能体ID", Default: 0},
  162. }
  163. // APIKeyTable holds the schema information for the "api_key" table.
  164. APIKeyTable = &schema.Table{
  165. Name: "api_key",
  166. Columns: APIKeyColumns,
  167. PrimaryKey: []*schema.Column{APIKeyColumns[0]},
  168. ForeignKeys: []*schema.ForeignKey{
  169. {
  170. Symbol: "api_key_agent_key_agent",
  171. Columns: []*schema.Column{APIKeyColumns[11]},
  172. RefColumns: []*schema.Column{AgentColumns[0]},
  173. OnDelete: schema.NoAction,
  174. },
  175. },
  176. Indexes: []*schema.Index{
  177. {
  178. Name: "apikey_key",
  179. Unique: true,
  180. Columns: []*schema.Column{APIKeyColumns[5]},
  181. },
  182. },
  183. }
  184. // BatchMsgColumns holds the columns for the "batch_msg" table.
  185. BatchMsgColumns = []*schema.Column{
  186. {Name: "id", Type: field.TypeUint64, Increment: true},
  187. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  188. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  189. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  190. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "状态 0 未开始 1 开始发送 2 发送完成 3 发送中止"},
  191. {Name: "batch_no", Type: field.TypeString, Unique: true, Nullable: true, Comment: "批次号"},
  192. {Name: "task_name", Type: field.TypeString, Nullable: true, Comment: "任务名称", Default: ""},
  193. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  194. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "内容"},
  195. {Name: "tag", Type: field.TypeString, Nullable: true, Comment: "发送规则 all 全部 tag1,tag2 按tag发送"},
  196. {Name: "tagids", Type: field.TypeString, Nullable: true, Comment: "要发送的tagids"},
  197. {Name: "total", Type: field.TypeInt32, Nullable: true, Comment: "总数"},
  198. {Name: "success", Type: field.TypeInt32, Nullable: true, Comment: "成功数量"},
  199. {Name: "fail", Type: field.TypeInt32, Nullable: true, Comment: "失败数量"},
  200. {Name: "start_time", Type: field.TypeTime, Nullable: true, Comment: "开始时间"},
  201. {Name: "stop_time", Type: field.TypeTime, Nullable: true, Comment: "结束时间"},
  202. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  203. {Name: "type", Type: field.TypeInt32, Nullable: true, Comment: "发送类型 1-群发消息 2-群发朋友圈"},
  204. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  205. {Name: "ctype", Type: field.TypeUint64, Comment: "内容类型:1-微信 2-whatsapp", Default: 1},
  206. {Name: "cc", Type: field.TypeString, Nullable: true, Comment: "国家区号"},
  207. {Name: "phone", Type: field.TypeString, Nullable: true, Comment: "手机号"},
  208. {Name: "template_name", Type: field.TypeString, Nullable: true, Comment: "模板名"},
  209. {Name: "template_code", Type: field.TypeString, Nullable: true, Comment: "模板code"},
  210. {Name: "lang", Type: field.TypeString, Nullable: true, Comment: "语言"},
  211. }
  212. // BatchMsgTable holds the schema information for the "batch_msg" table.
  213. BatchMsgTable = &schema.Table{
  214. Name: "batch_msg",
  215. Columns: BatchMsgColumns,
  216. PrimaryKey: []*schema.Column{BatchMsgColumns[0]},
  217. Indexes: []*schema.Index{
  218. {
  219. Name: "batchmsg_batch_no",
  220. Unique: true,
  221. Columns: []*schema.Column{BatchMsgColumns[5]},
  222. },
  223. {
  224. Name: "batchmsg_type",
  225. Unique: false,
  226. Columns: []*schema.Column{BatchMsgColumns[17]},
  227. },
  228. },
  229. }
  230. // CategoryColumns holds the columns for the "category" table.
  231. CategoryColumns = []*schema.Column{
  232. {Name: "id", Type: field.TypeUint64, Increment: true},
  233. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  234. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  235. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  236. {Name: "name", Type: field.TypeString, Size: 255, Comment: "name | 角色名称"},
  237. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  238. }
  239. // CategoryTable holds the schema information for the "category" table.
  240. CategoryTable = &schema.Table{
  241. Name: "category",
  242. Columns: CategoryColumns,
  243. PrimaryKey: []*schema.Column{CategoryColumns[0]},
  244. Indexes: []*schema.Index{
  245. {
  246. Name: "category_organization_id",
  247. Unique: false,
  248. Columns: []*schema.Column{CategoryColumns[5]},
  249. },
  250. },
  251. }
  252. // ChatRecordsColumns holds the columns for the "chat_records" table.
  253. ChatRecordsColumns = []*schema.Column{
  254. {Name: "id", Type: field.TypeUint64, Increment: true},
  255. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  256. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  257. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  258. {Name: "content", Type: field.TypeString, Comment: "内容", Default: ""},
  259. {Name: "content_type", Type: field.TypeUint8, Comment: "内容类型:1-提问 2-回答", Default: 1},
  260. {Name: "session_id", Type: field.TypeUint64, Comment: "会话ID", Default: 0},
  261. {Name: "user_id", Type: field.TypeUint64, Comment: "用户ID", Default: 0},
  262. {Name: "bot_id", Type: field.TypeUint64, Comment: "聊天ID", Default: 0},
  263. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序card 3-智能体", Default: 2},
  264. }
  265. // ChatRecordsTable holds the schema information for the "chat_records" table.
  266. ChatRecordsTable = &schema.Table{
  267. Name: "chat_records",
  268. Columns: ChatRecordsColumns,
  269. PrimaryKey: []*schema.Column{ChatRecordsColumns[0]},
  270. Indexes: []*schema.Index{
  271. {
  272. Name: "chatrecords_user_id_bot_id_bot_type",
  273. Unique: false,
  274. Columns: []*schema.Column{ChatRecordsColumns[7], ChatRecordsColumns[8], ChatRecordsColumns[9]},
  275. },
  276. {
  277. Name: "chatrecords_session_id",
  278. Unique: false,
  279. Columns: []*schema.Column{ChatRecordsColumns[6]},
  280. },
  281. },
  282. }
  283. // ChatSessionColumns holds the columns for the "chat_session" table.
  284. ChatSessionColumns = []*schema.Column{
  285. {Name: "id", Type: field.TypeUint64, Increment: true},
  286. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  287. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  288. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  289. {Name: "name", Type: field.TypeString, Comment: "名称", Default: ""},
  290. {Name: "user_id", Type: field.TypeUint64, Comment: "用户ID", Default: 0},
  291. {Name: "bot_id", Type: field.TypeUint64, Comment: "聊天ID", Default: 0},
  292. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序card 3-智能体", Default: 2},
  293. }
  294. // ChatSessionTable holds the schema information for the "chat_session" table.
  295. ChatSessionTable = &schema.Table{
  296. Name: "chat_session",
  297. Columns: ChatSessionColumns,
  298. PrimaryKey: []*schema.Column{ChatSessionColumns[0]},
  299. Indexes: []*schema.Index{
  300. {
  301. Name: "chatsession_user_id_bot_id_bot_type",
  302. Unique: false,
  303. Columns: []*schema.Column{ChatSessionColumns[5], ChatSessionColumns[6], ChatSessionColumns[7]},
  304. },
  305. },
  306. }
  307. // CompapiAsynctaskColumns holds the columns for the "compapi_asynctask" table.
  308. CompapiAsynctaskColumns = []*schema.Column{
  309. {Name: "id", Type: field.TypeUint64, Increment: true},
  310. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  311. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  312. {Name: "auth_token", Type: field.TypeString, Comment: "发起请求者的授权token"},
  313. {Name: "event_type", Type: field.TypeString, Comment: "请求目标类型", Default: "fastgpt"},
  314. {Name: "chat_id", Type: field.TypeString, Nullable: true, Comment: "会话ID", Default: ""},
  315. {Name: "response_chat_item_id", Type: field.TypeString, Nullable: true, Default: ""},
  316. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  317. {Name: "openai_base", Type: field.TypeString, Comment: "待请求的大模型服务地址"},
  318. {Name: "openai_key", Type: field.TypeString, Comment: "待请求的大模型服务密钥授权token"},
  319. {Name: "request_raw", Type: field.TypeString, Comment: "请求参数结构字符串"},
  320. {Name: "response_raw", Type: field.TypeString, Nullable: true, Comment: "请求响应结构字符串", Default: ""},
  321. {Name: "callback_url", Type: field.TypeString, Size: 255, Comment: "callback_url | 异步执行回调地址"},
  322. {Name: "callback_response_raw", Type: field.TypeString, Nullable: true, Comment: "callback返回结构字符串", Default: ""},
  323. {Name: "model", Type: field.TypeString, Nullable: true, Comment: "所用大模型", Default: ""},
  324. {Name: "task_status", Type: field.TypeInt8, Nullable: true, Comment: "callback_status | 任务完成状态 10 任务就绪 20 请求API完成 30 请求回调完成 60 任务暂停 70 任务失败", Default: 10},
  325. {Name: "retry_count", Type: field.TypeInt8, Nullable: true, Comment: "retry count | 重试次数", Default: 0},
  326. {Name: "last_error", Type: field.TypeString, Nullable: true, Comment: "最后一次出错信息", Default: ""},
  327. }
  328. // CompapiAsynctaskTable holds the schema information for the "compapi_asynctask" table.
  329. CompapiAsynctaskTable = &schema.Table{
  330. Name: "compapi_asynctask",
  331. Columns: CompapiAsynctaskColumns,
  332. PrimaryKey: []*schema.Column{CompapiAsynctaskColumns[0]},
  333. Indexes: []*schema.Index{
  334. {
  335. Name: "compapiasynctask_task_status",
  336. Unique: false,
  337. Columns: []*schema.Column{CompapiAsynctaskColumns[15]},
  338. },
  339. },
  340. }
  341. // ContactColumns holds the columns for the "contact" table.
  342. ContactColumns = []*schema.Column{
  343. {Name: "id", Type: field.TypeUint64, Increment: true},
  344. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  345. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  346. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  347. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  348. {Name: "wx_wxid", Type: field.TypeString, Comment: "属主微信id", Default: ""},
  349. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "联系人类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  350. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  351. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  352. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称 群备注名称", Default: ""},
  353. {Name: "markname", Type: field.TypeString, Comment: "备注名", Default: ""},
  354. {Name: "headimg", Type: field.TypeString, Comment: "头像", Default: ""},
  355. {Name: "sex", Type: field.TypeInt, Comment: "性别 0未知 1男 2女", Default: 0},
  356. {Name: "starrole", Type: field.TypeString, Comment: "星标 65/67=星标 1/3=未星标", Default: ""},
  357. {Name: "dontseeit", Type: field.TypeInt, Comment: "不让他看我的朋友圈 0可以看 1不让看", Default: 0},
  358. {Name: "dontseeme", Type: field.TypeInt, Comment: "不看他的朋友圈 0可以看 1不看 1=开启了不看他 128/129=仅聊天", Default: 0},
  359. {Name: "lag", Type: field.TypeString, Comment: "所属标签id清单,多开会用逗号隔开", Default: ""},
  360. {Name: "gid", Type: field.TypeString, Comment: "群组id", Default: ""},
  361. {Name: "gname", Type: field.TypeString, Comment: "群组名称", Default: ""},
  362. {Name: "v3", Type: field.TypeString, Comment: "v3数据", Default: ""},
  363. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  364. {Name: "ctype", Type: field.TypeUint64, Comment: "内容类型:1-微信 2-whatsapp", Default: 1},
  365. {Name: "cage", Type: field.TypeInt, Comment: "年龄", Default: 0},
  366. {Name: "cname", Type: field.TypeString, Comment: "姓名", Default: ""},
  367. {Name: "carea", Type: field.TypeString, Comment: "地区", Default: ""},
  368. {Name: "cbirthday", Type: field.TypeString, Comment: "出生日期", Default: ""},
  369. {Name: "cbirtharea", Type: field.TypeString, Comment: "出生地", Default: ""},
  370. {Name: "cidcard_no", Type: field.TypeString, Comment: "身份证号", Default: ""},
  371. {Name: "ctitle", Type: field.TypeString, Comment: "称呼", Default: ""},
  372. {Name: "cc", Type: field.TypeString, Comment: "国家区号", Default: ""},
  373. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  374. }
  375. // ContactTable holds the schema information for the "contact" table.
  376. ContactTable = &schema.Table{
  377. Name: "contact",
  378. Columns: ContactColumns,
  379. PrimaryKey: []*schema.Column{ContactColumns[0]},
  380. Indexes: []*schema.Index{
  381. {
  382. Name: "contact_wx_wxid_wxid",
  383. Unique: true,
  384. Columns: []*schema.Column{ContactColumns[5], ContactColumns[7]},
  385. },
  386. {
  387. Name: "contact_wxid",
  388. Unique: false,
  389. Columns: []*schema.Column{ContactColumns[7]},
  390. },
  391. {
  392. Name: "contact_type",
  393. Unique: false,
  394. Columns: []*schema.Column{ContactColumns[6]},
  395. },
  396. {
  397. Name: "contact_gid",
  398. Unique: false,
  399. Columns: []*schema.Column{ContactColumns[17]},
  400. },
  401. },
  402. }
  403. // ContactFieldColumns holds the columns for the "contact_field" table.
  404. ContactFieldColumns = []*schema.Column{
  405. {Name: "id", Type: field.TypeUint64, Increment: true},
  406. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  407. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  408. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  409. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  410. {Name: "form_id", Type: field.TypeString, Comment: "表单 id"},
  411. {Name: "value", Type: field.TypeJSON, Comment: "表单值"},
  412. {Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
  413. }
  414. // ContactFieldTable holds the schema information for the "contact_field" table.
  415. ContactFieldTable = &schema.Table{
  416. Name: "contact_field",
  417. Columns: ContactFieldColumns,
  418. PrimaryKey: []*schema.Column{ContactFieldColumns[0]},
  419. ForeignKeys: []*schema.ForeignKey{
  420. {
  421. Symbol: "contact_field_contact_contact_fields",
  422. Columns: []*schema.Column{ContactFieldColumns[7]},
  423. RefColumns: []*schema.Column{ContactColumns[0]},
  424. OnDelete: schema.NoAction,
  425. },
  426. },
  427. }
  428. // ContactFieldTemplateColumns holds the columns for the "contact_field_template" table.
  429. ContactFieldTemplateColumns = []*schema.Column{
  430. {Name: "id", Type: field.TypeUint64, Increment: true},
  431. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  432. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  433. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  434. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  435. {Name: "organization_id", Type: field.TypeUint64, Comment: "机构 ID", Default: 1},
  436. {Name: "template", Type: field.TypeJSON, Comment: "模板"},
  437. }
  438. // ContactFieldTemplateTable holds the schema information for the "contact_field_template" table.
  439. ContactFieldTemplateTable = &schema.Table{
  440. Name: "contact_field_template",
  441. Columns: ContactFieldTemplateColumns,
  442. PrimaryKey: []*schema.Column{ContactFieldTemplateColumns[0]},
  443. }
  444. // CreditBalanceColumns holds the columns for the "credit_balance" table.
  445. CreditBalanceColumns = []*schema.Column{
  446. {Name: "id", Type: field.TypeUint64, Increment: true},
  447. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  448. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  449. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  450. {Name: "user_id", Type: field.TypeString, Nullable: true, Comment: "user_id | 用户ID"},
  451. {Name: "balance", Type: field.TypeFloat64, Comment: "balance | 积分余额"},
  452. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  453. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "organization_id | 租户ID"},
  454. }
  455. // CreditBalanceTable holds the schema information for the "credit_balance" table.
  456. CreditBalanceTable = &schema.Table{
  457. Name: "credit_balance",
  458. Columns: CreditBalanceColumns,
  459. PrimaryKey: []*schema.Column{CreditBalanceColumns[0]},
  460. Indexes: []*schema.Index{
  461. {
  462. Name: "creditbalance_user_id",
  463. Unique: false,
  464. Columns: []*schema.Column{CreditBalanceColumns[4]},
  465. },
  466. {
  467. Name: "creditbalance_organization_id",
  468. Unique: false,
  469. Columns: []*schema.Column{CreditBalanceColumns[7]},
  470. },
  471. },
  472. }
  473. // CreditUsageColumns holds the columns for the "credit_usage" table.
  474. CreditUsageColumns = []*schema.Column{
  475. {Name: "id", Type: field.TypeUint64, Increment: true},
  476. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  477. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  478. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  479. {Name: "user_id", Type: field.TypeString, Nullable: true, Size: 255, Comment: "user_id | 用户ID"},
  480. {Name: "number", Type: field.TypeFloat64, Comment: "number | 积分改变量"},
  481. {Name: "pay_number", Type: field.TypeFloat64, Nullable: true, Comment: "pay_number | 充值金额"},
  482. {Name: "before_number", Type: field.TypeFloat64, Nullable: true, Comment: "before_number | 变动前金额"},
  483. {Name: "after_number", Type: field.TypeFloat64, Nullable: true, Comment: "after_number | 变动后金额"},
  484. {Name: "pay_method", Type: field.TypeInt, Nullable: true, Comment: "pay_method | 充值方式", Default: 1},
  485. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  486. {Name: "ntype", Type: field.TypeInt, Comment: "ntype | 积分变化类型:1-消耗 2-增加", Default: 1},
  487. {Name: "table", Type: field.TypeString, Comment: "table | 积分变化表名", Default: ""},
  488. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "organization_id | 租户ID"},
  489. {Name: "nid", Type: field.TypeUint64, Comment: "nid | 积分变化关联信息ID", Default: 0},
  490. {Name: "reason", Type: field.TypeString, Size: 255, Comment: "reason | 积分变动原因", Default: ""},
  491. {Name: "operator", Type: field.TypeString, Size: 255, Comment: "operator | 积分变动人", Default: ""},
  492. }
  493. // CreditUsageTable holds the schema information for the "credit_usage" table.
  494. CreditUsageTable = &schema.Table{
  495. Name: "credit_usage",
  496. Columns: CreditUsageColumns,
  497. PrimaryKey: []*schema.Column{CreditUsageColumns[0]},
  498. Indexes: []*schema.Index{
  499. {
  500. Name: "creditusage_organization_id",
  501. Unique: false,
  502. Columns: []*schema.Column{CreditUsageColumns[13]},
  503. },
  504. },
  505. }
  506. // EmployeeColumns holds the columns for the "employee" table.
  507. EmployeeColumns = []*schema.Column{
  508. {Name: "id", Type: field.TypeUint64, Increment: true},
  509. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  510. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  511. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  512. {Name: "title", Type: field.TypeString, Size: 1000, Comment: "title | 标题"},
  513. {Name: "avatar", Type: field.TypeString, Comment: "avatar | 头像"},
  514. {Name: "tags", Type: field.TypeString, Comment: "tags | 个人标签"},
  515. {Name: "hire_count", Type: field.TypeInt, Comment: "hire_count | 被雇佣次数", Default: 0},
  516. {Name: "service_count", Type: field.TypeInt, Comment: "service_count | 已服务次数", Default: 0},
  517. {Name: "achievement_count", Type: field.TypeInt, Comment: "achievement_count | 业绩单数", Default: 0},
  518. {Name: "intro", Type: field.TypeString, Comment: "intro | 个人介绍", Default: ""},
  519. {Name: "estimate", Type: field.TypeString, Comment: "estimate | 自我评价", Default: ""},
  520. {Name: "skill", Type: field.TypeString, Comment: "skill | 技能卡", Default: ""},
  521. {Name: "ability_type", Type: field.TypeString, Comment: "ability_type | 能力类型", Default: ""},
  522. {Name: "scene", Type: field.TypeString, Comment: "scene | 使用场景", Default: ""},
  523. {Name: "switch_in", Type: field.TypeString, Comment: "switch_in | 支持介入", Default: ""},
  524. {Name: "video_url", Type: field.TypeString, Comment: "video_url | 视频地址", Default: ""},
  525. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  526. {Name: "category_id", Type: field.TypeUint64, Comment: "category_id | 分类ID"},
  527. {Name: "api_base", Type: field.TypeString, Comment: "api_base", Default: ""},
  528. {Name: "api_key", Type: field.TypeString, Comment: "api_key", Default: ""},
  529. {Name: "ai_info", Type: field.TypeString, Nullable: true, Comment: "AI信息"},
  530. {Name: "is_vip", Type: field.TypeInt, Comment: "是否VIP:0-否 1-是", Default: 0},
  531. {Name: "chat_url", Type: field.TypeString, Comment: "聊天URL"},
  532. }
  533. // EmployeeTable holds the schema information for the "employee" table.
  534. EmployeeTable = &schema.Table{
  535. Name: "employee",
  536. Columns: EmployeeColumns,
  537. PrimaryKey: []*schema.Column{EmployeeColumns[0]},
  538. Indexes: []*schema.Index{
  539. {
  540. Name: "employee_organization_id",
  541. Unique: false,
  542. Columns: []*schema.Column{EmployeeColumns[17]},
  543. },
  544. },
  545. }
  546. // EmployeeConfigColumns holds the columns for the "employee_config" table.
  547. EmployeeConfigColumns = []*schema.Column{
  548. {Name: "id", Type: field.TypeUint64, Increment: true},
  549. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  550. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  551. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  552. {Name: "stype", Type: field.TypeString, Comment: "类型:scene-场景 switch_in-接入方式", Default: ""},
  553. {Name: "title", Type: field.TypeString, Comment: "标题", Default: ""},
  554. {Name: "photo", Type: field.TypeString, Comment: "图片地址", Default: ""},
  555. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  556. }
  557. // EmployeeConfigTable holds the schema information for the "employee_config" table.
  558. EmployeeConfigTable = &schema.Table{
  559. Name: "employee_config",
  560. Columns: EmployeeConfigColumns,
  561. PrimaryKey: []*schema.Column{EmployeeConfigColumns[0]},
  562. Indexes: []*schema.Index{
  563. {
  564. Name: "employeeconfig_stype",
  565. Unique: false,
  566. Columns: []*schema.Column{EmployeeConfigColumns[4]},
  567. },
  568. },
  569. }
  570. // LabelColumns holds the columns for the "label" table.
  571. LabelColumns = []*schema.Column{
  572. {Name: "id", Type: field.TypeUint64, Increment: true},
  573. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  574. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  575. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  576. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  577. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  578. {Name: "name", Type: field.TypeString, Comment: "标签名称", Default: ""},
  579. {Name: "from", Type: field.TypeInt, Comment: "标签来源:1后台创建 2个微同步", Default: 1},
  580. {Name: "mode", Type: field.TypeInt, Comment: "标签模式:1动态 2静态", Default: 1},
  581. {Name: "conditions", Type: field.TypeString, Nullable: true, Comment: "标签的触达条件", Default: ""},
  582. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  583. }
  584. // LabelTable holds the schema information for the "label" table.
  585. LabelTable = &schema.Table{
  586. Name: "label",
  587. Columns: LabelColumns,
  588. PrimaryKey: []*schema.Column{LabelColumns[0]},
  589. Indexes: []*schema.Index{
  590. {
  591. Name: "label_name_organization_id",
  592. Unique: true,
  593. Columns: []*schema.Column{LabelColumns[6], LabelColumns[10]},
  594. },
  595. },
  596. }
  597. // LabelLogColumns holds the columns for the "label_log" table.
  598. LabelLogColumns = []*schema.Column{
  599. {Name: "id", Type: field.TypeUint64, Increment: true},
  600. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  601. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  602. {Name: "label_name", Type: field.TypeString, Comment: "标签名称", Default: ""},
  603. {Name: "label_id", Type: field.TypeInt, Comment: "三方平台标签id", Default: 0},
  604. {Name: "wx_id", Type: field.TypeString, Comment: "微信ID", Default: ""},
  605. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  606. }
  607. // LabelLogTable holds the schema information for the "label_log" table.
  608. LabelLogTable = &schema.Table{
  609. Name: "label_log",
  610. Columns: LabelLogColumns,
  611. PrimaryKey: []*schema.Column{LabelLogColumns[0]},
  612. Indexes: []*schema.Index{
  613. {
  614. Name: "idx_org_label",
  615. Unique: true,
  616. Columns: []*schema.Column{LabelLogColumns[4], LabelLogColumns[5], LabelLogColumns[6]},
  617. },
  618. },
  619. }
  620. // LabelRelationshipColumns holds the columns for the "label_relationship" table.
  621. LabelRelationshipColumns = []*schema.Column{
  622. {Name: "id", Type: field.TypeUint64, Increment: true},
  623. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  624. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  625. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  626. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  627. {Name: "contact_id", Type: field.TypeUint64, Comment: "联系人 ID", Default: 1},
  628. {Name: "label_id", Type: field.TypeUint64, Comment: "标签 ID", Default: 1},
  629. }
  630. // LabelRelationshipTable holds the schema information for the "label_relationship" table.
  631. LabelRelationshipTable = &schema.Table{
  632. Name: "label_relationship",
  633. Columns: LabelRelationshipColumns,
  634. PrimaryKey: []*schema.Column{LabelRelationshipColumns[0]},
  635. ForeignKeys: []*schema.ForeignKey{
  636. {
  637. Symbol: "label_relationship_contact_contact_relationships",
  638. Columns: []*schema.Column{LabelRelationshipColumns[5]},
  639. RefColumns: []*schema.Column{ContactColumns[0]},
  640. OnDelete: schema.NoAction,
  641. },
  642. {
  643. Symbol: "label_relationship_label_label_relationships",
  644. Columns: []*schema.Column{LabelRelationshipColumns[6]},
  645. RefColumns: []*schema.Column{LabelColumns[0]},
  646. OnDelete: schema.NoAction,
  647. },
  648. },
  649. Indexes: []*schema.Index{
  650. {
  651. Name: "u_label_contact",
  652. Unique: true,
  653. Columns: []*schema.Column{LabelRelationshipColumns[6], LabelRelationshipColumns[5]},
  654. },
  655. },
  656. }
  657. // LabelTaggingColumns holds the columns for the "label_tagging" table.
  658. LabelTaggingColumns = []*schema.Column{
  659. {Name: "id", Type: field.TypeUint64, Increment: true},
  660. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  661. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  662. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  663. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  664. {Name: "organization_id", Type: field.TypeUint64, Comment: "机构 ID", Default: 1},
  665. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3公众号,4企业微信联系人", Default: 1},
  666. {Name: "conditions", Type: field.TypeString, Comment: "关键词", Default: ""},
  667. {Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  668. {Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
  669. }
  670. // LabelTaggingTable holds the schema information for the "label_tagging" table.
  671. LabelTaggingTable = &schema.Table{
  672. Name: "label_tagging",
  673. Columns: LabelTaggingColumns,
  674. PrimaryKey: []*schema.Column{LabelTaggingColumns[0]},
  675. }
  676. // MessagesColumns holds the columns for the "messages" table.
  677. MessagesColumns = []*schema.Column{
  678. {Name: "id", Type: field.TypeInt, Increment: true},
  679. {Name: "wx_wxid", Type: field.TypeString, Nullable: true, Comment: "属主微信id", Default: ""},
  680. {Name: "wxid", Type: field.TypeString, Comment: "微信id 公众号微信ID", Default: ""},
  681. {Name: "content", Type: field.TypeString, Comment: "微信消息内容", Default: ""},
  682. }
  683. // MessagesTable holds the schema information for the "messages" table.
  684. MessagesTable = &schema.Table{
  685. Name: "messages",
  686. Columns: MessagesColumns,
  687. PrimaryKey: []*schema.Column{MessagesColumns[0]},
  688. }
  689. // MessageRecordsColumns holds the columns for the "message_records" table.
  690. MessageRecordsColumns = []*schema.Column{
  691. {Name: "id", Type: field.TypeUint64, Increment: true},
  692. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  693. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  694. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  695. {Name: "bot_wxid", Type: field.TypeString, Comment: "机器人微信 id"},
  696. {Name: "contact_type", Type: field.TypeInt, Comment: "类型:1好友,2群组,3企业微信联系人", Default: 1},
  697. {Name: "contact_wxid", Type: field.TypeString, Comment: "接收方微信 id", Default: ""},
  698. {Name: "content_type", Type: field.TypeInt, Comment: "内容类型 1 文本 2 文件", Default: 1},
  699. {Name: "content", Type: field.TypeString, Comment: "发送内容", Default: ""},
  700. {Name: "meta", Type: field.TypeJSON, Nullable: true, Comment: "元数据"},
  701. {Name: "error_detail", Type: field.TypeString, Comment: "异常原因", Default: ""},
  702. {Name: "send_time", Type: field.TypeTime, Nullable: true, Comment: "发送时间"},
  703. {Name: "source_type", Type: field.TypeInt, Comment: "源类型 1 点发 2 群发 3 SOP", Default: 1},
  704. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  705. {Name: "contact_id", Type: field.TypeUint64, Nullable: true, Comment: "联系人 id"},
  706. {Name: "sub_source_id", Type: field.TypeUint64, Nullable: true, Comment: "次源 ID", Default: 1},
  707. {Name: "source_id", Type: field.TypeUint64, Nullable: true, Comment: "源 ID", Default: 1},
  708. }
  709. // MessageRecordsTable holds the schema information for the "message_records" table.
  710. MessageRecordsTable = &schema.Table{
  711. Name: "message_records",
  712. Columns: MessageRecordsColumns,
  713. PrimaryKey: []*schema.Column{MessageRecordsColumns[0]},
  714. ForeignKeys: []*schema.ForeignKey{
  715. {
  716. Symbol: "message_records_contact_contact_messages",
  717. Columns: []*schema.Column{MessageRecordsColumns[14]},
  718. RefColumns: []*schema.Column{ContactColumns[0]},
  719. OnDelete: schema.SetNull,
  720. },
  721. {
  722. Symbol: "message_records_sop_node_node_messages",
  723. Columns: []*schema.Column{MessageRecordsColumns[15]},
  724. RefColumns: []*schema.Column{SopNodeColumns[0]},
  725. OnDelete: schema.SetNull,
  726. },
  727. {
  728. Symbol: "message_records_sop_stage_stage_messages",
  729. Columns: []*schema.Column{MessageRecordsColumns[16]},
  730. RefColumns: []*schema.Column{SopStageColumns[0]},
  731. OnDelete: schema.SetNull,
  732. },
  733. },
  734. Indexes: []*schema.Index{
  735. {
  736. Name: "messagerecords_source_type",
  737. Unique: false,
  738. Columns: []*schema.Column{MessageRecordsColumns[12]},
  739. },
  740. },
  741. }
  742. // MsgColumns holds the columns for the "msg" table.
  743. MsgColumns = []*schema.Column{
  744. {Name: "id", Type: field.TypeUint64, Increment: true},
  745. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  746. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  747. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  748. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用"},
  749. {Name: "fromwxid", Type: field.TypeString, Nullable: true, Comment: "发送方微信ID"},
  750. {Name: "toid", Type: field.TypeString, Nullable: true, Comment: "接收人微信ID/群ID"},
  751. {Name: "msgtype", Type: field.TypeInt32, Nullable: true, Comment: "消息类型"},
  752. {Name: "msg", Type: field.TypeString, Nullable: true, Comment: "消息"},
  753. {Name: "batch_no", Type: field.TypeString, Nullable: true, Comment: "批次号"},
  754. {Name: "cc", Type: field.TypeString, Comment: "国家区号", Default: ""},
  755. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  756. }
  757. // MsgTable holds the schema information for the "msg" table.
  758. MsgTable = &schema.Table{
  759. Name: "msg",
  760. Columns: MsgColumns,
  761. PrimaryKey: []*schema.Column{MsgColumns[0]},
  762. Indexes: []*schema.Index{
  763. {
  764. Name: "msg_batch_no",
  765. Unique: false,
  766. Columns: []*schema.Column{MsgColumns[9]},
  767. },
  768. {
  769. Name: "msg_id",
  770. Unique: false,
  771. Columns: []*schema.Column{MsgColumns[0]},
  772. },
  773. {
  774. Name: "msg_status",
  775. Unique: false,
  776. Columns: []*schema.Column{MsgColumns[4]},
  777. },
  778. },
  779. }
  780. // PayRechargeColumns holds the columns for the "pay_recharge" table.
  781. PayRechargeColumns = []*schema.Column{
  782. {Name: "id", Type: field.TypeUint64, Increment: true},
  783. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  784. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  785. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  786. {Name: "user_id", Type: field.TypeString, Size: 255, Comment: "user_id | 用户ID"},
  787. {Name: "number", Type: field.TypeFloat32, Comment: "number | 变化积分数", Default: 0},
  788. {Name: "status", Type: field.TypeInt, Nullable: true, Comment: "status | 状态 1-正常 2-禁用", Default: 1},
  789. {Name: "money", Type: field.TypeFloat32, Nullable: true, Comment: "money | 充值钱数", Default: 0},
  790. {Name: "out_trade_no", Type: field.TypeString, Nullable: true, Comment: "out_trade_no | 外部订单号", Default: ""},
  791. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID", Default: 0},
  792. }
  793. // PayRechargeTable holds the schema information for the "pay_recharge" table.
  794. PayRechargeTable = &schema.Table{
  795. Name: "pay_recharge",
  796. Columns: PayRechargeColumns,
  797. PrimaryKey: []*schema.Column{PayRechargeColumns[0]},
  798. Indexes: []*schema.Index{
  799. {
  800. Name: "payrecharge_user_id",
  801. Unique: false,
  802. Columns: []*schema.Column{PayRechargeColumns[4]},
  803. },
  804. {
  805. Name: "payrecharge_organization_id",
  806. Unique: false,
  807. Columns: []*schema.Column{PayRechargeColumns[9]},
  808. },
  809. },
  810. }
  811. // ServerColumns holds the columns for the "server" table.
  812. ServerColumns = []*schema.Column{
  813. {Name: "id", Type: field.TypeUint64, Increment: true},
  814. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  815. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  816. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  817. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  818. {Name: "name", Type: field.TypeString, Comment: "名称"},
  819. {Name: "public_ip", Type: field.TypeString, Comment: "公网ip"},
  820. {Name: "private_ip", Type: field.TypeString, Comment: "内网ip"},
  821. {Name: "admin_port", Type: field.TypeString, Comment: "管理端口"},
  822. }
  823. // ServerTable holds the schema information for the "server" table.
  824. ServerTable = &schema.Table{
  825. Name: "server",
  826. Columns: ServerColumns,
  827. PrimaryKey: []*schema.Column{ServerColumns[0]},
  828. Indexes: []*schema.Index{
  829. {
  830. Name: "server_name",
  831. Unique: false,
  832. Columns: []*schema.Column{ServerColumns[5]},
  833. },
  834. {
  835. Name: "server_private_ip",
  836. Unique: false,
  837. Columns: []*schema.Column{ServerColumns[7]},
  838. },
  839. {
  840. Name: "server_public_ip",
  841. Unique: true,
  842. Columns: []*schema.Column{ServerColumns[6]},
  843. },
  844. },
  845. }
  846. // SopNodeColumns holds the columns for the "sop_node" table.
  847. SopNodeColumns = []*schema.Column{
  848. {Name: "id", Type: field.TypeUint64, Increment: true},
  849. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  850. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  851. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  852. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  853. {Name: "parent_id", Type: field.TypeUint64, Comment: "父节点 ID"},
  854. {Name: "name", Type: field.TypeString, Comment: "节点名称", Default: ""},
  855. {Name: "condition_type", Type: field.TypeInt, Comment: "触发条件类型 1 客户回复后触发 2 超时后触发", Default: 1},
  856. {Name: "condition_list", Type: field.TypeJSON, Nullable: true, Comment: "触发语义列表 当为空时则代表用户回复任意内容后触发"},
  857. {Name: "no_reply_condition", Type: field.TypeUint64, Comment: "超时触发时间(分钟)", Default: 0},
  858. {Name: "no_reply_unit", Type: field.TypeString, Comment: "超时触发时间单位", Default: ""},
  859. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  860. {Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  861. {Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
  862. {Name: "action_forward", Type: field.TypeJSON, Nullable: true, Comment: "命中后转发的消息"},
  863. {Name: "stage_id", Type: field.TypeUint64, Comment: "阶段 ID"},
  864. }
  865. // SopNodeTable holds the schema information for the "sop_node" table.
  866. SopNodeTable = &schema.Table{
  867. Name: "sop_node",
  868. Columns: SopNodeColumns,
  869. PrimaryKey: []*schema.Column{SopNodeColumns[0]},
  870. ForeignKeys: []*schema.ForeignKey{
  871. {
  872. Symbol: "sop_node_sop_stage_stage_nodes",
  873. Columns: []*schema.Column{SopNodeColumns[15]},
  874. RefColumns: []*schema.Column{SopStageColumns[0]},
  875. OnDelete: schema.NoAction,
  876. },
  877. },
  878. Indexes: []*schema.Index{
  879. {
  880. Name: "sopnode_name",
  881. Unique: false,
  882. Columns: []*schema.Column{SopNodeColumns[6]},
  883. },
  884. },
  885. }
  886. // SopStageColumns holds the columns for the "sop_stage" table.
  887. SopStageColumns = []*schema.Column{
  888. {Name: "id", Type: field.TypeUint64, Increment: true},
  889. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  890. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  891. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  892. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  893. {Name: "name", Type: field.TypeString, Comment: "阶段名称", Default: ""},
  894. {Name: "condition_type", Type: field.TypeInt, Comment: "客群筛选条件类型 1 按标签筛选 2 按客户基本信息筛选", Default: 1},
  895. {Name: "condition_operator", Type: field.TypeInt, Comment: "筛选条件关系 1 满足所有条件(and) 2 满足任意条件(or)", Default: 1},
  896. {Name: "condition_list", Type: field.TypeJSON, Comment: "筛选条件列表"},
  897. {Name: "action_message", Type: field.TypeJSON, Nullable: true, Comment: "命中后发送的消息内容"},
  898. {Name: "action_label_add", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要打的标签"},
  899. {Name: "action_label_del", Type: field.TypeJSON, Nullable: true, Comment: "命中后需要移除的标签"},
  900. {Name: "action_forward", Type: field.TypeJSON, Nullable: true, Comment: "命中后转发的消息"},
  901. {Name: "index_sort", Type: field.TypeInt, Nullable: true, Comment: "阶段顺序", Default: 1},
  902. {Name: "task_id", Type: field.TypeUint64, Comment: "SOP 任务 ID"},
  903. }
  904. // SopStageTable holds the schema information for the "sop_stage" table.
  905. SopStageTable = &schema.Table{
  906. Name: "sop_stage",
  907. Columns: SopStageColumns,
  908. PrimaryKey: []*schema.Column{SopStageColumns[0]},
  909. ForeignKeys: []*schema.ForeignKey{
  910. {
  911. Symbol: "sop_stage_sop_task_task_stages",
  912. Columns: []*schema.Column{SopStageColumns[14]},
  913. RefColumns: []*schema.Column{SopTaskColumns[0]},
  914. OnDelete: schema.NoAction,
  915. },
  916. },
  917. Indexes: []*schema.Index{
  918. {
  919. Name: "sopstage_name",
  920. Unique: false,
  921. Columns: []*schema.Column{SopStageColumns[5]},
  922. },
  923. },
  924. }
  925. // SopTaskColumns holds the columns for the "sop_task" table.
  926. SopTaskColumns = []*schema.Column{
  927. {Name: "id", Type: field.TypeUint64, Increment: true},
  928. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  929. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  930. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  931. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  932. {Name: "name", Type: field.TypeString, Comment: "SOP 任务名称"},
  933. {Name: "bot_wxid_list", Type: field.TypeJSON, Nullable: true, Comment: "机器人微信 id 列表"},
  934. {Name: "type", Type: field.TypeInt, Comment: "标签类型:1好友,2群组,3企业微信联系人", Default: 1},
  935. {Name: "plan_start_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划开始时间"},
  936. {Name: "plan_end_time", Type: field.TypeTime, Nullable: true, Comment: "任务计划结束时间"},
  937. {Name: "creator_id", Type: field.TypeString, Nullable: true, Comment: "创建者 id"},
  938. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  939. {Name: "token", Type: field.TypeJSON, Nullable: true, Comment: "Token"},
  940. }
  941. // SopTaskTable holds the schema information for the "sop_task" table.
  942. SopTaskTable = &schema.Table{
  943. Name: "sop_task",
  944. Columns: SopTaskColumns,
  945. PrimaryKey: []*schema.Column{SopTaskColumns[0]},
  946. Indexes: []*schema.Index{
  947. {
  948. Name: "soptask_name",
  949. Unique: false,
  950. Columns: []*schema.Column{SopTaskColumns[5]},
  951. },
  952. {
  953. Name: "soptask_token",
  954. Unique: false,
  955. Columns: []*schema.Column{SopTaskColumns[12]},
  956. },
  957. },
  958. }
  959. // TokenColumns holds the columns for the "token" table.
  960. TokenColumns = []*schema.Column{
  961. {Name: "id", Type: field.TypeUint64, Increment: true},
  962. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  963. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  964. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  965. {Name: "expire_at", Type: field.TypeTime, Nullable: true, Comment: "过期时间"},
  966. {Name: "token", Type: field.TypeString, Nullable: true, Comment: "Token", Default: ""},
  967. {Name: "mac", Type: field.TypeString, Nullable: true, Comment: "Mac地址", Default: ""},
  968. {Name: "organization_id", Type: field.TypeUint64, Comment: "租户ID", Default: 0},
  969. {Name: "custom_agent_base", Type: field.TypeString, Nullable: true, Comment: "定制agent服务地址", Default: ""},
  970. {Name: "custom_agent_key", Type: field.TypeString, Nullable: true, Comment: "定制agent服务密钥", Default: ""},
  971. {Name: "openai_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  972. {Name: "openai_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  973. {Name: "agent_id", Type: field.TypeUint64, Comment: "智能体ID", Default: 0},
  974. }
  975. // TokenTable holds the schema information for the "token" table.
  976. TokenTable = &schema.Table{
  977. Name: "token",
  978. Columns: TokenColumns,
  979. PrimaryKey: []*schema.Column{TokenColumns[0]},
  980. ForeignKeys: []*schema.ForeignKey{
  981. {
  982. Symbol: "token_agent_token_agent",
  983. Columns: []*schema.Column{TokenColumns[12]},
  984. RefColumns: []*schema.Column{AgentColumns[0]},
  985. OnDelete: schema.NoAction,
  986. },
  987. },
  988. Indexes: []*schema.Index{
  989. {
  990. Name: "token_token",
  991. Unique: true,
  992. Columns: []*schema.Column{TokenColumns[5]},
  993. },
  994. },
  995. }
  996. // TutorialColumns holds the columns for the "tutorial" table.
  997. TutorialColumns = []*schema.Column{
  998. {Name: "id", Type: field.TypeUint64, Increment: true},
  999. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1000. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1001. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1002. {Name: "index", Type: field.TypeInt, Comment: "index | 序号"},
  1003. {Name: "title", Type: field.TypeString, Comment: "title | 标题"},
  1004. {Name: "content", Type: field.TypeString, Comment: "content | 内容"},
  1005. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  1006. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  1007. }
  1008. // TutorialTable holds the schema information for the "tutorial" table.
  1009. TutorialTable = &schema.Table{
  1010. Name: "tutorial",
  1011. Columns: TutorialColumns,
  1012. PrimaryKey: []*schema.Column{TutorialColumns[0]},
  1013. ForeignKeys: []*schema.ForeignKey{
  1014. {
  1015. Symbol: "tutorial_employee_em_tutorial",
  1016. Columns: []*schema.Column{TutorialColumns[8]},
  1017. RefColumns: []*schema.Column{EmployeeColumns[0]},
  1018. OnDelete: schema.NoAction,
  1019. },
  1020. },
  1021. Indexes: []*schema.Index{
  1022. {
  1023. Name: "tutorial_employee_id",
  1024. Unique: false,
  1025. Columns: []*schema.Column{TutorialColumns[8]},
  1026. },
  1027. },
  1028. }
  1029. // UsageDetailColumns holds the columns for the "usage_detail" table.
  1030. UsageDetailColumns = []*schema.Column{
  1031. {Name: "id", Type: field.TypeUint64, Increment: true},
  1032. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1033. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1034. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1035. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "1 微信 2 名片", Default: 1},
  1036. {Name: "bot_id", Type: field.TypeString, Comment: "微信或名片id", Default: ""},
  1037. {Name: "receiver_id", Type: field.TypeString, Comment: "微信id或open_id", Default: ""},
  1038. {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},
  1039. {Name: "session_id", Type: field.TypeUint64, Nullable: true, Comment: "名片会话id", Default: 1},
  1040. {Name: "request", Type: field.TypeString, Comment: "请求内容", Default: ""},
  1041. {Name: "response", Type: field.TypeString, Comment: "响应内容", Default: ""},
  1042. {Name: "original_data", Type: field.TypeJSON, Comment: "原始数据"},
  1043. {Name: "total_tokens", Type: field.TypeUint64, Nullable: true, Comment: "使用token总数", Default: 0},
  1044. {Name: "prompt_tokens", Type: field.TypeUint64, Nullable: true, Comment: "请求token数", Default: 0},
  1045. {Name: "completion_tokens", Type: field.TypeUint64, Nullable: true, Comment: "响应token数", Default: 0},
  1046. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  1047. {Name: "model", Type: field.TypeString, Nullable: true, Comment: "模型", Default: "GPT-4o mini"},
  1048. {Name: "credits", Type: field.TypeFloat64, Nullable: true, Comment: "coins | 积分消耗数"},
  1049. }
  1050. // UsageDetailTable holds the schema information for the "usage_detail" table.
  1051. UsageDetailTable = &schema.Table{
  1052. Name: "usage_detail",
  1053. Columns: UsageDetailColumns,
  1054. PrimaryKey: []*schema.Column{UsageDetailColumns[0]},
  1055. Indexes: []*schema.Index{
  1056. {
  1057. Name: "usagedetail_bot_id",
  1058. Unique: false,
  1059. Columns: []*schema.Column{UsageDetailColumns[5]},
  1060. },
  1061. {
  1062. Name: "usagedetail_organization_id",
  1063. Unique: false,
  1064. Columns: []*schema.Column{UsageDetailColumns[15]},
  1065. },
  1066. },
  1067. }
  1068. // UsageStatisticDayColumns holds the columns for the "usage_statistic_day" table.
  1069. UsageStatisticDayColumns = []*schema.Column{
  1070. {Name: "id", Type: field.TypeUint64, Increment: true},
  1071. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1072. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1073. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1074. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1075. {Name: "addtime", Type: field.TypeUint64, Comment: "写入年月日"},
  1076. {Name: "type", Type: field.TypeInt, Comment: "1-微信 2-名片"},
  1077. {Name: "bot_id", Type: field.TypeString, Nullable: true, Comment: "微信或名片id"},
  1078. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构ID"},
  1079. {Name: "ai_response", Type: field.TypeUint64, Comment: "AI回复次数"},
  1080. {Name: "sop_run", Type: field.TypeUint64, Comment: "SOP运行次数"},
  1081. {Name: "total_friend", Type: field.TypeUint64, Comment: "好友总数"},
  1082. {Name: "total_group", Type: field.TypeUint64, Comment: "群总数"},
  1083. {Name: "account_balance", Type: field.TypeUint64, Comment: "账户余额(单位:分)"},
  1084. {Name: "consume_token", Type: field.TypeUint64, Comment: "消耗token数"},
  1085. {Name: "active_user", Type: field.TypeUint64, Comment: "活跃用户数"},
  1086. {Name: "new_user", Type: field.TypeInt64, Comment: "新增用户数"},
  1087. {Name: "label_dist", Type: field.TypeJSON, Comment: "标签分布"},
  1088. {Name: "consume_coin", Type: field.TypeFloat64, Nullable: true, Comment: "消耗积分", Default: 0},
  1089. }
  1090. // UsageStatisticDayTable holds the schema information for the "usage_statistic_day" table.
  1091. UsageStatisticDayTable = &schema.Table{
  1092. Name: "usage_statistic_day",
  1093. Columns: UsageStatisticDayColumns,
  1094. PrimaryKey: []*schema.Column{UsageStatisticDayColumns[0]},
  1095. Indexes: []*schema.Index{
  1096. {
  1097. Name: "usagestatisticday_addtime",
  1098. Unique: false,
  1099. Columns: []*schema.Column{UsageStatisticDayColumns[5]},
  1100. },
  1101. {
  1102. Name: "usagestatisticday_bot_id",
  1103. Unique: false,
  1104. Columns: []*schema.Column{UsageStatisticDayColumns[7]},
  1105. },
  1106. },
  1107. }
  1108. // UsageStatisticHourColumns holds the columns for the "usage_statistic_hour" table.
  1109. UsageStatisticHourColumns = []*schema.Column{
  1110. {Name: "id", Type: field.TypeUint64, Increment: true},
  1111. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1112. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1113. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1114. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1115. {Name: "addtime", Type: field.TypeUint64, Comment: "写入小时"},
  1116. {Name: "type", Type: field.TypeInt, Comment: "1-微信 2-名片"},
  1117. {Name: "bot_id", Type: field.TypeString, Nullable: true, Comment: "微信或名片id"},
  1118. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构ID"},
  1119. {Name: "ai_response", Type: field.TypeUint64, Comment: "AI回复次数"},
  1120. {Name: "sop_run", Type: field.TypeUint64, Comment: "SOP运行次数"},
  1121. {Name: "total_friend", Type: field.TypeUint64, Comment: "好友总数"},
  1122. {Name: "total_group", Type: field.TypeUint64, Comment: "群总数"},
  1123. {Name: "account_balance", Type: field.TypeUint64, Comment: "账户余额(单位:分)"},
  1124. {Name: "consume_token", Type: field.TypeUint64, Comment: "消耗token数"},
  1125. {Name: "active_user", Type: field.TypeUint64, Comment: "活跃用户数"},
  1126. {Name: "new_user", Type: field.TypeInt64, Comment: "新增用户数"},
  1127. {Name: "label_dist", Type: field.TypeJSON, Comment: "标签分布"},
  1128. {Name: "consume_coin", Type: field.TypeFloat64, Nullable: true, Comment: "消耗积分", Default: 0},
  1129. }
  1130. // UsageStatisticHourTable holds the schema information for the "usage_statistic_hour" table.
  1131. UsageStatisticHourTable = &schema.Table{
  1132. Name: "usage_statistic_hour",
  1133. Columns: UsageStatisticHourColumns,
  1134. PrimaryKey: []*schema.Column{UsageStatisticHourColumns[0]},
  1135. Indexes: []*schema.Index{
  1136. {
  1137. Name: "usagestatistichour_addtime",
  1138. Unique: false,
  1139. Columns: []*schema.Column{UsageStatisticHourColumns[5]},
  1140. },
  1141. {
  1142. Name: "usagestatistichour_bot_id",
  1143. Unique: false,
  1144. Columns: []*schema.Column{UsageStatisticHourColumns[7]},
  1145. },
  1146. },
  1147. }
  1148. // UsageStatisticMonthColumns holds the columns for the "usage_statistic_month" table.
  1149. UsageStatisticMonthColumns = []*schema.Column{
  1150. {Name: "id", Type: field.TypeUint64, Increment: true},
  1151. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1152. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1153. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1154. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1155. {Name: "addtime", Type: field.TypeUint64, Comment: "写入年月"},
  1156. {Name: "type", Type: field.TypeInt, Comment: "1-微信 2-名片"},
  1157. {Name: "bot_id", Type: field.TypeString, Nullable: true, Comment: "微信或名片id"},
  1158. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构ID"},
  1159. {Name: "ai_response", Type: field.TypeUint64, Comment: "AI回复次数"},
  1160. {Name: "sop_run", Type: field.TypeUint64, Comment: "SOP运行次数"},
  1161. {Name: "total_friend", Type: field.TypeUint64, Comment: "好友总数"},
  1162. {Name: "total_group", Type: field.TypeUint64, Comment: "群总数"},
  1163. {Name: "account_balance", Type: field.TypeUint64, Comment: "账户余额(单位:分)"},
  1164. {Name: "consume_token", Type: field.TypeUint64, Comment: "消耗token数"},
  1165. {Name: "active_user", Type: field.TypeUint64, Comment: "活跃用户数"},
  1166. {Name: "new_user", Type: field.TypeInt64, Comment: "新增用户数"},
  1167. {Name: "label_dist", Type: field.TypeJSON, Comment: "标签分布"},
  1168. {Name: "consume_coin", Type: field.TypeFloat64, Nullable: true, Comment: "消耗积分", Default: 0},
  1169. }
  1170. // UsageStatisticMonthTable holds the schema information for the "usage_statistic_month" table.
  1171. UsageStatisticMonthTable = &schema.Table{
  1172. Name: "usage_statistic_month",
  1173. Columns: UsageStatisticMonthColumns,
  1174. PrimaryKey: []*schema.Column{UsageStatisticMonthColumns[0]},
  1175. Indexes: []*schema.Index{
  1176. {
  1177. Name: "usagestatisticmonth_addtime",
  1178. Unique: false,
  1179. Columns: []*schema.Column{UsageStatisticMonthColumns[5]},
  1180. },
  1181. {
  1182. Name: "usagestatisticmonth_bot_id",
  1183. Unique: false,
  1184. Columns: []*schema.Column{UsageStatisticMonthColumns[7]},
  1185. },
  1186. },
  1187. }
  1188. // UsageTotalColumns holds the columns for the "usage_total" table.
  1189. UsageTotalColumns = []*schema.Column{
  1190. {Name: "id", Type: field.TypeUint64, Increment: true},
  1191. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1192. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1193. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1194. {Name: "type", Type: field.TypeInt, Nullable: true, Comment: "1 微信 2 名片", Default: 1},
  1195. {Name: "bot_id", Type: field.TypeString, Comment: "微信或名片id", Default: ""},
  1196. {Name: "total_tokens", Type: field.TypeUint64, Nullable: true, Comment: "使用token总数", Default: 0},
  1197. {Name: "credits", Type: field.TypeFloat64, Nullable: true, Comment: "使用积分总数", Default: 0},
  1198. {Name: "start_index", Type: field.TypeUint64, Nullable: true, Comment: "重制后的起始usage_detail 索引", Default: 0},
  1199. {Name: "end_index", Type: field.TypeUint64, Nullable: true, Comment: "usage_detail 索引", Default: 0},
  1200. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  1201. }
  1202. // UsageTotalTable holds the schema information for the "usage_total" table.
  1203. UsageTotalTable = &schema.Table{
  1204. Name: "usage_total",
  1205. Columns: UsageTotalColumns,
  1206. PrimaryKey: []*schema.Column{UsageTotalColumns[0]},
  1207. Indexes: []*schema.Index{
  1208. {
  1209. Name: "usagetotal_bot_id",
  1210. Unique: false,
  1211. Columns: []*schema.Column{UsageTotalColumns[5]},
  1212. },
  1213. {
  1214. Name: "usagetotal_organization_id",
  1215. Unique: false,
  1216. Columns: []*schema.Column{UsageTotalColumns[10]},
  1217. },
  1218. },
  1219. }
  1220. // WhatsappColumns holds the columns for the "whatsapp" table.
  1221. WhatsappColumns = []*schema.Column{
  1222. {Name: "id", Type: field.TypeUint64, Increment: true},
  1223. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1224. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1225. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1226. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1227. {Name: "wa_id", Type: field.TypeString, Nullable: true, Default: ""},
  1228. {Name: "wa_name", Type: field.TypeString, Nullable: true, Default: ""},
  1229. {Name: "callback", Type: field.TypeString, Nullable: true, Default: ""},
  1230. {Name: "account", Type: field.TypeString, Nullable: true, Default: ""},
  1231. {Name: "cc", Type: field.TypeString, Default: ""},
  1232. {Name: "phone", Type: field.TypeString, Default: ""},
  1233. {Name: "cc_phone", Type: field.TypeString, Default: ""},
  1234. {Name: "phone_name", Type: field.TypeString, Default: ""},
  1235. {Name: "phone_status", Type: field.TypeInt8, Default: 0},
  1236. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Default: 0},
  1237. {Name: "api_base", Type: field.TypeString, Nullable: true, Default: ""},
  1238. {Name: "api_key", Type: field.TypeString, Nullable: true, Default: ""},
  1239. {Name: "allow_list", Type: field.TypeJSON, Nullable: true},
  1240. {Name: "group_allow_list", Type: field.TypeJSON, Nullable: true},
  1241. {Name: "block_list", Type: field.TypeJSON, Nullable: true},
  1242. {Name: "group_block_list", Type: field.TypeJSON, Nullable: true},
  1243. {Name: "agent_id", Type: field.TypeUint64, Default: 0},
  1244. }
  1245. // WhatsappTable holds the schema information for the "whatsapp" table.
  1246. WhatsappTable = &schema.Table{
  1247. Name: "whatsapp",
  1248. Columns: WhatsappColumns,
  1249. PrimaryKey: []*schema.Column{WhatsappColumns[0]},
  1250. ForeignKeys: []*schema.ForeignKey{
  1251. {
  1252. Symbol: "whatsapp_agent_wa_agent",
  1253. Columns: []*schema.Column{WhatsappColumns[21]},
  1254. RefColumns: []*schema.Column{AgentColumns[0]},
  1255. OnDelete: schema.NoAction,
  1256. },
  1257. },
  1258. }
  1259. // WhatsappChannelColumns holds the columns for the "whatsapp_channel" table.
  1260. WhatsappChannelColumns = []*schema.Column{
  1261. {Name: "id", Type: field.TypeUint64, Increment: true},
  1262. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1263. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1264. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1265. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1266. {Name: "ak", Type: field.TypeString, Nullable: true, Default: ""},
  1267. {Name: "sk", Type: field.TypeString, Default: ""},
  1268. {Name: "wa_id", Type: field.TypeString, Nullable: true, Default: ""},
  1269. {Name: "wa_name", Type: field.TypeString, Nullable: true, Default: ""},
  1270. {Name: "waba_id", Type: field.TypeUint64, Default: 0},
  1271. {Name: "business_id", Type: field.TypeUint64, Default: 0},
  1272. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Default: 0},
  1273. {Name: "verify_account", Type: field.TypeString, Default: ""},
  1274. }
  1275. // WhatsappChannelTable holds the schema information for the "whatsapp_channel" table.
  1276. WhatsappChannelTable = &schema.Table{
  1277. Name: "whatsapp_channel",
  1278. Columns: WhatsappChannelColumns,
  1279. PrimaryKey: []*schema.Column{WhatsappChannelColumns[0]},
  1280. Indexes: []*schema.Index{
  1281. {
  1282. Name: "whatsappchannel_ak_sk",
  1283. Unique: false,
  1284. Columns: []*schema.Column{WhatsappChannelColumns[5], WhatsappChannelColumns[6]},
  1285. },
  1286. },
  1287. }
  1288. // WorkExperienceColumns holds the columns for the "work_experience" table.
  1289. WorkExperienceColumns = []*schema.Column{
  1290. {Name: "id", Type: field.TypeUint64, Increment: true},
  1291. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1292. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1293. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1294. {Name: "start_date", Type: field.TypeTime, Comment: "start_date | 开始时间"},
  1295. {Name: "end_date", Type: field.TypeTime, Comment: "end_date | 结束时间"},
  1296. {Name: "company", Type: field.TypeString, Comment: "company | 公司名"},
  1297. {Name: "experience", Type: field.TypeString, Size: 2147483647, Comment: "experience | 工作内容"},
  1298. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  1299. {Name: "employee_id", Type: field.TypeUint64, Comment: "employee_id | 员工ID"},
  1300. }
  1301. // WorkExperienceTable holds the schema information for the "work_experience" table.
  1302. WorkExperienceTable = &schema.Table{
  1303. Name: "work_experience",
  1304. Columns: WorkExperienceColumns,
  1305. PrimaryKey: []*schema.Column{WorkExperienceColumns[0]},
  1306. ForeignKeys: []*schema.ForeignKey{
  1307. {
  1308. Symbol: "work_experience_employee_em_work_experiences",
  1309. Columns: []*schema.Column{WorkExperienceColumns[9]},
  1310. RefColumns: []*schema.Column{EmployeeColumns[0]},
  1311. OnDelete: schema.NoAction,
  1312. },
  1313. },
  1314. Indexes: []*schema.Index{
  1315. {
  1316. Name: "workexperience_employee_id",
  1317. Unique: false,
  1318. Columns: []*schema.Column{WorkExperienceColumns[9]},
  1319. },
  1320. },
  1321. }
  1322. // WpChatroomColumns holds the columns for the "wp_chatroom" table.
  1323. WpChatroomColumns = []*schema.Column{
  1324. {Name: "id", Type: field.TypeUint64, Increment: true},
  1325. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1326. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1327. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1328. {Name: "wx_wxid", Type: field.TypeString, Comment: "所属微信id", Default: ""},
  1329. {Name: "chatroom_id", Type: field.TypeString, Comment: "群id", Default: ""},
  1330. {Name: "nickname", Type: field.TypeString, Comment: "群昵称", Default: ""},
  1331. {Name: "owner", Type: field.TypeString, Comment: "群主", Default: ""},
  1332. {Name: "avatar", Type: field.TypeString, Comment: "群头像", Default: ""},
  1333. {Name: "member_list", Type: field.TypeJSON, Comment: "群成员"},
  1334. }
  1335. // WpChatroomTable holds the schema information for the "wp_chatroom" table.
  1336. WpChatroomTable = &schema.Table{
  1337. Name: "wp_chatroom",
  1338. Columns: WpChatroomColumns,
  1339. PrimaryKey: []*schema.Column{WpChatroomColumns[0]},
  1340. Indexes: []*schema.Index{
  1341. {
  1342. Name: "wpchatroom_wx_wxid_chatroom_id",
  1343. Unique: false,
  1344. Columns: []*schema.Column{WpChatroomColumns[4], WpChatroomColumns[5]},
  1345. },
  1346. },
  1347. }
  1348. // WpChatroomMemberColumns holds the columns for the "wp_chatroom_member" table.
  1349. WpChatroomMemberColumns = []*schema.Column{
  1350. {Name: "id", Type: field.TypeUint64, Increment: true},
  1351. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1352. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1353. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1354. {Name: "wx_wxid", Type: field.TypeString, Comment: "所属微信id", Default: ""},
  1355. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  1356. {Name: "nickname", Type: field.TypeString, Comment: "群昵称", Default: ""},
  1357. {Name: "avatar", Type: field.TypeString, Comment: "群头像", Default: ""},
  1358. }
  1359. // WpChatroomMemberTable holds the schema information for the "wp_chatroom_member" table.
  1360. WpChatroomMemberTable = &schema.Table{
  1361. Name: "wp_chatroom_member",
  1362. Columns: WpChatroomMemberColumns,
  1363. PrimaryKey: []*schema.Column{WpChatroomMemberColumns[0]},
  1364. Indexes: []*schema.Index{
  1365. {
  1366. Name: "wpchatroommember_wx_wxid_wxid",
  1367. Unique: false,
  1368. Columns: []*schema.Column{WpChatroomMemberColumns[4], WpChatroomMemberColumns[5]},
  1369. },
  1370. },
  1371. }
  1372. // WxColumns holds the columns for the "wx" table.
  1373. WxColumns = []*schema.Column{
  1374. {Name: "id", Type: field.TypeUint64, Increment: true},
  1375. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1376. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1377. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1378. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1379. {Name: "port", Type: field.TypeString, Comment: "端口号", Default: ""},
  1380. {Name: "process_id", Type: field.TypeString, Comment: "进程号", Default: ""},
  1381. {Name: "callback", Type: field.TypeString, Comment: "回调地址", Default: ""},
  1382. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  1383. {Name: "account", Type: field.TypeString, Comment: "微信账号", Default: ""},
  1384. {Name: "nickname", Type: field.TypeString, Comment: "微信昵称", Default: ""},
  1385. {Name: "tel", Type: field.TypeString, Comment: "手机号", Default: ""},
  1386. {Name: "head_big", Type: field.TypeString, Comment: "微信头像", Default: ""},
  1387. {Name: "organization_id", Type: field.TypeUint64, Nullable: true, Comment: "机构 ID", Default: 1},
  1388. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  1389. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  1390. {Name: "allow_list", Type: field.TypeJSON, Comment: "白名单"},
  1391. {Name: "group_allow_list", Type: field.TypeJSON, Comment: "群白名单"},
  1392. {Name: "block_list", Type: field.TypeJSON, Comment: "黑名单"},
  1393. {Name: "group_block_list", Type: field.TypeJSON, Comment: "群黑名单"},
  1394. {Name: "ctype", Type: field.TypeUint64, Nullable: true, Comment: "账号类型:1-个微 2-企微", Default: 1},
  1395. {Name: "agent_id", Type: field.TypeUint64, Comment: "模式ID", Default: 0},
  1396. {Name: "agent_base_wx_agent", Type: field.TypeString, Nullable: true},
  1397. {Name: "server_id", Type: field.TypeUint64, Nullable: true, Comment: "服务器id", Default: 0},
  1398. }
  1399. // WxTable holds the schema information for the "wx" table.
  1400. WxTable = &schema.Table{
  1401. Name: "wx",
  1402. Columns: WxColumns,
  1403. PrimaryKey: []*schema.Column{WxColumns[0]},
  1404. ForeignKeys: []*schema.ForeignKey{
  1405. {
  1406. Symbol: "wx_agent_wx_agent",
  1407. Columns: []*schema.Column{WxColumns[21]},
  1408. RefColumns: []*schema.Column{AgentColumns[0]},
  1409. OnDelete: schema.NoAction,
  1410. },
  1411. {
  1412. Symbol: "wx_agent_base_wx_agent",
  1413. Columns: []*schema.Column{WxColumns[22]},
  1414. RefColumns: []*schema.Column{AgentBaseColumns[0]},
  1415. OnDelete: schema.SetNull,
  1416. },
  1417. {
  1418. Symbol: "wx_server_wxs",
  1419. Columns: []*schema.Column{WxColumns[23]},
  1420. RefColumns: []*schema.Column{ServerColumns[0]},
  1421. OnDelete: schema.SetNull,
  1422. },
  1423. },
  1424. Indexes: []*schema.Index{
  1425. {
  1426. Name: "wx_server_id_port_ctype",
  1427. Unique: true,
  1428. Columns: []*schema.Column{WxColumns[23], WxColumns[5], WxColumns[20]},
  1429. },
  1430. {
  1431. Name: "wx_wxid",
  1432. Unique: true,
  1433. Columns: []*schema.Column{WxColumns[8]},
  1434. },
  1435. {
  1436. Name: "wx_account",
  1437. Unique: false,
  1438. Columns: []*schema.Column{WxColumns[9]},
  1439. },
  1440. {
  1441. Name: "wx_nickname",
  1442. Unique: false,
  1443. Columns: []*schema.Column{WxColumns[10]},
  1444. },
  1445. {
  1446. Name: "wx_tel",
  1447. Unique: false,
  1448. Columns: []*schema.Column{WxColumns[11]},
  1449. },
  1450. },
  1451. }
  1452. // WxCardColumns holds the columns for the "wx_card" table.
  1453. WxCardColumns = []*schema.Column{
  1454. {Name: "id", Type: field.TypeUint64, Increment: true},
  1455. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1456. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1457. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1458. {Name: "user_id", Type: field.TypeUint64, Nullable: true, Comment: "user表ID", Default: 0},
  1459. {Name: "wx_user_id", Type: field.TypeUint64, Nullable: true, Comment: "wx表ID", Default: 0},
  1460. {Name: "avatar", Type: field.TypeString, Comment: "头像", Default: ""},
  1461. {Name: "logo", Type: field.TypeString, Comment: "logo", Default: ""},
  1462. {Name: "name", Type: field.TypeString, Comment: "名称", Default: ""},
  1463. {Name: "company", Type: field.TypeString, Comment: "公司", Default: ""},
  1464. {Name: "address", Type: field.TypeString, Comment: "地址", Default: ""},
  1465. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  1466. {Name: "official_account", Type: field.TypeString, Comment: "公众号", Default: ""},
  1467. {Name: "wechat_account", Type: field.TypeString, Comment: "微信号", Default: ""},
  1468. {Name: "email", Type: field.TypeString, Nullable: true, Comment: "邮箱", Default: ""},
  1469. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "fastgpt-base"},
  1470. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "fastgpt-key"},
  1471. {Name: "ai_info", Type: field.TypeString, Nullable: true, Comment: "AI信息"},
  1472. {Name: "intro", Type: field.TypeString, Nullable: true, Comment: "个人介绍", Default: ""},
  1473. }
  1474. // WxCardTable holds the schema information for the "wx_card" table.
  1475. WxCardTable = &schema.Table{
  1476. Name: "wx_card",
  1477. Columns: WxCardColumns,
  1478. PrimaryKey: []*schema.Column{WxCardColumns[0]},
  1479. Indexes: []*schema.Index{
  1480. {
  1481. Name: "wxcard_user_id",
  1482. Unique: false,
  1483. Columns: []*schema.Column{WxCardColumns[4]},
  1484. },
  1485. {
  1486. Name: "wxcard_wx_user_id",
  1487. Unique: false,
  1488. Columns: []*schema.Column{WxCardColumns[5]},
  1489. },
  1490. },
  1491. }
  1492. // WxCardUserColumns holds the columns for the "wx_card_user" table.
  1493. WxCardUserColumns = []*schema.Column{
  1494. {Name: "id", Type: field.TypeUint64, Increment: true},
  1495. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1496. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1497. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1498. {Name: "wxid", Type: field.TypeString, Comment: "微信id", Default: ""},
  1499. {Name: "account", Type: field.TypeString, Comment: "微信号", Default: ""},
  1500. {Name: "avatar", Type: field.TypeString, Comment: "头像", Default: ""},
  1501. {Name: "nickname", Type: field.TypeString, Comment: "昵称", Default: ""},
  1502. {Name: "remark", Type: field.TypeString, Comment: "备注名", Default: ""},
  1503. {Name: "phone", Type: field.TypeString, Comment: "手机号", Default: ""},
  1504. {Name: "open_id", Type: field.TypeString, Comment: "OpenID", Default: ""},
  1505. {Name: "union_id", Type: field.TypeString, Comment: "UnionID", Default: ""},
  1506. {Name: "session_key", Type: field.TypeString, Comment: "SessionKey", Default: ""},
  1507. {Name: "is_vip", Type: field.TypeInt, Comment: "是否VIP:0-否 1-是", Default: 0},
  1508. }
  1509. // WxCardUserTable holds the schema information for the "wx_card_user" table.
  1510. WxCardUserTable = &schema.Table{
  1511. Name: "wx_card_user",
  1512. Columns: WxCardUserColumns,
  1513. PrimaryKey: []*schema.Column{WxCardUserColumns[0]},
  1514. Indexes: []*schema.Index{
  1515. {
  1516. Name: "wxcarduser_wxid_open_id",
  1517. Unique: false,
  1518. Columns: []*schema.Column{WxCardUserColumns[4], WxCardUserColumns[10]},
  1519. },
  1520. },
  1521. }
  1522. // WxCardVisitColumns holds the columns for the "wx_card_visit" table.
  1523. WxCardVisitColumns = []*schema.Column{
  1524. {Name: "id", Type: field.TypeUint64, Increment: true},
  1525. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1526. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1527. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1528. {Name: "user_id", Type: field.TypeUint64, Nullable: true, Comment: "user表ID", Default: 0},
  1529. {Name: "bot_id", Type: field.TypeUint64, Comment: "被访ID", Default: 0},
  1530. {Name: "bot_type", Type: field.TypeUint8, Comment: "类型:1-微信 2-小程序 3-智能体", Default: 0},
  1531. }
  1532. // WxCardVisitTable holds the schema information for the "wx_card_visit" table.
  1533. WxCardVisitTable = &schema.Table{
  1534. Name: "wx_card_visit",
  1535. Columns: WxCardVisitColumns,
  1536. PrimaryKey: []*schema.Column{WxCardVisitColumns[0]},
  1537. Indexes: []*schema.Index{
  1538. {
  1539. Name: "wxcardvisit_user_id",
  1540. Unique: false,
  1541. Columns: []*schema.Column{WxCardVisitColumns[4]},
  1542. },
  1543. {
  1544. Name: "wxcardvisit_bot_id_bot_type",
  1545. Unique: false,
  1546. Columns: []*schema.Column{WxCardVisitColumns[5], WxCardVisitColumns[6]},
  1547. },
  1548. },
  1549. }
  1550. // XunjiColumns holds the columns for the "xunji" table.
  1551. XunjiColumns = []*schema.Column{
  1552. {Name: "id", Type: field.TypeUint64, Increment: true},
  1553. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1554. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1555. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1556. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1557. {Name: "app_key", Type: field.TypeString, Nullable: true, Comment: "AppKey"},
  1558. {Name: "app_secret", Type: field.TypeString, Nullable: true, Comment: "AppSecret"},
  1559. {Name: "token", Type: field.TypeString, Nullable: true, Comment: "Token"},
  1560. {Name: "encoding_key", Type: field.TypeString, Nullable: true, Comment: "加密key"},
  1561. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  1562. }
  1563. // XunjiTable holds the schema information for the "xunji" table.
  1564. XunjiTable = &schema.Table{
  1565. Name: "xunji",
  1566. Columns: XunjiColumns,
  1567. PrimaryKey: []*schema.Column{XunjiColumns[0]},
  1568. Indexes: []*schema.Index{
  1569. {
  1570. Name: "xunji_app_key_token",
  1571. Unique: false,
  1572. Columns: []*schema.Column{XunjiColumns[5], XunjiColumns[7]},
  1573. },
  1574. },
  1575. }
  1576. // XunjiServiceColumns holds the columns for the "xunji_service" table.
  1577. XunjiServiceColumns = []*schema.Column{
  1578. {Name: "id", Type: field.TypeUint64, Increment: true},
  1579. {Name: "created_at", Type: field.TypeTime, Comment: "Create Time | 创建日期"},
  1580. {Name: "updated_at", Type: field.TypeTime, Comment: "Update Time | 修改日期"},
  1581. {Name: "status", Type: field.TypeUint8, Nullable: true, Comment: "Status 1: normal 2: ban | 状态 1 正常 2 禁用", Default: 1},
  1582. {Name: "deleted_at", Type: field.TypeTime, Nullable: true, Comment: "Delete Time | 删除日期"},
  1583. {Name: "xunji_id", Type: field.TypeUint64, Comment: "Xunji表ID"},
  1584. {Name: "organization_id", Type: field.TypeUint64, Comment: "organization_id | 租户ID"},
  1585. {Name: "wxid", Type: field.TypeString, Comment: "微信ID"},
  1586. {Name: "api_base", Type: field.TypeString, Nullable: true, Comment: "大模型服务地址", Default: ""},
  1587. {Name: "api_key", Type: field.TypeString, Nullable: true, Comment: "大模型服务密钥", Default: ""},
  1588. {Name: "agent_id", Type: field.TypeUint64, Comment: "智能体ID", Default: 0},
  1589. }
  1590. // XunjiServiceTable holds the schema information for the "xunji_service" table.
  1591. XunjiServiceTable = &schema.Table{
  1592. Name: "xunji_service",
  1593. Columns: XunjiServiceColumns,
  1594. PrimaryKey: []*schema.Column{XunjiServiceColumns[0]},
  1595. ForeignKeys: []*schema.ForeignKey{
  1596. {
  1597. Symbol: "xunji_service_agent_xjs_agent",
  1598. Columns: []*schema.Column{XunjiServiceColumns[10]},
  1599. RefColumns: []*schema.Column{AgentColumns[0]},
  1600. OnDelete: schema.NoAction,
  1601. },
  1602. },
  1603. Indexes: []*schema.Index{
  1604. {
  1605. Name: "xunjiservice_xunji_id",
  1606. Unique: false,
  1607. Columns: []*schema.Column{XunjiServiceColumns[5]},
  1608. },
  1609. {
  1610. Name: "xunjiservice_wxid",
  1611. Unique: false,
  1612. Columns: []*schema.Column{XunjiServiceColumns[7]},
  1613. },
  1614. },
  1615. }
  1616. // Tables holds all the tables in the schema.
  1617. Tables = []*schema.Table{
  1618. AddWechatFriendLogTable,
  1619. AgentTable,
  1620. AgentBaseTable,
  1621. AliyunAvatarTable,
  1622. AllocAgentTable,
  1623. APIKeyTable,
  1624. BatchMsgTable,
  1625. CategoryTable,
  1626. ChatRecordsTable,
  1627. ChatSessionTable,
  1628. CompapiAsynctaskTable,
  1629. ContactTable,
  1630. ContactFieldTable,
  1631. ContactFieldTemplateTable,
  1632. CreditBalanceTable,
  1633. CreditUsageTable,
  1634. EmployeeTable,
  1635. EmployeeConfigTable,
  1636. LabelTable,
  1637. LabelLogTable,
  1638. LabelRelationshipTable,
  1639. LabelTaggingTable,
  1640. MessagesTable,
  1641. MessageRecordsTable,
  1642. MsgTable,
  1643. PayRechargeTable,
  1644. ServerTable,
  1645. SopNodeTable,
  1646. SopStageTable,
  1647. SopTaskTable,
  1648. TokenTable,
  1649. TutorialTable,
  1650. UsageDetailTable,
  1651. UsageStatisticDayTable,
  1652. UsageStatisticHourTable,
  1653. UsageStatisticMonthTable,
  1654. UsageTotalTable,
  1655. WhatsappTable,
  1656. WhatsappChannelTable,
  1657. WorkExperienceTable,
  1658. WpChatroomTable,
  1659. WpChatroomMemberTable,
  1660. WxTable,
  1661. WxCardTable,
  1662. WxCardUserTable,
  1663. WxCardVisitTable,
  1664. XunjiTable,
  1665. XunjiServiceTable,
  1666. }
  1667. )
  1668. func init() {
  1669. AddWechatFriendLogTable.Annotation = &entsql.Annotation{
  1670. Table: "add_wechat_friend_log",
  1671. }
  1672. AgentTable.Annotation = &entsql.Annotation{
  1673. Table: "agent",
  1674. }
  1675. AgentBaseTable.Annotation = &entsql.Annotation{
  1676. Table: "agent_base",
  1677. }
  1678. AliyunAvatarTable.Annotation = &entsql.Annotation{
  1679. Table: "aliyun_avatar",
  1680. }
  1681. AllocAgentTable.Annotation = &entsql.Annotation{
  1682. Table: "alloc_agent",
  1683. }
  1684. APIKeyTable.ForeignKeys[0].RefTable = AgentTable
  1685. APIKeyTable.Annotation = &entsql.Annotation{
  1686. Table: "api_key",
  1687. }
  1688. BatchMsgTable.Annotation = &entsql.Annotation{
  1689. Table: "batch_msg",
  1690. }
  1691. CategoryTable.Annotation = &entsql.Annotation{
  1692. Table: "category",
  1693. }
  1694. ChatRecordsTable.Annotation = &entsql.Annotation{
  1695. Table: "chat_records",
  1696. }
  1697. ChatSessionTable.Annotation = &entsql.Annotation{
  1698. Table: "chat_session",
  1699. }
  1700. CompapiAsynctaskTable.Annotation = &entsql.Annotation{
  1701. Table: "compapi_asynctask",
  1702. }
  1703. ContactTable.Annotation = &entsql.Annotation{
  1704. Table: "contact",
  1705. }
  1706. ContactFieldTable.ForeignKeys[0].RefTable = ContactTable
  1707. ContactFieldTable.Annotation = &entsql.Annotation{
  1708. Table: "contact_field",
  1709. }
  1710. ContactFieldTemplateTable.Annotation = &entsql.Annotation{
  1711. Table: "contact_field_template",
  1712. }
  1713. CreditBalanceTable.Annotation = &entsql.Annotation{
  1714. Table: "credit_balance",
  1715. }
  1716. CreditUsageTable.Annotation = &entsql.Annotation{
  1717. Table: "credit_usage",
  1718. }
  1719. EmployeeTable.Annotation = &entsql.Annotation{
  1720. Table: "employee",
  1721. }
  1722. EmployeeConfigTable.Annotation = &entsql.Annotation{
  1723. Table: "employee_config",
  1724. }
  1725. LabelTable.Annotation = &entsql.Annotation{
  1726. Table: "label",
  1727. }
  1728. LabelLogTable.Annotation = &entsql.Annotation{
  1729. Table: "label_log",
  1730. }
  1731. LabelRelationshipTable.ForeignKeys[0].RefTable = ContactTable
  1732. LabelRelationshipTable.ForeignKeys[1].RefTable = LabelTable
  1733. LabelRelationshipTable.Annotation = &entsql.Annotation{
  1734. Table: "label_relationship",
  1735. }
  1736. LabelTaggingTable.Annotation = &entsql.Annotation{
  1737. Table: "label_tagging",
  1738. }
  1739. MessagesTable.Annotation = &entsql.Annotation{
  1740. Table: "messages",
  1741. }
  1742. MessageRecordsTable.ForeignKeys[0].RefTable = ContactTable
  1743. MessageRecordsTable.ForeignKeys[1].RefTable = SopNodeTable
  1744. MessageRecordsTable.ForeignKeys[2].RefTable = SopStageTable
  1745. MessageRecordsTable.Annotation = &entsql.Annotation{
  1746. Table: "message_records",
  1747. }
  1748. MsgTable.Annotation = &entsql.Annotation{
  1749. Table: "msg",
  1750. }
  1751. PayRechargeTable.Annotation = &entsql.Annotation{
  1752. Table: "pay_recharge",
  1753. }
  1754. ServerTable.Annotation = &entsql.Annotation{
  1755. Table: "server",
  1756. }
  1757. SopNodeTable.ForeignKeys[0].RefTable = SopStageTable
  1758. SopNodeTable.Annotation = &entsql.Annotation{
  1759. Table: "sop_node",
  1760. }
  1761. SopStageTable.ForeignKeys[0].RefTable = SopTaskTable
  1762. SopStageTable.Annotation = &entsql.Annotation{
  1763. Table: "sop_stage",
  1764. }
  1765. SopTaskTable.Annotation = &entsql.Annotation{
  1766. Table: "sop_task",
  1767. }
  1768. TokenTable.ForeignKeys[0].RefTable = AgentTable
  1769. TokenTable.Annotation = &entsql.Annotation{
  1770. Table: "token",
  1771. }
  1772. TutorialTable.ForeignKeys[0].RefTable = EmployeeTable
  1773. TutorialTable.Annotation = &entsql.Annotation{
  1774. Table: "tutorial",
  1775. }
  1776. UsageDetailTable.Annotation = &entsql.Annotation{
  1777. Table: "usage_detail",
  1778. }
  1779. UsageStatisticDayTable.Annotation = &entsql.Annotation{
  1780. Table: "usage_statistic_day",
  1781. }
  1782. UsageStatisticHourTable.Annotation = &entsql.Annotation{
  1783. Table: "usage_statistic_hour",
  1784. }
  1785. UsageStatisticMonthTable.Annotation = &entsql.Annotation{
  1786. Table: "usage_statistic_month",
  1787. }
  1788. UsageTotalTable.Annotation = &entsql.Annotation{
  1789. Table: "usage_total",
  1790. }
  1791. WhatsappTable.ForeignKeys[0].RefTable = AgentTable
  1792. WhatsappTable.Annotation = &entsql.Annotation{
  1793. Table: "whatsapp",
  1794. }
  1795. WhatsappChannelTable.Annotation = &entsql.Annotation{
  1796. Table: "whatsapp_channel",
  1797. }
  1798. WorkExperienceTable.ForeignKeys[0].RefTable = EmployeeTable
  1799. WorkExperienceTable.Annotation = &entsql.Annotation{
  1800. Table: "work_experience",
  1801. }
  1802. WpChatroomTable.Annotation = &entsql.Annotation{
  1803. Table: "wp_chatroom",
  1804. }
  1805. WpChatroomMemberTable.Annotation = &entsql.Annotation{
  1806. Table: "wp_chatroom_member",
  1807. }
  1808. WxTable.ForeignKeys[0].RefTable = AgentTable
  1809. WxTable.ForeignKeys[1].RefTable = AgentBaseTable
  1810. WxTable.ForeignKeys[2].RefTable = ServerTable
  1811. WxTable.Annotation = &entsql.Annotation{
  1812. Table: "wx",
  1813. }
  1814. WxCardTable.Annotation = &entsql.Annotation{
  1815. Table: "wx_card",
  1816. }
  1817. WxCardUserTable.Annotation = &entsql.Annotation{
  1818. Table: "wx_card_user",
  1819. }
  1820. WxCardVisitTable.Annotation = &entsql.Annotation{
  1821. Table: "wx_card_visit",
  1822. }
  1823. XunjiTable.Annotation = &entsql.Annotation{
  1824. Table: "xunji",
  1825. }
  1826. XunjiServiceTable.ForeignKeys[0].RefTable = AgentTable
  1827. XunjiServiceTable.Annotation = &entsql.Annotation{
  1828. Table: "xunji_service",
  1829. }
  1830. }