From f381510a0d3b4c46898ef7c65820db0f034b758f Mon Sep 17 00:00:00 2001 From: "DESKTOP-V763RJ7\\Administrator" <835606593@qq.com> Date: Fri, 9 Jan 2026 14:08:41 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=8D=8F=E8=AE=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/ss/grpc_pb/service_gateway.pb.go | 8 +- proto/ss/grpc_pb/service_scene.pb.go | 7 +- proto/ss/grpc_pb/service_user.pb.go | 166 ++++++++++++++++++++--- proto/ss/grpc_pb/service_user.pb.gw.go | 67 ++++++++- proto/ss/grpc_pb/service_user_grpc.pb.go | 36 +++++ 5 files changed, 256 insertions(+), 28 deletions(-) diff --git a/proto/ss/grpc_pb/service_gateway.pb.go b/proto/ss/grpc_pb/service_gateway.pb.go index fe6e1d1..115a095 100644 --- a/proto/ss/grpc_pb/service_gateway.pb.go +++ b/proto/ss/grpc_pb/service_gateway.pb.go @@ -228,9 +228,11 @@ var file_service_gateway_proto_rawDesc = []byte{ 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, 0x12, 0x29, 0x0a, 0x08, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x12, 0x0c, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x4b, 0x69, 0x63, 0x6b, 0x55, 0x73, 0x65, 0x72, 0x52, - 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x73, 0x70, 0x22, 0x00, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, + 0x71, 0x2e, 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/ss/grpc_pb/service_scene.pb.go b/proto/ss/grpc_pb/service_scene.pb.go index 234fbf4..c12ff75 100644 --- a/proto/ss/grpc_pb/service_scene.pb.go +++ b/proto/ss/grpc_pb/service_scene.pb.go @@ -414,9 +414,10 @@ var file_service_scene_proto_rawDesc = []byte{ 0x61, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x25, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0a, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0b, 0x2e, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, 0x00, 0x28, 0x01, - 0x42, 0x19, 0x5a, 0x17, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, 0x61, 0x73, 0x69, + 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, + 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/ss/grpc_pb/service_user.pb.go b/proto/ss/grpc_pb/service_user.pb.go index 6731e7d..09ce300 100644 --- a/proto/ss/grpc_pb/service_user.pb.go +++ b/proto/ss/grpc_pb/service_user.pb.go @@ -234,6 +234,91 @@ func (x *GetUserInfoResp) GetName() string { return "" } +type GenerateQuestionReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Num int32 `protobuf:"varint,1,opt,name=Num,json=num,proto3" json:"Num,omitempty"` // 生成数量 +} + +func (x *GenerateQuestionReq) Reset() { + *x = GenerateQuestionReq{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateQuestionReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateQuestionReq) ProtoMessage() {} + +func (x *GenerateQuestionReq) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateQuestionReq.ProtoReflect.Descriptor instead. +func (*GenerateQuestionReq) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{4} +} + +func (x *GenerateQuestionReq) GetNum() int32 { + if x != nil { + return x.Num + } + return 0 +} + +type GenerateQuestionResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *GenerateQuestionResp) Reset() { + *x = GenerateQuestionResp{} + if protoimpl.UnsafeEnabled { + mi := &file_service_user_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GenerateQuestionResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GenerateQuestionResp) ProtoMessage() {} + +func (x *GenerateQuestionResp) ProtoReflect() protoreflect.Message { + mi := &file_service_user_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GenerateQuestionResp.ProtoReflect.Descriptor instead. +func (*GenerateQuestionResp) Descriptor() ([]byte, []int) { + return file_service_user_proto_rawDescGZIP(), []int{5} +} + var File_service_user_proto protoreflect.FileDescriptor var file_service_user_proto_rawDesc = []byte{ @@ -253,16 +338,29 @@ var file_service_user_proto_rawDesc = []byte{ 0x22, 0x37, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x10, 0x0a, 0x03, 0x55, 0x53, 0x4e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x03, 0x75, 0x73, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x32, 0x71, 0x0a, 0x04, 0x55, 0x73, 0x65, - 0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x09, 0x2e, 0x4c, 0x6f, 0x67, - 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, - 0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, 0x01, 0x2a, - 0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x42, 0x19, 0x5a, 0x17, - 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x73, 0x2f, - 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x27, 0x0a, 0x13, 0x47, 0x65, 0x6e, + 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x12, 0x10, 0x0a, 0x03, 0x4e, 0x75, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6e, + 0x75, 0x6d, 0x22, 0x16, 0x0a, 0x14, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, + 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x32, 0xd6, 0x01, 0x0a, 0x04, 0x55, + 0x73, 0x65, 0x72, 0x12, 0x20, 0x0a, 0x05, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x12, 0x09, 0x2e, 0x4c, + 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x0a, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x22, 0x00, 0x12, 0x47, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, + 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0f, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x3a, + 0x01, 0x2a, 0x22, 0x0a, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x2f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x63, + 0x0a, 0x10, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x14, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, + 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x15, 0x2e, 0x47, 0x65, 0x6e, 0x65, 0x72, + 0x61, 0x74, 0x65, 0x51, 0x75, 0x65, 0x73, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x22, + 0x22, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1c, 0x3a, 0x01, 0x2a, 0x22, 0x17, 0x2f, 0x75, 0x73, 0x65, + 0x72, 0x2f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x69, 0x6f, 0x6e, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x2e, 0x68, 0x6c, 0x73, 0x71, 0x2e, + 0x61, 0x73, 0x69, 0x61, 0x2f, 0x6d, 0x6d, 0x6f, 0x72, 0x70, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x2d, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x73, 0x73, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x5f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -277,20 +375,24 @@ func file_service_user_proto_rawDescGZIP() []byte { return file_service_user_proto_rawDescData } -var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_service_user_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_service_user_proto_goTypes = []interface{}{ - (*LoginReq)(nil), // 0: LoginReq - (*LoginResp)(nil), // 1: LoginResp - (*GetUserInfoReq)(nil), // 2: GetUserInfoReq - (*GetUserInfoResp)(nil), // 3: GetUserInfoResp + (*LoginReq)(nil), // 0: LoginReq + (*LoginResp)(nil), // 1: LoginResp + (*GetUserInfoReq)(nil), // 2: GetUserInfoReq + (*GetUserInfoResp)(nil), // 3: GetUserInfoResp + (*GenerateQuestionReq)(nil), // 4: GenerateQuestionReq + (*GenerateQuestionResp)(nil), // 5: GenerateQuestionResp } var file_service_user_proto_depIdxs = []int32{ 0, // 0: User.Login:input_type -> LoginReq 2, // 1: User.GetUserInfo:input_type -> GetUserInfoReq - 1, // 2: User.Login:output_type -> LoginResp - 3, // 3: User.GetUserInfo:output_type -> GetUserInfoResp - 2, // [2:4] is the sub-list for method output_type - 0, // [0:2] is the sub-list for method input_type + 4, // 2: User.GenerateQuestion:input_type -> GenerateQuestionReq + 1, // 3: User.Login:output_type -> LoginResp + 3, // 4: User.GetUserInfo:output_type -> GetUserInfoResp + 5, // 5: User.GenerateQuestion:output_type -> GenerateQuestionResp + 3, // [3:6] is the sub-list for method output_type + 0, // [0:3] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name 0, // [0:0] is the sub-list for extension extendee 0, // [0:0] is the sub-list for field type_name @@ -350,6 +452,30 @@ func file_service_user_proto_init() { return nil } } + file_service_user_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateQuestionReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_user_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GenerateQuestionResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -357,7 +483,7 @@ func file_service_user_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_service_user_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/ss/grpc_pb/service_user.pb.gw.go b/proto/ss/grpc_pb/service_user.pb.gw.go index 367d62d..81567a4 100644 --- a/proto/ss/grpc_pb/service_user.pb.gw.go +++ b/proto/ss/grpc_pb/service_user.pb.gw.go @@ -59,6 +59,30 @@ func local_request_User_GetUserInfo_0(ctx context.Context, marshaler runtime.Mar return msg, metadata, err } +func request_User_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, client UserClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GenerateQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := client.GenerateQuestion(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err +} + +func local_request_User_GenerateQuestion_0(ctx context.Context, marshaler runtime.Marshaler, server UserServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var ( + protoReq GenerateQuestionReq + metadata runtime.ServerMetadata + ) + if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && !errors.Is(err, io.EOF) { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + msg, err := server.GenerateQuestion(ctx, &protoReq) + return msg, metadata, err +} + // RegisterUserHandlerServer registers the http handlers for service User to "mux". // UnaryRPC :call UserServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -85,6 +109,26 @@ func RegisterUserHandlerServer(ctx context.Context, mux *runtime.ServeMux, serve } forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_User_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateIncomingContext(ctx, mux, req, "/.User/GenerateQuestion", runtime.WithHTTPPathPattern("/user/generate_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_User_GenerateQuestion_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } @@ -142,13 +186,32 @@ func RegisterUserHandlerClient(ctx context.Context, mux *runtime.ServeMux, clien } forward_User_GetUserInfo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) + mux.Handle(http.MethodPost, pattern_User_GenerateQuestion_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + annotatedContext, err := runtime.AnnotateContext(ctx, mux, req, "/.User/GenerateQuestion", runtime.WithHTTPPathPattern("/user/generate_question")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_User_GenerateQuestion_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + forward_User_GenerateQuestion_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + }) return nil } var ( - pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, "")) + pattern_User_GetUserInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "info"}, "")) + pattern_User_GenerateQuestion_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"user", "generate_question"}, "")) ) var ( - forward_User_GetUserInfo_0 = runtime.ForwardResponseMessage + forward_User_GetUserInfo_0 = runtime.ForwardResponseMessage + forward_User_GenerateQuestion_0 = runtime.ForwardResponseMessage ) diff --git a/proto/ss/grpc_pb/service_user_grpc.pb.go b/proto/ss/grpc_pb/service_user_grpc.pb.go index a539483..a5b37d1 100644 --- a/proto/ss/grpc_pb/service_user_grpc.pb.go +++ b/proto/ss/grpc_pb/service_user_grpc.pb.go @@ -24,6 +24,7 @@ const _ = grpc.SupportPackageIsVersion7 type UserClient interface { Login(ctx context.Context, in *LoginReq, opts ...grpc.CallOption) (*LoginResp, error) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) + GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error) } type userClient struct { @@ -52,12 +53,22 @@ func (c *userClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts . return out, nil } +func (c *userClient) GenerateQuestion(ctx context.Context, in *GenerateQuestionReq, opts ...grpc.CallOption) (*GenerateQuestionResp, error) { + out := new(GenerateQuestionResp) + err := c.cc.Invoke(ctx, "/User/GenerateQuestion", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // UserServer is the server API for User service. // All implementations must embed UnimplementedUserServer // for forward compatibility type UserServer interface { Login(context.Context, *LoginReq) (*LoginResp, error) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) + GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) mustEmbedUnimplementedUserServer() } @@ -71,6 +82,9 @@ func (UnimplementedUserServer) Login(context.Context, *LoginReq) (*LoginResp, er func (UnimplementedUserServer) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) { return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented") } +func (UnimplementedUserServer) GenerateQuestion(context.Context, *GenerateQuestionReq) (*GenerateQuestionResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method GenerateQuestion not implemented") +} func (UnimplementedUserServer) mustEmbedUnimplementedUserServer() {} // UnsafeUserServer may be embedded to opt out of forward compatibility for this service. @@ -120,6 +134,24 @@ func _User_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _User_GenerateQuestion_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GenerateQuestionReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(UserServer).GenerateQuestion(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/User/GenerateQuestion", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(UserServer).GenerateQuestion(ctx, req.(*GenerateQuestionReq)) + } + return interceptor(ctx, in, info, handler) +} + // User_ServiceDesc is the grpc.ServiceDesc for User service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -135,6 +167,10 @@ var User_ServiceDesc = grpc.ServiceDesc{ MethodName: "GetUserInfo", Handler: _User_GetUserInfo_Handler, }, + { + MethodName: "GenerateQuestion", + Handler: _User_GenerateQuestion_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "service_user.proto",