ai

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatIssuesForPrompt

func FormatIssuesForPrompt(issues []models.Issue, locale string) string

FormatIssuesForPrompt formats the issue list to be included in the prompt

func FormatTemplateForPrompt

func FormatTemplateForPrompt(template *models.IssueTemplate, lang string, templateType string) string

FormatTemplateForPrompt formats a template for inclusion in an AI prompt. It handles both Issue and PR templates with proper language support.

func GetCommitPromptTemplate

func GetCommitPromptTemplate(lang string, hasTicket bool) string

GetCommitPromptTemplate returns the commit template based on language and whether there is a ticket

func GetIssuePromptTemplate

func GetIssuePromptTemplate(lang string) string

GetIssuePromptTemplate returns the appropriate issue generation template based on language

func GetIssueReferenceInstructions

func GetIssueReferenceInstructions(lang string) string

GetIssueReferenceInstructions returns issue reference instructions based on the language

func GetNoIssueReferenceInstruction

func GetNoIssueReferenceInstruction(locale string) string

func GetPRIssueContextInstructions

func GetPRIssueContextInstructions(locale string) string

GetPRIssueContextInstructions returns issue context instructions for PRs

func GetPRPromptTemplate

func GetPRPromptTemplate(lang string) string

GetPRPromptTemplate returns the appropriate template based on the language

func GetPRTemplateInstructions

func GetPRTemplateInstructions(lang string) string

GetPRTemplateInstructions returns PR template instructions based on the language

func GetReleaseNotesSectionHeaders

func GetReleaseNotesSectionHeaders(locale string) map[string]string

func GetReleasePromptTemplate

func GetReleasePromptTemplate(lang string) string

GetReleasePromptTemplate returns the release template based on the language

func GetTechnicalAnalysisInstruction

func GetTechnicalAnalysisInstruction(locale string) string

func GetTemplateInstructions

func GetTemplateInstructions(lang string) string

GetTemplateInstructions returns template instructions based on the language

func RenderPrompt

func RenderPrompt(name, tmplStr string, data interface{}) (string, error)

RenderPrompt renders a prompt template with the provided data

Types

type ConfirmationCallback

type ConfirmationCallback func(result ConfirmationResult) (choice string, proceed bool)

type ConfirmationResult

type ConfirmationResult struct {
	EstimatedCost  float64
	InputTokens    int
	OutputTokens   int
	SuggestedModel string
	CurrentModel   string
	RationaleKey   string
}

type CostAwareWrapper

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

func NewCostAwareWrapper

func NewCostAwareWrapper(cfg WrapperConfig) (*CostAwareWrapper, error)

NewCostAwareWrapper creates a provider-agnostic wrapper

func (*CostAwareWrapper) SetSkipConfirmation

func (w *CostAwareWrapper) SetSkipConfirmation(skip bool)

SetSkipConfirmation allows enabling or disabling manual user confirmation.

func (*CostAwareWrapper) WrapGenerate

func (w *CostAwareWrapper) WrapGenerate(
	ctx context.Context,
	command string,
	prompt string,
	generateFn GenerateFunc,
) (interface{}, *models.TokenUsage, error)

WrapGenerate wraps any generation function with tracking

type GenerateFunc

type GenerateFunc func(ctx context.Context, model string, prompt string) (interface{}, *models.TokenUsage, error)

type PromptData

type PromptData struct {
	Count           int
	Files           string
	Diff            string
	Ticket          string
	History         string
	Instructions    string
	IssueNumber     int
	RelatedIssues   string
	IssueInfo       string
	RepoOwner       string
	RepoName        string
	PreviousVersion string
	CurrentVersion  string
	LatestVersion   string
	ReleaseDate     string
	Changelog       string
	PRContent       string
	TechnicalInfo   string
}

PromptData holds the parameters for template rendering

type WrapperConfig

type WrapperConfig struct {
	Provider              ports.CostAwareAIProvider
	BudgetDaily           float64
	EstimatedOutputTokens int
	SkipConfirmation      bool
	OnConfirmation        ConfirmationCallback
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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