Skip to content

Commit ff18e24

Browse files
committed
Revert changes to common_chat_format_single
1 parent 4e378fb commit ff18e24

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

common/chat.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -294,11 +294,9 @@ std::string common_chat_format_single(
294294
const std::vector<common_chat_msg> & past_msg,
295295
const common_chat_msg & new_msg,
296296
bool add_ass,
297-
bool use_jinja,
298-
const struct common_chat_templates_inputs * input_extra,
299-
struct common_chat_params * out_params) {
297+
bool use_jinja) {
300298

301-
common_chat_templates_inputs inputs = input_extra ? *input_extra : common_chat_templates_inputs();
299+
common_chat_templates_inputs inputs;
302300
inputs.use_jinja = use_jinja;
303301

304302
std::string fmt_past_msg;
@@ -315,13 +313,9 @@ std::string common_chat_format_single(
315313
// format chat with new_msg
316314
inputs.messages.push_back(new_msg);
317315
inputs.add_generation_prompt = add_ass;
318-
auto chat_params = common_chat_templates_apply(tmpls, inputs);
319-
auto fmt_new_msg = chat_params.prompt;
316+
auto fmt_new_msg = common_chat_templates_apply(tmpls, inputs).prompt;
320317
// get the diff part
321318
ss << fmt_new_msg.substr(fmt_past_msg.size(), fmt_new_msg.size() - fmt_past_msg.size());
322-
if (out_params) {
323-
*out_params = std::move(chat_params);
324-
}
325319
return ss.str();
326320
}
327321

common/chat.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ std::string common_chat_format_single(
112112
const std::vector<common_chat_msg> & past_msg,
113113
const common_chat_msg & new_msg,
114114
bool add_ass,
115-
bool use_jinja,
116-
const struct common_chat_templates_inputs * input_extra = nullptr,
117-
struct common_chat_params * out_params = nullptr);
115+
bool use_jinja);
118116

119117
// Returns an example of formatted chat
120118
std::string common_chat_format_example(

0 commit comments

Comments
 (0)