code

package
v0.0.0-...-e487a75 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderClaude = "claude"
	ProviderGemini = "gemini"
)

Variables

This section is empty.

Functions

func FormatHistoricalComments

func FormatHistoricalComments(allComments *models.PRAllComments, currentCommentID int64) string

FormatHistoricalComments 格式化历史评论,用于构建上下文(通用版本)

func ParseStructuredOutput

func ParseStructuredOutput(output string) (summary, changes, testPlan string)

ParseStructuredOutput 解析AI的三段式输出(通用版本)

Types

type Code

type Code interface {
	Prompt(message string) (*Response, error)
	Close() error
}

func New

func New(workspace *models.Workspace, cfg *config.Config) (Code, error)

func NewClaudeDocker

func NewClaudeDocker(workspace *models.Workspace, cfg *config.Config) (Code, error)

func NewClaudeInteractive

func NewClaudeInteractive(workspace *models.Workspace, cfg *config.Config) (Code, error)

func NewClaudeLocal

func NewClaudeLocal(workspace *models.Workspace, cfg *config.Config) (Code, error)

NewClaudeLocal 创建本地 Claude CLI 实现

func NewGeminiDocker

func NewGeminiDocker(workspace *models.Workspace, cfg *config.Config) (Code, error)

NewGeminiDocker 创建 Docker Gemini CLI 实现

func NewGeminiLocal

func NewGeminiLocal(workspace *models.Workspace, cfg *config.Config) (Code, error)

NewGeminiLocal 创建本地 Gemini CLI 实现

type InteractiveResponseReader

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

InteractiveResponseReader 处理交互式响应读取

func (*InteractiveResponseReader) Read

func (r *InteractiveResponseReader) Read(p []byte) (n int, err error)

type InteractiveSession

type InteractiveSession struct {
	ID            string
	CreatedAt     time.Time
	LastActivity  time.Time
	MessageCount  int
	WorkspacePath string
}

InteractiveSession 管理交互式会话

type Response

type Response struct {
	Out io.Reader
}

func PromptWithRetry

func PromptWithRetry(ctx context.Context, code Code, prompt string, maxRetries int) (*Response, error)

PromptWithRetry 带重试机制的 prompt 调用(通用版本)

type SessionManager

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

func NewSessionManager

func NewSessionManager(cfg *config.Config) *SessionManager

func (*SessionManager) CloseSession

func (sm *SessionManager) CloseSession(workspace *models.Workspace) error

CloseSession closes and removes a Code session from the manager.

func (*SessionManager) GetSession

func (sm *SessionManager) GetSession(workspace *models.Workspace) (Code, error)

GetSession retrieves an existing Code session or creates a new one.

Jump to

Keyboard shortcuts

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