Add profiles.proto with UserProfileService and UserMoodHistoryService for managing Telegram user profiles, avatars, mood history, and memorable moments. Add messages.proto with UserMessageService for storing and querying chat messages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
136 lines
3.2 KiB
Protocol Buffer
136 lines
3.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package users;
|
|
|
|
option go_package = "git.be.kaien.ru/l-ai/l-ai-core-proto/proto";
|
|
|
|
import "google/protobuf/empty.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
// UserMessageService manages stored user messages
|
|
service UserMessageService {
|
|
rpc SaveMessage(SaveMessageRequest) returns (google.protobuf.Empty);
|
|
rpc GetRecentMessages(GetRecentMessagesRequest) returns (GetMessagesResponse);
|
|
rpc GetAllUsersInChat(GetAllUsersInChatRequest) returns (GetAllUsersInChatResponse);
|
|
rpc GetRandomUser(GetRandomUserRequest) returns (GetRandomUserResponse);
|
|
rpc GetUsersByChat(GetUsersByChatRequest) returns (GetUsersByChatResponse);
|
|
rpc GetTotalMessageCount(google.protobuf.Empty) returns (GetMessageCountResponse);
|
|
rpc GetUserMessageCount(GetUserMessageCountRequest) returns (GetMessageCountResponse);
|
|
rpc GetMessagesInTimeRange(GetMessagesInTimeRangeRequest) returns (GetMessagesResponse);
|
|
rpc FindSimilarMessage(FindSimilarMessageRequest) returns (FindSimilarMessageResponse);
|
|
rpc GetMessageByTelegramID(GetMessageByTelegramIDRequest) returns (FindSimilarMessageResponse);
|
|
rpc GetRecentChatMessages(GetRecentChatMessagesRequest) returns (GetMessagesResponse);
|
|
rpc GetAllUserMessages(GetAllUserMessagesRequest) returns (GetMessagesResponse);
|
|
rpc GetRandomMessageFromChat(GetRandomMessageFromChatRequest) returns (FindSimilarMessageResponse);
|
|
}
|
|
|
|
// --- Messages ---
|
|
|
|
message ChatMessage {
|
|
int64 id = 1;
|
|
int64 user_id = 2;
|
|
int64 chat_id = 3;
|
|
string username = 4;
|
|
string text = 5;
|
|
int32 message_id = 6;
|
|
google.protobuf.Timestamp created_at = 7;
|
|
}
|
|
|
|
message ChatUserInfo {
|
|
int64 user_id = 1;
|
|
string username = 2;
|
|
}
|
|
|
|
// --- Request/Response messages ---
|
|
|
|
message SaveMessageRequest {
|
|
int64 user_id = 1;
|
|
int64 chat_id = 2;
|
|
string username = 3;
|
|
string text = 4;
|
|
int32 message_id = 5;
|
|
}
|
|
|
|
message GetRecentMessagesRequest {
|
|
int64 user_id = 1;
|
|
int64 chat_id = 2;
|
|
int32 limit = 3;
|
|
}
|
|
|
|
message GetMessagesResponse {
|
|
repeated ChatMessage messages = 1;
|
|
}
|
|
|
|
message GetAllUsersInChatRequest {
|
|
int64 chat_id = 1;
|
|
}
|
|
|
|
message GetAllUsersInChatResponse {
|
|
repeated int64 user_ids = 1;
|
|
}
|
|
|
|
message GetRandomUserRequest {
|
|
int64 chat_id = 1;
|
|
repeated int64 exclude_user_ids = 2;
|
|
}
|
|
|
|
message GetRandomUserResponse {
|
|
int64 user_id = 1;
|
|
string username = 2;
|
|
}
|
|
|
|
message GetUsersByChatRequest {
|
|
int64 chat_id = 1;
|
|
}
|
|
|
|
message GetUsersByChatResponse {
|
|
repeated ChatUserInfo users = 1;
|
|
}
|
|
|
|
message GetMessageCountResponse {
|
|
int64 count = 1;
|
|
}
|
|
|
|
message GetUserMessageCountRequest {
|
|
int64 user_id = 1;
|
|
int64 chat_id = 2;
|
|
}
|
|
|
|
message GetMessagesInTimeRangeRequest {
|
|
int64 user_id = 1;
|
|
int64 chat_id = 2;
|
|
google.protobuf.Timestamp from = 3;
|
|
google.protobuf.Timestamp to = 4;
|
|
}
|
|
|
|
message FindSimilarMessageRequest {
|
|
int64 user_id = 1;
|
|
int64 chat_id = 2;
|
|
string text = 3;
|
|
int32 within_days = 4;
|
|
}
|
|
|
|
message FindSimilarMessageResponse {
|
|
ChatMessage message = 1;
|
|
bool found = 2;
|
|
}
|
|
|
|
message GetMessageByTelegramIDRequest {
|
|
int64 chat_id = 1;
|
|
int32 message_id = 2;
|
|
}
|
|
|
|
message GetRecentChatMessagesRequest {
|
|
int64 chat_id = 1;
|
|
int32 limit = 2;
|
|
google.protobuf.Timestamp since = 3;
|
|
}
|
|
|
|
message GetAllUserMessagesRequest {
|
|
int64 user_id = 1;
|
|
}
|
|
|
|
message GetRandomMessageFromChatRequest {
|
|
int64 chat_id = 1;
|
|
}
|