Guitar
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
CommitMessageGenerator Class Reference

#include <CommitMessageGenerator.h>

Collaboration diagram for CommitMessageGenerator:
Collaboration graph
[legend]

Classes

class  Result
 

Public Member Functions

 CommitMessageGenerator ()
 
Result generate (std::string const &diff, QString const &hint={})
 Generate a commit message using the given diff. More...
 
void set_ai_model (GenerativeAI::Model model)
 

Static Public Member Functions

static std::string diff_head (GitRunner g)
 
static Result Error (std::string const &status, std::string const &message)
 

Private Member Functions

CommitMessageGenerator::Result parse_response (const std::string &in, GenerativeAI::AI provider)
 Parse the response from the AI model. More...
 
std::string generatePrompt (const std::string &diff, int max)
 Generate a prompt for the given diff. More...
 
std::string generate_prompt_json (const GenerativeAI::Model &model, const std::string &prompt)
 
GenerativeAI::Model ai_model ()
 

Private Attributes

GenerativeAI::Model ai_model_
 

Constructor & Destructor Documentation

◆ CommitMessageGenerator()

CommitMessageGenerator::CommitMessageGenerator ( )
Here is the call graph for this function:

Member Function Documentation

◆ ai_model()

GenerativeAI::Model CommitMessageGenerator::ai_model ( )
private

◆ diff_head()

std::string CommitMessageGenerator::diff_head ( GitRunner  g)
static
Here is the call graph for this function:

◆ Error()

static Result CommitMessageGenerator::Error ( std::string const &  status,
std::string const &  message 
)
inlinestatic

◆ generate()

CommitMessageGenerator::Result CommitMessageGenerator::generate ( std::string const &  diff,
QString const &  hint = {} 
)

Generate a commit message using the given diff.

Parameters
gThe Git object.
Returns
The generated commit message.
Here is the call graph for this function:

◆ generate_prompt_json()

std::string CommitMessageGenerator::generate_prompt_json ( const GenerativeAI::Model model,
const std::string &  prompt 
)
private
Here is the call graph for this function:

◆ generatePrompt()

std::string CommitMessageGenerator::generatePrompt ( const std::string &  diff,
int  max 
)
private

Generate a prompt for the given diff.

Parameters
diffThe diff.
maxThe maximum number of messages to generate.
Returns
The prompt.

◆ parse_response()

CommitMessageGenerator::Result CommitMessageGenerator::parse_response ( const std::string &  in,
GenerativeAI::AI  provider 
)
private

Parse the response from the AI model.

Parameters
inThe response.
ai_typeThe AI model type.
Returns
The generated commit message.
Here is the call graph for this function:

◆ set_ai_model()

void CommitMessageGenerator::set_ai_model ( GenerativeAI::Model  model)

Member Data Documentation

◆ ai_model_

GenerativeAI::Model CommitMessageGenerator::ai_model_
private

The documentation for this class was generated from the following files: