This repository was archived by the owner on Jul 4, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -200,16 +200,16 @@ void llamaCPP::chatCompletion(
200200 stopWords.push_back (stop_word.asString ());
201201 }
202202 // specify default stop words
203- stopWords.push_back (user_prompt);
203+ stopWords.push_back (nitro_utils::rtrim ( user_prompt) );
204204 data[" stop" ] = stopWords;
205205 }
206206
207207 bool is_streamed = data[" stream" ];
208- // Enable full message debugging
209- #ifdef DEBUG
208+ // Enable full message debugging
209+ #ifdef DEBUG
210210 LOG_INFO << " Current completion text" ;
211- LOG_INFO << formatted_output ;
212- #endif
211+ LOG_INFO << formatted_output;
212+ #endif
213213 const int task_id = llama.request_completion (data, false , false );
214214 LOG_INFO << " Resolved request for task_id:" << task_id;
215215
Original file line number Diff line number Diff line change 88#include < ostream>
99
1010namespace nitro_utils {
11+
12+ inline std::string rtrim (const std::string &str) {
13+ size_t end = str.find_last_not_of (" \n\t " );
14+ return (end == std::string::npos) ? " " : str.substr (0 , end + 1 );
15+ }
16+
1117inline std::string generate_random_string (std::size_t length) {
1218 const std::string characters =
1319 " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" ;
You can’t perform that action at this time.
0 commit comments