redis缓存替换+pgvector向量替换
This commit is contained in:
@@ -59,18 +59,10 @@ func (s *chatService) newApp(in *proto.ChatCompletionRequest, contextCache chat_
|
||||
if in.ChatParam.Model != "" {
|
||||
conf.Model = in.ChatParam.Model
|
||||
}
|
||||
if in.ChatParam.TopP != 0 {
|
||||
conf.TopP = in.ChatParam.TopP
|
||||
}
|
||||
if in.ChatParam.FrequencyPenalty != 0 {
|
||||
conf.FrequencyPenalty = in.ChatParam.FrequencyPenalty
|
||||
}
|
||||
if in.ChatParam.PresencePenalty != 0 {
|
||||
conf.PresencePenalty = in.ChatParam.PresencePenalty
|
||||
}
|
||||
if in.ChatParam.Temperature != 0 {
|
||||
conf.Temperature = in.ChatParam.Temperature
|
||||
}
|
||||
conf.TopP = in.ChatParam.TopP
|
||||
conf.FrequencyPenalty = in.ChatParam.FrequencyPenalty
|
||||
conf.PresencePenalty = in.ChatParam.PresencePenalty
|
||||
conf.Temperature = in.ChatParam.Temperature
|
||||
if in.ChatParam.BotDesc != "" {
|
||||
conf.BotDesc = in.ChatParam.BotDesc
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ func (s *chatService) ChatCompletion(ctx context.Context, in *proto.ChatCompleti
|
||||
idStr, score, err := s.vectorData.QueryData(context.Background(), map[string][]string{"keywords": {strings.Join(keywords, ",")}})
|
||||
if err != nil {
|
||||
s.log.Error(err)
|
||||
} else if score > 0.99 {
|
||||
} else if score > s.config.Vector.Threshold {
|
||||
id, err := strconv.ParseInt(idStr, 10, 64)
|
||||
if err != nil {
|
||||
s.log.Error(err)
|
||||
@@ -200,7 +200,7 @@ func (s *chatService) ChatCompletionStream(in *proto.ChatCompletionRequest, stre
|
||||
idStr, score, err := s.vectorData.QueryData(context.Background(), map[string][]string{"keywords": {strings.Join(keywords, ",")}})
|
||||
if err != nil {
|
||||
s.log.Error(err)
|
||||
} else if score > 0.99 {
|
||||
} else if score > s.config.Vector.Threshold {
|
||||
id, err := strconv.ParseInt(idStr, 10, 64)
|
||||
if err != nil {
|
||||
s.log.Error(err)
|
||||
|
||||
Reference in New Issue
Block a user