#include <CommitMessageGenerator.h>
◆ CommitMessageGenerator()
< システムロールの内容(OpenAI Chat Completions 形式で使用)
◆ accept_file_diff()
| bool CommitMessageGenerator::accept_file_diff |
( |
const std::string & |
filename, |
|
|
const std::string & |
mimetype |
|
) |
| |
|
static |
ファイルのdiffをAIに送るべきか判定する。
画像やバイナリ、PDFなどは行単位のdiffが意味をなさないため除外する。 Qtの翻訳ファイル(*.ts)も行番号変化が多く差分がノイズになるため除外する。
- Parameters
-
| filename | ファイル名 |
| mimetype | ファイルのMIMEタイプ |
- Returns
- diff対象に含めるべきならtrue、そうでなければfalse
◆ generatePrompt()
| std::string CommitMessageGenerator::generatePrompt |
( |
| ) |
const |
diffからAIへ送るプロンプト文字列を生成する。
AIにJSONフォーマット({"messages": [...]})で返すよう指示する。
- Parameters
-
| diff | コミット対象のdiff文字列 |
| max | 生成するコミットメッセージ候補の最大数 |
- Returns
- AIに送るプロンプト文字列
◆ make_diff()
| std::string CommitMessageGenerator::make_diff |
( |
const std::string & |
gitcommand, |
|
|
const std::string & |
dir, |
|
|
CommitPair const & |
commits |
|
) |
| |
|
static |
コミット差分を取得する。
コマンドラインの git を呼び出して diff を取得する内部実装。GitRunner を引数に取らないオーバーロード。
- Parameters
-
| gitcommand | gitコマンドのパス(例: "/usr/bin/git" または "C:\\Program Files\\Git\\bin\\git.exe") |
| dir | gitコマンドを実行するディレクトリ(例: リポジトリのルートディレクトリ) |
| id_a | 比較対象のコミットID(例: "HEAD") |
| id_b | 比較対象のコミットID(例: "" なら作業ツリーとの差分) |
- Returns
- 連結されたdiff文字列
◆ parse_response()
| CommitMessageGenerator::CommitMessageGenerator::Result CommitMessageGenerator::parse_response |
( |
GenerativeAI::Model |
model, |
|
|
const AiResult & |
result |
|
) |
| |
|
static |
AIレスポンスのJSON文字列を解析してコミットメッセージ候補を取り出す。
- Parameters
-
| in | AIから返ってきたレスポンス文字列(JSON) |
| provider | 使用したAIプロバイダー |
- Returns
- コミットメッセージ候補のリスト、またはエラー情報
◆ request()
| AiResult CommitMessageGenerator::request |
( |
| ) |
|
|
inline |
◆ set_ai_model()
◆ api_
◆ max_diff_size
| constexpr static int CommitMessageGenerator::max_diff_size = 200000 |
|
staticconstexpr |
◆ request_
The documentation for this class was generated from the following files: