Take a deep breath and work on this problem step-by-step. Summarize the provided diff into a clear and concise written commit message. Use the imperative style for the subject, use the imperative style for the body, and limit the subject types to 50 characters or less. Optionally, use a scope, and limit the scope types to 50 characters or less. Be as descriptive as possible, but keep it to a single line. Return a single code block. Ready to be pasted into commit edits without further editing.
The commit message should be in the following format and should be lowercase:

<type>(<scope?>): <subject>



Diff:
diff --git a/main.py b/main.py
index 4d7085f..be71ff6 100644
--- a/main.py
+++ b/main.py
@@ -13,6 +13,7 @@ from rich.console import Console
 from rich.table import Table
 import difflib
 import re
+import subprocess
 
 
 MODEL = "gpt-o1-preview" # Models: gpt-o1-preview, gpt-o1-mini, gpt-4o-turbo, gpt-4o-mini, gpt-4o
@@ -28,8 +29,7 @@ When given a user request, perform the following steps:
 
 IMPORTANT: Your response must ONLY contain the code blocks with no additional text before or after. Do not use markdown formatting outside of the code blocks. Use the following format for the special comment line. Do not include any explanations, additional text:
 
-For folders:
-```
+For folders:```
 ### FOLDER: path/to/folder
 ```
 
@@ -138,6 +138,13 @@ NEVER ADD ANY CODE BLOCK MARKER AT THE BEGINNING OF THE FILE OR AT THE END OF TH
 
 PLANNING_PROMPT = """You are an AI planning assistant. Your task is to create a detailed plan based on the user's request. Consider all aspects of the task, break it down into steps, and provide a comprehensive strategy for accomplishment. Your plan should be clear, actionable, and thorough."""
 
+COMMIT_PROMPT = """
+Take a deep breath and work on this problem step-by-step. Summarize the provided diff into a clear and concise written commit message. Use the imperative style for the subject, use the imperative style for the body, and limit the subject types to 50 characters or less. Optionally, use a scope, and limit the scope types to 50 characters or less. Be as descriptive as possible, but keep it to a single line. Return a single code block. Ready to be pasted into commit edits without further editing.
+The commit message should be in the following format and should be lowercase:
+
+<type>(<scope?>): <subject>
+
+"""
 
 last_ai_response = None
 conversation_history = []
@@ -398,7 +405,7 @@ def apply_edit_instructions(edit_instructions, original_files):
             modified_files[file_path] = content  # No changes for this file
     return modified_files
 
-def chat_with_ai(user_message, is_edit_request=False, retry_count=0, added_files=None):
+def chat_with_ai(user_message, is_edit_request=False, retry_count=0, added_files=None, is_commit_request=False):
     global last_ai_response, conversation_history
     try:
         # Include added file contents and conversation history in the user message
@@ -429,7 +436,7 @@ def chat_with_ai(user_message, is_edit_request=False, retry_count=0, added_files
             logging.info("Sending general query to AI.")
 
         response = requests.post("http://88.214.24.11:6969/api/chat/completions", json={
-            "model": MODEL,
+            "model": MODEL if not is_commit_request else "gpt-4o-turbo",
             "prompt": message_content,
         })
 
@@ -464,6 +471,7 @@ def main():
     print(f"{colored('/reset', 'magenta'):<10} {colored('Reset chat context and clear added files', 'dark_grey')}")
     print(f"{colored('/review', 'magenta'):<10} {colored('Review code files (followed by file paths)', 'dark_grey')}")
     print(f"{colored('/planning', 'magenta'):<10} {colored('Generate a detailed plan based on your request', 'dark_grey')}")
+    print(f"{colored('/commit', 'magenta'):<10} {colored('Generate a commit message based on current changes', 'dark_grey')}")
     print(f"{colored('/quit', 'magenta'):<10} {colored('Exit the program', 'dark_grey')}")
 
     style = Style.from_dict({
@@ -475,7 +483,7 @@ def main():
 
     # Create a WordCompleter with available commands and files
     completer = WordCompleter(
-        ['/edit', '/create', '/add', '/quit', '/debug', '/reset', '/review', '/planning'] + files,
+        ['/edit', '/create', '/add', '/commit', '/quit', '/debug', '/reset', '/review', '/planning'] + files,
         ignore_case=True
     )
 
@@ -663,6 +671,28 @@ Files to modify:
                 print(colored("Failed to generate a planning response. Please try again.", "red"))
                 logging.error("AI failed to generate a planning response.")
 
+        elif user_input.lower() == '/commit':
+            try:
+                diff = subprocess.check_output(['git', 'diff'], encoding='utf-8')
+                if not diff.strip():
+                    print(colored("No changes detected to commit.", "green"))
+                    logging.info("No changes detected for commit.")
+                else:
+                    # Prepare the AI prompt using COMMIT_PROMPT
+                    commit_request = f"{COMMIT_PROMPT}\n\nDiff:\n{diff}"
+                    ai_response = chat_with_ai(commit_request, is_edit_request=False)
+                    if ai_response:
+                        print()
+                        print(colored("Suggested Commit Message:", "blue"))
+                        rprint(Markdown(ai_response))
+                        logging.info("Provided commit message to user.")
+                    else:
+                        print(colored("Failed to generate a commit message. Please try again.", "red"))
+                        logging.error("AI failed to generate commit message.")
+            except Exception as e:
+                print(colored(f"An error occurred while retrieving Git diff: {e}", "red"))
+                logging.error(f"Error retrieving Git diff: {e}")
+
         else:
             ai_response = chat_with_ai(user_input, added_files=added_files)
             if ai_response:
@@ -675,4 +705,6 @@ Files to modify:
 
 
 if __name__ == "__main__":
-    main()
\ No newline at end of file
+    main()
+
+
diff --git a/test.py b/test.py
index 20732ca..de2f973 100644
--- a/test.py
+++ b/test.py
@@ -24,4 +24,11 @@ if __name__ == "__main__":
     if diff:
         print(diff)
     else:
-        print("No changes detected or unable to retrieve git diff.")
\ No newline at end of file
+        print("No changes detected or unable to retrieve git diff.")
+
+# This script does nothing different from running 'git diff' in the command line.
+# It simply wraps the 'git diff' command in a Python script, which doesn't provide
+# any additional functionality beyond what 'git diff' already offers.
+# The file_context_0 shows multiple 'git diff' commands, suggesting that running
+# this script is equivalent to manually executing 'git diff' in the terminal.
+help
\ No newline at end of file

PROMPT: 
Take a deep breath and work on this problem step-by-step. Summarize the provided diff into a clear and concise written commit message. Use the imperative style for the subject, use the imperative style for the body, and limit the subject types to 50 characters or less. Optionally, use a scope, and limit the scope types to 50 characters or less. Be as descriptive as possible, but keep it to a single line. Return a single code block. Ready to be pasted into commit edits without further editing.
The commit message should be in the following format and should be lowercase:

<type>(<scope?>): <subject>



Diff:
diff --git a/main.py b/main.py
index 4d7085f..be71ff6 100644
--- a/main.py
+++ b/main.py
@@ -13,6 +13,7 @@ from rich.console import Console
 from rich.table import Table
 import difflib
 import re
+import subprocess
 
 
 MODEL = "gpt-o1-preview" # Models: gpt-o1-preview, gpt-o1-mini, gpt-4o-turbo, gpt-4o-mini, gpt-4o
@@ -28,8 +29,7 @@ When given a user request, perform the following steps:
 
 IMPORTANT: Your response must ONLY contain the code blocks with no additional text before or after. Do not use markdown formatting outside of the code blocks. Use the following format for the special comment line. Do not include any explanations, additional text:
 
-For folders:
-```
+For folders:```
 ### FOLDER: path/to/folder
 ```
 
@@ -138,6 +138,13 @@ NEVER ADD ANY CODE BLOCK MARKER AT THE BEGINNING OF THE FILE OR AT THE END OF TH
 
 PLANNING_PROMPT = """You are an AI planning assistant. Your task is to create a detailed plan based on the user's request. Consider all aspects of the task, break it down into steps, and provide a comprehensive strategy for accomplishment. Your plan should be clear, actionable, and thorough."""
 
+COMMIT_PROMPT = """
+Take a deep breath and work on this problem step-by-step. Summarize the provided diff into a clear and concise written commit message. Use the imperative style for the subject, use the imperative style for the body, and limit the subject types to 50 characters or less. Optionally, use a scope, and limit the scope types to 50 characters or less. Be as descriptive as possible, but keep it to a single line. Return a single code block. Ready to be pasted into commit edits without further editing.
+The commit message should be in the following format and should be lowercase:
+
+<type>(<scope?>): <subject>
+
+"""
 
 last_ai_response = None
 conversation_history = []
@@ -398,7 +405,7 @@ def apply_edit_instructions(edit_instructions, original_files):
             modified_files[file_path] = content  # No changes for this file
     return modified_files
 
-def chat_with_ai(user_message, is_edit_request=False, retry_count=0, added_files=None):
+def chat_with_ai(user_message, is_edit_request=False, retry_count=0, added_files=None, is_commit_request=False):
     global last_ai_response, conversation_history
     try:
         # Include added file contents and conversation history in the user message
@@ -429,7 +436,7 @@ def chat_with_ai(user_message, is_edit_request=False, retry_count=0, added_files
             logging.info("Sending general query to AI.")
 
         response = requests.post("http://88.214.24.11:6969/api/chat/completions", json={
-            "model": MODEL,
+            "model": MODEL if not is_commit_request else "gpt-4o-turbo",
             "prompt": message_content,
         })
 
@@ -464,6 +471,7 @@ def main():
     print(f"{colored('/reset', 'magenta'):<10} {colored('Reset chat context and clear added files', 'dark_grey')}")
     print(f"{colored('/review', 'magenta'):<10} {colored('Review code files (followed by file paths)', 'dark_grey')}")
     print(f"{colored('/planning', 'magenta'):<10} {colored('Generate a detailed plan based on your request', 'dark_grey')}")
+    print(f"{colored('/commit', 'magenta'):<10} {colored('Generate a commit message based on current changes', 'dark_grey')}")
     print(f"{colored('/quit', 'magenta'):<10} {colored('Exit the program', 'dark_grey')}")
 
     style = Style.from_dict({
@@ -475,7 +483,7 @@ def main():
 
     # Create a WordCompleter with available commands and files
     completer = WordCompleter(
-        ['/edit', '/create', '/add', '/quit', '/debug', '/reset', '/review', '/planning'] + files,
+        ['/edit', '/create', '/add', '/commit', '/quit', '/debug', '/reset', '/review', '/planning'] + files,
         ignore_case=True
     )
 
@@ -663,6 +671,28 @@ Files to modify:
                 print(colored("Failed to generate a planning response. Please try again.", "red"))
                 logging.error("AI failed to generate a planning response.")
 
+        elif user_input.lower() == '/commit':
+            try:
+                diff = subprocess.check_output(['git', 'diff'], encoding='utf-8')
+                if not diff.strip():
+                    print(colored("No changes detected to commit.", "green"))
+                    logging.info("No changes detected for commit.")
+                else:
+                    # Prepare the AI prompt using COMMIT_PROMPT
+                    commit_request = f"{COMMIT_PROMPT}\n\nDiff:\n{diff}"
+                    ai_response = chat_with_ai(commit_request, is_edit_request=False)
+                    if ai_response:
+                        print()
+                        print(colored("Suggested Commit Message:", "blue"))
+                        rprint(Markdown(ai_response))
+                        logging.info("Provided commit message to user.")
+                    else:
+                        print(colored("Failed to generate a commit message. Please try again.", "red"))
+                        logging.error("AI failed to generate commit message.")
+            except Exception as e:
+                print(colored(f"An error occurred while retrieving Git diff: {e}", "red"))
+                logging.error(f"Error retrieving Git diff: {e}")
+
         else:
             ai_response = chat_with_ai(user_input, added_files=added_files)
             if ai_response:
@@ -675,4 +705,6 @@ Files to modify:
 
 
 if __name__ == "__main__":
-    main()
\ No newline at end of file
+    main()
+
+
diff --git a/test.py b/test.py
index 20732ca..de2f973 100644
--- a/test.py
+++ b/test.py
@@ -24,4 +24,11 @@ if __name__ == "__main__":
     if diff:
         print(diff)
     else:
-        print("No changes detected or unable to retrieve git diff.")
\ No newline at end of file
+        print("No changes detected or unable to retrieve git diff.")
+
+# This script does nothing different from running 'git diff' in the command line.
+# It simply wraps the 'git diff' command in a Python script, which doesn't provide
+# any additional functionality beyond what 'git diff' already offers.
+# The file_context_0 shows multiple 'git diff' commands, suggesting that running
+# this script is equivalent to manually executing 'git diff' in the terminal.
+help
\ No newline at end of file