feat: 增强 AI-Core 文档解析器
- 添加 VLM 客户端支持 - 优化解析器配置 - 添加配置示例文件 - 生成新的 gRPC protobuf 文件 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
197
server/document_parser_grpc.pb.go
Normal file
197
server/document_parser_grpc.pb.go
Normal file
@@ -0,0 +1,197 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v5.29.3
|
||||
// source: document_parser.proto
|
||||
|
||||
package docparser
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
DocumentParser_ParseDocument_FullMethodName = "/docparser.DocumentParser/ParseDocument"
|
||||
DocumentParser_GetSupportedFormats_FullMethodName = "/docparser.DocumentParser/GetSupportedFormats"
|
||||
DocumentParser_GetEngines_FullMethodName = "/docparser.DocumentParser/GetEngines"
|
||||
)
|
||||
|
||||
// DocumentParserClient is the client API for DocumentParser 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 DocumentParserClient interface {
|
||||
ParseDocument(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error)
|
||||
GetSupportedFormats(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SupportedFormatsResponse, error)
|
||||
GetEngines(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*EnginesResponse, error)
|
||||
}
|
||||
|
||||
type documentParserClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewDocumentParserClient(cc grpc.ClientConnInterface) DocumentParserClient {
|
||||
return &documentParserClient{cc}
|
||||
}
|
||||
|
||||
func (c *documentParserClient) ParseDocument(ctx context.Context, in *ParseRequest, opts ...grpc.CallOption) (*ParseResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ParseResponse)
|
||||
err := c.cc.Invoke(ctx, DocumentParser_ParseDocument_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *documentParserClient) GetSupportedFormats(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*SupportedFormatsResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(SupportedFormatsResponse)
|
||||
err := c.cc.Invoke(ctx, DocumentParser_GetSupportedFormats_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *documentParserClient) GetEngines(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*EnginesResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(EnginesResponse)
|
||||
err := c.cc.Invoke(ctx, DocumentParser_GetEngines_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// DocumentParserServer is the server API for DocumentParser service.
|
||||
// All implementations must embed UnimplementedDocumentParserServer
|
||||
// for forward compatibility.
|
||||
type DocumentParserServer interface {
|
||||
ParseDocument(context.Context, *ParseRequest) (*ParseResponse, error)
|
||||
GetSupportedFormats(context.Context, *Empty) (*SupportedFormatsResponse, error)
|
||||
GetEngines(context.Context, *Empty) (*EnginesResponse, error)
|
||||
mustEmbedUnimplementedDocumentParserServer()
|
||||
}
|
||||
|
||||
// UnimplementedDocumentParserServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedDocumentParserServer struct{}
|
||||
|
||||
func (UnimplementedDocumentParserServer) ParseDocument(context.Context, *ParseRequest) (*ParseResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ParseDocument not implemented")
|
||||
}
|
||||
func (UnimplementedDocumentParserServer) GetSupportedFormats(context.Context, *Empty) (*SupportedFormatsResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetSupportedFormats not implemented")
|
||||
}
|
||||
func (UnimplementedDocumentParserServer) GetEngines(context.Context, *Empty) (*EnginesResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetEngines not implemented")
|
||||
}
|
||||
func (UnimplementedDocumentParserServer) mustEmbedUnimplementedDocumentParserServer() {}
|
||||
func (UnimplementedDocumentParserServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeDocumentParserServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to DocumentParserServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeDocumentParserServer interface {
|
||||
mustEmbedUnimplementedDocumentParserServer()
|
||||
}
|
||||
|
||||
func RegisterDocumentParserServer(s grpc.ServiceRegistrar, srv DocumentParserServer) {
|
||||
// If the following call panics, it indicates UnimplementedDocumentParserServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&DocumentParser_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _DocumentParser_ParseDocument_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ParseRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DocumentParserServer).ParseDocument(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: DocumentParser_ParseDocument_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DocumentParserServer).ParseDocument(ctx, req.(*ParseRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DocumentParser_GetSupportedFormats_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.(DocumentParserServer).GetSupportedFormats(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: DocumentParser_GetSupportedFormats_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DocumentParserServer).GetSupportedFormats(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _DocumentParser_GetEngines_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.(DocumentParserServer).GetEngines(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: DocumentParser_GetEngines_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DocumentParserServer).GetEngines(ctx, req.(*Empty))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// DocumentParser_ServiceDesc is the grpc.ServiceDesc for DocumentParser service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var DocumentParser_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "docparser.DocumentParser",
|
||||
HandlerType: (*DocumentParserServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "ParseDocument",
|
||||
Handler: _DocumentParser_ParseDocument_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetSupportedFormats",
|
||||
Handler: _DocumentParser_GetSupportedFormats_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetEngines",
|
||||
Handler: _DocumentParser_GetEngines_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "document_parser.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user