mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-05-12 05:51:28 +00:00
feat: use llama cpp for generation of git commit message. (#380)
* Enable remote llama cpp server for Windows. * Mixtral instruct template was added. * Use llama cpp for generation of git commit message. * style fix
This commit is contained in:
parent
6e1a116ed2
commit
9627bbda15
2 changed files with 37 additions and 3 deletions
|
|
@ -41,6 +41,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
|
||||
public class GenerateGitCommitMessageAction extends AnAction {
|
||||
|
||||
public static final int MAX_TOKEN_COUNT_WARNING = 4096;
|
||||
private final EncodingManager encodingManager;
|
||||
|
||||
public GenerateGitCommitMessageAction() {
|
||||
|
|
@ -54,12 +55,14 @@ public class GenerateGitCommitMessageAction extends AnAction {
|
|||
@Override
|
||||
public void update(@NotNull AnActionEvent event) {
|
||||
var selectedService = GeneralSettings.getCurrentState().getSelectedService();
|
||||
if (selectedService == ServiceType.OPENAI || selectedService == ServiceType.AZURE) {
|
||||
if (selectedService == ServiceType.OPENAI || selectedService == ServiceType.AZURE
|
||||
|| selectedService == ServiceType.LLAMA_CPP) {
|
||||
var filesSelected = !getReferencedFilePaths(event).isEmpty();
|
||||
var callAllowed = (selectedService == ServiceType.OPENAI
|
||||
&& OpenAICredentialManager.getInstance().isCredentialSet())
|
||||
|| (selectedService == ServiceType.AZURE
|
||||
&& AzureCredentialsManager.getInstance().isCredentialSet());
|
||||
&& AzureCredentialsManager.getInstance().isCredentialSet())
|
||||
|| selectedService == ServiceType.LLAMA_CPP;
|
||||
event.getPresentation().setEnabled(callAllowed && filesSelected);
|
||||
event.getPresentation().setText(CodeGPTBundle.get(callAllowed
|
||||
? "action.generateCommitMessage.title"
|
||||
|
|
@ -79,8 +82,10 @@ public class GenerateGitCommitMessageAction extends AnAction {
|
|||
}
|
||||
|
||||
var gitDiff = getGitDiff(project, getReferencedFilePaths(event));
|
||||
|
||||
var tokenCount = encodingManager.countTokens(gitDiff);
|
||||
if (tokenCount > 4096 && OverlayUtil.showTokenSoftLimitWarningDialog(tokenCount) != OK) {
|
||||
if (tokenCount > MAX_TOKEN_COUNT_WARNING
|
||||
&& OverlayUtil.showTokenSoftLimitWarningDialog(tokenCount) != OK) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue