schema.go 90 KB

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