Skip to content

Commit aed6c0c

Browse files
committed
ChatON: Use the constants defined for the keys
1 parent 00324ab commit aed6c0c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

common/chaton.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ const auto K_BEGIN = "begin";
6969
const auto K_END = "end";
7070
const auto K_GLOBAL = "global";
7171
const auto K_SYSTEMUSER_1ST_USER_HAS_PREFIX = "systemuser-1st-user-has-prefix";
72+
const auto K_REVERSE_PROMPT = "reverse-prompt";
7273

7374

7475
using json = nlohmann::json;

examples/main/main.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ int main(int argc, char ** argv) {
265265
params.prompt = "<|im_start|>system\n" + params.prompt + "<|im_end|>";
266266
}
267267
if (params.chaton) {
268-
params.prompt = chaton_tmpl_apply_single(params.chaton_template_id, "system", params.prompt);
268+
params.prompt = chaton_tmpl_apply_single(params.chaton_template_id, K_SYSTEM, params.prompt);
269269
}
270270
embd_inp = ::llama_tokenize(ctx, params.prompt, true, true);
271271
} else {
@@ -376,13 +376,13 @@ int main(int argc, char ** argv) {
376376
}
377377

378378
// chaton mode
379-
const auto chaton_assitant_prefix = ::llama_tokenize(ctx, chaton_tmpl_role_kv(params.chaton_template_id, "assistant", "prefix"), false, true);
379+
const auto chaton_assitant_prefix = ::llama_tokenize(ctx, chaton_tmpl_role_kv(params.chaton_template_id, K_ASSISTANT, K_PREFIX), false, true);
380380
if (params.chaton) {
381381
params.interactive = true; // may remove later, by requiring user to explicitly request interactive mode
382382
params.interactive_first = true;
383-
params.input_prefix = chaton_tmpl_role_kv(params.chaton_template_id, "user", "prefix");
384-
params.input_suffix = chaton_tmpl_role_kv(params.chaton_template_id, "user", "suffix");
385-
params.antiprompt.emplace_back(chaton_tmpl_kv(params.chaton_template_id, "reverse-prompt"));
383+
params.input_prefix = chaton_tmpl_role_kv(params.chaton_template_id, K_USER, K_PREFIX);
384+
params.input_suffix = chaton_tmpl_role_kv(params.chaton_template_id, K_USER, K_SUFFIX);
385+
params.antiprompt.emplace_back(chaton_tmpl_kv(params.chaton_template_id, K_REVERSE_PROMPT));
386386
}
387387

388388
// enable interactive mode if interactive start is specified

0 commit comments

Comments
 (0)