schema.go 91 KB

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