暂存

tmp
This commit is contained in:
2024-05-09 16:35:21 +08:00
parent 3afa0d81bb
commit bcc1b51006
27 changed files with 1526 additions and 0 deletions

487
proto/msw.pb.go Normal file
View File

@@ -0,0 +1,487 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.33.0
// protoc v4.25.3
// source: proto/msw.proto
package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
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 Empty struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Empty) Reset() {
*x = Empty{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_msw_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Empty) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Empty) ProtoMessage() {}
func (x *Empty) ProtoReflect() protoreflect.Message {
mi := &file_proto_msw_proto_msgTypes[0]
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 Empty.ProtoReflect.Descriptor instead.
func (*Empty) Descriptor() ([]byte, []int) {
return file_proto_msw_proto_rawDescGZIP(), []int{0}
}
type VersionResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Major int32 `protobuf:"varint,1,opt,name=major,proto3" json:"major,omitempty"`
Minor int32 `protobuf:"varint,2,opt,name=minor,proto3" json:"minor,omitempty"`
Patch int32 `protobuf:"varint,3,opt,name=patch,proto3" json:"patch,omitempty"`
Hostname string `protobuf:"bytes,4,opt,name=hostname,proto3" json:"hostname,omitempty"`
Addr []string `protobuf:"bytes,5,rep,name=addr,proto3" json:"addr,omitempty"`
Latency int64 `protobuf:"varint,6,opt,name=latency,proto3" json:"latency,omitempty"`
StartedAt *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"`
}
func (x *VersionResponse) Reset() {
*x = VersionResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_msw_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *VersionResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*VersionResponse) ProtoMessage() {}
func (x *VersionResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_msw_proto_msgTypes[1]
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 VersionResponse.ProtoReflect.Descriptor instead.
func (*VersionResponse) Descriptor() ([]byte, []int) {
return file_proto_msw_proto_rawDescGZIP(), []int{1}
}
func (x *VersionResponse) GetMajor() int32 {
if x != nil {
return x.Major
}
return 0
}
func (x *VersionResponse) GetMinor() int32 {
if x != nil {
return x.Minor
}
return 0
}
func (x *VersionResponse) GetPatch() int32 {
if x != nil {
return x.Patch
}
return 0
}
func (x *VersionResponse) GetHostname() string {
if x != nil {
return x.Hostname
}
return ""
}
func (x *VersionResponse) GetAddr() []string {
if x != nil {
return x.Addr
}
return nil
}
func (x *VersionResponse) GetLatency() int64 {
if x != nil {
return x.Latency
}
return 0
}
func (x *VersionResponse) GetStartedAt() *timestamppb.Timestamp {
if x != nil {
return x.StartedAt
}
return nil
}
type DataPackage struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ToPlugin string `protobuf:"bytes,1,opt,name=ToPlugin,proto3" json:"ToPlugin,omitempty"`
Params map[string]string `protobuf:"bytes,2,rep,name=Params,proto3" json:"Params,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
Body string `protobuf:"bytes,3,opt,name=Body,proto3" json:"Body,omitempty"`
}
func (x *DataPackage) Reset() {
*x = DataPackage{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_msw_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DataPackage) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DataPackage) ProtoMessage() {}
func (x *DataPackage) ProtoReflect() protoreflect.Message {
mi := &file_proto_msw_proto_msgTypes[2]
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 DataPackage.ProtoReflect.Descriptor instead.
func (*DataPackage) Descriptor() ([]byte, []int) {
return file_proto_msw_proto_rawDescGZIP(), []int{2}
}
func (x *DataPackage) GetToPlugin() string {
if x != nil {
return x.ToPlugin
}
return ""
}
func (x *DataPackage) GetParams() map[string]string {
if x != nil {
return x.Params
}
return nil
}
func (x *DataPackage) GetBody() string {
if x != nil {
return x.Body
}
return ""
}
type ClipEmbeddingForTextRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Text string `protobuf:"bytes,1,opt,name=Text,proto3" json:"Text,omitempty"`
}
func (x *ClipEmbeddingForTextRequest) Reset() {
*x = ClipEmbeddingForTextRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_msw_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClipEmbeddingForTextRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClipEmbeddingForTextRequest) ProtoMessage() {}
func (x *ClipEmbeddingForTextRequest) ProtoReflect() protoreflect.Message {
mi := &file_proto_msw_proto_msgTypes[3]
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 ClipEmbeddingForTextRequest.ProtoReflect.Descriptor instead.
func (*ClipEmbeddingForTextRequest) Descriptor() ([]byte, []int) {
return file_proto_msw_proto_rawDescGZIP(), []int{3}
}
func (x *ClipEmbeddingForTextRequest) GetText() string {
if x != nil {
return x.Text
}
return ""
}
type ClipEmbeddingForTextResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Embedding []float32 `protobuf:"fixed32,1,rep,packed,name=Embedding,proto3" json:"Embedding,omitempty"`
}
func (x *ClipEmbeddingForTextResponse) Reset() {
*x = ClipEmbeddingForTextResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_proto_msw_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ClipEmbeddingForTextResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ClipEmbeddingForTextResponse) ProtoMessage() {}
func (x *ClipEmbeddingForTextResponse) ProtoReflect() protoreflect.Message {
mi := &file_proto_msw_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 ClipEmbeddingForTextResponse.ProtoReflect.Descriptor instead.
func (*ClipEmbeddingForTextResponse) Descriptor() ([]byte, []int) {
return file_proto_msw_proto_rawDescGZIP(), []int{4}
}
func (x *ClipEmbeddingForTextResponse) GetEmbedding() []float32 {
if x != nil {
return x.Embedding
}
return nil
}
var File_proto_msw_proto protoreflect.FileDescriptor
var file_proto_msw_proto_rawDesc = []byte{
0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6d, 0x73, 0x77, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x12, 0x03, 0x6d, 0x73, 0x77, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x07, 0x0a, 0x05, 0x45, 0x6d, 0x70, 0x74, 0x79,
0x22, 0xd8, 0x01, 0x0a, 0x0f, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x18, 0x01, 0x20,
0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x61, 0x6a, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x69,
0x6e, 0x6f, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6d, 0x69, 0x6e, 0x6f, 0x72,
0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52,
0x05, 0x70, 0x61, 0x74, 0x63, 0x68, 0x12, 0x1a, 0x0a, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61,
0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09,
0x52, 0x04, 0x61, 0x64, 0x64, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63,
0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x07, 0x6c, 0x61, 0x74, 0x65, 0x6e, 0x63, 0x79,
0x12, 0x39, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x07,
0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70,
0x52, 0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x65, 0x64, 0x41, 0x74, 0x22, 0xae, 0x01, 0x0a, 0x0b,
0x44, 0x61, 0x74, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x54,
0x6f, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x54,
0x6f, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x34, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d,
0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x6d, 0x73, 0x77, 0x2e, 0x44, 0x61,
0x74, 0x61, 0x50, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x12, 0x0a,
0x04, 0x42, 0x6f, 0x64, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x42, 0x6f, 0x64,
0x79, 0x1a, 0x39, 0x0a, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79,
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x31, 0x0a, 0x1b,
0x43, 0x6c, 0x69, 0x70, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x6f, 0x72,
0x54, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x54,
0x65, 0x78, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x54, 0x65, 0x78, 0x74, 0x22,
0x3c, 0x0a, 0x1c, 0x43, 0x6c, 0x69, 0x70, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x69, 0x6e, 0x67,
0x46, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x1c, 0x0a, 0x09, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x18, 0x01, 0x20, 0x03,
0x28, 0x02, 0x52, 0x09, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x32, 0x8f, 0x01,
0x0a, 0x03, 0x4d, 0x53, 0x57, 0x12, 0x2b, 0x0a, 0x07, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e,
0x12, 0x0a, 0x2e, 0x6d, 0x73, 0x77, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x1a, 0x14, 0x2e, 0x6d,
0x73, 0x77, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x5b, 0x0a, 0x14, 0x43, 0x6c, 0x69, 0x70, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64,
0x69, 0x6e, 0x67, 0x46, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x12, 0x20, 0x2e, 0x6d, 0x73, 0x77,
0x2e, 0x43, 0x6c, 0x69, 0x70, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x46, 0x6f,
0x72, 0x54, 0x65, 0x78, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d,
0x73, 0x77, 0x2e, 0x43, 0x6c, 0x69, 0x70, 0x45, 0x6d, 0x62, 0x65, 0x64, 0x64, 0x69, 0x6e, 0x67,
0x46, 0x6f, 0x72, 0x54, 0x65, 0x78, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42,
0x0b, 0x5a, 0x09, 0x6d, 0x73, 0x77, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (
file_proto_msw_proto_rawDescOnce sync.Once
file_proto_msw_proto_rawDescData = file_proto_msw_proto_rawDesc
)
func file_proto_msw_proto_rawDescGZIP() []byte {
file_proto_msw_proto_rawDescOnce.Do(func() {
file_proto_msw_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_msw_proto_rawDescData)
})
return file_proto_msw_proto_rawDescData
}
var file_proto_msw_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_proto_msw_proto_goTypes = []interface{}{
(*Empty)(nil), // 0: msw.Empty
(*VersionResponse)(nil), // 1: msw.VersionResponse
(*DataPackage)(nil), // 2: msw.DataPackage
(*ClipEmbeddingForTextRequest)(nil), // 3: msw.ClipEmbeddingForTextRequest
(*ClipEmbeddingForTextResponse)(nil), // 4: msw.ClipEmbeddingForTextResponse
nil, // 5: msw.DataPackage.ParamsEntry
(*timestamppb.Timestamp)(nil), // 6: google.protobuf.Timestamp
}
var file_proto_msw_proto_depIdxs = []int32{
6, // 0: msw.VersionResponse.started_at:type_name -> google.protobuf.Timestamp
5, // 1: msw.DataPackage.Params:type_name -> msw.DataPackage.ParamsEntry
0, // 2: msw.MSW.Version:input_type -> msw.Empty
3, // 3: msw.MSW.ClipEmbeddingForText:input_type -> msw.ClipEmbeddingForTextRequest
1, // 4: msw.MSW.Version:output_type -> msw.VersionResponse
4, // 5: msw.MSW.ClipEmbeddingForText:output_type -> msw.ClipEmbeddingForTextResponse
4, // [4:6] is the sub-list for method output_type
2, // [2:4] 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
}
func init() { file_proto_msw_proto_init() }
func file_proto_msw_proto_init() {
if File_proto_msw_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_proto_msw_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Empty); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_msw_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*VersionResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_msw_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DataPackage); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_msw_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClipEmbeddingForTextRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_proto_msw_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ClipEmbeddingForTextResponse); 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{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_proto_msw_proto_rawDesc,
NumEnums: 0,
NumMessages: 6,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_proto_msw_proto_goTypes,
DependencyIndexes: file_proto_msw_proto_depIdxs,
MessageInfos: file_proto_msw_proto_msgTypes,
}.Build()
File_proto_msw_proto = out.File
file_proto_msw_proto_rawDesc = nil
file_proto_msw_proto_goTypes = nil
file_proto_msw_proto_depIdxs = nil
}

41
proto/msw.proto Normal file
View File

@@ -0,0 +1,41 @@
syntax = "proto3";
package msw;
import "google/protobuf/timestamp.proto";
option go_package = "msw/proto";
service MSW {
rpc Version(Empty) returns (VersionResponse) {};
rpc ClipEmbeddingForText(ClipEmbeddingForTextRequest)
returns (ClipEmbeddingResponse) {};
rpc ClipEmbeddingForImage(ClipEmbeddingForImageRequest)
returns (ClipEmbeddingResponse) {};
}
message Empty {}
message VersionResponse {
int32 major = 1;
int32 minor = 2;
int32 patch = 3;
string hostname = 4;
repeated string addr = 5;
int64 latency = 6;
google.protobuf.Timestamp started_at = 7;
}
message DataPackage {
string ToPlugin = 1;
map<string, string> Params = 2;
string Body = 3;
}
message ClipEmbeddingForTextRequest { repeated string Text = 1; }
message ClipEmbeddingForImageRequest { bytes Image = 1; }
message ClipEmbeddingResponse { repeated Embedding Embeddings = 1; }
message Embedding { repeated float Embedding = 2; }

146
proto/msw_grpc.pb.go Normal file
View File

@@ -0,0 +1,146 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v4.25.3
// source: proto/msw.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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
MSW_Version_FullMethodName = "/msw.MSW/Version"
MSW_ClipEmbeddingForText_FullMethodName = "/msw.MSW/ClipEmbeddingForText"
)
// MSWClient is the client API for MSW 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.
type MSWClient interface {
Version(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*VersionResponse, error)
ClipEmbeddingForText(ctx context.Context, in *ClipEmbeddingForTextRequest, opts ...grpc.CallOption) (*ClipEmbeddingForTextResponse, error)
}
type mSWClient struct {
cc grpc.ClientConnInterface
}
func NewMSWClient(cc grpc.ClientConnInterface) MSWClient {
return &mSWClient{cc}
}
func (c *mSWClient) Version(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*VersionResponse, error) {
out := new(VersionResponse)
err := c.cc.Invoke(ctx, MSW_Version_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *mSWClient) ClipEmbeddingForText(ctx context.Context, in *ClipEmbeddingForTextRequest, opts ...grpc.CallOption) (*ClipEmbeddingForTextResponse, error) {
out := new(ClipEmbeddingForTextResponse)
err := c.cc.Invoke(ctx, MSW_ClipEmbeddingForText_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MSWServer is the server API for MSW service.
// All implementations must embed UnimplementedMSWServer
// for forward compatibility
type MSWServer interface {
Version(context.Context, *Empty) (*VersionResponse, error)
ClipEmbeddingForText(context.Context, *ClipEmbeddingForTextRequest) (*ClipEmbeddingForTextResponse, error)
mustEmbedUnimplementedMSWServer()
}
// UnimplementedMSWServer must be embedded to have forward compatible implementations.
type UnimplementedMSWServer struct {
}
func (UnimplementedMSWServer) Version(context.Context, *Empty) (*VersionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Version not implemented")
}
func (UnimplementedMSWServer) ClipEmbeddingForText(context.Context, *ClipEmbeddingForTextRequest) (*ClipEmbeddingForTextResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ClipEmbeddingForText not implemented")
}
func (UnimplementedMSWServer) mustEmbedUnimplementedMSWServer() {}
// UnsafeMSWServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to MSWServer will
// result in compilation errors.
type UnsafeMSWServer interface {
mustEmbedUnimplementedMSWServer()
}
func RegisterMSWServer(s grpc.ServiceRegistrar, srv MSWServer) {
s.RegisterService(&MSW_ServiceDesc, srv)
}
func _MSW_Version_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MSWServer).Version(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: MSW_Version_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MSWServer).Version(ctx, req.(*Empty))
}
return interceptor(ctx, in, info, handler)
}
func _MSW_ClipEmbeddingForText_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ClipEmbeddingForTextRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MSWServer).ClipEmbeddingForText(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: MSW_ClipEmbeddingForText_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MSWServer).ClipEmbeddingForText(ctx, req.(*ClipEmbeddingForTextRequest))
}
return interceptor(ctx, in, info, handler)
}
// MSW_ServiceDesc is the grpc.ServiceDesc for MSW service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var MSW_ServiceDesc = grpc.ServiceDesc{
ServiceName: "msw.MSW",
HandlerType: (*MSWServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "Version",
Handler: _MSW_Version_Handler,
},
{
MethodName: "ClipEmbeddingForText",
Handler: _MSW_ClipEmbeddingForText_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "proto/msw.proto",
}