main.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package main
  2. import (
  3. "data_ai/extract"
  4. "data_ai/tool"
  5. "data_ai/udp"
  6. "data_ai/ul"
  7. log "github.com/donnie4w/go-logger/logger"
  8. qu "jygit.jydev.jianyu360.cn/data_processing/common_utils"
  9. "sync"
  10. "unicode/utf8"
  11. )
  12. func init() {
  13. ul.IsTool = false
  14. ul.IsFull = false
  15. ul.IsLocal = true
  16. if ul.IsTool {
  17. log.Debug("工具版本···")
  18. ul.InitToolVar()
  19. } else {
  20. ul.InitGlobalVar()
  21. if !ul.IsFull {
  22. log.Debug("正常版本···")
  23. udp.InitProcessVar()
  24. } else {
  25. log.Debug("全量版本···")
  26. }
  27. }
  28. }
  29. func main() {
  30. if ul.IsTool {
  31. tool.StartToolInfo()
  32. return
  33. } else {
  34. if !ul.IsFull {
  35. //extract.TestSinglePackageInfo("bidding", "66e38634b25c3e1debf23a00")
  36. extract.TestSinglePackageInfo("bidding", "67050280b25c3e1deb667d38")
  37. }
  38. }
  39. lock := make(chan bool)
  40. <-lock
  41. }
  42. func test() {
  43. log.Debug("开始大模型验证内存数据···")
  44. q := map[string]interface{}{}
  45. pool_mgo := make(chan bool, ul.Reading)
  46. wg_mgo := &sync.WaitGroup{}
  47. sess := ul.SourceMgo.GetMgoConn()
  48. defer ul.SourceMgo.DestoryMongoConn(sess)
  49. total, isok := 0, 0
  50. it := sess.DB(ul.SourceMgo.DbName).C(ul.Ext_Name).Find(&q).Sort("_id").Iter()
  51. for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
  52. if total%100 == 0 {
  53. log.Debug("cur index ", total)
  54. }
  55. isok++
  56. pool_mgo <- true
  57. wg_mgo.Add(1)
  58. go func(tmp map[string]interface{}) {
  59. defer func() {
  60. <-pool_mgo
  61. wg_mgo.Done()
  62. }()
  63. detail := qu.ObjToString(tmp["detail"])
  64. filetext := qu.ObjToString(tmp["filetext"]) //此处为附件信息···
  65. if utf8.RuneCountInString(detail) < 100 {
  66. detail = filetext
  67. }
  68. detail = ul.HttpConvertToMarkdown(detail)
  69. //最终结果...
  70. if detail != "" {
  71. }
  72. }(tmp)
  73. tmp = make(map[string]interface{})
  74. }
  75. wg_mgo.Wait()
  76. log.Debug("ai is over ...")
  77. }