File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ class partial_formatter {
112112 }
113113 if (!diff.content_delta .empty ()) {
114114 if (had_reasoning) {
115- result.push_back ({" ...\n " , REASONING});
115+ result.push_back ({" ...\n\n " , REASONING});
116116 had_reasoning = false ;
117117 }
118118 result.push_back ({diff.content_delta , CONTENT});
@@ -122,6 +122,11 @@ class partial_formatter {
122122 return result;
123123 }
124124
125+ void clear () {
126+ previous = common_chat_msg ();
127+ had_reasoning = false ;
128+ }
129+
125130private:
126131 common_chat_syntax syntax;
127132 common_chat_msg previous;
@@ -141,6 +146,10 @@ class chat_formatter {
141146 std::string operator ()(const std::string & role, const std::string & content) {
142147 if (role == " user" ) {
143148 formatted_cumulative.clear (); // Needed if template strips reasoning
149+
150+ if (partial_formatter_ptr) {
151+ partial_formatter_ptr->clear (); // Remove stale data from delta
152+ }
144153 }
145154
146155 common_chat_msg new_msg;
You can’t perform that action at this time.
0 commit comments