File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ namespace LlamaCpp::Internal::Constants {
6
6
const char LLAMACPP_USE_GLOBAL_SETTINGS[] = " LlamaCpp.UseGlobalSettings" ;
7
7
8
8
const char LLAMACPP_TOGGLE_ENABLE_DISABLE[] = " LlamaCpp.ToggleEnableDisable" ;
9
+ const char LLAMACPP_TOGGLE_AUTOFIM[] = " LlamaCpp.ToggleAutoFIM" ;
9
10
const char LLAMACPP_REQUEST_SUGGESTION[] = " LlamaCpp.RequestSuggestion" ;
10
11
11
12
const char LLAMACPP_GENERAL_OPTIONS_ID[] = " LlamaCpp.General" ;
Original file line number Diff line number Diff line change @@ -123,13 +123,34 @@ void LlamaPlugin::initialize()
123
123
settings ().apply ();
124
124
});
125
125
126
+ ActionBuilder toggleAutoFimAction (this , Constants::LLAMACPP_TOGGLE_AUTOFIM);
127
+ toggleAutoFimAction.setText (Tr::tr (" Toggle Auto FIM" ));
128
+ toggleAutoFimAction.setCheckable (true );
129
+ toggleAutoFimAction.setChecked (settings ().autoFim ());
130
+ toggleAutoFimAction.addOnTriggered (this , [this ](bool checked) {
131
+ qCInfo (llamaLog) << " Toggle Auto FIM" << checked;
132
+
133
+ settings ().autoFim .setValue (checked);
134
+ settings ().apply ();
135
+
136
+ if (checked) {
137
+ // Show the llama.cpp text hint
138
+ fim (-1 , -1 , false );
139
+ } else {
140
+ hideCompletionHint ();
141
+ }
142
+ });
143
+ toggleAutoFimAction.setDefaultKeySequence (Tr::tr (" Ctrl+Shift+G" ));
144
+
126
145
QAction *toggleAct = toggleAction.contextAction ();
127
146
QAction *requestAct = requestAction.contextAction ();
128
- auto updateActions = [toggleAct, requestAct] {
147
+ QAction *toogleAutoFimAct = toggleAutoFimAction.contextAction ();
148
+ auto updateActions = [toggleAct, requestAct, toogleAutoFimAct] {
129
149
const bool enabled = settings ().enableLlamaCpp ();
130
150
toggleAct->setToolTip (enabled ? Tr::tr (" Disable llama.cpp." ) : Tr::tr (" Enable llama.cpp." ));
131
151
toggleAct->setChecked (enabled);
132
152
requestAct->setEnabled (enabled);
153
+ toogleAutoFimAct->setEnabled (enabled);
133
154
};
134
155
135
156
settings ().enableLlamaCpp .addOnChanged (this , updateActions);
You can’t perform that action at this time.
0 commit comments