wangkaiyue před 2 roky
rodič
revize
859f06568c

+ 0 - 3
internal/model/chatHistory.go

@@ -111,9 +111,6 @@ func (m *cChatHistory) Evaluate(userId int64, megId string, value int) error {
 	if res == nil {
 		return fmt.Errorf("未找到记录")
 	}
-	if gconv.Int(res.Map()["useful"]) != 0 {
-		return fmt.Errorf("已评价")
-	}
 	r, _ := g.Model("ai_message_history").Data(g.Map{"useful": value}).Where("id =? and person_id =? and type=2", megId, userId).Update()
 	affect, _ := r.RowsAffected()
 	if affect != 1 {

+ 1 - 1
internal/model/question.go

@@ -57,7 +57,7 @@ func (r *BaseQuestion) ParseHistoryFsw() {
 func (q *cQuestion) GetUsuallyProblem(ctx context.Context, scenario, limit int) (list []string, err error) {
 	list = make([]string, 0, limit)
 	res, err := g.Model("ai_question_list").Ctx(ctx).Fields("question").
-		Where("status = 1 and question_type = ? and source = ?", consts.QUESTION_TYPE_USUALLY, scenario).OrderDesc("id").Limit(limit).All()
+		Where("status = 1 and question_type = ? and source = ?", consts.QUESTION_TYPE_USUALLY, scenario).OrderDesc("create_time").OrderAsc("id").Limit(limit).All()
 	if err != nil {
 		return nil, err
 	}

+ 2 - 4
internal/model/ws.go

@@ -61,9 +61,7 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
 			}
 			return ""
 		}()
-		if errReply != "" {
-			reply, from = errReply, -1
-		} else {
+		if errReply == "" {
 			reply, from, err = Question.DetailQuestion(m.Ctx, req)
 			if err != nil {
 				g.Log().Error(m.Ctx, "问答异常", err)
@@ -78,7 +76,7 @@ func (m *WsChat) Handle(ws *ghttp.WebSocket, msg []byte) {
 			Actions:    gconv.Int(If(errReply == "", 1, 0)),
 			QuestionId: questionId,
 			PersonId:   jSession.PositionId,
-			Item:       from,
+			Item:       gconv.Int(If(errReply == "", from, -1)),
 			CreateTime: time.Now().Format(date.Date_Full_Layout),
 		})
 		if replyId <= 0 {

+ 1 - 1
manifest/config/config.yaml

@@ -14,7 +14,7 @@ server:
 
 chat:
   appId: "10000"
-  usuallyProblem: 5 # 常见问题返回数量
+  usuallyProblem: 100 # 常见问题返回数量
   resourceCode: "ai_helper" # 资源扣减
   api: #ChatGpt 配置
     addr_simple: "http://192.168.3.109:8880/search" # 语义服务