schema.go 90 KB

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