ai_api

package
v1.9.3-beta Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	ID               string
	Name             string
	Service          string
	Path             string
	Description      string
	Timeout          int
	Retry            int
	Model            string
	Provider         string
	CreateAt         time.Time
	UpdateAt         time.Time
	UseToken         int
	Creator          string
	Updater          string
	Type             int
	AdditionalConfig map[string]interface{}
	Disable          bool
}

func FromEntity

func FromEntity(e *api.AiAPIInfo) *API

type APIUse

type APIUse struct {
	API         string
	InputToken  int
	OutputToken int
	TotalToken  int
}

type Create

type Create struct {
	ID               string
	Name             string
	Service          string
	Path             string
	Description      string
	Timeout          int
	Retry            int
	Model            string
	Provider         string
	AdditionalConfig map[string]interface{}
	Type             int
	Disable          bool
}

type Edit

type Edit struct {
	Name             *string
	Path             *string
	Description      *string
	Timeout          *int
	Retry            *int
	Provider         *string
	Model            *string
	Disable          *bool
	UseToken         *int
	Type             *int
	AdditionalConfig *map[string]interface{}
}

type IAPIService

type IAPIService interface {
	universally.IServiceGet[API]
	universally.IServiceCreate[Create]
	universally.IServiceEdit[Edit]
	universally.IServiceDelete
	CountMapByProvider(ctx context.Context, keyword string, conditions map[string]interface{}) (map[string]int64, error)
	CountMapByModel(ctx context.Context, keyword string, conditions map[string]interface{}) (map[string]int64, error)
	CountByModel(ctx context.Context, model string) (int64, error)
	CountByProvider(ctx context.Context, provider string) (int64, error)
	UpdateAIProvider(ctx context.Context, providerId string, ids ...string) error
	DeleteByService(ctx context.Context, serviceId string) error
}

type IAPIUseService

type IAPIUseService interface {
	SumByApis(ctx context.Context, providerId string, start, end int64, apiIds ...string) ([]*APIUse, error)
	SumByApisPage(ctx context.Context, providerId string, start, end int64, page, pageSize int, order string, apiIds ...string) ([]*APIUse, int64, error)
	Incr(ctx context.Context, incr *IncrAPIUse) error
}

type IncrAPIUse

type IncrAPIUse struct {
	API         string
	Service     string
	Provider    string
	Model       string
	Day         int64
	Hour        int64
	Minute      int64
	InputToken  int
	OutputToken int
	TotalToken  int
}

Jump to

Keyboard shortcuts

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