app

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 24 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrorCodeSystem = "system"

	// It exceed the max times for a day.
	ErrorCodeAIQuestionExceedMaxTimes           = "aiquestion_exceed_max_times"
	ErrorCodeAIQuestionSubmissionExpiry         = "aiquestion_submission_expiry"
	ErrorCodeAIQuestionSubmissionUnmatchedTimes = "aiquestion_submission_unmatched_times"

	ErrorBigModelSensitiveInfo     = "bigmodel_sensitive_info"
	ErrorBigModelRecourseBusy      = "bigmodel_resource_busy"
	ErrorBigModelConcurrentRequest = "bigmodel_concurrent_request"

	ErrorWuKongNoPicture        = "bigmodel_no_wukong_picture"
	ErrorWuKongInvalidId        = "wukong_invalid_id"
	ErrorWuKongInvalidOwner     = "wukong_invalid_owner"
	ErrorWuKongInvalidPath      = "wukong_invalid_path"
	ErrorWuKongNoAuthorization  = "wukong_no_authorization"
	ErrorWuKongInvalidLink      = "wukong_invalid_link"
	ErrorWuKongDuplicateLike    = "wukong_duplicate_like"
	ErrorWuKongExccedMaxLikeNum = "wukong_excced_max_like_num"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AIDetectorCmd

type AIDetectorCmd struct {
	User types.Account         `json:"user"`
	Lang domain.Lang           `json:"lang"`
	Text domain.AIDetectorText `json:"text"`
}

func (AIDetectorCmd) Validate

func (cmd AIDetectorCmd) Validate() error

type ApiApplyRecordDTO

type ApiApplyRecordDTO struct {
	User      string `json:"user"`
	Name      string `json:"name"`
	Endpoint  string `json:"endpoint"`
	ApplyAt   string `json:"apply_at"`
	UpdateAt  string `json:"update_at"`
	ModelName string `json:"model_name"`
	Enabled   bool   `json:"enabled"`
}

type ApiInfoDTO

type ApiInfoDTO struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	Endpoint string `json:"endpoint"`
	Doc      string `json:"doc"`
}

type ApplyRecordGetCmd

type ApplyRecordGetCmd struct {
	User      types.Account
	ModelName domain.ModelName
}

type AsyncBigModelService

type AsyncBigModelService interface {
	WuKong(uint64, types.Account, *WuKongCmd) error
	GetIdleEndpoint(bid string) (int, error)
}

func NewAsyncBigModelService

func NewAsyncBigModelService(
	fm bigmodel.BigModel,
	sender message.MessageProducer,
) AsyncBigModelService

type BaiChuanCmd

type BaiChuanCmd struct {
	User              types.Account
	Sampling          bool
	Text              domain.BaiChuanText
	TopK              domain.TopK
	TopP              domain.TopP
	Temperature       domain.Temperature
	RepetitionPenalty domain.RepetitionPenalty
}

baichuan

func (*BaiChuanCmd) SetDefault

func (cmd *BaiChuanCmd) SetDefault()

type BaiChuanDTO

type BaiChuanDTO struct {
	Text string `json:"text"`
}

type BigModelService

type BigModelService interface {
	// luojia
	LuoJiaUploadPicture(io.Reader, types.Account) error
	LuoJia(types.Account) (string, error)
	ListLuoJiaRecord(types.Account) ([]LuoJiaRecordDTO, error)

	// wukong
	GenWuKongSamples(int) ([]string, error)
	WuKong(types.Account, *WuKongCmd) (map[string]string, string, error)
	WuKongHF(*WuKongHFCmd) (map[string]string, string, error)
	WuKongInferenceAsync(types.Account, *WuKongCmd) (string, error)
	GetWuKongWaitingTaskRank(types.Account) (WuKongRankDTO, error)
	GetWuKongLastTaskResp(types.Account) ([]wukongPictureDTO, string, error)
	AddLikeFromTempPicture(*WuKongAddLikeFromTempCmd) (string, string, error)
	AddLikeFromPublicPicture(*WuKongAddLikeFromPublicCmd) (string, string, error)
	AddPublicFromTempPicture(*WuKongAddPublicFromTempCmd) (string, string, error)
	AddPublicFromLikePicture(*WuKongAddPublicFromLikeCmd) (string, string, error)
	CancelPublic(types.Account, string) error
	GetPublicsGlobal(cmd *WuKongListPublicGlobalCmd) (WuKongPublicGlobalDTO, error)
	ListPublics(types.Account) ([]WuKongPublicDTO, error)
	CancelLike(types.Account, string) error
	ListLikes(types.Account) ([]WuKongLikeDTO, error)
	DiggPicture(*WuKongAddDiggCmd) (int, error)
	CancelDiggPicture(*WuKongCancelDiggCmd) (int, error)
	ReGenerateDownloadURL(types.Account, string) (string, string, error)

	//api service
	ApplyApi(types.Account, domain.ModelName, string) error
	WukongApi(types.Account, domain.ModelName, *WuKongApiCmd) (map[string]string, string, error)
	GetApplyRecordByModel(types.Account, domain.ModelName) (string, error)
	GetApplyRecordByUser(types.Account) ([]ApiApplyRecordDTO, error)
	IsApplyModel(types.Account, domain.ModelName) (bool, error)
	UpdateToken(types.Account, domain.ModelName, string) (string, error)

	//api info
	GetApiInfo(model domain.ModelName) (ApiInfoDTO, error)

	// ai detector
	AIDetector(*AIDetectorCmd) (string, bool, error)

	// baichuan
	BaiChuan(*BaiChuanCmd) (string, BaiChuanDTO, error)

	// glm2
	GLM2(*GLM2Cmd) (string, error)

	// llama2
	LLAMA2(*LLAMA2Cmd) (string, error)

	// iflytekspark
	IFlytekSpark(*IFlytekSparkCmd) (string, error)

	// skywork 13b
	SkyWork(*SkyWorkCmd) (string, error)
}

func NewBigModelService

func NewBigModelService(
	fm bigmodel.BigModel,
	user userrepo.User,
	luojia repository.LuoJia,
	wukong repository.WuKong,
	wukongPicture repository.WuKongPicture,
	asynccli async.AsyncTask,
	sender message.MessageProducer,
	apiService repository.ApiService,
	apiInfo repository.ApiInfo,
	userService userapp.RegService,
) BigModelService

type CodeGeexCmd

type CodeGeexCmd bigmodel.CodeGeexReq

func (*CodeGeexCmd) Validate

func (cmd *CodeGeexCmd) Validate() error

type CodeGeexDTO

type CodeGeexDTO = bigmodel.CodeGeexResp

type DescribePictureCmd

type DescribePictureCmd struct {
	User    types.Account
	Picture io.Reader
	Name    string
	Length  int64
}

func (*DescribePictureCmd) Validate

func (cmd *DescribePictureCmd) Validate() error

type GLM2Cmd

type GLM2Cmd struct {
	CH                chan string
	User              types.Account
	History           []domain.History
	Sampling          bool
	Text              domain.GLM2Text
	TopK              domain.TopK
	TopP              domain.TopP
	Temperature       domain.Temperature
	RepetitionPenalty domain.RepetitionPenalty
}

glm2

func (*GLM2Cmd) SetDefault

func (cmd *GLM2Cmd) SetDefault()

type GLM2DTO

type GLM2DTO struct {
	Reply        string `json:"reply"`
	StreamStatus string `json:"stream_status"`
}

type GenPictureCmd

type GenPictureCmd struct {
	User types.Account `json:"user"`
	Desc domain.Desc   `json:"desc"`
}

taichu

type IFlytekSparkCmd

type IFlytekSparkCmd struct {
	CH                chan string
	User              types.Account
	Sampling          bool
	Text              domain.IFlytekSparkText
	TopK              domain.TopK
	Temperature       domain.Temperature
	RepetitionPenalty domain.RepetitionPenalty
}

iflytekspark

func (*IFlytekSparkCmd) SetDefault

func (cmd *IFlytekSparkCmd) SetDefault()

type IFlytekSparkDTO

type IFlytekSparkDTO struct {
	Reply        string `json:"reply"`
	StreamStatus string `json:"stream_status"`
}

type LLAMA2Cmd

type LLAMA2Cmd struct {
	CH                chan string
	User              types.Account
	History           []domain.History
	Sampling          bool
	Text              domain.LLAMA2Text
	TopK              domain.TopK
	TopP              domain.TopP
	Temperature       domain.Temperature
	RepetitionPenalty domain.RepetitionPenalty
}

llama2

func (*LLAMA2Cmd) SetDefault

func (cmd *LLAMA2Cmd) SetDefault()

type LLAMA2DTO

type LLAMA2DTO struct {
	Reply        string `json:"reply"`
	StreamStatus string `json:"stream_status"`
}

type LuoJiaHFCmd

type LuoJiaHFCmd struct {
	User    userdomain.Account
	Picture io.Reader
}

func (*LuoJiaHFCmd) Validate

func (cmd *LuoJiaHFCmd) Validate() error

type LuoJiaRecordDTO

type LuoJiaRecordDTO struct {
	CreatedAt string `json:"created_at"`
	Id        string `json:"id"`
}

type SkyWorkCmd

type SkyWorkCmd struct {
	CH                chan string
	User              types.Account
	History           []domain.History
	Sampling          bool
	Text              domain.SkyWorkText
	TopK              domain.TopK
	TopP              domain.TopP
	Temperature       domain.Temperature
	RepetitionPenalty domain.RepetitionPenalty
}

skywork 13b

func (*SkyWorkCmd) SetDefault

func (cmd *SkyWorkCmd) SetDefault()

type SkyWorkDTO

type SkyWorkDTO struct {
	Reply        string `json:"reply"`
	StreamStatus string `json:"stream_status"`
}

type VQAHFCmd

type VQAHFCmd struct {
	User    types.Account
	Picture io.Reader
	Ask     string
}

func (*VQAHFCmd) Validate

func (cmd *VQAHFCmd) Validate() error

type WuKongAddDiggCmd

type WuKongAddDiggCmd struct {
	User  types.Account
	Owner types.Account
	Id    string
}

type WuKongAddLikeFromPublicCmd

type WuKongAddLikeFromPublicCmd struct {
	User  types.Account
	Owner types.Account
	Id    string
}

type WuKongAddLikeFromTempCmd

type WuKongAddLikeFromTempCmd struct {
	User    types.Account
	OBSPath domain.OBSPath
}

type WuKongAddPublicFromLikeCmd

type WuKongAddPublicFromLikeCmd struct {
	User types.Account
	Id   string
}

type WuKongAddPublicFromTempCmd

type WuKongAddPublicFromTempCmd = WuKongAddLikeFromTempCmd

type WuKongApiCmd

type WuKongApiCmd struct {
	WuKongCmd

	EndPointType string
	User         types.Account
}

func (*WuKongApiCmd) Validate

func (cmd *WuKongApiCmd) Validate() error

type WuKongCancelDiggCmd

type WuKongCancelDiggCmd WuKongAddDiggCmd

type WuKongCmd

type WuKongCmd struct {
	domain.WuKongPictureMeta

	EsType string
}

func (*WuKongCmd) Validate

func (cmd *WuKongCmd) Validate() error

type WuKongHFCmd

type WuKongHFCmd struct {
	WuKongCmd

	EndPointType string
	User         types.Account
}

func (*WuKongHFCmd) Validate

func (cmd *WuKongHFCmd) Validate() error

type WuKongIsLikeDTO

type WuKongIsLikeDTO struct {
	IsLike bool
	LikeID string
}

type WuKongLikeDTO

type WuKongLikeDTO struct {
	IsPublic bool   `json:"is_public"`
	Avatar   string `json:"avatar"`

	WuKongPictureBaseDTO
}

type WuKongListPublicGlobalCmd

type WuKongListPublicGlobalCmd struct {
	User  types.Account
	Level domain.WuKongPictureLevel
	WuKongPictureListOption
}

func (*WuKongListPublicGlobalCmd) Validate

func (cmd *WuKongListPublicGlobalCmd) Validate() error

type WuKongPictureBaseDTO

type WuKongPictureBaseDTO struct {
	Id        string `json:"id"`
	Owner     string `json:"owner"` // owner of picture
	Desc      string `json:"desc"`
	Style     string `json:"style"`
	Link      string `json:"link"`
	CreatedAt string `json:"created_at"`
}

type WuKongPictureListOption

type WuKongPictureListOption struct {
	CountPerPage int
	PageNum      int
}

type WuKongPicturesListCmd

type WuKongPicturesListCmd = repository.WuKongPictureListOption

type WuKongPublicDTO

type WuKongPublicDTO struct {
	Avatar    string `json:"avatar"`
	IsLike    bool   `json:"is_like"`
	LikeID    string `json:"like_id"`
	IsDigg    bool   `json:"is_digg"`
	DiggCount int    `json:"digg_count"`

	WuKongPictureBaseDTO
}

type WuKongPublicGlobalDTO

type WuKongPublicGlobalDTO struct {
	Pictures []WuKongPublicDTO `json:"pictures"`
	Total    int               `json:"total"`
}

type WuKongRankDTO

type WuKongRankDTO struct {
	Rank int `json:"rank"`
}

Jump to

Keyboard shortcuts

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