From f73783b74203157def5254580ff7d4c38bf7e169 Mon Sep 17 00:00:00 2001 From: BuildingBlocksLin <835606593@qq.com> Date: Wed, 11 Mar 2026 20:17:59 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E8=87=AA=E5=AE=9A=E4=B9=89=E9=97=AE?= =?UTF-8?q?=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/grpcserver/server_custom.go | 30 ++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 internal/grpcserver/server_custom.go diff --git a/internal/grpcserver/server_custom.go b/internal/grpcserver/server_custom.go new file mode 100644 index 0000000..9454d2c --- /dev/null +++ b/internal/grpcserver/server_custom.go @@ -0,0 +1,30 @@ +package grpcserver + +import ( + "context" + "fmt" + "git.hlsq.asia/mmorpg/service-common/proto/rs/rspb" + "git.hlsq.asia/mmorpg/service-common/utils" + "git.hlsq.asia/mmorpg/service-qgdzs/internal/ai" +) + +func (s *Server) CustomAnswerQuestion(ctx context.Context, req *rspb.CustomAnswerQuestionReq) (*rspb.CustomAnswerQuestionResp, error) { + answer := "" + err := ai.NewAIClient(false, "", 0.9). + RequestAI( + []string{ + fmt.Sprintf(req.Question), + }, + func(content string, i int) error { + if i == 0 { + return nil + } + answer = content + return nil + }, + ) + if err != nil { + return nil, utils.ErrorsWrap(err) + } + return &rspb.CustomAnswerQuestionResp{Answer: answer}, nil +}