doc2x

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusResponseDataStatusSuccess    = "success"
	StatusResponseDataStatusProcessing = "processing"
	StatusResponseDataStatusFailed     = "failed"
)

Variables

View Source
var ModelList = []*model.ModelConfig{
	{
		Model:      "pdf",
		Type:       relaymode.ParsePdf,
		Owner:      model.ModelOwnerDoc2x,
		InputPrice: 20,
		RPM:        10,
	},
}

Functions

func ConvertParsePdfRequest

func ConvertParsePdfRequest(meta *meta.Meta, req *http.Request) (string, http.Header, io.Reader, error)

func HTMLImage2Md

func HTMLImage2Md(content string) string

func HTMLTable2Md

func HTMLTable2Md(content string) string

func HandleParsePdfResponse

func HandleParsePdfResponse(meta *meta.Meta, c *gin.Context, resp *http.Response) (*relaymodel.Usage, *relaymodel.ErrorWithStatusCode)

func InlineMdImage

func InlineMdImage(ctx context.Context, text string) string

Types

type Adaptor

type Adaptor struct{}

func (*Adaptor) ConvertRequest

func (a *Adaptor) ConvertRequest(meta *meta.Meta, req *http.Request) (string, http.Header, io.Reader, error)

func (*Adaptor) DoRequest

func (a *Adaptor) DoRequest(_ *meta.Meta, _ *gin.Context, req *http.Request) (*http.Response, error)

func (*Adaptor) DoResponse

func (a *Adaptor) DoResponse(meta *meta.Meta, c *gin.Context, resp *http.Response) (*relaymodel.Usage, *relaymodel.ErrorWithStatusCode)

func (*Adaptor) GetBaseURL

func (a *Adaptor) GetBaseURL() string

func (*Adaptor) GetChannelName

func (a *Adaptor) GetChannelName() string

func (*Adaptor) GetModelList

func (a *Adaptor) GetModelList() []*model.ModelConfig

func (*Adaptor) GetRequestURL

func (a *Adaptor) GetRequestURL(meta *meta.Meta) (string, error)

func (*Adaptor) SetupRequestHeader

func (a *Adaptor) SetupRequestHeader(meta *meta.Meta, _ *gin.Context, req *http.Request) error

type ParsePdfResponse

type ParsePdfResponse struct {
	Code string               `json:"code"`
	Data ParsePdfResponseData `json:"data"`
	Msg  string               `json:"msg"`
}

type ParsePdfResponseData

type ParsePdfResponseData struct {
	UID string `json:"uid"`
}

type StatusResponse

type StatusResponse struct {
	Code string              `json:"code"`
	Msg  string              `json:"msg"`
	Data *StatusResponseData `json:"data"`
}

type StatusResponseData

type StatusResponseData struct {
	Progress int                       `json:"progress"`
	Status   string                    `json:"status"`
	Detail   string                    `json:"detail"`
	Result   *StatusResponseDataResult `json:"result"`
}

func GetStatus

func GetStatus(ctx context.Context, meta *meta.Meta, uid string) (*StatusResponseData, error)

type StatusResponseDataResult

type StatusResponseDataResult struct {
	Version string                         `json:"version"`
	Pages   []StatusResponseDataResultPage `json:"pages"`
}

type StatusResponseDataResultPage

type StatusResponseDataResultPage struct {
	URL        string `json:"url"`
	PageIdx    int    `json:"page_idx"`
	PageWidth  int    `json:"page_width"`
	PageHeight int    `json:"page_height"`
	MD         string `json:"md"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL