ai

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const AttentionPrompt = `` /* 1964-byte string literal not displayed */
View Source
const EveryProjectAnalysisPrompt = `` /* 1927-byte string literal not displayed */
View Source
const ParseUserPromptPrompt = `` /* 2127-byte string literal not displayed */
View Source
const ProjectAnalysisPrompt = `` /* 619-byte string literal not displayed */

Variables

View Source
var PromptExamples = []string{
	"通过历史数据,请用简洁的文字总结%s项目最近一个月的整体表现。",
	"请根据项目%s的构建、部署、测试和发布等数据,分析项目最近一个月的现状,并基于历史数据,分析未来的趋势和潜在问题,并提出改进建议。",
	"根据%s项目最近一个月每周的构建,部署,测试等数据的变化,以此分析该项目最近一段时间的发展趋势,如果存在问题则分析原因并给出合理的解决方案。",
	"通过历史数据,分析%s项目的最大短板是什么?并针对这些短板提供一些解决办法。",
	"分析所有项目%s在最近一个月的整体表现,选出质量和效率最高的一个项目和最差的一个项目,并分析这两个项目产生差距的原因。",
	"从项目质量和效率两个角度分析项目%s最近一个月的情况,并分析这些项目的最近一个月的构建和部署趋势,对比构建趋势分析这些项目发展情况。",
}

PromptExamples great example to display

View Source
var (
	ReturnAnswerWrongFormat = errors.New("AI return wrong answer format")
)

Functions

func AnalyzeProject

func AnalyzeProject(userPrompt string, project *ProjectData, client llm.ILLM, ans *analysisAnswer, wg *sync.WaitGroup, logger *zap.SugaredLogger)

Types

type AIAttentionResp

type AIAttentionResp struct {
	Answer []AttentionAnswer `json:"answer"`
}

func AnalyzeMonthAttention

func AnalyzeMonthAttention(start, end int64, data []*service2.MonthAttention, logger *zap.SugaredLogger) (*AIAttentionResp, error)

type AiAnalysisReq

type AiAnalysisReq struct {
	Prompt      string   `json:"prompt"`
	ProjectList []string `json:"project_list"`
	StartTime   int64    `json:"start_time"`
	EndTime     int64    `json:"end_time"`
}

type AiAnalysisResp

type AiAnalysisResp struct {
	Answer               string `json:"answer"`
	InputData            string `json:"input_data"`
	OverallProjectPrompt string `json:"overall_project_prompt"`
	TokenNum             int    `json:"token_num"`
}

func AnalyzeProjectStats

func AnalyzeProjectStats(args *AiAnalysisReq, logger *zap.SugaredLogger) (*AiAnalysisResp, error)

type AiReqData

type AiReqData struct {
	StartTime   int64          `json:"start_time"`
	EndTime     int64          `json:"end_time"`
	ProjectList []*ProjectData `json:"project_list"`
}

func GetStatsAnalysisData

func GetStatsAnalysisData(args *UserPromptParseInput, logger *zap.SugaredLogger) (*AiReqData, error)

type Answer2input

type Answer2input struct {
	ProjectName            string `json:"project_name"`
	ProjectDataStartTime   int64  `json:"project_data_start_time"`
	ProjectDataEndTime     int64  `json:"project_data_end_time"`
	AIAnalyzeProjectResult string `json:"ai_analyze_project_result"`
}

type AttentionAnswer

type AttentionAnswer struct {
	Project      string `json:"project"`
	Result       string `json:"result"`
	Name         string `json:"name"`
	CurrentMonth string `json:"current_month"`
	LastMonth    string `json:"last_month"`
}

type BuildData

type BuildData struct {
	Description string        `json:"data_description"`
	Details     *BuildDetails `json:"data_details"`
}

type BuildDetail

type BuildDetail struct {
	Description string `json:"data_description"`
	Details     string `json:"details"`
}

type BuildDetails

type BuildDetails struct {
	BuildTotal            int          `json:"build_total"`
	BuildSuccessTotal     int          `json:"build_success_total"`
	BuildFailureTotal     int          `json:"build_failure_total"`
	BuildTotalDuration    int64        `json:"build_total_duration"`
	BuildTrendData        *BuildDetail `json:"build_weekly_trend_data"`
	BuildDailyMeasureData *BuildDetail `json:"build_daily_measure_data"`
}

type DataDetail

type DataDetail struct {
	BuildInfo   *BuildData   `json:"build_info"`
	DeployInfo  *DeployData  `json:"deploy_info"`
	TestInfo    *TestData    `json:"test_info"`
	ReleaseInfo *ReleaseData `json:"release_info"`
}

type DeployData

type DeployData struct {
	Description string         `json:"description"`
	Details     *DeployDetails `json:"deploy_details"`
}

type DeployDetail

type DeployDetail struct {
	Description string `json:"description"`
	Details     string `json:"details"`
}

type DeployDetails

type DeployDetails struct {
	DeployTotal                     int           `json:"deploy_total"`
	DeploySuccessTotal              int           `json:"deploy_success_total"`
	DeployFailureTotal              int           `json:"deploy_failure_total"`
	DeployTotalDuration             int64         `json:"deploy_total_duration"`
	DeployHealthMeasureData         *DeployDetail `json:"deploy_health_measure_data"`
	DeployWeeklyMeasureData         *DeployDetail `json:"deploy_weekly_measure_data"`
	DeployTopFiveHigherMeasureData  *DeployDetail `json:"deploy_top_five_higher_measure_data"`
	DeployTopFiveFailureMeasureData *DeployDetail `json:"deploy_top_five_failure_measure_data"`
}

type ExamplePrompt

type ExamplePrompt struct {
	Prompts []string `json:"prompts"`
}

func GetAiPrompts

func GetAiPrompts(logger *zap.SugaredLogger) (*ExamplePrompt, error)

GetAiPrompts TODO: need to optimize,consider that whether to save prompt examples in db

type ProjectData

type ProjectData struct {
	ProjectName                    string      `json:"project_name"`
	ProjectDataDetail              *DataDetail `json:"project_data_detail"`
	SystemInternalEvaluationResult string      `json:"system_internal_evaluation_result"`
}

type ReleaseData

type ReleaseData struct {
	Description string          `json:"data_description"`
	Details     *ReleaseDetails `json:"data_details"`
}

type ReleaseDetails

type ReleaseDetails struct {
	ReleaseTotal         int   `json:"release_total"`
	ReleaseSuccessTotal  int   `json:"release_success_total"`
	ReleaseFailureTotal  int   `json:"release_failure_total"`
	ReleaseTotalDuration int64 `json:"release_total_duration"`
}

type SystemEvaluation

type SystemEvaluation struct {
	ProjectName      string `json:"project_name"`
	EvaluationResult string `json:"evaluation_result"`
	Description      string `json:"data_description"`
}

type TestData

type TestData struct {
	Description string       `json:"description"`
	Details     *TestDetails `json:"test_details"`
}

type TestDetail

type TestDetail struct {
	Description string `json:"data_description"`
	Details     string `json:"data_details"`
}

type TestDetails

type TestDetails struct {
	TestTotal              int         `json:"test_total"`
	TestPass               int         `json:"test_pass_total"`
	TestFail               int         `json:"test_fail_total"`
	TestTotalDuration      int64       `json:"test_total_duration"`
	TestWeeklyTrendData    *TestDetail `json:"test_weekly_trend_data"`
	TestDailyMeasureData   *TestDetail `json:"test_daily_measure_data"`
	TestHealthMeasureData  *TestDetail `json:"test_health_measure_data"`
	TestCaseMeasureData    *TestDetail `json:"test_case_measure_data"`
	TestAverageMeasureData *TestDetail `json:"test_average_measure_data"`
	TestDeliveryDeployData *TestDetail `json:"test_delivery_deploy_data"`
}

type UserPromptParseInput

type UserPromptParseInput struct {
	ProjectList []string `json:"project_list"`
	JobList     []string `json:"job_list"`
	StartTime   int64    `json:"start_time"`
	EndTime     int64    `json:"end_time"`
}

UserPromptParseInput use to parse user prompt

type UserPromptTimeParseResult

type UserPromptTimeParseResult struct {
	Prompt      string   `json:"prompt"`
	ErrMessage  string   `json:"err_message"`
	ParseResult []string `json:"parse_result"`
}

Jump to

Keyboard shortcuts

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