service

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInsufficientCredit = ai.ErrInsufficientCredit

Functions

This section is empty.

Types

type CaseSetService added in v0.2.1

type CaseSetService interface {
	Save(ctx context.Context, set domain.CaseSet) (int64, error)
	UpdateCases(ctx context.Context, set domain.CaseSet) error
	List(ctx context.Context, offset, limit int) ([]domain.CaseSet, int64, error)
	Detail(ctx context.Context, id int64) (domain.CaseSet, error)
	GetByIds(ctx context.Context, ids []int64) ([]domain.CaseSet, error)
	// GetByIdsWithCases 会查询关联的 Case,但是目前只是发返回了 ID
	GetByIdsWithCases(ctx context.Context, ids []int64) ([]domain.CaseSet, error)

	ListByBiz(ctx context.Context, offset, limit int, biz string) ([]domain.CaseSet, error)
	ListDefault(ctx context.Context, offset, limit int) ([]domain.CaseSet, error)
	GetByBiz(ctx context.Context, biz string, bizId int64) (domain.CaseSet, error)
	GetCandidates(ctx context.Context, id int64, offset int, limit int) ([]domain.Case, int64, error)
}

func NewCaseSetService added in v0.2.1

type ExamineService added in v0.2.1

type ExamineService interface {
	// Examine 测试服务
	// input 是用户输入的内容
	Examine(ctx context.Context, uid, cid int64, input string) (domain.ExamineCaseResult, error)
	GetResult(ctx context.Context, uid, cid int64) (domain.CaseResult, error)
	GetResults(ctx context.Context, uid int64, ids []int64) (map[int64]domain.ExamineCaseResult, error)
}

ExamineService 测试服务

func NewLLMExamineService added in v0.2.1

func NewLLMExamineService(
	caseRepo repository.CaseRepo,
	repo repository.ExamineRepository,
	aiSvc ai.LLMService,
) ExamineService

type LLMExamineService added in v0.2.1

type LLMExamineService struct {
	// contains filtered or unexported fields
}

LLMExamineService 使用 LLM 进行评价的测试服务

func (*LLMExamineService) Examine added in v0.2.1

func (svc *LLMExamineService) Examine(ctx context.Context,
	uid int64,
	cid int64, input string) (domain.ExamineCaseResult, error)

func (*LLMExamineService) GetResult added in v0.3.0

func (svc *LLMExamineService) GetResult(ctx context.Context, uid, qid int64) (domain.CaseResult, error)

func (*LLMExamineService) GetResults added in v0.2.1

func (svc *LLMExamineService) GetResults(ctx context.Context, uid int64, ids []int64) (map[int64]domain.ExamineCaseResult, error)

type Service

type Service interface {
	// Save 保存数据,case 绝对不会为 nil
	Save(ctx context.Context, ca domain.Case) (int64, error)
	Publish(ctx context.Context, ca domain.Case) (int64, error)
	List(ctx context.Context, offset int, limit int) ([]domain.Case, int64, error)

	PubList(ctx context.Context, offset int, limit int) ([]domain.Case, error)
	GetPubByIDs(ctx context.Context, ids []int64) ([]domain.Case, error)
	Detail(ctx context.Context, caseId int64) (domain.Case, error)
	PubDetail(ctx context.Context, caseId int64) (domain.Case, error)
}

func NewService

func NewService(repo repository.CaseRepo,
	intrProducer event.InteractiveEventProducer,
	producer event.SyncEventProducer) Service

Jump to

Keyboard shortcuts

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