proto: add generated gRPC Go files

This commit is contained in:
Aleksander Ogurtsov 2026-03-13 09:29:26 +03:00
parent fe18b548b0
commit 023e27a5f8
3 changed files with 471 additions and 1 deletions

303
ai.pb.go Normal file
View File

@ -0,0 +1,303 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
// protoc v7.34.0
// source: ai.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
unsafe "unsafe"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// AIRequest содержит запрос к AI модели
type AIRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` // Текст запроса
BotUsername string `protobuf:"bytes,2,opt,name=bot_username,json=botUsername,proto3" json:"bot_username,omitempty"` // Username бота для упоминаний
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AIRequest) Reset() {
*x = AIRequest{}
mi := &file_ai_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AIRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AIRequest) ProtoMessage() {}
func (x *AIRequest) ProtoReflect() protoreflect.Message {
mi := &file_ai_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AIRequest.ProtoReflect.Descriptor instead.
func (*AIRequest) Descriptor() ([]byte, []int) {
return file_ai_proto_rawDescGZIP(), []int{0}
}
func (x *AIRequest) GetText() string {
if x != nil {
return x.Text
}
return ""
}
func (x *AIRequest) GetBotUsername() string {
if x != nil {
return x.BotUsername
}
return ""
}
// AIResponse содержит ответ от AI модели
type AIResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // Текст ответа
Error string `protobuf:"bytes,2,opt,name=error,proto3" json:"error,omitempty"` // Текст ошибки, если произошла
DurationMs float64 `protobuf:"fixed64,3,opt,name=duration_ms,json=durationMs,proto3" json:"duration_ms,omitempty"` // Время выполнения в миллисекундах
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *AIResponse) Reset() {
*x = AIResponse{}
mi := &file_ai_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *AIResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*AIResponse) ProtoMessage() {}
func (x *AIResponse) ProtoReflect() protoreflect.Message {
mi := &file_ai_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use AIResponse.ProtoReflect.Descriptor instead.
func (*AIResponse) Descriptor() ([]byte, []int) {
return file_ai_proto_rawDescGZIP(), []int{1}
}
func (x *AIResponse) GetContent() string {
if x != nil {
return x.Content
}
return ""
}
func (x *AIResponse) GetError() string {
if x != nil {
return x.Error
}
return ""
}
func (x *AIResponse) GetDurationMs() float64 {
if x != nil {
return x.DurationMs
}
return 0
}
// HealthCheckRequest для проверки здоровья сервиса
type HealthCheckRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HealthCheckRequest) Reset() {
*x = HealthCheckRequest{}
mi := &file_ai_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HealthCheckRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HealthCheckRequest) ProtoMessage() {}
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
mi := &file_ai_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
return file_ai_proto_rawDescGZIP(), []int{2}
}
// HealthCheckResponse для ответа на проверку здоровья
type HealthCheckResponse struct {
state protoimpl.MessageState `protogen:"open.v1"`
Serving bool `protobuf:"varint,1,opt,name=serving,proto3" json:"serving,omitempty"`
Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
func (x *HealthCheckResponse) Reset() {
*x = HealthCheckResponse{}
mi := &file_ai_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
func (x *HealthCheckResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HealthCheckResponse) ProtoMessage() {}
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
mi := &file_ai_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
func (*HealthCheckResponse) Descriptor() ([]byte, []int) {
return file_ai_proto_rawDescGZIP(), []int{3}
}
func (x *HealthCheckResponse) GetServing() bool {
if x != nil {
return x.Serving
}
return false
}
func (x *HealthCheckResponse) GetVersion() string {
if x != nil {
return x.Version
}
return ""
}
var File_ai_proto protoreflect.FileDescriptor
const file_ai_proto_rawDesc = "" +
"\n" +
"\bai.proto\x12\x02ai\"B\n" +
"\tAIRequest\x12\x12\n" +
"\x04text\x18\x01 \x01(\tR\x04text\x12!\n" +
"\fbot_username\x18\x02 \x01(\tR\vbotUsername\"]\n" +
"\n" +
"AIResponse\x12\x18\n" +
"\acontent\x18\x01 \x01(\tR\acontent\x12\x14\n" +
"\x05error\x18\x02 \x01(\tR\x05error\x12\x1f\n" +
"\vduration_ms\x18\x03 \x01(\x01R\n" +
"durationMs\"\x14\n" +
"\x12HealthCheckRequest\"I\n" +
"\x13HealthCheckResponse\x12\x18\n" +
"\aserving\x18\x01 \x01(\bR\aserving\x12\x18\n" +
"\aversion\x18\x02 \x01(\tR\aversion2|\n" +
"\tAIService\x12/\n" +
"\x0eGenerateAnswer\x12\r.ai.AIRequest\x1a\x0e.ai.AIResponse\x12>\n" +
"\vHealthCheck\x12\x16.ai.HealthCheckRequest\x1a\x17.ai.HealthCheckResponseB'Z%github.com/l-ai/l-ai-core-proto/protob\x06proto3"
var (
file_ai_proto_rawDescOnce sync.Once
file_ai_proto_rawDescData []byte
)
func file_ai_proto_rawDescGZIP() []byte {
file_ai_proto_rawDescOnce.Do(func() {
file_ai_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ai_proto_rawDesc), len(file_ai_proto_rawDesc)))
})
return file_ai_proto_rawDescData
}
var file_ai_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_ai_proto_goTypes = []any{
(*AIRequest)(nil), // 0: ai.AIRequest
(*AIResponse)(nil), // 1: ai.AIResponse
(*HealthCheckRequest)(nil), // 2: ai.HealthCheckRequest
(*HealthCheckResponse)(nil), // 3: ai.HealthCheckResponse
}
var file_ai_proto_depIdxs = []int32{
0, // 0: ai.AIService.GenerateAnswer:input_type -> ai.AIRequest
2, // 1: ai.AIService.HealthCheck:input_type -> ai.HealthCheckRequest
1, // 2: ai.AIService.GenerateAnswer:output_type -> ai.AIResponse
3, // 3: ai.AIService.HealthCheck:output_type -> ai.HealthCheckResponse
2, // [2:4] is the sub-list for method output_type
0, // [0:2] 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
}
func init() { file_ai_proto_init() }
func file_ai_proto_init() {
if File_ai_proto != nil {
return
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ai_proto_rawDesc), len(file_ai_proto_rawDesc)),
NumEnums: 0,
NumMessages: 4,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_ai_proto_goTypes,
DependencyIndexes: file_ai_proto_depIdxs,
MessageInfos: file_ai_proto_msgTypes,
}.Build()
File_ai_proto = out.File
file_ai_proto_goTypes = nil
file_ai_proto_depIdxs = nil
}

View File

@ -2,7 +2,7 @@ syntax = "proto3";
package ai;
option go_package = "ai_service/proto/ai";
option go_package = "github.com/l-ai/l-ai-core-proto/proto";
// AIRequest содержит запрос к AI модели
message AIRequest {

167
ai_grpc.pb.go Normal file
View File

@ -0,0 +1,167 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc v7.34.0
// source: ai.proto
package proto
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc.SupportPackageIsVersion9
const (
AIService_GenerateAnswer_FullMethodName = "/ai.AIService/GenerateAnswer"
AIService_HealthCheck_FullMethodName = "/ai.AIService/HealthCheck"
)
// AIServiceClient is the client API for AIService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
//
// AIService - основной сервис для работы с AI
type AIServiceClient interface {
// GenerateAnswer генерирует ответ на запрос
GenerateAnswer(ctx context.Context, in *AIRequest, opts ...grpc.CallOption) (*AIResponse, error)
// HealthCheck проверяет здоровье сервиса
HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
}
type aIServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAIServiceClient(cc grpc.ClientConnInterface) AIServiceClient {
return &aIServiceClient{cc}
}
func (c *aIServiceClient) GenerateAnswer(ctx context.Context, in *AIRequest, opts ...grpc.CallOption) (*AIResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AIResponse)
err := c.cc.Invoke(ctx, AIService_GenerateAnswer_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *aIServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(HealthCheckResponse)
err := c.cc.Invoke(ctx, AIService_HealthCheck_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AIServiceServer is the server API for AIService service.
// All implementations must embed UnimplementedAIServiceServer
// for forward compatibility.
//
// AIService - основной сервис для работы с AI
type AIServiceServer interface {
// GenerateAnswer генерирует ответ на запрос
GenerateAnswer(context.Context, *AIRequest) (*AIResponse, error)
// HealthCheck проверяет здоровье сервиса
HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
mustEmbedUnimplementedAIServiceServer()
}
// UnimplementedAIServiceServer must be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedAIServiceServer struct{}
func (UnimplementedAIServiceServer) GenerateAnswer(context.Context, *AIRequest) (*AIResponse, error) {
return nil, status.Error(codes.Unimplemented, "method GenerateAnswer not implemented")
}
func (UnimplementedAIServiceServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
return nil, status.Error(codes.Unimplemented, "method HealthCheck not implemented")
}
func (UnimplementedAIServiceServer) mustEmbedUnimplementedAIServiceServer() {}
func (UnimplementedAIServiceServer) testEmbeddedByValue() {}
// UnsafeAIServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AIServiceServer will
// result in compilation errors.
type UnsafeAIServiceServer interface {
mustEmbedUnimplementedAIServiceServer()
}
func RegisterAIServiceServer(s grpc.ServiceRegistrar, srv AIServiceServer) {
// If the following call panics, it indicates UnimplementedAIServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
t.testEmbeddedByValue()
}
s.RegisterService(&AIService_ServiceDesc, srv)
}
func _AIService_GenerateAnswer_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(AIRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AIServiceServer).GenerateAnswer(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AIService_GenerateAnswer_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AIServiceServer).GenerateAnswer(ctx, req.(*AIRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AIService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(HealthCheckRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AIServiceServer).HealthCheck(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AIService_HealthCheck_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AIServiceServer).HealthCheck(ctx, req.(*HealthCheckRequest))
}
return interceptor(ctx, in, info, handler)
}
// AIService_ServiceDesc is the grpc.ServiceDesc for AIService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AIService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ai.AIService",
HandlerType: (*AIServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GenerateAnswer",
Handler: _AIService_GenerateAnswer_Handler,
},
{
MethodName: "HealthCheck",
Handler: _AIService_HealthCheck_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "ai.proto",
}