service

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInsufficientCredit = ai.ErrInsufficientCredit

Functions

This section is empty.

Types

type ExamineService added in v0.1.8

type ExamineService interface {
	// Examine 测试服务
	// input 是用户输入的内容
	Examine(ctx context.Context, uid, qid int64, input string) (domain.ExamineResult, error)
	QuestionResult(ctx context.Context, uid, qid int64) (domain.Result, error)
	GetResults(ctx context.Context, uid int64, ids []int64) (map[int64]domain.ExamineResult, error)
	Correct(ctx context.Context, uid int64, qid int64, questionResult domain.Result) error
}

ExamineService 测试服务

func NewLLMExamineService added in v0.1.8

func NewLLMExamineService(
	queRepo repository.Repository,
	repo repository.ExamineRepository,
	aiSvc ai.LLMService,
) ExamineService

type LLMExamineService added in v0.1.8

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

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

func (*LLMExamineService) Correct added in v0.3.0

func (svc *LLMExamineService) Correct(ctx context.Context, uid int64,
	qid int64, questionResult domain.Result) error

func (*LLMExamineService) Examine added in v0.1.8

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

Examine 的执行步骤: - 先抽取关键点 - 比较候选人遗漏的关键点 - 根据关键点评分 因此总体上要调用 AI 两次

func (*LLMExamineService) GetResults added in v0.1.8

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

func (*LLMExamineService) QuestionResult added in v0.1.8

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

type QuestionKnowledgeBase added in v0.3.3

type QuestionKnowledgeBase interface {
	FullSync()
}

func NewQuestionKnowledgeBase added in v0.3.3

func NewQuestionKnowledgeBase(knowledgeBaseId string, queRepo repository.Repository, knowledgeBaseSvc ai.KnowledgeBaseService) QuestionKnowledgeBase

type QuestionSetService

type QuestionSetService interface {
	Save(ctx context.Context, set domain.QuestionSet) (int64, error)
	UpdateQuestions(ctx context.Context, set domain.QuestionSet) error
	List(ctx context.Context, offset, limit int) ([]domain.QuestionSet, int64, error)
	ListDefault(ctx context.Context, offset, limit int) ([]domain.QuestionSet, int64, error)
	Detail(ctx context.Context, id int64) (domain.QuestionSet, error)
	GetByIds(ctx context.Context, ids []int64) ([]domain.QuestionSet, error)
	DetailByBiz(ctx context.Context, biz string, bizId int64) (domain.QuestionSet, error)
	GetCandidates(ctx context.Context, id int64, offset int, limit int) ([]domain.Question, int64, error)
	GetByIDsWithQuestion(ctx context.Context, ids []int64) ([]domain.QuestionSet, error)

	PubDetail(ctx context.Context, id int64) (domain.QuestionSet, error)
}

QuestionSetService 还没有分离制作库和线上库

type Service

type Service interface {
	// Save 保存数据,question 绝对不会为 nil
	Save(ctx context.Context, question *domain.Question) (int64, error)
	Publish(ctx context.Context, que *domain.Question) (int64, error)
	List(ctx context.Context, offset int, limit int) ([]domain.Question, int64, error)
	Detail(ctx context.Context, qid int64) (domain.Question, error)
	// Delete 会直接删除制作库和线上库的数据
	Delete(ctx context.Context, qid int64) error

	// PubList 只会返回八股文的数据
	PubList(ctx context.Context, offset int, limit int) (int64, []domain.Question, error)
	// GetPubByIDs 目前只会获取基础信息,也就是不包括答案在内的信息
	GetPubByIDs(ctx context.Context, ids []int64) ([]domain.Question, error)
	PubDetail(ctx context.Context, qid int64) (domain.Question, error)
}

Service TODO 要分离制作库接口和线上库接口

Jump to

Keyboard shortcuts

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