openai

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddGitmoji

func AddGitmoji(message, commitType string) string

AddGitmoji prepends an emoji to the commit message based on commitType.

func BuildPrompt

func BuildPrompt(diff, language, commitType, additionalText string) string

BuildPrompt constructs the prompt sent to OpenAI.

func GetChatCompletion

func GetChatCompletion(ctx context.Context, client *gogpt.Client, prompt string) (string, error)

GetChatCompletion calls the OpenAI API and returns the generated commit message.

func MaybeSummarizeDiff

func MaybeSummarizeDiff(diff string, maxLength int) (string, bool)

MaybeSummarizeDiff truncates the diff if it exceeds maxLength.

func SanitizeOpenAIResponse

func SanitizeOpenAIResponse(msg, commitType string) string

SanitizeOpenAIResponse cleans the AI response.

Types

This section is empty.

Jump to

Keyboard shortcuts

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