You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Generates a commit message based on the provided options and the OpenAI API.
18
38
/// </summary>
19
39
/// <param name="options">An instance of <see cref="GenerateCommitMessageOptions"/> containing the branch name, original message, and git diff.</param>
20
40
/// <returns>A string containing the generated commit message from the OpenAI API.</returns>
21
41
/// <remarks>
22
-
/// This method retrieves the OpenAI API URL and API key from the environment variables. If the URL is not set, it defaults to "https://api.openai.com/v1".
23
-
/// If the API key is not provided, it returns a message prompting the user to set the <c>OPENAI_API_KEY</c> environment variable.
24
-
/// It constructs a message that includes the branch name, original commit message, and git diff, which is then sent to the OpenAI API using a chat client.
25
-
/// If debugging is enabled, it serializes the chat completion response to JSON and writes it to a file named "debug.json".
26
-
/// Finally, it returns the generated commit message from the chat completion response.
42
+
/// This method retrieves API details (URL and key) from environment variables, constructs a message including the branch name,
43
+
/// original commit message, and git diff, and sends it to the OpenAI API for processing. It also handles debugging, saving
44
+
/// API responses to a JSON file if debugging is enabled. If the commit message is a merge conflict resolution, it is returned as-is.
27
45
/// </remarks>
46
+
/// <exception cref="InvalidOperationException">Thrown if both the branch and diff are empty, as meaningful commit generation is not possible.</exception>
0 commit comments