diff --git a/api/rag/document.pb.go b/api/rag/document.pb.go index 92d2dea..2e5b9cd 100644 --- a/api/rag/document.pb.go +++ b/api/rag/document.pb.go @@ -226,6 +226,397 @@ func (x *ListDocumentResponse) GetDocuments() []*Document { return nil } +type CreateDocumentBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DocumentId int64 `protobuf:"varint,1,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty"` + Order int64 `protobuf:"varint,2,opt,name=order,proto3" json:"order,omitempty"` + Content string `protobuf:"bytes,3,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *CreateDocumentBlockRequest) Reset() { + *x = CreateDocumentBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateDocumentBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDocumentBlockRequest) ProtoMessage() {} + +func (x *CreateDocumentBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateDocumentBlockRequest.ProtoReflect.Descriptor instead. +func (*CreateDocumentBlockRequest) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateDocumentBlockRequest) GetDocumentId() int64 { + if x != nil { + return x.DocumentId + } + return 0 +} + +func (x *CreateDocumentBlockRequest) GetOrder() int64 { + if x != nil { + return x.Order + } + return 0 +} + +func (x *CreateDocumentBlockRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type CreateDocumentBlockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DocumentBlock *DocumentBlock `protobuf:"bytes,1,opt,name=document_block,json=documentBlock,proto3" json:"document_block,omitempty"` +} + +func (x *CreateDocumentBlockResponse) Reset() { + *x = CreateDocumentBlockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateDocumentBlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateDocumentBlockResponse) ProtoMessage() {} + +func (x *CreateDocumentBlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateDocumentBlockResponse.ProtoReflect.Descriptor instead. +func (*CreateDocumentBlockResponse) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateDocumentBlockResponse) GetDocumentBlock() *DocumentBlock { + if x != nil { + return x.DocumentBlock + } + return nil +} + +type DeleteDocumentBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteDocumentBlockRequest) Reset() { + *x = DeleteDocumentBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteDocumentBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDocumentBlockRequest) ProtoMessage() {} + +func (x *DeleteDocumentBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteDocumentBlockRequest.ProtoReflect.Descriptor instead. +func (*DeleteDocumentBlockRequest) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{6} +} + +func (x *DeleteDocumentBlockRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +type DeleteDocumentBlockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteDocumentBlockResponse) Reset() { + *x = DeleteDocumentBlockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteDocumentBlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteDocumentBlockResponse) ProtoMessage() {} + +func (x *DeleteDocumentBlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteDocumentBlockResponse.ProtoReflect.Descriptor instead. +func (*DeleteDocumentBlockResponse) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{7} +} + +type ListDocumentBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DocumentId int64 `protobuf:"varint,1,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty"` +} + +func (x *ListDocumentBlockRequest) Reset() { + *x = ListDocumentBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDocumentBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDocumentBlockRequest) ProtoMessage() {} + +func (x *ListDocumentBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDocumentBlockRequest.ProtoReflect.Descriptor instead. +func (*ListDocumentBlockRequest) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{8} +} + +func (x *ListDocumentBlockRequest) GetDocumentId() int64 { + if x != nil { + return x.DocumentId + } + return 0 +} + +type ListDocumentBlockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DocumentBlocks []*DocumentBlock `protobuf:"bytes,1,rep,name=document_blocks,json=documentBlocks,proto3" json:"document_blocks,omitempty"` +} + +func (x *ListDocumentBlockResponse) Reset() { + *x = ListDocumentBlockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListDocumentBlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListDocumentBlockResponse) ProtoMessage() {} + +func (x *ListDocumentBlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListDocumentBlockResponse.ProtoReflect.Descriptor instead. +func (*ListDocumentBlockResponse) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{9} +} + +func (x *ListDocumentBlockResponse) GetDocumentBlocks() []*DocumentBlock { + if x != nil { + return x.DocumentBlocks + } + return nil +} + +type UpdateDocumentBlockRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` +} + +func (x *UpdateDocumentBlockRequest) Reset() { + *x = UpdateDocumentBlockRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDocumentBlockRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDocumentBlockRequest) ProtoMessage() {} + +func (x *UpdateDocumentBlockRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateDocumentBlockRequest.ProtoReflect.Descriptor instead. +func (*UpdateDocumentBlockRequest) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{10} +} + +func (x *UpdateDocumentBlockRequest) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UpdateDocumentBlockRequest) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +type UpdateDocumentBlockResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + DocumentBlock *DocumentBlock `protobuf:"bytes,1,opt,name=document_block,json=documentBlock,proto3" json:"document_block,omitempty"` +} + +func (x *UpdateDocumentBlockResponse) Reset() { + *x = UpdateDocumentBlockResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateDocumentBlockResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateDocumentBlockResponse) ProtoMessage() {} + +func (x *UpdateDocumentBlockResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateDocumentBlockResponse.ProtoReflect.Descriptor instead. +func (*UpdateDocumentBlockResponse) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{11} +} + +func (x *UpdateDocumentBlockResponse) GetDocumentBlock() *DocumentBlock { + if x != nil { + return x.DocumentBlock + } + return nil +} + type Document struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -243,7 +634,7 @@ type Document struct { func (x *Document) Reset() { *x = Document{} if protoimpl.UnsafeEnabled { - mi := &file_api_rag_document_proto_msgTypes[4] + mi := &file_api_rag_document_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -256,7 +647,7 @@ func (x *Document) String() string { func (*Document) ProtoMessage() {} func (x *Document) ProtoReflect() protoreflect.Message { - mi := &file_api_rag_document_proto_msgTypes[4] + mi := &file_api_rag_document_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -269,7 +660,7 @@ func (x *Document) ProtoReflect() protoreflect.Message { // Deprecated: Use Document.ProtoReflect.Descriptor instead. func (*Document) Descriptor() ([]byte, []int) { - return file_api_rag_document_proto_rawDescGZIP(), []int{4} + return file_api_rag_document_proto_rawDescGZIP(), []int{12} } func (x *Document) GetId() int64 { @@ -321,6 +712,85 @@ func (x *Document) GetUpdatedAt() string { return "" } +type DocumentBlock struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + DocumentId int64 `protobuf:"varint,3,opt,name=document_id,json=documentId,proto3" json:"document_id,omitempty"` + CreatedAt string `protobuf:"bytes,4,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"` + UpdatedAt string `protobuf:"bytes,5,opt,name=updated_at,json=updatedAt,proto3" json:"updated_at,omitempty"` +} + +func (x *DocumentBlock) Reset() { + *x = DocumentBlock{} + if protoimpl.UnsafeEnabled { + mi := &file_api_rag_document_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DocumentBlock) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DocumentBlock) ProtoMessage() {} + +func (x *DocumentBlock) ProtoReflect() protoreflect.Message { + mi := &file_api_rag_document_proto_msgTypes[13] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DocumentBlock.ProtoReflect.Descriptor instead. +func (*DocumentBlock) Descriptor() ([]byte, []int) { + return file_api_rag_document_proto_rawDescGZIP(), []int{13} +} + +func (x *DocumentBlock) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *DocumentBlock) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *DocumentBlock) GetDocumentId() int64 { + if x != nil { + return x.DocumentId + } + return 0 +} + +func (x *DocumentBlock) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *DocumentBlock) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + var File_api_rag_document_proto protoreflect.FileDescriptor var file_api_rag_document_proto_rawDesc = []byte{ @@ -347,21 +817,67 @@ var file_api_rag_document_proto_rawDesc = []byte{ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x27, 0x0a, 0x09, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x09, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, - 0xbe, 0x01, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, - 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x6c, 0x69, - 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, - 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, 0x75, 0x73, 0x65, - 0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, 0x73, 0x65, 0x72, - 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, - 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x42, 0x1e, 0x5a, 0x1c, 0x6c, 0x65, 0x61, 0x66, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x6f, 0x70, 0x2f, - 0x6c, 0x65, 0x61, 0x66, 0x2f, 0x72, 0x61, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x61, 0x67, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6d, 0x0a, 0x1a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, + 0x0b, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x14, + 0x0a, 0x05, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6f, + 0x72, 0x64, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x54, + 0x0a, 0x1b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, + 0x0e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x2c, 0x0a, 0x1a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x6f, + 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, + 0x69, 0x64, 0x22, 0x1d, 0x0a, 0x1b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, + 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x3b, 0x0a, 0x18, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, + 0x0b, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x22, 0x54, + 0x0a, 0x19, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x0f, 0x64, + 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, + 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x0e, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x73, 0x22, 0x46, 0x0a, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, + 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, + 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x54, 0x0a, 0x1b, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x0e, 0x64, + 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x0d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, + 0x63, 0x6b, 0x22, 0xbe, 0x01, 0x0a, 0x08, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, + 0x0a, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x09, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x49, 0x64, 0x12, 0x17, 0x0a, 0x07, + 0x75, 0x73, 0x65, 0x72, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x75, + 0x73, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, + 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, + 0x65, 0x64, 0x41, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, + 0x61, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x64, 0x41, 0x74, 0x22, 0x98, 0x01, 0x0a, 0x0d, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, + 0x1f, 0x0a, 0x0b, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, + 0x1d, 0x0a, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x42, 0x1e, + 0x5a, 0x1c, 0x6c, 0x65, 0x61, 0x66, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x6f, 0x70, 0x2f, 0x6c, 0x65, + 0x61, 0x66, 0x2f, 0x72, 0x61, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x61, 0x67, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -376,22 +892,34 @@ func file_api_rag_document_proto_rawDescGZIP() []byte { return file_api_rag_document_proto_rawDescData } -var file_api_rag_document_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_api_rag_document_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_api_rag_document_proto_goTypes = []interface{}{ - (*CreateDocumentRequest)(nil), // 0: CreateDocumentRequest - (*CreateDocumentResponse)(nil), // 1: CreateDocumentResponse - (*ListDocumentRequest)(nil), // 2: ListDocumentRequest - (*ListDocumentResponse)(nil), // 3: ListDocumentResponse - (*Document)(nil), // 4: Document + (*CreateDocumentRequest)(nil), // 0: CreateDocumentRequest + (*CreateDocumentResponse)(nil), // 1: CreateDocumentResponse + (*ListDocumentRequest)(nil), // 2: ListDocumentRequest + (*ListDocumentResponse)(nil), // 3: ListDocumentResponse + (*CreateDocumentBlockRequest)(nil), // 4: CreateDocumentBlockRequest + (*CreateDocumentBlockResponse)(nil), // 5: CreateDocumentBlockResponse + (*DeleteDocumentBlockRequest)(nil), // 6: DeleteDocumentBlockRequest + (*DeleteDocumentBlockResponse)(nil), // 7: DeleteDocumentBlockResponse + (*ListDocumentBlockRequest)(nil), // 8: ListDocumentBlockRequest + (*ListDocumentBlockResponse)(nil), // 9: ListDocumentBlockResponse + (*UpdateDocumentBlockRequest)(nil), // 10: UpdateDocumentBlockRequest + (*UpdateDocumentBlockResponse)(nil), // 11: UpdateDocumentBlockResponse + (*Document)(nil), // 12: Document + (*DocumentBlock)(nil), // 13: DocumentBlock } var file_api_rag_document_proto_depIdxs = []int32{ - 4, // 0: CreateDocumentResponse.document:type_name -> Document - 4, // 1: ListDocumentResponse.documents:type_name -> Document - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 12, // 0: CreateDocumentResponse.document:type_name -> Document + 12, // 1: ListDocumentResponse.documents:type_name -> Document + 13, // 2: CreateDocumentBlockResponse.document_block:type_name -> DocumentBlock + 13, // 3: ListDocumentBlockResponse.document_blocks:type_name -> DocumentBlock + 13, // 4: UpdateDocumentBlockResponse.document_block:type_name -> DocumentBlock + 5, // [5:5] is the sub-list for method output_type + 5, // [5:5] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name } func init() { file_api_rag_document_proto_init() } @@ -449,6 +977,102 @@ func file_api_rag_document_proto_init() { } } file_api_rag_document_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateDocumentBlockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateDocumentBlockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteDocumentBlockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteDocumentBlockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDocumentBlockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListDocumentBlockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDocumentBlockRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateDocumentBlockResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_rag_document_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Document); i { case 0: return &v.state @@ -460,6 +1084,18 @@ func file_api_rag_document_proto_init() { return nil } } + file_api_rag_document_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DocumentBlock); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -467,7 +1103,7 @@ func file_api_rag_document_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_api_rag_document_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 14, NumExtensions: 0, NumServices: 0, }, diff --git a/api/rag/rag.pb.go b/api/rag/rag.pb.go index f0e1d7f..aed3391 100644 --- a/api/rag/rag.pb.go +++ b/api/rag/rag.pb.go @@ -32,7 +32,7 @@ var file_api_rag_rag_proto_rawDesc = []byte{ 0x64, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x16, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x61, 0x67, 0x2f, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x61, 0x67, 0x2f, 0x6c, 0x69, 0x62, 0x72, 0x61, 0x72, - 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xf2, 0x02, 0x0a, 0x0a, 0x52, 0x41, 0x47, 0x53, + 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xb8, 0x06, 0x0a, 0x0a, 0x52, 0x41, 0x47, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x13, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x4c, 0x69, 0x73, @@ -55,36 +55,80 @@ var file_api_rag_rag_proto_rawDesc = []byte{ 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x19, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x13, 0x12, 0x11, 0x2f, 0x61, 0x70, 0x69, 0x2f, - 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x42, 0x1e, 0x5a, 0x1c, - 0x6c, 0x65, 0x61, 0x66, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x6f, 0x70, 0x2f, 0x6c, 0x65, 0x61, 0x66, - 0x2f, 0x72, 0x61, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, 0x61, 0x67, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x6b, 0x0a, 0x11, + 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, + 0x6b, 0x12, 0x19, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x4c, + 0x69, 0x73, 0x74, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, + 0x12, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, + 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x71, 0x0a, 0x13, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, + 0x12, 0x1b, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x19, 0x22, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x63, + 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, 0x71, 0x0a, 0x13, + 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, + 0x6f, 0x63, 0x6b, 0x12, 0x1b, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, + 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x1a, 0x1c, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1f, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x31, 0x2f, + 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x73, 0x12, + 0x71, 0x0a, 0x13, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, + 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1b, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, + 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x75, + 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x1f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x1a, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x76, 0x31, 0x2f, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x62, 0x6c, 0x6f, 0x63, + 0x6b, 0x73, 0x42, 0x1e, 0x5a, 0x1c, 0x6c, 0x65, 0x61, 0x66, 0x64, 0x65, 0x76, 0x2e, 0x74, 0x6f, + 0x70, 0x2f, 0x6c, 0x65, 0x61, 0x66, 0x2f, 0x72, 0x61, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x72, + 0x61, 0x67, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var file_api_rag_rag_proto_goTypes = []interface{}{ - (*ListLibraryRequest)(nil), // 0: ListLibraryRequest - (*CreateLibraryRequest)(nil), // 1: CreateLibraryRequest - (*CreateDocumentRequest)(nil), // 2: CreateDocumentRequest - (*ListDocumentRequest)(nil), // 3: ListDocumentRequest - (*ListLibraryResponse)(nil), // 4: ListLibraryResponse - (*CreateLibraryResponse)(nil), // 5: CreateLibraryResponse - (*CreateDocumentResponse)(nil), // 6: CreateDocumentResponse - (*ListDocumentResponse)(nil), // 7: ListDocumentResponse + (*ListLibraryRequest)(nil), // 0: ListLibraryRequest + (*CreateLibraryRequest)(nil), // 1: CreateLibraryRequest + (*CreateDocumentRequest)(nil), // 2: CreateDocumentRequest + (*ListDocumentRequest)(nil), // 3: ListDocumentRequest + (*ListDocumentBlockRequest)(nil), // 4: ListDocumentBlockRequest + (*CreateDocumentBlockRequest)(nil), // 5: CreateDocumentBlockRequest + (*DeleteDocumentBlockRequest)(nil), // 6: DeleteDocumentBlockRequest + (*UpdateDocumentBlockRequest)(nil), // 7: UpdateDocumentBlockRequest + (*ListLibraryResponse)(nil), // 8: ListLibraryResponse + (*CreateLibraryResponse)(nil), // 9: CreateLibraryResponse + (*CreateDocumentResponse)(nil), // 10: CreateDocumentResponse + (*ListDocumentResponse)(nil), // 11: ListDocumentResponse + (*ListDocumentBlockResponse)(nil), // 12: ListDocumentBlockResponse + (*CreateDocumentBlockResponse)(nil), // 13: CreateDocumentBlockResponse + (*DeleteDocumentBlockResponse)(nil), // 14: DeleteDocumentBlockResponse + (*UpdateDocumentBlockResponse)(nil), // 15: UpdateDocumentBlockResponse } var file_api_rag_rag_proto_depIdxs = []int32{ - 0, // 0: RagService.RAGService.ListLibrary:input_type -> ListLibraryRequest - 1, // 1: RagService.RAGService.CreateLibrary:input_type -> CreateLibraryRequest - 2, // 2: RagService.RAGService.CreateDocument:input_type -> CreateDocumentRequest - 3, // 3: RagService.RAGService.ListDocument:input_type -> ListDocumentRequest - 4, // 4: RagService.RAGService.ListLibrary:output_type -> ListLibraryResponse - 5, // 5: RagService.RAGService.CreateLibrary:output_type -> CreateLibraryResponse - 6, // 6: RagService.RAGService.CreateDocument:output_type -> CreateDocumentResponse - 7, // 7: RagService.RAGService.ListDocument:output_type -> ListDocumentResponse - 4, // [4:8] is the sub-list for method output_type - 0, // [0:4] 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 + 0, // 0: RagService.RAGService.ListLibrary:input_type -> ListLibraryRequest + 1, // 1: RagService.RAGService.CreateLibrary:input_type -> CreateLibraryRequest + 2, // 2: RagService.RAGService.CreateDocument:input_type -> CreateDocumentRequest + 3, // 3: RagService.RAGService.ListDocument:input_type -> ListDocumentRequest + 4, // 4: RagService.RAGService.ListDocumentBlock:input_type -> ListDocumentBlockRequest + 5, // 5: RagService.RAGService.CreateDocumentBlock:input_type -> CreateDocumentBlockRequest + 6, // 6: RagService.RAGService.DeleteDocumentBlock:input_type -> DeleteDocumentBlockRequest + 7, // 7: RagService.RAGService.UpdateDocumentBlock:input_type -> UpdateDocumentBlockRequest + 8, // 8: RagService.RAGService.ListLibrary:output_type -> ListLibraryResponse + 9, // 9: RagService.RAGService.CreateLibrary:output_type -> CreateLibraryResponse + 10, // 10: RagService.RAGService.CreateDocument:output_type -> CreateDocumentResponse + 11, // 11: RagService.RAGService.ListDocument:output_type -> ListDocumentResponse + 12, // 12: RagService.RAGService.ListDocumentBlock:output_type -> ListDocumentBlockResponse + 13, // 13: RagService.RAGService.CreateDocumentBlock:output_type -> CreateDocumentBlockResponse + 14, // 14: RagService.RAGService.DeleteDocumentBlock:output_type -> DeleteDocumentBlockResponse + 15, // 15: RagService.RAGService.UpdateDocumentBlock:output_type -> UpdateDocumentBlockResponse + 8, // [8:16] is the sub-list for method output_type + 0, // [0:8] 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_api_rag_rag_proto_init() } diff --git a/api/rag/rag.pb.gw.go b/api/rag/rag.pb.gw.go index c1a0c0f..e924590 100644 --- a/api/rag/rag.pb.gw.go +++ b/api/rag/rag.pb.gw.go @@ -175,6 +175,150 @@ func local_request_RAGService_ListDocument_0(ctx context.Context, marshaler runt } +var ( + filter_RAGService_ListDocumentBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_RAGService_ListDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, client RAGServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_ListDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListDocumentBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_RAGService_ListDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, server RAGServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_ListDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListDocumentBlock(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_RAGService_CreateDocumentBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_RAGService_CreateDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, client RAGServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_CreateDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateDocumentBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_RAGService_CreateDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, server RAGServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_CreateDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateDocumentBlock(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_RAGService_DeleteDocumentBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_RAGService_DeleteDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, client RAGServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_DeleteDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.DeleteDocumentBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_RAGService_DeleteDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, server RAGServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_DeleteDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.DeleteDocumentBlock(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_RAGService_UpdateDocumentBlock_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_RAGService_UpdateDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, client RAGServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_UpdateDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateDocumentBlock(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_RAGService_UpdateDocumentBlock_0(ctx context.Context, marshaler runtime.Marshaler, server RAGServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateDocumentBlockRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_RAGService_UpdateDocumentBlock_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateDocumentBlock(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterRAGServiceHandlerServer registers the http handlers for service RAGService to "mux". // UnaryRPC :call RAGServiceServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -281,6 +425,106 @@ func RegisterRAGServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_RAGService_ListDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/RagService.RAGService/ListDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_RAGService_ListDocumentBlock_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_ListDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_RAGService_CreateDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/RagService.RAGService/CreateDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_RAGService_CreateDocumentBlock_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_CreateDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_RAGService_DeleteDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/RagService.RAGService/DeleteDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_RAGService_DeleteDocumentBlock_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_DeleteDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_RAGService_UpdateDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/RagService.RAGService/UpdateDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_RAGService_UpdateDocumentBlock_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_UpdateDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -410,6 +654,94 @@ func RegisterRAGServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, }) + mux.Handle("GET", pattern_RAGService_ListDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/RagService.RAGService/ListDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_RAGService_ListDocumentBlock_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_ListDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_RAGService_CreateDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/RagService.RAGService/CreateDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_RAGService_CreateDocumentBlock_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_CreateDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_RAGService_DeleteDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/RagService.RAGService/DeleteDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_RAGService_DeleteDocumentBlock_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_DeleteDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_RAGService_UpdateDocumentBlock_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/RagService.RAGService/UpdateDocumentBlock", runtime.WithHTTPPathPattern("/api/v1/document_blocks")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_RAGService_UpdateDocumentBlock_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_RAGService_UpdateDocumentBlock_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -421,6 +753,14 @@ var ( pattern_RAGService_CreateDocument_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "documents"}, "")) pattern_RAGService_ListDocument_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "documents"}, "")) + + pattern_RAGService_ListDocumentBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "document_blocks"}, "")) + + pattern_RAGService_CreateDocumentBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "document_blocks"}, "")) + + pattern_RAGService_DeleteDocumentBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "document_blocks"}, "")) + + pattern_RAGService_UpdateDocumentBlock_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v1", "document_blocks"}, "")) ) var ( @@ -431,4 +771,12 @@ var ( forward_RAGService_CreateDocument_0 = runtime.ForwardResponseMessage forward_RAGService_ListDocument_0 = runtime.ForwardResponseMessage + + forward_RAGService_ListDocumentBlock_0 = runtime.ForwardResponseMessage + + forward_RAGService_CreateDocumentBlock_0 = runtime.ForwardResponseMessage + + forward_RAGService_DeleteDocumentBlock_0 = runtime.ForwardResponseMessage + + forward_RAGService_UpdateDocumentBlock_0 = runtime.ForwardResponseMessage ) diff --git a/api/rag/rag_grpc.pb.go b/api/rag/rag_grpc.pb.go index a7283c6..ab71f7e 100644 --- a/api/rag/rag_grpc.pb.go +++ b/api/rag/rag_grpc.pb.go @@ -24,9 +24,13 @@ const _ = grpc.SupportPackageIsVersion7 type RAGServiceClient interface { ListLibrary(ctx context.Context, in *ListLibraryRequest, opts ...grpc.CallOption) (*ListLibraryResponse, error) CreateLibrary(ctx context.Context, in *CreateLibraryRequest, opts ...grpc.CallOption) (*CreateLibraryResponse, error) - // DocumentService + // DocumentService CreateDocument(ctx context.Context, in *CreateDocumentRequest, opts ...grpc.CallOption) (*CreateDocumentResponse, error) ListDocument(ctx context.Context, in *ListDocumentRequest, opts ...grpc.CallOption) (*ListDocumentResponse, error) + ListDocumentBlock(ctx context.Context, in *ListDocumentBlockRequest, opts ...grpc.CallOption) (*ListDocumentBlockResponse, error) + CreateDocumentBlock(ctx context.Context, in *CreateDocumentBlockRequest, opts ...grpc.CallOption) (*CreateDocumentBlockResponse, error) + DeleteDocumentBlock(ctx context.Context, in *DeleteDocumentBlockRequest, opts ...grpc.CallOption) (*DeleteDocumentBlockResponse, error) + UpdateDocumentBlock(ctx context.Context, in *UpdateDocumentBlockRequest, opts ...grpc.CallOption) (*UpdateDocumentBlockResponse, error) } type rAGServiceClient struct { @@ -73,15 +77,55 @@ func (c *rAGServiceClient) ListDocument(ctx context.Context, in *ListDocumentReq return out, nil } +func (c *rAGServiceClient) ListDocumentBlock(ctx context.Context, in *ListDocumentBlockRequest, opts ...grpc.CallOption) (*ListDocumentBlockResponse, error) { + out := new(ListDocumentBlockResponse) + err := c.cc.Invoke(ctx, "/RagService.RAGService/ListDocumentBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rAGServiceClient) CreateDocumentBlock(ctx context.Context, in *CreateDocumentBlockRequest, opts ...grpc.CallOption) (*CreateDocumentBlockResponse, error) { + out := new(CreateDocumentBlockResponse) + err := c.cc.Invoke(ctx, "/RagService.RAGService/CreateDocumentBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rAGServiceClient) DeleteDocumentBlock(ctx context.Context, in *DeleteDocumentBlockRequest, opts ...grpc.CallOption) (*DeleteDocumentBlockResponse, error) { + out := new(DeleteDocumentBlockResponse) + err := c.cc.Invoke(ctx, "/RagService.RAGService/DeleteDocumentBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *rAGServiceClient) UpdateDocumentBlock(ctx context.Context, in *UpdateDocumentBlockRequest, opts ...grpc.CallOption) (*UpdateDocumentBlockResponse, error) { + out := new(UpdateDocumentBlockResponse) + err := c.cc.Invoke(ctx, "/RagService.RAGService/UpdateDocumentBlock", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // RAGServiceServer is the server API for RAGService service. // All implementations must embed UnimplementedRAGServiceServer // for forward compatibility type RAGServiceServer interface { ListLibrary(context.Context, *ListLibraryRequest) (*ListLibraryResponse, error) CreateLibrary(context.Context, *CreateLibraryRequest) (*CreateLibraryResponse, error) - // DocumentService + // DocumentService CreateDocument(context.Context, *CreateDocumentRequest) (*CreateDocumentResponse, error) ListDocument(context.Context, *ListDocumentRequest) (*ListDocumentResponse, error) + ListDocumentBlock(context.Context, *ListDocumentBlockRequest) (*ListDocumentBlockResponse, error) + CreateDocumentBlock(context.Context, *CreateDocumentBlockRequest) (*CreateDocumentBlockResponse, error) + DeleteDocumentBlock(context.Context, *DeleteDocumentBlockRequest) (*DeleteDocumentBlockResponse, error) + UpdateDocumentBlock(context.Context, *UpdateDocumentBlockRequest) (*UpdateDocumentBlockResponse, error) mustEmbedUnimplementedRAGServiceServer() } @@ -101,6 +145,18 @@ func (UnimplementedRAGServiceServer) CreateDocument(context.Context, *CreateDocu func (UnimplementedRAGServiceServer) ListDocument(context.Context, *ListDocumentRequest) (*ListDocumentResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListDocument not implemented") } +func (UnimplementedRAGServiceServer) ListDocumentBlock(context.Context, *ListDocumentBlockRequest) (*ListDocumentBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListDocumentBlock not implemented") +} +func (UnimplementedRAGServiceServer) CreateDocumentBlock(context.Context, *CreateDocumentBlockRequest) (*CreateDocumentBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateDocumentBlock not implemented") +} +func (UnimplementedRAGServiceServer) DeleteDocumentBlock(context.Context, *DeleteDocumentBlockRequest) (*DeleteDocumentBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteDocumentBlock not implemented") +} +func (UnimplementedRAGServiceServer) UpdateDocumentBlock(context.Context, *UpdateDocumentBlockRequest) (*UpdateDocumentBlockResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateDocumentBlock not implemented") +} func (UnimplementedRAGServiceServer) mustEmbedUnimplementedRAGServiceServer() {} // UnsafeRAGServiceServer may be embedded to opt out of forward compatibility for this service. @@ -186,6 +242,78 @@ func _RAGService_ListDocument_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _RAGService_ListDocumentBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListDocumentBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RAGServiceServer).ListDocumentBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/RagService.RAGService/ListDocumentBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RAGServiceServer).ListDocumentBlock(ctx, req.(*ListDocumentBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RAGService_CreateDocumentBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateDocumentBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RAGServiceServer).CreateDocumentBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/RagService.RAGService/CreateDocumentBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RAGServiceServer).CreateDocumentBlock(ctx, req.(*CreateDocumentBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RAGService_DeleteDocumentBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteDocumentBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RAGServiceServer).DeleteDocumentBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/RagService.RAGService/DeleteDocumentBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RAGServiceServer).DeleteDocumentBlock(ctx, req.(*DeleteDocumentBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RAGService_UpdateDocumentBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateDocumentBlockRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RAGServiceServer).UpdateDocumentBlock(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/RagService.RAGService/UpdateDocumentBlock", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RAGServiceServer).UpdateDocumentBlock(ctx, req.(*UpdateDocumentBlockRequest)) + } + return interceptor(ctx, in, info, handler) +} + // RAGService_ServiceDesc is the grpc.ServiceDesc for RAGService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -209,6 +337,22 @@ var RAGService_ServiceDesc = grpc.ServiceDesc{ MethodName: "ListDocument", Handler: _RAGService_ListDocument_Handler, }, + { + MethodName: "ListDocumentBlock", + Handler: _RAGService_ListDocumentBlock_Handler, + }, + { + MethodName: "CreateDocumentBlock", + Handler: _RAGService_CreateDocumentBlock_Handler, + }, + { + MethodName: "DeleteDocumentBlock", + Handler: _RAGService_DeleteDocumentBlock_Handler, + }, + { + MethodName: "UpdateDocumentBlock", + Handler: _RAGService_UpdateDocumentBlock_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/rag/rag.proto", diff --git a/ent/documentblock.go b/ent/documentblock.go index c788e15..253de7e 100644 --- a/ent/documentblock.go +++ b/ent/documentblock.go @@ -17,8 +17,6 @@ type DocumentBlock struct { config `json:"-"` // ID of the ent. ID int `json:"id,omitempty"` - // Name holds the value of the "name" field. - Name string `json:"name,omitempty"` // Content holds the value of the "content" field. Content string `json:"content,omitempty"` // Order holds the value of the "order" field. @@ -62,7 +60,7 @@ func (*DocumentBlock) scanValues(columns []string) ([]any, error) { switch columns[i] { case documentblock.FieldID, documentblock.FieldOrder, documentblock.FieldDocumentID: values[i] = new(sql.NullInt64) - case documentblock.FieldName, documentblock.FieldContent, documentblock.FieldUserID: + case documentblock.FieldContent, documentblock.FieldUserID: values[i] = new(sql.NullString) case documentblock.FieldCreatedAt, documentblock.FieldUpdatedAt: values[i] = new(sql.NullTime) @@ -87,12 +85,6 @@ func (db *DocumentBlock) assignValues(columns []string, values []any) error { return fmt.Errorf("unexpected type %T for field id", value) } db.ID = int(value.Int64) - case documentblock.FieldName: - if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field name", values[i]) - } else if value.Valid { - db.Name = value.String - } case documentblock.FieldContent: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field content", values[i]) @@ -170,9 +162,6 @@ func (db *DocumentBlock) String() string { var builder strings.Builder builder.WriteString("DocumentBlock(") builder.WriteString(fmt.Sprintf("id=%v, ", db.ID)) - builder.WriteString("name=") - builder.WriteString(db.Name) - builder.WriteString(", ") builder.WriteString("content=") builder.WriteString(db.Content) builder.WriteString(", ") diff --git a/ent/documentblock/documentblock.go b/ent/documentblock/documentblock.go index abcb5df..5aaf77f 100644 --- a/ent/documentblock/documentblock.go +++ b/ent/documentblock/documentblock.go @@ -14,8 +14,6 @@ const ( Label = "document_block" // FieldID holds the string denoting the id field in the database. FieldID = "id" - // FieldName holds the string denoting the name field in the database. - FieldName = "name" // FieldContent holds the string denoting the content field in the database. FieldContent = "content" // FieldOrder holds the string denoting the order field in the database. @@ -44,7 +42,6 @@ const ( // Columns holds all SQL columns for documentblock fields. var Columns = []string{ FieldID, - FieldName, FieldContent, FieldOrder, FieldDocumentID, @@ -78,11 +75,6 @@ func ByID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldID, opts...).ToFunc() } -// ByName orders the results by the name field. -func ByName(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldName, opts...).ToFunc() -} - // ByContent orders the results by the content field. func ByContent(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldContent, opts...).ToFunc() diff --git a/ent/documentblock/where.go b/ent/documentblock/where.go index 0ea7bc0..702f78e 100644 --- a/ent/documentblock/where.go +++ b/ent/documentblock/where.go @@ -55,11 +55,6 @@ func IDLTE(id int) predicate.DocumentBlock { return predicate.DocumentBlock(sql.FieldLTE(FieldID, id)) } -// Name applies equality check predicate on the "name" field. It's identical to NameEQ. -func Name(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldEQ(FieldName, v)) -} - // Content applies equality check predicate on the "content" field. It's identical to ContentEQ. func Content(v string) predicate.DocumentBlock { return predicate.DocumentBlock(sql.FieldEQ(FieldContent, v)) @@ -90,71 +85,6 @@ func UpdatedAt(v time.Time) predicate.DocumentBlock { return predicate.DocumentBlock(sql.FieldEQ(FieldUpdatedAt, v)) } -// NameEQ applies the EQ predicate on the "name" field. -func NameEQ(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldEQ(FieldName, v)) -} - -// NameNEQ applies the NEQ predicate on the "name" field. -func NameNEQ(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldNEQ(FieldName, v)) -} - -// NameIn applies the In predicate on the "name" field. -func NameIn(vs ...string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldIn(FieldName, vs...)) -} - -// NameNotIn applies the NotIn predicate on the "name" field. -func NameNotIn(vs ...string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldNotIn(FieldName, vs...)) -} - -// NameGT applies the GT predicate on the "name" field. -func NameGT(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldGT(FieldName, v)) -} - -// NameGTE applies the GTE predicate on the "name" field. -func NameGTE(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldGTE(FieldName, v)) -} - -// NameLT applies the LT predicate on the "name" field. -func NameLT(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldLT(FieldName, v)) -} - -// NameLTE applies the LTE predicate on the "name" field. -func NameLTE(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldLTE(FieldName, v)) -} - -// NameContains applies the Contains predicate on the "name" field. -func NameContains(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldContains(FieldName, v)) -} - -// NameHasPrefix applies the HasPrefix predicate on the "name" field. -func NameHasPrefix(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldHasPrefix(FieldName, v)) -} - -// NameHasSuffix applies the HasSuffix predicate on the "name" field. -func NameHasSuffix(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldHasSuffix(FieldName, v)) -} - -// NameEqualFold applies the EqualFold predicate on the "name" field. -func NameEqualFold(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldEqualFold(FieldName, v)) -} - -// NameContainsFold applies the ContainsFold predicate on the "name" field. -func NameContainsFold(v string) predicate.DocumentBlock { - return predicate.DocumentBlock(sql.FieldContainsFold(FieldName, v)) -} - // ContentEQ applies the EQ predicate on the "content" field. func ContentEQ(v string) predicate.DocumentBlock { return predicate.DocumentBlock(sql.FieldEQ(FieldContent, v)) diff --git a/ent/documentblock_create.go b/ent/documentblock_create.go index 891277d..0ec0392 100644 --- a/ent/documentblock_create.go +++ b/ent/documentblock_create.go @@ -21,12 +21,6 @@ type DocumentBlockCreate struct { hooks []Hook } -// SetName sets the "name" field. -func (dbc *DocumentBlockCreate) SetName(s string) *DocumentBlockCreate { - dbc.mutation.SetName(s) - return dbc -} - // SetContent sets the "content" field. func (dbc *DocumentBlockCreate) SetContent(s string) *DocumentBlockCreate { dbc.mutation.SetContent(s) @@ -141,9 +135,6 @@ func (dbc *DocumentBlockCreate) defaults() { // check runs all checks and user-defined validators on the builder. func (dbc *DocumentBlockCreate) check() error { - if _, ok := dbc.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`ent: missing required field "DocumentBlock.name"`)} - } if _, ok := dbc.mutation.Content(); !ok { return &ValidationError{Name: "content", err: errors.New(`ent: missing required field "DocumentBlock.content"`)} } @@ -188,10 +179,6 @@ func (dbc *DocumentBlockCreate) createSpec() (*DocumentBlock, *sqlgraph.CreateSp _node = &DocumentBlock{config: dbc.config} _spec = sqlgraph.NewCreateSpec(documentblock.Table, sqlgraph.NewFieldSpec(documentblock.FieldID, field.TypeInt)) ) - if value, ok := dbc.mutation.Name(); ok { - _spec.SetField(documentblock.FieldName, field.TypeString, value) - _node.Name = value - } if value, ok := dbc.mutation.Content(); ok { _spec.SetField(documentblock.FieldContent, field.TypeString, value) _node.Content = value diff --git a/ent/documentblock_query.go b/ent/documentblock_query.go index b54e755..4219d4d 100644 --- a/ent/documentblock_query.go +++ b/ent/documentblock_query.go @@ -298,12 +298,12 @@ func (dbq *DocumentBlockQuery) WithDocument(opts ...func(*DocumentQuery)) *Docum // Example: // // var v []struct { -// Name string `json:"name,omitempty"` +// Content string `json:"content,omitempty"` // Count int `json:"count,omitempty"` // } // // client.DocumentBlock.Query(). -// GroupBy(documentblock.FieldName). +// GroupBy(documentblock.FieldContent). // Aggregate(ent.Count()). // Scan(ctx, &v) func (dbq *DocumentBlockQuery) GroupBy(field string, fields ...string) *DocumentBlockGroupBy { @@ -321,11 +321,11 @@ func (dbq *DocumentBlockQuery) GroupBy(field string, fields ...string) *Document // Example: // // var v []struct { -// Name string `json:"name,omitempty"` +// Content string `json:"content,omitempty"` // } // // client.DocumentBlock.Query(). -// Select(documentblock.FieldName). +// Select(documentblock.FieldContent). // Scan(ctx, &v) func (dbq *DocumentBlockQuery) Select(fields ...string) *DocumentBlockSelect { dbq.ctx.Fields = append(dbq.ctx.Fields, fields...) diff --git a/ent/documentblock_update.go b/ent/documentblock_update.go index f283626..aa8148d 100644 --- a/ent/documentblock_update.go +++ b/ent/documentblock_update.go @@ -29,20 +29,6 @@ func (dbu *DocumentBlockUpdate) Where(ps ...predicate.DocumentBlock) *DocumentBl return dbu } -// SetName sets the "name" field. -func (dbu *DocumentBlockUpdate) SetName(s string) *DocumentBlockUpdate { - dbu.mutation.SetName(s) - return dbu -} - -// SetNillableName sets the "name" field if the given value is not nil. -func (dbu *DocumentBlockUpdate) SetNillableName(s *string) *DocumentBlockUpdate { - if s != nil { - dbu.SetName(*s) - } - return dbu -} - // SetContent sets the "content" field. func (dbu *DocumentBlockUpdate) SetContent(s string) *DocumentBlockUpdate { dbu.mutation.SetContent(s) @@ -218,9 +204,6 @@ func (dbu *DocumentBlockUpdate) sqlSave(ctx context.Context) (n int, err error) } } } - if value, ok := dbu.mutation.Name(); ok { - _spec.SetField(documentblock.FieldName, field.TypeString, value) - } if value, ok := dbu.mutation.Content(); ok { _spec.SetField(documentblock.FieldContent, field.TypeString, value) } @@ -310,20 +293,6 @@ type DocumentBlockUpdateOne struct { mutation *DocumentBlockMutation } -// SetName sets the "name" field. -func (dbuo *DocumentBlockUpdateOne) SetName(s string) *DocumentBlockUpdateOne { - dbuo.mutation.SetName(s) - return dbuo -} - -// SetNillableName sets the "name" field if the given value is not nil. -func (dbuo *DocumentBlockUpdateOne) SetNillableName(s *string) *DocumentBlockUpdateOne { - if s != nil { - dbuo.SetName(*s) - } - return dbuo -} - // SetContent sets the "content" field. func (dbuo *DocumentBlockUpdateOne) SetContent(s string) *DocumentBlockUpdateOne { dbuo.mutation.SetContent(s) @@ -529,9 +498,6 @@ func (dbuo *DocumentBlockUpdateOne) sqlSave(ctx context.Context) (_node *Documen } } } - if value, ok := dbuo.mutation.Name(); ok { - _spec.SetField(documentblock.FieldName, field.TypeString, value) - } if value, ok := dbuo.mutation.Content(); ok { _spec.SetField(documentblock.FieldContent, field.TypeString, value) } diff --git a/ent/migrate/schema.go b/ent/migrate/schema.go index 1f31c04..156466a 100644 --- a/ent/migrate/schema.go +++ b/ent/migrate/schema.go @@ -42,7 +42,6 @@ var ( // DocumentBlocksColumns holds the columns for the "document_blocks" table. DocumentBlocksColumns = []*schema.Column{ {Name: "id", Type: field.TypeInt, Increment: true}, - {Name: "name", Type: field.TypeString}, {Name: "content", Type: field.TypeString}, {Name: "order", Type: field.TypeInt64}, {Name: "document_id", Type: field.TypeInt64}, @@ -57,9 +56,9 @@ var ( PrimaryKey: []*schema.Column{DocumentBlocksColumns[0]}, Indexes: []*schema.Index{ { - Name: "documentblock_name_user_id_order", + Name: "documentblock_user_id_order", Unique: false, - Columns: []*schema.Column{DocumentBlocksColumns[1], DocumentBlocksColumns[5], DocumentBlocksColumns[3]}, + Columns: []*schema.Column{DocumentBlocksColumns[4], DocumentBlocksColumns[2]}, }, }, } diff --git a/ent/mutation.go b/ent/mutation.go index 2e7d616..ad99d11 100644 --- a/ent/mutation.go +++ b/ent/mutation.go @@ -615,7 +615,6 @@ type DocumentBlockMutation struct { op Op typ string id *int - name *string content *string _order *int64 add_order *int64 @@ -731,42 +730,6 @@ func (m *DocumentBlockMutation) IDs(ctx context.Context) ([]int, error) { } } -// SetName sets the "name" field. -func (m *DocumentBlockMutation) SetName(s string) { - m.name = &s -} - -// Name returns the value of the "name" field in the mutation. -func (m *DocumentBlockMutation) Name() (r string, exists bool) { - v := m.name - if v == nil { - return - } - return *v, true -} - -// OldName returns the old "name" field's value of the DocumentBlock entity. -// If the DocumentBlock object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *DocumentBlockMutation) OldName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldName: %w", err) - } - return oldValue.Name, nil -} - -// ResetName resets all changes to the "name" field. -func (m *DocumentBlockMutation) ResetName() { - m.name = nil -} - // SetContent sets the "content" field. func (m *DocumentBlockMutation) SetContent(s string) { m.content = &s @@ -1111,10 +1074,7 @@ func (m *DocumentBlockMutation) Type() string { // order to get all numeric fields that were incremented/decremented, call // AddedFields(). func (m *DocumentBlockMutation) Fields() []string { - fields := make([]string, 0, 7) - if m.name != nil { - fields = append(fields, documentblock.FieldName) - } + fields := make([]string, 0, 6) if m.content != nil { fields = append(fields, documentblock.FieldContent) } @@ -1141,8 +1101,6 @@ func (m *DocumentBlockMutation) Fields() []string { // schema. func (m *DocumentBlockMutation) Field(name string) (ent.Value, bool) { switch name { - case documentblock.FieldName: - return m.Name() case documentblock.FieldContent: return m.Content() case documentblock.FieldOrder: @@ -1164,8 +1122,6 @@ func (m *DocumentBlockMutation) Field(name string) (ent.Value, bool) { // database failed. func (m *DocumentBlockMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case documentblock.FieldName: - return m.OldName(ctx) case documentblock.FieldContent: return m.OldContent(ctx) case documentblock.FieldOrder: @@ -1187,13 +1143,6 @@ func (m *DocumentBlockMutation) OldField(ctx context.Context, name string) (ent. // type. func (m *DocumentBlockMutation) SetField(name string, value ent.Value) error { switch name { - case documentblock.FieldName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetName(v) - return nil case documentblock.FieldContent: v, ok := value.(string) if !ok { @@ -1312,9 +1261,6 @@ func (m *DocumentBlockMutation) ClearField(name string) error { // It returns an error if the field is not defined in the schema. func (m *DocumentBlockMutation) ResetField(name string) error { switch name { - case documentblock.FieldName: - m.ResetName() - return nil case documentblock.FieldContent: m.ResetContent() return nil diff --git a/ent/runtime.go b/ent/runtime.go index 770c5fa..6590257 100644 --- a/ent/runtime.go +++ b/ent/runtime.go @@ -28,11 +28,11 @@ func init() { documentblockFields := schema.DocumentBlock{}.Fields() _ = documentblockFields // documentblockDescCreatedAt is the schema descriptor for created_at field. - documentblockDescCreatedAt := documentblockFields[5].Descriptor() + documentblockDescCreatedAt := documentblockFields[4].Descriptor() // documentblock.DefaultCreatedAt holds the default value on creation for the created_at field. documentblock.DefaultCreatedAt = documentblockDescCreatedAt.Default.(func() time.Time) // documentblockDescUpdatedAt is the schema descriptor for updated_at field. - documentblockDescUpdatedAt := documentblockFields[6].Descriptor() + documentblockDescUpdatedAt := documentblockFields[5].Descriptor() // documentblock.DefaultUpdatedAt holds the default value on creation for the updated_at field. documentblock.DefaultUpdatedAt = documentblockDescUpdatedAt.Default.(func() time.Time) libraryFields := schema.Library{}.Fields()