add UserSettingsService proto (GetPreferredModel, SetPreferredModel)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3a741152fc
commit
5e6d62b6a5
243
settings.pb.go
Normal file
243
settings.pb.go
Normal file
@ -0,0 +1,243 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v7.34.0
|
||||
// source: settings.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
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)
|
||||
)
|
||||
|
||||
type GetPreferredModelRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetPreferredModelRequest) Reset() {
|
||||
*x = GetPreferredModelRequest{}
|
||||
mi := &file_settings_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetPreferredModelRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetPreferredModelRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetPreferredModelRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_settings_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 GetPreferredModelRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetPreferredModelRequest) Descriptor() ([]byte, []int) {
|
||||
return file_settings_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *GetPreferredModelRequest) GetUserId() int64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type GetPreferredModelResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Model string `protobuf:"bytes,1,opt,name=model,proto3" json:"model,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetPreferredModelResponse) Reset() {
|
||||
*x = GetPreferredModelResponse{}
|
||||
mi := &file_settings_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetPreferredModelResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetPreferredModelResponse) ProtoMessage() {}
|
||||
|
||||
func (x *GetPreferredModelResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_settings_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 GetPreferredModelResponse.ProtoReflect.Descriptor instead.
|
||||
func (*GetPreferredModelResponse) Descriptor() ([]byte, []int) {
|
||||
return file_settings_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetPreferredModelResponse) GetModel() string {
|
||||
if x != nil {
|
||||
return x.Model
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type SetPreferredModelRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
UserId int64 `protobuf:"varint,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
|
||||
Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
|
||||
Model string `protobuf:"bytes,3,opt,name=model,proto3" json:"model,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *SetPreferredModelRequest) Reset() {
|
||||
*x = SetPreferredModelRequest{}
|
||||
mi := &file_settings_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *SetPreferredModelRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*SetPreferredModelRequest) ProtoMessage() {}
|
||||
|
||||
func (x *SetPreferredModelRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_settings_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 SetPreferredModelRequest.ProtoReflect.Descriptor instead.
|
||||
func (*SetPreferredModelRequest) Descriptor() ([]byte, []int) {
|
||||
return file_settings_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *SetPreferredModelRequest) GetUserId() int64 {
|
||||
if x != nil {
|
||||
return x.UserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *SetPreferredModelRequest) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *SetPreferredModelRequest) GetModel() string {
|
||||
if x != nil {
|
||||
return x.Model
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_settings_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_settings_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x0esettings.proto\x12\x05users\x1a\x1bgoogle/protobuf/empty.proto\"3\n" +
|
||||
"\x18GetPreferredModelRequest\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\x03R\x06userId\"1\n" +
|
||||
"\x19GetPreferredModelResponse\x12\x14\n" +
|
||||
"\x05model\x18\x01 \x01(\tR\x05model\"e\n" +
|
||||
"\x18SetPreferredModelRequest\x12\x17\n" +
|
||||
"\auser_id\x18\x01 \x01(\x03R\x06userId\x12\x1a\n" +
|
||||
"\busername\x18\x02 \x01(\tR\busername\x12\x14\n" +
|
||||
"\x05model\x18\x03 \x01(\tR\x05model2\xbb\x01\n" +
|
||||
"\x13UserSettingsService\x12V\n" +
|
||||
"\x11GetPreferredModel\x12\x1f.users.GetPreferredModelRequest\x1a .users.GetPreferredModelResponse\x12L\n" +
|
||||
"\x11SetPreferredModel\x12\x1f.users.SetPreferredModelRequest\x1a\x16.google.protobuf.EmptyB,Z*git.be.kaien.ru/l-ai/l-ai-core-proto/protob\x06proto3"
|
||||
|
||||
var (
|
||||
file_settings_proto_rawDescOnce sync.Once
|
||||
file_settings_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_settings_proto_rawDescGZIP() []byte {
|
||||
file_settings_proto_rawDescOnce.Do(func() {
|
||||
file_settings_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_settings_proto_rawDesc), len(file_settings_proto_rawDesc)))
|
||||
})
|
||||
return file_settings_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_settings_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
|
||||
var file_settings_proto_goTypes = []any{
|
||||
(*GetPreferredModelRequest)(nil), // 0: users.GetPreferredModelRequest
|
||||
(*GetPreferredModelResponse)(nil), // 1: users.GetPreferredModelResponse
|
||||
(*SetPreferredModelRequest)(nil), // 2: users.SetPreferredModelRequest
|
||||
(*emptypb.Empty)(nil), // 3: google.protobuf.Empty
|
||||
}
|
||||
var file_settings_proto_depIdxs = []int32{
|
||||
0, // 0: users.UserSettingsService.GetPreferredModel:input_type -> users.GetPreferredModelRequest
|
||||
2, // 1: users.UserSettingsService.SetPreferredModel:input_type -> users.SetPreferredModelRequest
|
||||
1, // 2: users.UserSettingsService.GetPreferredModel:output_type -> users.GetPreferredModelResponse
|
||||
3, // 3: users.UserSettingsService.SetPreferredModel:output_type -> google.protobuf.Empty
|
||||
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_settings_proto_init() }
|
||||
func file_settings_proto_init() {
|
||||
if File_settings_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_settings_proto_rawDesc), len(file_settings_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 3,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_settings_proto_goTypes,
|
||||
DependencyIndexes: file_settings_proto_depIdxs,
|
||||
MessageInfos: file_settings_proto_msgTypes,
|
||||
}.Build()
|
||||
File_settings_proto = out.File
|
||||
file_settings_proto_goTypes = nil
|
||||
file_settings_proto_depIdxs = nil
|
||||
}
|
||||
27
settings.proto
Normal file
27
settings.proto
Normal file
@ -0,0 +1,27 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package users;
|
||||
|
||||
option go_package = "git.be.kaien.ru/l-ai/l-ai-core-proto/proto";
|
||||
|
||||
import "google/protobuf/empty.proto";
|
||||
|
||||
// UserSettingsService manages per-user bot settings
|
||||
service UserSettingsService {
|
||||
rpc GetPreferredModel(GetPreferredModelRequest) returns (GetPreferredModelResponse);
|
||||
rpc SetPreferredModel(SetPreferredModelRequest) returns (google.protobuf.Empty);
|
||||
}
|
||||
|
||||
message GetPreferredModelRequest {
|
||||
int64 user_id = 1;
|
||||
}
|
||||
|
||||
message GetPreferredModelResponse {
|
||||
string model = 1;
|
||||
}
|
||||
|
||||
message SetPreferredModelRequest {
|
||||
int64 user_id = 1;
|
||||
string username = 2;
|
||||
string model = 3;
|
||||
}
|
||||
164
settings_grpc.pb.go
Normal file
164
settings_grpc.pb.go
Normal file
@ -0,0 +1,164 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v7.34.0
|
||||
// source: settings.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
emptypb "google.golang.org/protobuf/types/known/emptypb"
|
||||
)
|
||||
|
||||
// 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 (
|
||||
UserSettingsService_GetPreferredModel_FullMethodName = "/users.UserSettingsService/GetPreferredModel"
|
||||
UserSettingsService_SetPreferredModel_FullMethodName = "/users.UserSettingsService/SetPreferredModel"
|
||||
)
|
||||
|
||||
// UserSettingsServiceClient is the client API for UserSettingsService 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.
|
||||
//
|
||||
// UserSettingsService manages per-user bot settings
|
||||
type UserSettingsServiceClient interface {
|
||||
GetPreferredModel(ctx context.Context, in *GetPreferredModelRequest, opts ...grpc.CallOption) (*GetPreferredModelResponse, error)
|
||||
SetPreferredModel(ctx context.Context, in *SetPreferredModelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
}
|
||||
|
||||
type userSettingsServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewUserSettingsServiceClient(cc grpc.ClientConnInterface) UserSettingsServiceClient {
|
||||
return &userSettingsServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *userSettingsServiceClient) GetPreferredModel(ctx context.Context, in *GetPreferredModelRequest, opts ...grpc.CallOption) (*GetPreferredModelResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(GetPreferredModelResponse)
|
||||
err := c.cc.Invoke(ctx, UserSettingsService_GetPreferredModel_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *userSettingsServiceClient) SetPreferredModel(ctx context.Context, in *SetPreferredModelRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, UserSettingsService_SetPreferredModel_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// UserSettingsServiceServer is the server API for UserSettingsService service.
|
||||
// All implementations must embed UnimplementedUserSettingsServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// UserSettingsService manages per-user bot settings
|
||||
type UserSettingsServiceServer interface {
|
||||
GetPreferredModel(context.Context, *GetPreferredModelRequest) (*GetPreferredModelResponse, error)
|
||||
SetPreferredModel(context.Context, *SetPreferredModelRequest) (*emptypb.Empty, error)
|
||||
mustEmbedUnimplementedUserSettingsServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedUserSettingsServiceServer 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 UnimplementedUserSettingsServiceServer struct{}
|
||||
|
||||
func (UnimplementedUserSettingsServiceServer) GetPreferredModel(context.Context, *GetPreferredModelRequest) (*GetPreferredModelResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetPreferredModel not implemented")
|
||||
}
|
||||
func (UnimplementedUserSettingsServiceServer) SetPreferredModel(context.Context, *SetPreferredModelRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method SetPreferredModel not implemented")
|
||||
}
|
||||
func (UnimplementedUserSettingsServiceServer) mustEmbedUnimplementedUserSettingsServiceServer() {}
|
||||
func (UnimplementedUserSettingsServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeUserSettingsServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to UserSettingsServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeUserSettingsServiceServer interface {
|
||||
mustEmbedUnimplementedUserSettingsServiceServer()
|
||||
}
|
||||
|
||||
func RegisterUserSettingsServiceServer(s grpc.ServiceRegistrar, srv UserSettingsServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedUserSettingsServiceServer 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(&UserSettingsService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _UserSettingsService_GetPreferredModel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetPreferredModelRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserSettingsServiceServer).GetPreferredModel(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserSettingsService_GetPreferredModel_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserSettingsServiceServer).GetPreferredModel(ctx, req.(*GetPreferredModelRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _UserSettingsService_SetPreferredModel_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(SetPreferredModelRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(UserSettingsServiceServer).SetPreferredModel(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: UserSettingsService_SetPreferredModel_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(UserSettingsServiceServer).SetPreferredModel(ctx, req.(*SetPreferredModelRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// UserSettingsService_ServiceDesc is the grpc.ServiceDesc for UserSettingsService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var UserSettingsService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "users.UserSettingsService",
|
||||
HandlerType: (*UserSettingsServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetPreferredModel",
|
||||
Handler: _UserSettingsService_GetPreferredModel_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetPreferredModel",
|
||||
Handler: _UserSettingsService_SetPreferredModel_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "settings.proto",
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user