File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -219,6 +219,7 @@ struct common_chat_parser_params {
219219 bool reasoning_in_content = false ;
220220 std::string generation_prompt;
221221 bool parse_tool_calls = true ;
222+ bool is_continuation = false ;
222223 bool echo = false ; // Include assistant prefilled msg in output
223224 bool debug = false ; // Enable debug output for PEG parser
224225 common_peg_arena parser = {};
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ task_result_state::task_result_state(const common_chat_parser_params & chat_pars
149149 , oai_resp_id(" resp_" + random_string())
150150 , oai_resp_reasoning_id(" rs_" + random_string())
151151 , oai_resp_message_id(" msg_" + random_string()) {
152- if (!chat_parser_params.echo ) {
152+ if (chat_parser_params. is_continuation && !chat_parser_params.echo ) {
153153 // initialize chat_msg to avoid emitting a delta containing the assistant prefill
154154 chat_msg = common_chat_parse (" " , true , chat_parser_params);
155155 }
@@ -432,6 +432,10 @@ task_params server_task::params_from_json_cmpl(
432432 if (data.contains (" chat_parser" )) {
433433 params.chat_parser_params .parser .load (data.at (" chat_parser" ).get <std::string>());
434434 }
435+ if (data.contains (" continue_final_message" )) {
436+ auto continuation = common_chat_continuation_parse (data.at (" continue_final_message" ));
437+ params.chat_parser_params .is_continuation = continuation != COMMON_CHAT_CONTINUATION_NONE ;
438+ }
435439 params.chat_parser_params .echo = json_value (data, " echo" , false );
436440 }
437441
You can’t perform that action at this time.
0 commit comments