Compare commits
10 Commits
3a741152fc
...
be5ac2dc40
| Author | SHA1 | Date | |
|---|---|---|---|
| be5ac2dc40 | |||
| 1763962b7d | |||
| f91884026e | |||
| d9b7efeca0 | |||
| f0926121d7 | |||
| 7d3c064ed8 | |||
| 33e75e5cb9 | |||
| 96298efc46 | |||
| 51a7f583da | |||
| 5e6d62b6a5 |
587
ai.pb.go
587
ai.pb.go
@ -23,11 +23,13 @@ const (
|
|||||||
|
|
||||||
// AIRequest содержит запрос к AI модели
|
// AIRequest содержит запрос к AI модели
|
||||||
type AIRequest struct {
|
type AIRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Text string `protobuf:"bytes,1,opt,name=text,proto3" json:"text,omitempty"` // Текст запроса
|
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 бота для упоминаний
|
BotUsername string `protobuf:"bytes,2,opt,name=bot_username,json=botUsername,proto3" json:"bot_username,omitempty"` // Username бота для упоминаний
|
||||||
ModelName string `protobuf:"bytes,3,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` // Название модели (по умолчанию "venice-uncensored")
|
ModelName string `protobuf:"bytes,3,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` // Название модели (по умолчанию "venice-uncensored")
|
||||||
EnableReasoning bool `protobuf:"varint,4,opt,name=enable_reasoning,json=enableReasoning,proto3" json:"enable_reasoning,omitempty"` // Включить режим рассуждений (по умолчанию false)
|
EnableReasoning bool `protobuf:"varint,4,opt,name=enable_reasoning,json=enableReasoning,proto3" json:"enable_reasoning,omitempty"` // Включить режим рассуждений (по умолчанию false)
|
||||||
|
GlobalUserId int64 `protobuf:"varint,5,opt,name=global_user_id,json=globalUserId,proto3" json:"global_user_id,omitempty"` // Global user ID для получения доп. данных (профиль, воспоминания)
|
||||||
|
Options *AnswerGenerationOptions `protobuf:"bytes,6,opt,name=options,proto3" json:"options,omitempty"` // Дополнительные опции генерации ответа
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
}
|
}
|
||||||
@ -90,6 +92,65 @@ func (x *AIRequest) GetEnableReasoning() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *AIRequest) GetGlobalUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GlobalUserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AIRequest) GetOptions() *AnswerGenerationOptions {
|
||||||
|
if x != nil {
|
||||||
|
return x.Options
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnswerGenerationOptions содержит дополнительные опции для генерации ответа
|
||||||
|
type AnswerGenerationOptions struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
IncludeUserMemories bool `protobuf:"varint,1,opt,name=include_user_memories,json=includeUserMemories,proto3" json:"include_user_memories,omitempty"` // Включить воспоминания о пользователе в промпт
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AnswerGenerationOptions) Reset() {
|
||||||
|
*x = AnswerGenerationOptions{}
|
||||||
|
mi := &file_ai_proto_msgTypes[1]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AnswerGenerationOptions) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AnswerGenerationOptions) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AnswerGenerationOptions) 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 AnswerGenerationOptions.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AnswerGenerationOptions) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ai_proto_rawDescGZIP(), []int{1}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AnswerGenerationOptions) GetIncludeUserMemories() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.IncludeUserMemories
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
// AIResponse содержит ответ от AI модели
|
// AIResponse содержит ответ от AI модели
|
||||||
type AIResponse struct {
|
type AIResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
@ -103,7 +164,7 @@ type AIResponse struct {
|
|||||||
|
|
||||||
func (x *AIResponse) Reset() {
|
func (x *AIResponse) Reset() {
|
||||||
*x = AIResponse{}
|
*x = AIResponse{}
|
||||||
mi := &file_ai_proto_msgTypes[1]
|
mi := &file_ai_proto_msgTypes[2]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -115,7 +176,7 @@ func (x *AIResponse) String() string {
|
|||||||
func (*AIResponse) ProtoMessage() {}
|
func (*AIResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *AIResponse) ProtoReflect() protoreflect.Message {
|
func (x *AIResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_ai_proto_msgTypes[1]
|
mi := &file_ai_proto_msgTypes[2]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -128,7 +189,7 @@ func (x *AIResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use AIResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use AIResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*AIResponse) Descriptor() ([]byte, []int) {
|
func (*AIResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_ai_proto_rawDescGZIP(), []int{1}
|
return file_ai_proto_rawDescGZIP(), []int{2}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *AIResponse) GetContent() string {
|
func (x *AIResponse) GetContent() string {
|
||||||
@ -159,6 +220,404 @@ func (x *AIResponse) GetReasoningContent() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateSessionRequest для создания новой AI сессии
|
||||||
|
type CreateSessionRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
UserId string `protobuf:"bytes,1,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"` // Идентификатор пользователя
|
||||||
|
BotUsername string `protobuf:"bytes,2,opt,name=bot_username,json=botUsername,proto3" json:"bot_username,omitempty"` // Username бота для упоминаний
|
||||||
|
ModelName string `protobuf:"bytes,3,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` // Название модели (по умолчанию "venice-uncensored")
|
||||||
|
TtlSeconds int64 `protobuf:"varint,4,opt,name=ttl_seconds,json=ttlSeconds,proto3" json:"ttl_seconds,omitempty"` // Время жизни сессии в секундах (по умолчанию 3600 = 1 час)
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionRequest) Reset() {
|
||||||
|
*x = CreateSessionRequest{}
|
||||||
|
mi := &file_ai_proto_msgTypes[3]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CreateSessionRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CreateSessionRequest) 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 CreateSessionRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CreateSessionRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ai_proto_rawDescGZIP(), []int{3}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionRequest) GetUserId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.UserId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionRequest) GetBotUsername() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.BotUsername
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionRequest) GetModelName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ModelName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionRequest) GetTtlSeconds() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.TtlSeconds
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSessionResponse содержит ID созданной сессии
|
||||||
|
type CreateSessionResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // ID сессии
|
||||||
|
Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` // Статус сессии
|
||||||
|
Error string `protobuf:"bytes,3,opt,name=error,proto3" json:"error,omitempty"` // Текст ошибки, если произошла
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionResponse) Reset() {
|
||||||
|
*x = CreateSessionResponse{}
|
||||||
|
mi := &file_ai_proto_msgTypes[4]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*CreateSessionResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *CreateSessionResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_ai_proto_msgTypes[4]
|
||||||
|
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 CreateSessionResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*CreateSessionResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ai_proto_rawDescGZIP(), []int{4}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionResponse) GetSessionId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.SessionId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionResponse) GetStatus() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Status
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *CreateSessionResponse) GetError() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// AskInSessionRequest для запроса в рамках сессии
|
||||||
|
type AskInSessionRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // ID сессии
|
||||||
|
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"` // Текст запроса
|
||||||
|
EnableReasoning bool `protobuf:"varint,3,opt,name=enable_reasoning,json=enableReasoning,proto3" json:"enable_reasoning,omitempty"` // Включить режим рассуждений (по умолчанию false)
|
||||||
|
GlobalUserId int64 `protobuf:"varint,4,opt,name=global_user_id,json=globalUserId,proto3" json:"global_user_id,omitempty"` // Global user ID для получения воспоминаний
|
||||||
|
Options *AnswerGenerationOptions `protobuf:"bytes,5,opt,name=options,proto3" json:"options,omitempty"` // Дополнительные опции генерации
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) Reset() {
|
||||||
|
*x = AskInSessionRequest{}
|
||||||
|
mi := &file_ai_proto_msgTypes[5]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*AskInSessionRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_ai_proto_msgTypes[5]
|
||||||
|
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 AskInSessionRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*AskInSessionRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ai_proto_rawDescGZIP(), []int{5}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) GetSessionId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.SessionId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) GetText() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Text
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) GetEnableReasoning() bool {
|
||||||
|
if x != nil {
|
||||||
|
return x.EnableReasoning
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) GetGlobalUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GlobalUserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *AskInSessionRequest) GetOptions() *AnswerGenerationOptions {
|
||||||
|
if x != nil {
|
||||||
|
return x.Options
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SessionStatusResponse содержит статус сессии и ответ AI
|
||||||
|
type SessionStatusResponse struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // ID сессии
|
||||||
|
Status string `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"` // Статус сессии (active, expired, closed)
|
||||||
|
Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` // Текст ответа от AI
|
||||||
|
Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` // Текст ошибки, если произошла
|
||||||
|
DurationMs float64 `protobuf:"fixed64,5,opt,name=duration_ms,json=durationMs,proto3" json:"duration_ms,omitempty"` // Время выполнения в миллисекундах
|
||||||
|
ReasoningContent string `protobuf:"bytes,6,opt,name=reasoning_content,json=reasoningContent,proto3" json:"reasoning_content,omitempty"` // Текст рассуждений (если включён режим reasoning)
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) Reset() {
|
||||||
|
*x = SessionStatusResponse{}
|
||||||
|
mi := &file_ai_proto_msgTypes[6]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*SessionStatusResponse) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_ai_proto_msgTypes[6]
|
||||||
|
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 SessionStatusResponse.ProtoReflect.Descriptor instead.
|
||||||
|
func (*SessionStatusResponse) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ai_proto_rawDescGZIP(), []int{6}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) GetSessionId() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.SessionId
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) GetStatus() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Status
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) GetContent() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Content
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) GetError() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Error
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) GetDurationMs() float64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.DurationMs
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *SessionStatusResponse) GetReasoningContent() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ReasoningContent
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatelessMessage одно сообщение для stateless запроса (role + content)
|
||||||
|
type StatelessMessage struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Role string `protobuf:"bytes,1,opt,name=role,proto3" json:"role,omitempty"` // "system", "user", "assistant"
|
||||||
|
Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // Текст сообщения
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessMessage) Reset() {
|
||||||
|
*x = StatelessMessage{}
|
||||||
|
mi := &file_ai_proto_msgTypes[7]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessMessage) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*StatelessMessage) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *StatelessMessage) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_ai_proto_msgTypes[7]
|
||||||
|
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 StatelessMessage.ProtoReflect.Descriptor instead.
|
||||||
|
func (*StatelessMessage) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ai_proto_rawDescGZIP(), []int{7}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessMessage) GetRole() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Role
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessMessage) GetContent() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Content
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatelessRequest для stateless генерации с полным контролем над messages
|
||||||
|
type StatelessRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
Messages []*StatelessMessage `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` // Массив сообщений (system + history + user)
|
||||||
|
ModelName string `protobuf:"bytes,2,opt,name=model_name,json=modelName,proto3" json:"model_name,omitempty"` // Название модели (по умолчанию "venice-uncensored")
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessRequest) Reset() {
|
||||||
|
*x = StatelessRequest{}
|
||||||
|
mi := &file_ai_proto_msgTypes[8]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*StatelessRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *StatelessRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_ai_proto_msgTypes[8]
|
||||||
|
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 StatelessRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*StatelessRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_ai_proto_rawDescGZIP(), []int{8}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessRequest) GetMessages() []*StatelessMessage {
|
||||||
|
if x != nil {
|
||||||
|
return x.Messages
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *StatelessRequest) GetModelName() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.ModelName
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// HealthCheckRequest для проверки здоровья сервиса
|
// HealthCheckRequest для проверки здоровья сервиса
|
||||||
type HealthCheckRequest struct {
|
type HealthCheckRequest struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
@ -168,7 +627,7 @@ type HealthCheckRequest struct {
|
|||||||
|
|
||||||
func (x *HealthCheckRequest) Reset() {
|
func (x *HealthCheckRequest) Reset() {
|
||||||
*x = HealthCheckRequest{}
|
*x = HealthCheckRequest{}
|
||||||
mi := &file_ai_proto_msgTypes[2]
|
mi := &file_ai_proto_msgTypes[9]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -180,7 +639,7 @@ func (x *HealthCheckRequest) String() string {
|
|||||||
func (*HealthCheckRequest) ProtoMessage() {}
|
func (*HealthCheckRequest) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
|
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_ai_proto_msgTypes[2]
|
mi := &file_ai_proto_msgTypes[9]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -193,7 +652,7 @@ func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
|
// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
|
||||||
func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
|
func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
|
||||||
return file_ai_proto_rawDescGZIP(), []int{2}
|
return file_ai_proto_rawDescGZIP(), []int{9}
|
||||||
}
|
}
|
||||||
|
|
||||||
// HealthCheckResponse для ответа на проверку здоровья
|
// HealthCheckResponse для ответа на проверку здоровья
|
||||||
@ -207,7 +666,7 @@ type HealthCheckResponse struct {
|
|||||||
|
|
||||||
func (x *HealthCheckResponse) Reset() {
|
func (x *HealthCheckResponse) Reset() {
|
||||||
*x = HealthCheckResponse{}
|
*x = HealthCheckResponse{}
|
||||||
mi := &file_ai_proto_msgTypes[3]
|
mi := &file_ai_proto_msgTypes[10]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -219,7 +678,7 @@ func (x *HealthCheckResponse) String() string {
|
|||||||
func (*HealthCheckResponse) ProtoMessage() {}
|
func (*HealthCheckResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
|
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_ai_proto_msgTypes[3]
|
mi := &file_ai_proto_msgTypes[10]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -232,7 +691,7 @@ func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*HealthCheckResponse) Descriptor() ([]byte, []int) {
|
func (*HealthCheckResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_ai_proto_rawDescGZIP(), []int{3}
|
return file_ai_proto_rawDescGZIP(), []int{10}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HealthCheckResponse) GetServing() bool {
|
func (x *HealthCheckResponse) GetServing() bool {
|
||||||
@ -253,27 +712,69 @@ var File_ai_proto protoreflect.FileDescriptor
|
|||||||
|
|
||||||
const file_ai_proto_rawDesc = "" +
|
const file_ai_proto_rawDesc = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\bai.proto\x12\x02ai\"\x8c\x01\n" +
|
"\bai.proto\x12\x02ai\"\xe9\x01\n" +
|
||||||
"\tAIRequest\x12\x12\n" +
|
"\tAIRequest\x12\x12\n" +
|
||||||
"\x04text\x18\x01 \x01(\tR\x04text\x12!\n" +
|
"\x04text\x18\x01 \x01(\tR\x04text\x12!\n" +
|
||||||
"\fbot_username\x18\x02 \x01(\tR\vbotUsername\x12\x1d\n" +
|
"\fbot_username\x18\x02 \x01(\tR\vbotUsername\x12\x1d\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"model_name\x18\x03 \x01(\tR\tmodelName\x12)\n" +
|
"model_name\x18\x03 \x01(\tR\tmodelName\x12)\n" +
|
||||||
"\x10enable_reasoning\x18\x04 \x01(\bR\x0fenableReasoning\"\x8a\x01\n" +
|
"\x10enable_reasoning\x18\x04 \x01(\bR\x0fenableReasoning\x12$\n" +
|
||||||
|
"\x0eglobal_user_id\x18\x05 \x01(\x03R\fglobalUserId\x125\n" +
|
||||||
|
"\aoptions\x18\x06 \x01(\v2\x1b.ai.AnswerGenerationOptionsR\aoptions\"M\n" +
|
||||||
|
"\x17AnswerGenerationOptions\x122\n" +
|
||||||
|
"\x15include_user_memories\x18\x01 \x01(\bR\x13includeUserMemories\"\x8a\x01\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"AIResponse\x12\x18\n" +
|
"AIResponse\x12\x18\n" +
|
||||||
"\acontent\x18\x01 \x01(\tR\acontent\x12\x14\n" +
|
"\acontent\x18\x01 \x01(\tR\acontent\x12\x14\n" +
|
||||||
"\x05error\x18\x02 \x01(\tR\x05error\x12\x1f\n" +
|
"\x05error\x18\x02 \x01(\tR\x05error\x12\x1f\n" +
|
||||||
"\vduration_ms\x18\x03 \x01(\x01R\n" +
|
"\vduration_ms\x18\x03 \x01(\x01R\n" +
|
||||||
"durationMs\x12+\n" +
|
"durationMs\x12+\n" +
|
||||||
"\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\"\x14\n" +
|
"\x11reasoning_content\x18\x04 \x01(\tR\x10reasoningContent\"\x92\x01\n" +
|
||||||
|
"\x14CreateSessionRequest\x12\x17\n" +
|
||||||
|
"\auser_id\x18\x01 \x01(\tR\x06userId\x12!\n" +
|
||||||
|
"\fbot_username\x18\x02 \x01(\tR\vbotUsername\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"model_name\x18\x03 \x01(\tR\tmodelName\x12\x1f\n" +
|
||||||
|
"\vttl_seconds\x18\x04 \x01(\x03R\n" +
|
||||||
|
"ttlSeconds\"d\n" +
|
||||||
|
"\x15CreateSessionResponse\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"session_id\x18\x01 \x01(\tR\tsessionId\x12\x16\n" +
|
||||||
|
"\x06status\x18\x02 \x01(\tR\x06status\x12\x14\n" +
|
||||||
|
"\x05error\x18\x03 \x01(\tR\x05error\"\xd0\x01\n" +
|
||||||
|
"\x13AskInSessionRequest\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"session_id\x18\x01 \x01(\tR\tsessionId\x12\x12\n" +
|
||||||
|
"\x04text\x18\x02 \x01(\tR\x04text\x12)\n" +
|
||||||
|
"\x10enable_reasoning\x18\x03 \x01(\bR\x0fenableReasoning\x12$\n" +
|
||||||
|
"\x0eglobal_user_id\x18\x04 \x01(\x03R\fglobalUserId\x125\n" +
|
||||||
|
"\aoptions\x18\x05 \x01(\v2\x1b.ai.AnswerGenerationOptionsR\aoptions\"\xcc\x01\n" +
|
||||||
|
"\x15SessionStatusResponse\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"session_id\x18\x01 \x01(\tR\tsessionId\x12\x16\n" +
|
||||||
|
"\x06status\x18\x02 \x01(\tR\x06status\x12\x18\n" +
|
||||||
|
"\acontent\x18\x03 \x01(\tR\acontent\x12\x14\n" +
|
||||||
|
"\x05error\x18\x04 \x01(\tR\x05error\x12\x1f\n" +
|
||||||
|
"\vduration_ms\x18\x05 \x01(\x01R\n" +
|
||||||
|
"durationMs\x12+\n" +
|
||||||
|
"\x11reasoning_content\x18\x06 \x01(\tR\x10reasoningContent\"@\n" +
|
||||||
|
"\x10StatelessMessage\x12\x12\n" +
|
||||||
|
"\x04role\x18\x01 \x01(\tR\x04role\x12\x18\n" +
|
||||||
|
"\acontent\x18\x02 \x01(\tR\acontent\"c\n" +
|
||||||
|
"\x10StatelessRequest\x120\n" +
|
||||||
|
"\bmessages\x18\x01 \x03(\v2\x14.ai.StatelessMessageR\bmessages\x12\x1d\n" +
|
||||||
|
"\n" +
|
||||||
|
"model_name\x18\x02 \x01(\tR\tmodelName\"\x14\n" +
|
||||||
"\x12HealthCheckRequest\"I\n" +
|
"\x12HealthCheckRequest\"I\n" +
|
||||||
"\x13HealthCheckResponse\x12\x18\n" +
|
"\x13HealthCheckResponse\x12\x18\n" +
|
||||||
"\aserving\x18\x01 \x01(\bR\aserving\x12\x18\n" +
|
"\aserving\x18\x01 \x01(\bR\aserving\x12\x18\n" +
|
||||||
"\aversion\x18\x02 \x01(\tR\aversion2|\n" +
|
"\aversion\x18\x02 \x01(\tR\aversion2\xc1\x02\n" +
|
||||||
"\tAIService\x12/\n" +
|
"\tAIService\x12/\n" +
|
||||||
"\x0eGenerateAnswer\x12\r.ai.AIRequest\x1a\x0e.ai.AIResponse\x12>\n" +
|
"\x0eGenerateAnswer\x12\r.ai.AIRequest\x1a\x0e.ai.AIResponse\x129\n" +
|
||||||
"\vHealthCheck\x12\x16.ai.HealthCheckRequest\x1a\x17.ai.HealthCheckResponseB,Z*git.be.kaien.ru/l-ai/l-ai-core-proto/protob\x06proto3"
|
"\x11GenerateStateless\x12\x14.ai.StatelessRequest\x1a\x0e.ai.AIResponse\x12>\n" +
|
||||||
|
"\vHealthCheck\x12\x16.ai.HealthCheckRequest\x1a\x17.ai.HealthCheckResponse\x12D\n" +
|
||||||
|
"\rCreateSession\x12\x18.ai.CreateSessionRequest\x1a\x19.ai.CreateSessionResponse\x12B\n" +
|
||||||
|
"\fAskInSession\x12\x17.ai.AskInSessionRequest\x1a\x19.ai.SessionStatusResponseB,Z*git.be.kaien.ru/l-ai/l-ai-core-proto/protob\x06proto3"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_ai_proto_rawDescOnce sync.Once
|
file_ai_proto_rawDescOnce sync.Once
|
||||||
@ -287,23 +788,39 @@ func file_ai_proto_rawDescGZIP() []byte {
|
|||||||
return file_ai_proto_rawDescData
|
return file_ai_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_ai_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
var file_ai_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||||
var file_ai_proto_goTypes = []any{
|
var file_ai_proto_goTypes = []any{
|
||||||
(*AIRequest)(nil), // 0: ai.AIRequest
|
(*AIRequest)(nil), // 0: ai.AIRequest
|
||||||
(*AIResponse)(nil), // 1: ai.AIResponse
|
(*AnswerGenerationOptions)(nil), // 1: ai.AnswerGenerationOptions
|
||||||
(*HealthCheckRequest)(nil), // 2: ai.HealthCheckRequest
|
(*AIResponse)(nil), // 2: ai.AIResponse
|
||||||
(*HealthCheckResponse)(nil), // 3: ai.HealthCheckResponse
|
(*CreateSessionRequest)(nil), // 3: ai.CreateSessionRequest
|
||||||
|
(*CreateSessionResponse)(nil), // 4: ai.CreateSessionResponse
|
||||||
|
(*AskInSessionRequest)(nil), // 5: ai.AskInSessionRequest
|
||||||
|
(*SessionStatusResponse)(nil), // 6: ai.SessionStatusResponse
|
||||||
|
(*StatelessMessage)(nil), // 7: ai.StatelessMessage
|
||||||
|
(*StatelessRequest)(nil), // 8: ai.StatelessRequest
|
||||||
|
(*HealthCheckRequest)(nil), // 9: ai.HealthCheckRequest
|
||||||
|
(*HealthCheckResponse)(nil), // 10: ai.HealthCheckResponse
|
||||||
}
|
}
|
||||||
var file_ai_proto_depIdxs = []int32{
|
var file_ai_proto_depIdxs = []int32{
|
||||||
0, // 0: ai.AIService.GenerateAnswer:input_type -> ai.AIRequest
|
1, // 0: ai.AIRequest.options:type_name -> ai.AnswerGenerationOptions
|
||||||
2, // 1: ai.AIService.HealthCheck:input_type -> ai.HealthCheckRequest
|
1, // 1: ai.AskInSessionRequest.options:type_name -> ai.AnswerGenerationOptions
|
||||||
1, // 2: ai.AIService.GenerateAnswer:output_type -> ai.AIResponse
|
7, // 2: ai.StatelessRequest.messages:type_name -> ai.StatelessMessage
|
||||||
3, // 3: ai.AIService.HealthCheck:output_type -> ai.HealthCheckResponse
|
0, // 3: ai.AIService.GenerateAnswer:input_type -> ai.AIRequest
|
||||||
2, // [2:4] is the sub-list for method output_type
|
8, // 4: ai.AIService.GenerateStateless:input_type -> ai.StatelessRequest
|
||||||
0, // [0:2] is the sub-list for method input_type
|
9, // 5: ai.AIService.HealthCheck:input_type -> ai.HealthCheckRequest
|
||||||
0, // [0:0] is the sub-list for extension type_name
|
3, // 6: ai.AIService.CreateSession:input_type -> ai.CreateSessionRequest
|
||||||
0, // [0:0] is the sub-list for extension extendee
|
5, // 7: ai.AIService.AskInSession:input_type -> ai.AskInSessionRequest
|
||||||
0, // [0:0] is the sub-list for field type_name
|
2, // 8: ai.AIService.GenerateAnswer:output_type -> ai.AIResponse
|
||||||
|
2, // 9: ai.AIService.GenerateStateless:output_type -> ai.AIResponse
|
||||||
|
10, // 10: ai.AIService.HealthCheck:output_type -> ai.HealthCheckResponse
|
||||||
|
4, // 11: ai.AIService.CreateSession:output_type -> ai.CreateSessionResponse
|
||||||
|
6, // 12: ai.AIService.AskInSession:output_type -> ai.SessionStatusResponse
|
||||||
|
8, // [8:13] is the sub-list for method output_type
|
||||||
|
3, // [3:8] is the sub-list for method input_type
|
||||||
|
3, // [3:3] is the sub-list for extension type_name
|
||||||
|
3, // [3:3] is the sub-list for extension extendee
|
||||||
|
0, // [0:3] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_ai_proto_init() }
|
func init() { file_ai_proto_init() }
|
||||||
@ -317,7 +834,7 @@ func file_ai_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ai_proto_rawDesc), len(file_ai_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ai_proto_rawDesc), len(file_ai_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 4,
|
NumMessages: 11,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
62
ai.proto
62
ai.proto
@ -10,6 +10,13 @@ message AIRequest {
|
|||||||
string bot_username = 2; // Username бота для упоминаний
|
string bot_username = 2; // Username бота для упоминаний
|
||||||
string model_name = 3; // Название модели (по умолчанию "venice-uncensored")
|
string model_name = 3; // Название модели (по умолчанию "venice-uncensored")
|
||||||
bool enable_reasoning = 4; // Включить режим рассуждений (по умолчанию false)
|
bool enable_reasoning = 4; // Включить режим рассуждений (по умолчанию false)
|
||||||
|
int64 global_user_id = 5; // Global user ID для получения доп. данных (профиль, воспоминания)
|
||||||
|
AnswerGenerationOptions options = 6; // Дополнительные опции генерации ответа
|
||||||
|
}
|
||||||
|
|
||||||
|
// AnswerGenerationOptions содержит дополнительные опции для генерации ответа
|
||||||
|
message AnswerGenerationOptions {
|
||||||
|
bool include_user_memories = 1; // Включить воспоминания о пользователе в промпт
|
||||||
}
|
}
|
||||||
|
|
||||||
// AIResponse содержит ответ от AI модели
|
// AIResponse содержит ответ от AI модели
|
||||||
@ -20,6 +27,52 @@ message AIResponse {
|
|||||||
string reasoning_content = 4; // Текст рассуждений (если включён режим reasoning)
|
string reasoning_content = 4; // Текст рассуждений (если включён режим reasoning)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateSessionRequest для создания новой AI сессии
|
||||||
|
message CreateSessionRequest {
|
||||||
|
string user_id = 1; // Идентификатор пользователя
|
||||||
|
string bot_username = 2; // Username бота для упоминаний
|
||||||
|
string model_name = 3; // Название модели (по умолчанию "venice-uncensored")
|
||||||
|
int64 ttl_seconds = 4; // Время жизни сессии в секундах (по умолчанию 3600 = 1 час)
|
||||||
|
}
|
||||||
|
|
||||||
|
// CreateSessionResponse содержит ID созданной сессии
|
||||||
|
message CreateSessionResponse {
|
||||||
|
string session_id = 1; // ID сессии
|
||||||
|
string status = 2; // Статус сессии
|
||||||
|
string error = 3; // Текст ошибки, если произошла
|
||||||
|
}
|
||||||
|
|
||||||
|
// AskInSessionRequest для запроса в рамках сессии
|
||||||
|
message AskInSessionRequest {
|
||||||
|
string session_id = 1; // ID сессии
|
||||||
|
string text = 2; // Текст запроса
|
||||||
|
bool enable_reasoning = 3; // Включить режим рассуждений (по умолчанию false)
|
||||||
|
int64 global_user_id = 4; // Global user ID для получения воспоминаний
|
||||||
|
AnswerGenerationOptions options = 5; // Дополнительные опции генерации
|
||||||
|
}
|
||||||
|
|
||||||
|
// SessionStatusResponse содержит статус сессии и ответ AI
|
||||||
|
message SessionStatusResponse {
|
||||||
|
string session_id = 1; // ID сессии
|
||||||
|
string status = 2; // Статус сессии (active, expired, closed)
|
||||||
|
string content = 3; // Текст ответа от AI
|
||||||
|
string error = 4; // Текст ошибки, если произошла
|
||||||
|
double duration_ms = 5; // Время выполнения в миллисекундах
|
||||||
|
string reasoning_content = 6; // Текст рассуждений (если включён режим reasoning)
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatelessMessage одно сообщение для stateless запроса (role + content)
|
||||||
|
message StatelessMessage {
|
||||||
|
string role = 1; // "system", "user", "assistant"
|
||||||
|
string content = 2; // Текст сообщения
|
||||||
|
}
|
||||||
|
|
||||||
|
// StatelessRequest для stateless генерации с полным контролем над messages
|
||||||
|
message StatelessRequest {
|
||||||
|
repeated StatelessMessage messages = 1; // Массив сообщений (system + history + user)
|
||||||
|
string model_name = 2; // Название модели (по умолчанию "venice-uncensored")
|
||||||
|
}
|
||||||
|
|
||||||
// HealthCheckRequest для проверки здоровья сервиса
|
// HealthCheckRequest для проверки здоровья сервиса
|
||||||
message HealthCheckRequest {}
|
message HealthCheckRequest {}
|
||||||
|
|
||||||
@ -34,6 +87,15 @@ service AIService {
|
|||||||
// GenerateAnswer генерирует ответ на запрос
|
// GenerateAnswer генерирует ответ на запрос
|
||||||
rpc GenerateAnswer(AIRequest) returns (AIResponse);
|
rpc GenerateAnswer(AIRequest) returns (AIResponse);
|
||||||
|
|
||||||
|
// GenerateStateless генерирует ответ из массива messages (system+history+user)
|
||||||
|
rpc GenerateStateless(StatelessRequest) returns (AIResponse);
|
||||||
|
|
||||||
// HealthCheck проверяет здоровье сервиса
|
// HealthCheck проверяет здоровье сервиса
|
||||||
rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse);
|
rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse);
|
||||||
|
|
||||||
|
// CreateSession созда новую AI сессию
|
||||||
|
rpc CreateSession(CreateSessionRequest) returns (CreateSessionResponse);
|
||||||
|
|
||||||
|
// AskInSession отправляет запрос в рамках существующей сессии
|
||||||
|
rpc AskInSession(AskInSessionRequest) returns (SessionStatusResponse);
|
||||||
}
|
}
|
||||||
|
|||||||
124
ai_grpc.pb.go
124
ai_grpc.pb.go
@ -19,8 +19,11 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AIService_GenerateAnswer_FullMethodName = "/ai.AIService/GenerateAnswer"
|
AIService_GenerateAnswer_FullMethodName = "/ai.AIService/GenerateAnswer"
|
||||||
AIService_HealthCheck_FullMethodName = "/ai.AIService/HealthCheck"
|
AIService_GenerateStateless_FullMethodName = "/ai.AIService/GenerateStateless"
|
||||||
|
AIService_HealthCheck_FullMethodName = "/ai.AIService/HealthCheck"
|
||||||
|
AIService_CreateSession_FullMethodName = "/ai.AIService/CreateSession"
|
||||||
|
AIService_AskInSession_FullMethodName = "/ai.AIService/AskInSession"
|
||||||
)
|
)
|
||||||
|
|
||||||
// AIServiceClient is the client API for AIService service.
|
// AIServiceClient is the client API for AIService service.
|
||||||
@ -31,8 +34,14 @@ const (
|
|||||||
type AIServiceClient interface {
|
type AIServiceClient interface {
|
||||||
// GenerateAnswer генерирует ответ на запрос
|
// GenerateAnswer генерирует ответ на запрос
|
||||||
GenerateAnswer(ctx context.Context, in *AIRequest, opts ...grpc.CallOption) (*AIResponse, error)
|
GenerateAnswer(ctx context.Context, in *AIRequest, opts ...grpc.CallOption) (*AIResponse, error)
|
||||||
|
// GenerateStateless генерирует ответ из массива messages (system+history+user)
|
||||||
|
GenerateStateless(ctx context.Context, in *StatelessRequest, opts ...grpc.CallOption) (*AIResponse, error)
|
||||||
// HealthCheck проверяет здоровье сервиса
|
// HealthCheck проверяет здоровье сервиса
|
||||||
HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
|
HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
|
||||||
|
// CreateSession созда новую AI сессию
|
||||||
|
CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...grpc.CallOption) (*CreateSessionResponse, error)
|
||||||
|
// AskInSession отправляет запрос в рамках существующей сессии
|
||||||
|
AskInSession(ctx context.Context, in *AskInSessionRequest, opts ...grpc.CallOption) (*SessionStatusResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type aIServiceClient struct {
|
type aIServiceClient struct {
|
||||||
@ -53,6 +62,16 @@ func (c *aIServiceClient) GenerateAnswer(ctx context.Context, in *AIRequest, opt
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *aIServiceClient) GenerateStateless(ctx context.Context, in *StatelessRequest, opts ...grpc.CallOption) (*AIResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AIResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AIService_GenerateStateless_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) {
|
func (c *aIServiceClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
|
||||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
out := new(HealthCheckResponse)
|
out := new(HealthCheckResponse)
|
||||||
@ -63,6 +82,26 @@ func (c *aIServiceClient) HealthCheck(ctx context.Context, in *HealthCheckReques
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *aIServiceClient) CreateSession(ctx context.Context, in *CreateSessionRequest, opts ...grpc.CallOption) (*CreateSessionResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(CreateSessionResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AIService_CreateSession_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *aIServiceClient) AskInSession(ctx context.Context, in *AskInSessionRequest, opts ...grpc.CallOption) (*SessionStatusResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(SessionStatusResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AIService_AskInSession_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// AIServiceServer is the server API for AIService service.
|
// AIServiceServer is the server API for AIService service.
|
||||||
// All implementations must embed UnimplementedAIServiceServer
|
// All implementations must embed UnimplementedAIServiceServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
@ -71,8 +110,14 @@ func (c *aIServiceClient) HealthCheck(ctx context.Context, in *HealthCheckReques
|
|||||||
type AIServiceServer interface {
|
type AIServiceServer interface {
|
||||||
// GenerateAnswer генерирует ответ на запрос
|
// GenerateAnswer генерирует ответ на запрос
|
||||||
GenerateAnswer(context.Context, *AIRequest) (*AIResponse, error)
|
GenerateAnswer(context.Context, *AIRequest) (*AIResponse, error)
|
||||||
|
// GenerateStateless генерирует ответ из массива messages (system+history+user)
|
||||||
|
GenerateStateless(context.Context, *StatelessRequest) (*AIResponse, error)
|
||||||
// HealthCheck проверяет здоровье сервиса
|
// HealthCheck проверяет здоровье сервиса
|
||||||
HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
|
HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
|
||||||
|
// CreateSession созда новую AI сессию
|
||||||
|
CreateSession(context.Context, *CreateSessionRequest) (*CreateSessionResponse, error)
|
||||||
|
// AskInSession отправляет запрос в рамках существующей сессии
|
||||||
|
AskInSession(context.Context, *AskInSessionRequest) (*SessionStatusResponse, error)
|
||||||
mustEmbedUnimplementedAIServiceServer()
|
mustEmbedUnimplementedAIServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,9 +131,18 @@ type UnimplementedAIServiceServer struct{}
|
|||||||
func (UnimplementedAIServiceServer) GenerateAnswer(context.Context, *AIRequest) (*AIResponse, error) {
|
func (UnimplementedAIServiceServer) GenerateAnswer(context.Context, *AIRequest) (*AIResponse, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method GenerateAnswer not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GenerateAnswer not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedAIServiceServer) GenerateStateless(context.Context, *StatelessRequest) (*AIResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GenerateStateless not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedAIServiceServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
|
func (UnimplementedAIServiceServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method HealthCheck not implemented")
|
return nil, status.Error(codes.Unimplemented, "method HealthCheck not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedAIServiceServer) CreateSession(context.Context, *CreateSessionRequest) (*CreateSessionResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method CreateSession not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAIServiceServer) AskInSession(context.Context, *AskInSessionRequest) (*SessionStatusResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method AskInSession not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedAIServiceServer) mustEmbedUnimplementedAIServiceServer() {}
|
func (UnimplementedAIServiceServer) mustEmbedUnimplementedAIServiceServer() {}
|
||||||
func (UnimplementedAIServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedAIServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
@ -128,6 +182,24 @@ func _AIService_GenerateAnswer_Handler(srv interface{}, ctx context.Context, dec
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _AIService_GenerateStateless_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(StatelessRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AIServiceServer).GenerateStateless(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AIService_GenerateStateless_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AIServiceServer).GenerateStateless(ctx, req.(*StatelessRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
func _AIService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
func _AIService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
in := new(HealthCheckRequest)
|
in := new(HealthCheckRequest)
|
||||||
if err := dec(in); err != nil {
|
if err := dec(in); err != nil {
|
||||||
@ -146,6 +218,42 @@ func _AIService_HealthCheck_Handler(srv interface{}, ctx context.Context, dec fu
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _AIService_CreateSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(CreateSessionRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AIServiceServer).CreateSession(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AIService_CreateSession_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AIServiceServer).CreateSession(ctx, req.(*CreateSessionRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AIService_AskInSession_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(AskInSessionRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AIServiceServer).AskInSession(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AIService_AskInSession_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AIServiceServer).AskInSession(ctx, req.(*AskInSessionRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// AIService_ServiceDesc is the grpc.ServiceDesc for AIService service.
|
// AIService_ServiceDesc is the grpc.ServiceDesc for AIService service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -157,10 +265,22 @@ var AIService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GenerateAnswer",
|
MethodName: "GenerateAnswer",
|
||||||
Handler: _AIService_GenerateAnswer_Handler,
|
Handler: _AIService_GenerateAnswer_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GenerateStateless",
|
||||||
|
Handler: _AIService_GenerateStateless_Handler,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
MethodName: "HealthCheck",
|
MethodName: "HealthCheck",
|
||||||
Handler: _AIService_HealthCheck_Handler,
|
Handler: _AIService_HealthCheck_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "CreateSession",
|
||||||
|
Handler: _AIService_CreateSession_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "AskInSession",
|
||||||
|
Handler: _AIService_AskInSession_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "ai.proto",
|
Metadata: "ai.proto",
|
||||||
|
|||||||
1003
auth.pb.go
Normal file
1003
auth.pb.go
Normal file
File diff suppressed because it is too large
Load Diff
131
auth.proto
Normal file
131
auth.proto
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
package auth;
|
||||||
|
|
||||||
|
option go_package = "ai_service/proto/l-ai-core-proto;proto";
|
||||||
|
|
||||||
|
// AuthService handles OAuth authentication and JWT token management.
|
||||||
|
// It is the single auth authority for all services in the platform.
|
||||||
|
service AuthService {
|
||||||
|
// Telegram Login Widget — verify widget callback data and return JWT tokens
|
||||||
|
rpc AuthWithTelegram(TelegramAuthRequest) returns (AuthResponse);
|
||||||
|
|
||||||
|
// Telegram new Login (id_token JWT) — verify JWT and return platform tokens
|
||||||
|
rpc AuthWithTelegramToken(TelegramTokenRequest) returns (AuthResponse);
|
||||||
|
|
||||||
|
// Discord OAuth — generate redirect URL (state stored server-side)
|
||||||
|
rpc GetDiscordOAuthURL(GetDiscordOAuthURLRequest) returns (OAuthURLResponse);
|
||||||
|
|
||||||
|
// Discord OAuth — exchange authorization code for JWT tokens
|
||||||
|
rpc ExchangeDiscordCode(DiscordExchangeRequest) returns (AuthResponse);
|
||||||
|
|
||||||
|
// Steam OpenID 2.0 — generate redirect URL (state stored server-side)
|
||||||
|
rpc GetSteamAuthURL(GetSteamAuthURLRequest) returns (OAuthURLResponse);
|
||||||
|
|
||||||
|
// Steam OpenID 2.0 — verify OpenID assertion and return JWT tokens
|
||||||
|
rpc ExchangeSteamLogin(SteamExchangeRequest) returns (AuthResponse);
|
||||||
|
|
||||||
|
// VK OAuth — generate redirect URL (state stored server-side)
|
||||||
|
rpc GetVKOAuthURL(GetVKOAuthURLRequest) returns (OAuthURLResponse);
|
||||||
|
|
||||||
|
// VK OAuth — exchange authorization code for JWT tokens
|
||||||
|
rpc ExchangeVKCode(VKExchangeRequest) returns (AuthResponse);
|
||||||
|
|
||||||
|
// Issue new token pair from a valid refresh token
|
||||||
|
rpc RefreshToken(RefreshTokenRequest) returns (AuthResponse);
|
||||||
|
|
||||||
|
// Revoke a token (add to blacklist)
|
||||||
|
rpc RevokeToken(RevokeTokenRequest) returns (RevokeTokenResponse);
|
||||||
|
|
||||||
|
// Validate a token and return its claims (optional — services can validate locally)
|
||||||
|
rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TelegramTokenRequest contains the id_token JWT from the new Telegram Login
|
||||||
|
message TelegramTokenRequest {
|
||||||
|
string id_token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TelegramAuthRequest contains the data sent by the Telegram Login Widget
|
||||||
|
message TelegramAuthRequest {
|
||||||
|
int64 id = 1;
|
||||||
|
string first_name = 2;
|
||||||
|
string last_name = 3;
|
||||||
|
string username = 4;
|
||||||
|
string photo_url = 5;
|
||||||
|
int64 auth_date = 6;
|
||||||
|
string hash = 7;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetDiscordOAuthURLRequest — caller provides the redirect_uri for their service
|
||||||
|
message GetDiscordOAuthURLRequest {
|
||||||
|
string redirect_uri = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// OAuthURLResponse returns the full OAuth redirect URL including state
|
||||||
|
message OAuthURLResponse {
|
||||||
|
string url = 1;
|
||||||
|
string state = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// DiscordExchangeRequest — exchange code received in Discord callback
|
||||||
|
message DiscordExchangeRequest {
|
||||||
|
string code = 1;
|
||||||
|
string state = 2;
|
||||||
|
string redirect_uri = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetSteamAuthURLRequest — caller provides the redirect_uri for their service
|
||||||
|
message GetSteamAuthURLRequest {
|
||||||
|
string redirect_uri = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// SteamExchangeRequest — all OpenID 2.0 params received in the Steam callback
|
||||||
|
message SteamExchangeRequest {
|
||||||
|
string state = 1;
|
||||||
|
map<string, string> openid_params = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// GetVKOAuthURLRequest — caller provides the redirect_uri for their service
|
||||||
|
message GetVKOAuthURLRequest {
|
||||||
|
string redirect_uri = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// VKExchangeRequest — exchange code received in VK callback
|
||||||
|
message VKExchangeRequest {
|
||||||
|
string code = 1;
|
||||||
|
string state = 2;
|
||||||
|
string redirect_uri = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
// AuthResponse is returned after successful authentication
|
||||||
|
message AuthResponse {
|
||||||
|
string access_token = 1;
|
||||||
|
string refresh_token = 2;
|
||||||
|
int64 global_user_id = 3;
|
||||||
|
string display_name = 4;
|
||||||
|
int64 expires_at = 5; // unix timestamp of access token expiry
|
||||||
|
}
|
||||||
|
|
||||||
|
message RefreshTokenRequest {
|
||||||
|
string refresh_token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RevokeTokenRequest {
|
||||||
|
string token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RevokeTokenResponse {
|
||||||
|
bool success = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ValidateTokenRequest {
|
||||||
|
string token = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
message ValidateTokenResponse {
|
||||||
|
bool valid = 1;
|
||||||
|
int64 global_user_id = 2;
|
||||||
|
string display_name = 3;
|
||||||
|
repeated string linked_platforms = 4;
|
||||||
|
}
|
||||||
529
auth_grpc.pb.go
Normal file
529
auth_grpc.pb.go
Normal file
@ -0,0 +1,529 @@
|
|||||||
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||||
|
// versions:
|
||||||
|
// - protoc-gen-go-grpc v1.6.1
|
||||||
|
// - protoc v7.34.0
|
||||||
|
// source: auth.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 (
|
||||||
|
AuthService_AuthWithTelegram_FullMethodName = "/auth.AuthService/AuthWithTelegram"
|
||||||
|
AuthService_AuthWithTelegramToken_FullMethodName = "/auth.AuthService/AuthWithTelegramToken"
|
||||||
|
AuthService_GetDiscordOAuthURL_FullMethodName = "/auth.AuthService/GetDiscordOAuthURL"
|
||||||
|
AuthService_ExchangeDiscordCode_FullMethodName = "/auth.AuthService/ExchangeDiscordCode"
|
||||||
|
AuthService_GetSteamAuthURL_FullMethodName = "/auth.AuthService/GetSteamAuthURL"
|
||||||
|
AuthService_ExchangeSteamLogin_FullMethodName = "/auth.AuthService/ExchangeSteamLogin"
|
||||||
|
AuthService_GetVKOAuthURL_FullMethodName = "/auth.AuthService/GetVKOAuthURL"
|
||||||
|
AuthService_ExchangeVKCode_FullMethodName = "/auth.AuthService/ExchangeVKCode"
|
||||||
|
AuthService_RefreshToken_FullMethodName = "/auth.AuthService/RefreshToken"
|
||||||
|
AuthService_RevokeToken_FullMethodName = "/auth.AuthService/RevokeToken"
|
||||||
|
AuthService_ValidateToken_FullMethodName = "/auth.AuthService/ValidateToken"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AuthServiceClient is the client API for AuthService 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.
|
||||||
|
//
|
||||||
|
// AuthService handles OAuth authentication and JWT token management.
|
||||||
|
// It is the single auth authority for all services in the platform.
|
||||||
|
type AuthServiceClient interface {
|
||||||
|
// Telegram Login Widget — verify widget callback data and return JWT tokens
|
||||||
|
AuthWithTelegram(ctx context.Context, in *TelegramAuthRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||||
|
// Telegram new Login (id_token JWT) — verify JWT and return platform tokens
|
||||||
|
AuthWithTelegramToken(ctx context.Context, in *TelegramTokenRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||||
|
// Discord OAuth — generate redirect URL (state stored server-side)
|
||||||
|
GetDiscordOAuthURL(ctx context.Context, in *GetDiscordOAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error)
|
||||||
|
// Discord OAuth — exchange authorization code for JWT tokens
|
||||||
|
ExchangeDiscordCode(ctx context.Context, in *DiscordExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||||
|
// Steam OpenID 2.0 — generate redirect URL (state stored server-side)
|
||||||
|
GetSteamAuthURL(ctx context.Context, in *GetSteamAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error)
|
||||||
|
// Steam OpenID 2.0 — verify OpenID assertion and return JWT tokens
|
||||||
|
ExchangeSteamLogin(ctx context.Context, in *SteamExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||||
|
// VK OAuth — generate redirect URL (state stored server-side)
|
||||||
|
GetVKOAuthURL(ctx context.Context, in *GetVKOAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error)
|
||||||
|
// VK OAuth — exchange authorization code for JWT tokens
|
||||||
|
ExchangeVKCode(ctx context.Context, in *VKExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||||
|
// Issue new token pair from a valid refresh token
|
||||||
|
RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||||
|
// Revoke a token (add to blacklist)
|
||||||
|
RevokeToken(ctx context.Context, in *RevokeTokenRequest, opts ...grpc.CallOption) (*RevokeTokenResponse, error)
|
||||||
|
// Validate a token and return its claims (optional — services can validate locally)
|
||||||
|
ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type authServiceClient struct {
|
||||||
|
cc grpc.ClientConnInterface
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
|
||||||
|
return &authServiceClient{cc}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) AuthWithTelegram(ctx context.Context, in *TelegramAuthRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AuthResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_AuthWithTelegram_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) AuthWithTelegramToken(ctx context.Context, in *TelegramTokenRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AuthResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_AuthWithTelegramToken_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) GetDiscordOAuthURL(ctx context.Context, in *GetDiscordOAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(OAuthURLResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_GetDiscordOAuthURL_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) ExchangeDiscordCode(ctx context.Context, in *DiscordExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AuthResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_ExchangeDiscordCode_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) GetSteamAuthURL(ctx context.Context, in *GetSteamAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(OAuthURLResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_GetSteamAuthURL_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) ExchangeSteamLogin(ctx context.Context, in *SteamExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AuthResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_ExchangeSteamLogin_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) GetVKOAuthURL(ctx context.Context, in *GetVKOAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(OAuthURLResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_GetVKOAuthURL_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) ExchangeVKCode(ctx context.Context, in *VKExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AuthResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_ExchangeVKCode_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(AuthResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_RefreshToken_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) RevokeToken(ctx context.Context, in *RevokeTokenRequest, opts ...grpc.CallOption) (*RevokeTokenResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(RevokeTokenResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_RevokeToken_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *authServiceClient) ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(ValidateTokenResponse)
|
||||||
|
err := c.cc.Invoke(ctx, AuthService_ValidateToken_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AuthServiceServer is the server API for AuthService service.
|
||||||
|
// All implementations must embed UnimplementedAuthServiceServer
|
||||||
|
// for forward compatibility.
|
||||||
|
//
|
||||||
|
// AuthService handles OAuth authentication and JWT token management.
|
||||||
|
// It is the single auth authority for all services in the platform.
|
||||||
|
type AuthServiceServer interface {
|
||||||
|
// Telegram Login Widget — verify widget callback data and return JWT tokens
|
||||||
|
AuthWithTelegram(context.Context, *TelegramAuthRequest) (*AuthResponse, error)
|
||||||
|
// Telegram new Login (id_token JWT) — verify JWT and return platform tokens
|
||||||
|
AuthWithTelegramToken(context.Context, *TelegramTokenRequest) (*AuthResponse, error)
|
||||||
|
// Discord OAuth — generate redirect URL (state stored server-side)
|
||||||
|
GetDiscordOAuthURL(context.Context, *GetDiscordOAuthURLRequest) (*OAuthURLResponse, error)
|
||||||
|
// Discord OAuth — exchange authorization code for JWT tokens
|
||||||
|
ExchangeDiscordCode(context.Context, *DiscordExchangeRequest) (*AuthResponse, error)
|
||||||
|
// Steam OpenID 2.0 — generate redirect URL (state stored server-side)
|
||||||
|
GetSteamAuthURL(context.Context, *GetSteamAuthURLRequest) (*OAuthURLResponse, error)
|
||||||
|
// Steam OpenID 2.0 — verify OpenID assertion and return JWT tokens
|
||||||
|
ExchangeSteamLogin(context.Context, *SteamExchangeRequest) (*AuthResponse, error)
|
||||||
|
// VK OAuth — generate redirect URL (state stored server-side)
|
||||||
|
GetVKOAuthURL(context.Context, *GetVKOAuthURLRequest) (*OAuthURLResponse, error)
|
||||||
|
// VK OAuth — exchange authorization code for JWT tokens
|
||||||
|
ExchangeVKCode(context.Context, *VKExchangeRequest) (*AuthResponse, error)
|
||||||
|
// Issue new token pair from a valid refresh token
|
||||||
|
RefreshToken(context.Context, *RefreshTokenRequest) (*AuthResponse, error)
|
||||||
|
// Revoke a token (add to blacklist)
|
||||||
|
RevokeToken(context.Context, *RevokeTokenRequest) (*RevokeTokenResponse, error)
|
||||||
|
// Validate a token and return its claims (optional — services can validate locally)
|
||||||
|
ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error)
|
||||||
|
mustEmbedUnimplementedAuthServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnimplementedAuthServiceServer 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 UnimplementedAuthServiceServer struct{}
|
||||||
|
|
||||||
|
func (UnimplementedAuthServiceServer) AuthWithTelegram(context.Context, *TelegramAuthRequest) (*AuthResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method AuthWithTelegram not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) AuthWithTelegramToken(context.Context, *TelegramTokenRequest) (*AuthResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method AuthWithTelegramToken not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) GetDiscordOAuthURL(context.Context, *GetDiscordOAuthURLRequest) (*OAuthURLResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetDiscordOAuthURL not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) ExchangeDiscordCode(context.Context, *DiscordExchangeRequest) (*AuthResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method ExchangeDiscordCode not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) GetSteamAuthURL(context.Context, *GetSteamAuthURLRequest) (*OAuthURLResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetSteamAuthURL not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) ExchangeSteamLogin(context.Context, *SteamExchangeRequest) (*AuthResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method ExchangeSteamLogin not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) GetVKOAuthURL(context.Context, *GetVKOAuthURLRequest) (*OAuthURLResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetVKOAuthURL not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) ExchangeVKCode(context.Context, *VKExchangeRequest) (*AuthResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method ExchangeVKCode not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) RefreshToken(context.Context, *RefreshTokenRequest) (*AuthResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method RefreshToken not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) RevokeToken(context.Context, *RevokeTokenRequest) (*RevokeTokenResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method RevokeToken not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method ValidateToken not implemented")
|
||||||
|
}
|
||||||
|
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
|
||||||
|
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
|
// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||||
|
// Use of this interface is not recommended, as added methods to AuthServiceServer will
|
||||||
|
// result in compilation errors.
|
||||||
|
type UnsafeAuthServiceServer interface {
|
||||||
|
mustEmbedUnimplementedAuthServiceServer()
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
|
||||||
|
// If the following call panics, it indicates UnimplementedAuthServiceServer 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(&AuthService_ServiceDesc, srv)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_AuthWithTelegram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(TelegramAuthRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).AuthWithTelegram(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_AuthWithTelegram_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).AuthWithTelegram(ctx, req.(*TelegramAuthRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_AuthWithTelegramToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(TelegramTokenRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).AuthWithTelegramToken(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_AuthWithTelegramToken_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).AuthWithTelegramToken(ctx, req.(*TelegramTokenRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_GetDiscordOAuthURL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetDiscordOAuthURLRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).GetDiscordOAuthURL(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_GetDiscordOAuthURL_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).GetDiscordOAuthURL(ctx, req.(*GetDiscordOAuthURLRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_ExchangeDiscordCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(DiscordExchangeRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).ExchangeDiscordCode(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_ExchangeDiscordCode_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).ExchangeDiscordCode(ctx, req.(*DiscordExchangeRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_GetSteamAuthURL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetSteamAuthURLRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).GetSteamAuthURL(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_GetSteamAuthURL_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).GetSteamAuthURL(ctx, req.(*GetSteamAuthURLRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_ExchangeSteamLogin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(SteamExchangeRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).ExchangeSteamLogin(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_ExchangeSteamLogin_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).ExchangeSteamLogin(ctx, req.(*SteamExchangeRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_GetVKOAuthURL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetVKOAuthURLRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).GetVKOAuthURL(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_GetVKOAuthURL_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).GetVKOAuthURL(ctx, req.(*GetVKOAuthURLRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_ExchangeVKCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(VKExchangeRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).ExchangeVKCode(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_ExchangeVKCode_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).ExchangeVKCode(ctx, req.(*VKExchangeRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(RefreshTokenRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).RefreshToken(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_RefreshToken_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).RefreshToken(ctx, req.(*RefreshTokenRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_RevokeToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(RevokeTokenRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).RevokeToken(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_RevokeToken_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).RevokeToken(ctx, req.(*RevokeTokenRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
func _AuthService_ValidateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(ValidateTokenRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(AuthServiceServer).ValidateToken(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: AuthService_ValidateToken_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(AuthServiceServer).ValidateToken(ctx, req.(*ValidateTokenRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
|
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
|
||||||
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
|
// and not to be introspected or modified (even as a copy)
|
||||||
|
var AuthService_ServiceDesc = grpc.ServiceDesc{
|
||||||
|
ServiceName: "auth.AuthService",
|
||||||
|
HandlerType: (*AuthServiceServer)(nil),
|
||||||
|
Methods: []grpc.MethodDesc{
|
||||||
|
{
|
||||||
|
MethodName: "AuthWithTelegram",
|
||||||
|
Handler: _AuthService_AuthWithTelegram_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "AuthWithTelegramToken",
|
||||||
|
Handler: _AuthService_AuthWithTelegramToken_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetDiscordOAuthURL",
|
||||||
|
Handler: _AuthService_GetDiscordOAuthURL_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ExchangeDiscordCode",
|
||||||
|
Handler: _AuthService_ExchangeDiscordCode_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetSteamAuthURL",
|
||||||
|
Handler: _AuthService_GetSteamAuthURL_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ExchangeSteamLogin",
|
||||||
|
Handler: _AuthService_ExchangeSteamLogin_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetVKOAuthURL",
|
||||||
|
Handler: _AuthService_GetVKOAuthURL_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ExchangeVKCode",
|
||||||
|
Handler: _AuthService_ExchangeVKCode_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "RefreshToken",
|
||||||
|
Handler: _AuthService_RefreshToken_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "RevokeToken",
|
||||||
|
Handler: _AuthService_RevokeToken_Handler,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
MethodName: "ValidateToken",
|
||||||
|
Handler: _AuthService_ValidateToken_Handler,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Streams: []grpc.StreamDesc{},
|
||||||
|
Metadata: "auth.proto",
|
||||||
|
}
|
||||||
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",
|
||||||
|
}
|
||||||
131
users.pb.go
131
users.pb.go
@ -615,6 +615,58 @@ func (x *GetLinkedAccountsByPlatformRequest) GetPlatform() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type GetLinkedAccountsByUserAndPlatformRequest struct {
|
||||||
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
|
GlobalUserId int64 `protobuf:"varint,1,opt,name=global_user_id,json=globalUserId,proto3" json:"global_user_id,omitempty"`
|
||||||
|
Platform string `protobuf:"bytes,2,opt,name=platform,proto3" json:"platform,omitempty"`
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetLinkedAccountsByUserAndPlatformRequest) Reset() {
|
||||||
|
*x = GetLinkedAccountsByUserAndPlatformRequest{}
|
||||||
|
mi := &file_users_proto_msgTypes[10]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetLinkedAccountsByUserAndPlatformRequest) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*GetLinkedAccountsByUserAndPlatformRequest) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *GetLinkedAccountsByUserAndPlatformRequest) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_users_proto_msgTypes[10]
|
||||||
|
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 GetLinkedAccountsByUserAndPlatformRequest.ProtoReflect.Descriptor instead.
|
||||||
|
func (*GetLinkedAccountsByUserAndPlatformRequest) Descriptor() ([]byte, []int) {
|
||||||
|
return file_users_proto_rawDescGZIP(), []int{10}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetLinkedAccountsByUserAndPlatformRequest) GetGlobalUserId() int64 {
|
||||||
|
if x != nil {
|
||||||
|
return x.GlobalUserId
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *GetLinkedAccountsByUserAndPlatformRequest) GetPlatform() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Platform
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
type GetLinkedAccountsResponse struct {
|
type GetLinkedAccountsResponse struct {
|
||||||
state protoimpl.MessageState `protogen:"open.v1"`
|
state protoimpl.MessageState `protogen:"open.v1"`
|
||||||
Accounts []*LinkedAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"`
|
Accounts []*LinkedAccount `protobuf:"bytes,1,rep,name=accounts,proto3" json:"accounts,omitempty"`
|
||||||
@ -624,7 +676,7 @@ type GetLinkedAccountsResponse struct {
|
|||||||
|
|
||||||
func (x *GetLinkedAccountsResponse) Reset() {
|
func (x *GetLinkedAccountsResponse) Reset() {
|
||||||
*x = GetLinkedAccountsResponse{}
|
*x = GetLinkedAccountsResponse{}
|
||||||
mi := &file_users_proto_msgTypes[10]
|
mi := &file_users_proto_msgTypes[11]
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
ms.StoreMessageInfo(mi)
|
ms.StoreMessageInfo(mi)
|
||||||
}
|
}
|
||||||
@ -636,7 +688,7 @@ func (x *GetLinkedAccountsResponse) String() string {
|
|||||||
func (*GetLinkedAccountsResponse) ProtoMessage() {}
|
func (*GetLinkedAccountsResponse) ProtoMessage() {}
|
||||||
|
|
||||||
func (x *GetLinkedAccountsResponse) ProtoReflect() protoreflect.Message {
|
func (x *GetLinkedAccountsResponse) ProtoReflect() protoreflect.Message {
|
||||||
mi := &file_users_proto_msgTypes[10]
|
mi := &file_users_proto_msgTypes[11]
|
||||||
if x != nil {
|
if x != nil {
|
||||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
if ms.LoadMessageInfo() == nil {
|
if ms.LoadMessageInfo() == nil {
|
||||||
@ -649,7 +701,7 @@ func (x *GetLinkedAccountsResponse) ProtoReflect() protoreflect.Message {
|
|||||||
|
|
||||||
// Deprecated: Use GetLinkedAccountsResponse.ProtoReflect.Descriptor instead.
|
// Deprecated: Use GetLinkedAccountsResponse.ProtoReflect.Descriptor instead.
|
||||||
func (*GetLinkedAccountsResponse) Descriptor() ([]byte, []int) {
|
func (*GetLinkedAccountsResponse) Descriptor() ([]byte, []int) {
|
||||||
return file_users_proto_rawDescGZIP(), []int{10}
|
return file_users_proto_rawDescGZIP(), []int{11}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *GetLinkedAccountsResponse) GetAccounts() []*LinkedAccount {
|
func (x *GetLinkedAccountsResponse) GetAccounts() []*LinkedAccount {
|
||||||
@ -711,9 +763,12 @@ const file_users_proto_rawDesc = "" +
|
|||||||
"\x0eglobal_user_id\x18\x01 \x01(\x03R\fglobalUserId\x12\x1a\n" +
|
"\x0eglobal_user_id\x18\x01 \x01(\x03R\fglobalUserId\x12\x1a\n" +
|
||||||
"\bplatform\x18\x02 \x01(\tR\bplatform\"@\n" +
|
"\bplatform\x18\x02 \x01(\tR\bplatform\"@\n" +
|
||||||
"\"GetLinkedAccountsByPlatformRequest\x12\x1a\n" +
|
"\"GetLinkedAccountsByPlatformRequest\x12\x1a\n" +
|
||||||
"\bplatform\x18\x01 \x01(\tR\bplatform\"M\n" +
|
"\bplatform\x18\x01 \x01(\tR\bplatform\"m\n" +
|
||||||
|
")GetLinkedAccountsByUserAndPlatformRequest\x12$\n" +
|
||||||
|
"\x0eglobal_user_id\x18\x01 \x01(\x03R\fglobalUserId\x12\x1a\n" +
|
||||||
|
"\bplatform\x18\x02 \x01(\tR\bplatform\"M\n" +
|
||||||
"\x19GetLinkedAccountsResponse\x120\n" +
|
"\x19GetLinkedAccountsResponse\x120\n" +
|
||||||
"\baccounts\x18\x01 \x03(\v2\x14.users.LinkedAccountR\baccounts2\xef\x04\n" +
|
"\baccounts\x18\x01 \x03(\v2\x14.users.LinkedAccountR\baccounts2\xe9\x05\n" +
|
||||||
"\fUsersService\x12E\n" +
|
"\fUsersService\x12E\n" +
|
||||||
"\x10CreateGlobalUser\x12\x1e.users.CreateGlobalUserRequest\x1a\x11.users.GlobalUser\x12?\n" +
|
"\x10CreateGlobalUser\x12\x1e.users.CreateGlobalUserRequest\x1a\x11.users.GlobalUser\x12?\n" +
|
||||||
"\rGetGlobalUser\x12\x1b.users.GetGlobalUserRequest\x1a\x11.users.GlobalUser\x12M\n" +
|
"\rGetGlobalUser\x12\x1b.users.GetGlobalUserRequest\x1a\x11.users.GlobalUser\x12M\n" +
|
||||||
@ -722,7 +777,8 @@ const file_users_proto_rawDesc = "" +
|
|||||||
"\vLinkAccount\x12\x19.users.LinkAccountRequest\x1a\x14.users.LinkedAccount\x12D\n" +
|
"\vLinkAccount\x12\x19.users.LinkAccountRequest\x1a\x14.users.LinkedAccount\x12D\n" +
|
||||||
"\rUnlinkAccount\x12\x1b.users.UnlinkAccountRequest\x1a\x16.google.protobuf.Empty\x12H\n" +
|
"\rUnlinkAccount\x12\x1b.users.UnlinkAccountRequest\x1a\x16.google.protobuf.Empty\x12H\n" +
|
||||||
"\x10GetLinkedAccount\x12\x1e.users.GetLinkedAccountRequest\x1a\x14.users.LinkedAccount\x12j\n" +
|
"\x10GetLinkedAccount\x12\x1e.users.GetLinkedAccountRequest\x1a\x14.users.LinkedAccount\x12j\n" +
|
||||||
"\x1bGetLinkedAccountsByPlatform\x12).users.GetLinkedAccountsByPlatformRequest\x1a .users.GetLinkedAccountsResponseB,Z*git.be.kaien.ru/l-ai/l-ai-core-proto/protob\x06proto3"
|
"\x1bGetLinkedAccountsByPlatform\x12).users.GetLinkedAccountsByPlatformRequest\x1a .users.GetLinkedAccountsResponse\x12x\n" +
|
||||||
|
"\"GetLinkedAccountsByUserAndPlatform\x120.users.GetLinkedAccountsByUserAndPlatformRequest\x1a .users.GetLinkedAccountsResponseB,Z*git.be.kaien.ru/l-ai/l-ai-core-proto/protob\x06proto3"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
file_users_proto_rawDescOnce sync.Once
|
file_users_proto_rawDescOnce sync.Once
|
||||||
@ -736,48 +792,51 @@ func file_users_proto_rawDescGZIP() []byte {
|
|||||||
return file_users_proto_rawDescData
|
return file_users_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_users_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
var file_users_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
|
||||||
var file_users_proto_goTypes = []any{
|
var file_users_proto_goTypes = []any{
|
||||||
(*GlobalUser)(nil), // 0: users.GlobalUser
|
(*GlobalUser)(nil), // 0: users.GlobalUser
|
||||||
(*LinkedAccount)(nil), // 1: users.LinkedAccount
|
(*LinkedAccount)(nil), // 1: users.LinkedAccount
|
||||||
(*CreateGlobalUserRequest)(nil), // 2: users.CreateGlobalUserRequest
|
(*CreateGlobalUserRequest)(nil), // 2: users.CreateGlobalUserRequest
|
||||||
(*GetGlobalUserRequest)(nil), // 3: users.GetGlobalUserRequest
|
(*GetGlobalUserRequest)(nil), // 3: users.GetGlobalUserRequest
|
||||||
(*GetAllGlobalUsersResponse)(nil), // 4: users.GetAllGlobalUsersResponse
|
(*GetAllGlobalUsersResponse)(nil), // 4: users.GetAllGlobalUsersResponse
|
||||||
(*UpdateDisplayNameRequest)(nil), // 5: users.UpdateDisplayNameRequest
|
(*UpdateDisplayNameRequest)(nil), // 5: users.UpdateDisplayNameRequest
|
||||||
(*LinkAccountRequest)(nil), // 6: users.LinkAccountRequest
|
(*LinkAccountRequest)(nil), // 6: users.LinkAccountRequest
|
||||||
(*UnlinkAccountRequest)(nil), // 7: users.UnlinkAccountRequest
|
(*UnlinkAccountRequest)(nil), // 7: users.UnlinkAccountRequest
|
||||||
(*GetLinkedAccountRequest)(nil), // 8: users.GetLinkedAccountRequest
|
(*GetLinkedAccountRequest)(nil), // 8: users.GetLinkedAccountRequest
|
||||||
(*GetLinkedAccountsByPlatformRequest)(nil), // 9: users.GetLinkedAccountsByPlatformRequest
|
(*GetLinkedAccountsByPlatformRequest)(nil), // 9: users.GetLinkedAccountsByPlatformRequest
|
||||||
(*GetLinkedAccountsResponse)(nil), // 10: users.GetLinkedAccountsResponse
|
(*GetLinkedAccountsByUserAndPlatformRequest)(nil), // 10: users.GetLinkedAccountsByUserAndPlatformRequest
|
||||||
(*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
|
(*GetLinkedAccountsResponse)(nil), // 11: users.GetLinkedAccountsResponse
|
||||||
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
|
(*timestamppb.Timestamp)(nil), // 12: google.protobuf.Timestamp
|
||||||
|
(*emptypb.Empty)(nil), // 13: google.protobuf.Empty
|
||||||
}
|
}
|
||||||
var file_users_proto_depIdxs = []int32{
|
var file_users_proto_depIdxs = []int32{
|
||||||
11, // 0: users.GlobalUser.created_at:type_name -> google.protobuf.Timestamp
|
12, // 0: users.GlobalUser.created_at:type_name -> google.protobuf.Timestamp
|
||||||
11, // 1: users.GlobalUser.updated_at:type_name -> google.protobuf.Timestamp
|
12, // 1: users.GlobalUser.updated_at:type_name -> google.protobuf.Timestamp
|
||||||
1, // 2: users.GlobalUser.linked_accounts:type_name -> users.LinkedAccount
|
1, // 2: users.GlobalUser.linked_accounts:type_name -> users.LinkedAccount
|
||||||
11, // 3: users.LinkedAccount.linked_at:type_name -> google.protobuf.Timestamp
|
12, // 3: users.LinkedAccount.linked_at:type_name -> google.protobuf.Timestamp
|
||||||
11, // 4: users.LinkedAccount.updated_at:type_name -> google.protobuf.Timestamp
|
12, // 4: users.LinkedAccount.updated_at:type_name -> google.protobuf.Timestamp
|
||||||
0, // 5: users.GetAllGlobalUsersResponse.users:type_name -> users.GlobalUser
|
0, // 5: users.GetAllGlobalUsersResponse.users:type_name -> users.GlobalUser
|
||||||
1, // 6: users.GetLinkedAccountsResponse.accounts:type_name -> users.LinkedAccount
|
1, // 6: users.GetLinkedAccountsResponse.accounts:type_name -> users.LinkedAccount
|
||||||
2, // 7: users.UsersService.CreateGlobalUser:input_type -> users.CreateGlobalUserRequest
|
2, // 7: users.UsersService.CreateGlobalUser:input_type -> users.CreateGlobalUserRequest
|
||||||
3, // 8: users.UsersService.GetGlobalUser:input_type -> users.GetGlobalUserRequest
|
3, // 8: users.UsersService.GetGlobalUser:input_type -> users.GetGlobalUserRequest
|
||||||
12, // 9: users.UsersService.GetAllGlobalUsers:input_type -> google.protobuf.Empty
|
13, // 9: users.UsersService.GetAllGlobalUsers:input_type -> google.protobuf.Empty
|
||||||
5, // 10: users.UsersService.UpdateDisplayName:input_type -> users.UpdateDisplayNameRequest
|
5, // 10: users.UsersService.UpdateDisplayName:input_type -> users.UpdateDisplayNameRequest
|
||||||
6, // 11: users.UsersService.LinkAccount:input_type -> users.LinkAccountRequest
|
6, // 11: users.UsersService.LinkAccount:input_type -> users.LinkAccountRequest
|
||||||
7, // 12: users.UsersService.UnlinkAccount:input_type -> users.UnlinkAccountRequest
|
7, // 12: users.UsersService.UnlinkAccount:input_type -> users.UnlinkAccountRequest
|
||||||
8, // 13: users.UsersService.GetLinkedAccount:input_type -> users.GetLinkedAccountRequest
|
8, // 13: users.UsersService.GetLinkedAccount:input_type -> users.GetLinkedAccountRequest
|
||||||
9, // 14: users.UsersService.GetLinkedAccountsByPlatform:input_type -> users.GetLinkedAccountsByPlatformRequest
|
9, // 14: users.UsersService.GetLinkedAccountsByPlatform:input_type -> users.GetLinkedAccountsByPlatformRequest
|
||||||
0, // 15: users.UsersService.CreateGlobalUser:output_type -> users.GlobalUser
|
10, // 15: users.UsersService.GetLinkedAccountsByUserAndPlatform:input_type -> users.GetLinkedAccountsByUserAndPlatformRequest
|
||||||
0, // 16: users.UsersService.GetGlobalUser:output_type -> users.GlobalUser
|
0, // 16: users.UsersService.CreateGlobalUser:output_type -> users.GlobalUser
|
||||||
4, // 17: users.UsersService.GetAllGlobalUsers:output_type -> users.GetAllGlobalUsersResponse
|
0, // 17: users.UsersService.GetGlobalUser:output_type -> users.GlobalUser
|
||||||
12, // 18: users.UsersService.UpdateDisplayName:output_type -> google.protobuf.Empty
|
4, // 18: users.UsersService.GetAllGlobalUsers:output_type -> users.GetAllGlobalUsersResponse
|
||||||
1, // 19: users.UsersService.LinkAccount:output_type -> users.LinkedAccount
|
13, // 19: users.UsersService.UpdateDisplayName:output_type -> google.protobuf.Empty
|
||||||
12, // 20: users.UsersService.UnlinkAccount:output_type -> google.protobuf.Empty
|
1, // 20: users.UsersService.LinkAccount:output_type -> users.LinkedAccount
|
||||||
1, // 21: users.UsersService.GetLinkedAccount:output_type -> users.LinkedAccount
|
13, // 21: users.UsersService.UnlinkAccount:output_type -> google.protobuf.Empty
|
||||||
10, // 22: users.UsersService.GetLinkedAccountsByPlatform:output_type -> users.GetLinkedAccountsResponse
|
1, // 22: users.UsersService.GetLinkedAccount:output_type -> users.LinkedAccount
|
||||||
15, // [15:23] is the sub-list for method output_type
|
11, // 23: users.UsersService.GetLinkedAccountsByPlatform:output_type -> users.GetLinkedAccountsResponse
|
||||||
7, // [7:15] is the sub-list for method input_type
|
11, // 24: users.UsersService.GetLinkedAccountsByUserAndPlatform:output_type -> users.GetLinkedAccountsResponse
|
||||||
|
16, // [16:25] is the sub-list for method output_type
|
||||||
|
7, // [7:16] is the sub-list for method input_type
|
||||||
7, // [7:7] is the sub-list for extension type_name
|
7, // [7:7] is the sub-list for extension type_name
|
||||||
7, // [7:7] is the sub-list for extension extendee
|
7, // [7:7] is the sub-list for extension extendee
|
||||||
0, // [0:7] is the sub-list for field type_name
|
0, // [0:7] is the sub-list for field type_name
|
||||||
@ -794,7 +853,7 @@ func file_users_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_users_proto_rawDesc), len(file_users_proto_rawDesc)),
|
RawDescriptor: unsafe.Slice(unsafe.StringData(file_users_proto_rawDesc), len(file_users_proto_rawDesc)),
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 11,
|
NumMessages: 12,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 1,
|
NumServices: 1,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -18,6 +18,7 @@ service UsersService {
|
|||||||
rpc UnlinkAccount(UnlinkAccountRequest) returns (google.protobuf.Empty);
|
rpc UnlinkAccount(UnlinkAccountRequest) returns (google.protobuf.Empty);
|
||||||
rpc GetLinkedAccount(GetLinkedAccountRequest) returns (LinkedAccount);
|
rpc GetLinkedAccount(GetLinkedAccountRequest) returns (LinkedAccount);
|
||||||
rpc GetLinkedAccountsByPlatform(GetLinkedAccountsByPlatformRequest) returns (GetLinkedAccountsResponse);
|
rpc GetLinkedAccountsByPlatform(GetLinkedAccountsByPlatformRequest) returns (GetLinkedAccountsResponse);
|
||||||
|
rpc GetLinkedAccountsByUserAndPlatform(GetLinkedAccountsByUserAndPlatformRequest) returns (GetLinkedAccountsResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
message GlobalUser {
|
message GlobalUser {
|
||||||
@ -79,6 +80,11 @@ message GetLinkedAccountsByPlatformRequest {
|
|||||||
string platform = 1;
|
string platform = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
message GetLinkedAccountsByUserAndPlatformRequest {
|
||||||
|
int64 global_user_id = 1;
|
||||||
|
string platform = 2;
|
||||||
|
}
|
||||||
|
|
||||||
message GetLinkedAccountsResponse {
|
message GetLinkedAccountsResponse {
|
||||||
repeated LinkedAccount accounts = 1;
|
repeated LinkedAccount accounts = 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,14 +20,15 @@ import (
|
|||||||
const _ = grpc.SupportPackageIsVersion9
|
const _ = grpc.SupportPackageIsVersion9
|
||||||
|
|
||||||
const (
|
const (
|
||||||
UsersService_CreateGlobalUser_FullMethodName = "/users.UsersService/CreateGlobalUser"
|
UsersService_CreateGlobalUser_FullMethodName = "/users.UsersService/CreateGlobalUser"
|
||||||
UsersService_GetGlobalUser_FullMethodName = "/users.UsersService/GetGlobalUser"
|
UsersService_GetGlobalUser_FullMethodName = "/users.UsersService/GetGlobalUser"
|
||||||
UsersService_GetAllGlobalUsers_FullMethodName = "/users.UsersService/GetAllGlobalUsers"
|
UsersService_GetAllGlobalUsers_FullMethodName = "/users.UsersService/GetAllGlobalUsers"
|
||||||
UsersService_UpdateDisplayName_FullMethodName = "/users.UsersService/UpdateDisplayName"
|
UsersService_UpdateDisplayName_FullMethodName = "/users.UsersService/UpdateDisplayName"
|
||||||
UsersService_LinkAccount_FullMethodName = "/users.UsersService/LinkAccount"
|
UsersService_LinkAccount_FullMethodName = "/users.UsersService/LinkAccount"
|
||||||
UsersService_UnlinkAccount_FullMethodName = "/users.UsersService/UnlinkAccount"
|
UsersService_UnlinkAccount_FullMethodName = "/users.UsersService/UnlinkAccount"
|
||||||
UsersService_GetLinkedAccount_FullMethodName = "/users.UsersService/GetLinkedAccount"
|
UsersService_GetLinkedAccount_FullMethodName = "/users.UsersService/GetLinkedAccount"
|
||||||
UsersService_GetLinkedAccountsByPlatform_FullMethodName = "/users.UsersService/GetLinkedAccountsByPlatform"
|
UsersService_GetLinkedAccountsByPlatform_FullMethodName = "/users.UsersService/GetLinkedAccountsByPlatform"
|
||||||
|
UsersService_GetLinkedAccountsByUserAndPlatform_FullMethodName = "/users.UsersService/GetLinkedAccountsByUserAndPlatform"
|
||||||
)
|
)
|
||||||
|
|
||||||
// UsersServiceClient is the client API for UsersService service.
|
// UsersServiceClient is the client API for UsersService service.
|
||||||
@ -44,6 +45,7 @@ type UsersServiceClient interface {
|
|||||||
UnlinkAccount(ctx context.Context, in *UnlinkAccountRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
UnlinkAccount(ctx context.Context, in *UnlinkAccountRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||||
GetLinkedAccount(ctx context.Context, in *GetLinkedAccountRequest, opts ...grpc.CallOption) (*LinkedAccount, error)
|
GetLinkedAccount(ctx context.Context, in *GetLinkedAccountRequest, opts ...grpc.CallOption) (*LinkedAccount, error)
|
||||||
GetLinkedAccountsByPlatform(ctx context.Context, in *GetLinkedAccountsByPlatformRequest, opts ...grpc.CallOption) (*GetLinkedAccountsResponse, error)
|
GetLinkedAccountsByPlatform(ctx context.Context, in *GetLinkedAccountsByPlatformRequest, opts ...grpc.CallOption) (*GetLinkedAccountsResponse, error)
|
||||||
|
GetLinkedAccountsByUserAndPlatform(ctx context.Context, in *GetLinkedAccountsByUserAndPlatformRequest, opts ...grpc.CallOption) (*GetLinkedAccountsResponse, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type usersServiceClient struct {
|
type usersServiceClient struct {
|
||||||
@ -134,6 +136,16 @@ func (c *usersServiceClient) GetLinkedAccountsByPlatform(ctx context.Context, in
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *usersServiceClient) GetLinkedAccountsByUserAndPlatform(ctx context.Context, in *GetLinkedAccountsByUserAndPlatformRequest, opts ...grpc.CallOption) (*GetLinkedAccountsResponse, error) {
|
||||||
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||||
|
out := new(GetLinkedAccountsResponse)
|
||||||
|
err := c.cc.Invoke(ctx, UsersService_GetLinkedAccountsByUserAndPlatform_FullMethodName, in, out, cOpts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|
||||||
// UsersServiceServer is the server API for UsersService service.
|
// UsersServiceServer is the server API for UsersService service.
|
||||||
// All implementations must embed UnimplementedUsersServiceServer
|
// All implementations must embed UnimplementedUsersServiceServer
|
||||||
// for forward compatibility.
|
// for forward compatibility.
|
||||||
@ -148,6 +160,7 @@ type UsersServiceServer interface {
|
|||||||
UnlinkAccount(context.Context, *UnlinkAccountRequest) (*emptypb.Empty, error)
|
UnlinkAccount(context.Context, *UnlinkAccountRequest) (*emptypb.Empty, error)
|
||||||
GetLinkedAccount(context.Context, *GetLinkedAccountRequest) (*LinkedAccount, error)
|
GetLinkedAccount(context.Context, *GetLinkedAccountRequest) (*LinkedAccount, error)
|
||||||
GetLinkedAccountsByPlatform(context.Context, *GetLinkedAccountsByPlatformRequest) (*GetLinkedAccountsResponse, error)
|
GetLinkedAccountsByPlatform(context.Context, *GetLinkedAccountsByPlatformRequest) (*GetLinkedAccountsResponse, error)
|
||||||
|
GetLinkedAccountsByUserAndPlatform(context.Context, *GetLinkedAccountsByUserAndPlatformRequest) (*GetLinkedAccountsResponse, error)
|
||||||
mustEmbedUnimplementedUsersServiceServer()
|
mustEmbedUnimplementedUsersServiceServer()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,6 +195,9 @@ func (UnimplementedUsersServiceServer) GetLinkedAccount(context.Context, *GetLin
|
|||||||
func (UnimplementedUsersServiceServer) GetLinkedAccountsByPlatform(context.Context, *GetLinkedAccountsByPlatformRequest) (*GetLinkedAccountsResponse, error) {
|
func (UnimplementedUsersServiceServer) GetLinkedAccountsByPlatform(context.Context, *GetLinkedAccountsByPlatformRequest) (*GetLinkedAccountsResponse, error) {
|
||||||
return nil, status.Error(codes.Unimplemented, "method GetLinkedAccountsByPlatform not implemented")
|
return nil, status.Error(codes.Unimplemented, "method GetLinkedAccountsByPlatform not implemented")
|
||||||
}
|
}
|
||||||
|
func (UnimplementedUsersServiceServer) GetLinkedAccountsByUserAndPlatform(context.Context, *GetLinkedAccountsByUserAndPlatformRequest) (*GetLinkedAccountsResponse, error) {
|
||||||
|
return nil, status.Error(codes.Unimplemented, "method GetLinkedAccountsByUserAndPlatform not implemented")
|
||||||
|
}
|
||||||
func (UnimplementedUsersServiceServer) mustEmbedUnimplementedUsersServiceServer() {}
|
func (UnimplementedUsersServiceServer) mustEmbedUnimplementedUsersServiceServer() {}
|
||||||
func (UnimplementedUsersServiceServer) testEmbeddedByValue() {}
|
func (UnimplementedUsersServiceServer) testEmbeddedByValue() {}
|
||||||
|
|
||||||
@ -347,6 +363,24 @@ func _UsersService_GetLinkedAccountsByPlatform_Handler(srv interface{}, ctx cont
|
|||||||
return interceptor(ctx, in, info, handler)
|
return interceptor(ctx, in, info, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func _UsersService_GetLinkedAccountsByUserAndPlatform_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||||
|
in := new(GetLinkedAccountsByUserAndPlatformRequest)
|
||||||
|
if err := dec(in); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if interceptor == nil {
|
||||||
|
return srv.(UsersServiceServer).GetLinkedAccountsByUserAndPlatform(ctx, in)
|
||||||
|
}
|
||||||
|
info := &grpc.UnaryServerInfo{
|
||||||
|
Server: srv,
|
||||||
|
FullMethod: UsersService_GetLinkedAccountsByUserAndPlatform_FullMethodName,
|
||||||
|
}
|
||||||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||||
|
return srv.(UsersServiceServer).GetLinkedAccountsByUserAndPlatform(ctx, req.(*GetLinkedAccountsByUserAndPlatformRequest))
|
||||||
|
}
|
||||||
|
return interceptor(ctx, in, info, handler)
|
||||||
|
}
|
||||||
|
|
||||||
// UsersService_ServiceDesc is the grpc.ServiceDesc for UsersService service.
|
// UsersService_ServiceDesc is the grpc.ServiceDesc for UsersService service.
|
||||||
// It's only intended for direct use with grpc.RegisterService,
|
// It's only intended for direct use with grpc.RegisterService,
|
||||||
// and not to be introspected or modified (even as a copy)
|
// and not to be introspected or modified (even as a copy)
|
||||||
@ -386,6 +420,10 @@ var UsersService_ServiceDesc = grpc.ServiceDesc{
|
|||||||
MethodName: "GetLinkedAccountsByPlatform",
|
MethodName: "GetLinkedAccountsByPlatform",
|
||||||
Handler: _UsersService_GetLinkedAccountsByPlatform_Handler,
|
Handler: _UsersService_GetLinkedAccountsByPlatform_Handler,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
MethodName: "GetLinkedAccountsByUserAndPlatform",
|
||||||
|
Handler: _UsersService_GetLinkedAccountsByUserAndPlatform_Handler,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Streams: []grpc.StreamDesc{},
|
Streams: []grpc.StreamDesc{},
|
||||||
Metadata: "users.proto",
|
Metadata: "users.proto",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user