|
|
@@ -7,10 +7,12 @@ import (
|
|
|
"io"
|
|
|
"net/http"
|
|
|
"net/url"
|
|
|
+ "strconv"
|
|
|
"strings"
|
|
|
"text/template"
|
|
|
"time"
|
|
|
|
|
|
+ jsoniter "github.com/json-iterator/go"
|
|
|
"github.com/tidwall/gjson"
|
|
|
"newaterobot-process/entity"
|
|
|
"newaterobot-process/model"
|
|
|
@@ -69,6 +71,9 @@ func (s *MetricProcessConfigService) ProcessMetric(inputData entity.MetricProces
|
|
|
inputData.ETime = time.Now().AddDate(0, 0, 180).Format("2006-01-02")
|
|
|
} else if config.MetricType == 59 {
|
|
|
inputData.DateTime = strings.Split(inputData.DateTime, " ")[0]
|
|
|
+ } else if config.MetricType == 42 {
|
|
|
+ inputData.STime = strconv.Itoa(time.Now().Year())
|
|
|
+ inputData.ETime = strconv.Itoa(int(time.Now().Month()))
|
|
|
}
|
|
|
// 直接回复分支
|
|
|
templateVarMap := s.objToMap(inputData)
|
|
|
@@ -181,8 +186,34 @@ func (s *MetricProcessConfigService) ProcessMetric(inputData entity.MetricProces
|
|
|
}
|
|
|
ret.Flag = entity.HttpReply
|
|
|
ret.ReplyContext = replyContext
|
|
|
+
|
|
|
+ info := make(map[string]interface{})
|
|
|
+ info["pid"] = inputData.ID
|
|
|
+ info["metric_type"] = config.MetricType
|
|
|
+ info["datetime"] = inputData.DateTime
|
|
|
+ info["metric"] = replyContext
|
|
|
+ info["is_english"] = inputData.IsEnglish
|
|
|
+ info["type"] = config.Type
|
|
|
+ k := fmt.Sprintf("deepseek2:%s:%s", inputData.ConversationId, inputData.DialogueCount)
|
|
|
+ msg, _ := jsoniter.MarshalToString(info)
|
|
|
+ GetRedisService().SetObject(k, msg, 3600*24*7)
|
|
|
return ret, nil
|
|
|
}
|
|
|
+
|
|
|
+func (s *MetricProcessConfigService) ProcessMate(cid string, mid string) (map[string]interface{}, error) {
|
|
|
+ k := fmt.Sprintf("deepseek2:%s:%s", cid, mid)
|
|
|
+ row, err := GetRedisService().GetString(k)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ info := make(map[string]interface{})
|
|
|
+ err = json.Unmarshal([]byte(row), &info)
|
|
|
+ if err != nil {
|
|
|
+ return nil, err
|
|
|
+ }
|
|
|
+ return info, nil
|
|
|
+}
|
|
|
+
|
|
|
func (s *MetricProcessConfigService) objToMap(req entity.MetricProcessRequest) map[string]interface{} {
|
|
|
ret := make(map[string]interface{})
|
|
|
ret["name"] = req.Name
|