File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 11{
22 "FileVersion": 3,
33 "Version": 1,
4- "VersionName": "0.9.4 ",
4+ "VersionName": "0.9.5 ",
55 "FriendlyName": "Llama",
66 "Description": "Llama.cpp plugin for large language model (LLM) inference.",
77 "Category": "LLM",
Original file line number Diff line number Diff line change @@ -156,12 +156,37 @@ void ULlamaComponent::ResetContextHistory(bool bKeepSystemPrompt)
156156
157157void ULlamaComponent::RemoveLastAssistantReply ()
158158{
159- LlamaNative->RemoveLastReply ();
159+ if (ModelParams.bRemoteMode )
160+ {
161+ // modify state only
162+ int32 Count = ModelState.ChatHistory .History .Num ();
163+ if (Count >0 )
164+ {
165+ ModelState.ChatHistory .History .RemoveAt (Count - 1 );
166+ }
167+ }
168+ else
169+ {
170+ LlamaNative->RemoveLastReply ();
171+ }
160172}
161173
162174void ULlamaComponent::RemoveLastUserInput ()
163175{
164- LlamaNative->RemoveLastUserInput ();
176+ if (ModelParams.bRemoteMode )
177+ {
178+ // modify state only
179+ int32 Count = ModelState.ChatHistory .History .Num ();
180+ if (Count > 1 )
181+ {
182+ ModelState.ChatHistory .History .RemoveAt (Count - 1 );
183+ ModelState.ChatHistory .History .RemoveAt (Count - 2 );
184+ }
185+ }
186+ else
187+ {
188+ LlamaNative->RemoveLastUserInput ();
189+ }
165190}
166191
167192
Original file line number Diff line number Diff line change @@ -236,6 +236,10 @@ struct FLLMModelParams
236236 UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " LLM Model Params" )
237237 bool bAutoLoadModelOnStartup = true ;
238238
239+ // If true, all prompt inserts/rollbacks only modify modelstate and do not forward to llama component (see impersonation)
240+ UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " LLM Model Params" )
241+ bool bRemoteMode = false ;
242+
239243 // If not different than default empty, no template will be applied
240244 UPROPERTY (EditAnywhere, BlueprintReadWrite, Category = " LLM Model Params" )
241245 FJinjaChatTemplate CustomChatTemplate = " " ;
You can’t perform that action at this time.
0 commit comments