ai

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderOpenAI   = "openai"
	ProviderGemini   = "gemini"
	ProviderDeepSeek = "deepseek"

	DefaultProvider = ProviderGemini
)

Variables

This section is empty.

Functions

func DefaultBaseURL

func DefaultBaseURL(provider string) string

DefaultBaseURL returns the default OpenAI-compatible endpoint for a provider.

func DefaultModelName

func DefaultModelName(provider string) string

DefaultModelName returns the default text model for a provider.

func IsCustomPrompt

func IsCustomPrompt(promptType PromptType) bool

IsCustomPrompt 检查是否为自定义提示词(文件路径)

func LoadCustomPrompt

func LoadCustomPrompt(filePath, language string) (string, error)

LoadCustomPrompt 加载自定义提示词文件

Types

type Client

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

Client wraps an OpenAI-compatible chat completion client.

func NewClient

func NewClient(cfg ClientConfig) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) GenerateReport

func (c *Client) GenerateReport(commits []git.CommitInfo, fromDate, toDate time.Time) (string, error)

func (*Client) GenerateReportWithPrompt

func (c *Client) GenerateReportWithPrompt(commits []git.CommitInfo, fromDate, toDate time.Time, promptType PromptType) (string, error)

func (*Client) SummarizeCommits

func (c *Client) SummarizeCommits(commits []git.CommitInfo) (string, error)

func (*Client) SummarizeCommitsWithPrompt

func (c *Client) SummarizeCommitsWithPrompt(commits []git.CommitInfo, promptType PromptType) (string, error)

type ClientConfig

type ClientConfig struct {
	Provider string
	BaseURL  string
	APIKey   string
	Model    string
	Language string
}

ClientConfig is the provider-neutral runtime config for the AI client.

func NormalizeClientConfig

func NormalizeClientConfig(cfg ClientConfig, lookup func(string) string) (ClientConfig, error)

NormalizeClientConfig applies provider defaults and resolves env fallback values.

type PromptType

type PromptType string

PromptType 表示不同类型的提示词

const (
	// BasicPrompt 基础提示词:核心摘要
	BasicPrompt PromptType = "basic"
	// ManagerUpdatePrompt 向上汇报提示词:强调进展、价值、风险和下一步
	ManagerUpdatePrompt PromptType = "manager-update"
	// SelfReviewPrompt 自我复盘提示词:强调产出、经验和后续改进
	SelfReviewPrompt PromptType = "self-review"
	// DetailedPrompt 中级提示词:详细且结构化的报告
	DetailedPrompt PromptType = "detailed"
	// ReleaseNotesPrompt 发布说明提示词:强调新增、修复和改进
	ReleaseNotesPrompt PromptType = "release-notes"
)

func GetPromptTypeFromString

func GetPromptTypeFromString(promptTypeStr string) PromptType

GetPromptTypeFromString 根据字符串返回对应的提示词类型

Jump to

Keyboard shortcuts

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