feat(commit-ai): enhance commit message generation and caching
Improve the commit message generation process by adding a caching mechanism and refining the input handling. This change aims to enhance performance and prevent redundant computations when generating commit messages based on staged changes. - **src-tauri/crates/commit_ai/src/cloud.rs**: - Introduced `looks_like_diff_echo` function to detect if the model's output is a diff instead of a commit message. - Updated `openai_compatible_request` and `generate_anthropic` to utilize the new function for error handling. - **src-tauri/crates/commit_ai/src/lib.rs**: - Added `LocalGenerationProfile` enum for managing different generation profiles. - Implemented caching for generated messages to avoid redundant processing. - Updated `generate_commit_message` to incorporate caching logic. - **src-tauri/src/git.rs**: - Added `staged_diff_local` function to handle local profile generation and exclude specific lock files from the diff. - Modified `commit_ai_generate` to accept and process the local generation profile. - **src/App.svelte**: - Added `lastLocalAiGeneratedMessage` state to track the last generated message and prevent unnecessary updates. - **.claude/settings.local.json**: - Updated settings to include additional commands for better functionality.
This commit is contained in:
@@ -71,7 +71,9 @@
|
||||
"Bash(echo \"EXIT:$?\")",
|
||||
"Bash(ls target/)",
|
||||
"Bash(rustup target *)",
|
||||
"Bash(echo \"exit code: $?\")"
|
||||
"Bash(echo \"exit code: $?\")",
|
||||
"Read(//home/cbr/.cargo/registry/src/**)",
|
||||
"Bash(find / -maxdepth 6 -iname \"mistralrs-*\" -type d)"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user