Skip to content

Commit 80f495f

Browse files
authored
remove nested ternary
1 parent a90612f commit 80f495f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

examples/main/main.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,11 +277,20 @@ int main(int argc, char ** argv) {
277277
};
278278

279279
{
280-
auto prompt = (params.conversation_mode && params.enable_chat_template)
280+
std::string prompt;
281+
282+
if (params.conversation_mode && params.enable_chat_template) {
281283
// format the system prompt in conversation mode (will use template default if empty)
282-
? (params.system_prompt.empty() ? params.system_prompt : chat_add_and_format("system", params.system_prompt))
284+
prompt = params.system_prompt;
285+
286+
if (!prompt.empty()) {
287+
prompt = chat_add_and_format("system", prompt);
288+
}
289+
} else {
283290
// otherwise use the prompt as is
284-
: params.prompt;
291+
prompt = params.prompt;
292+
}
293+
285294
if (params.interactive_first || !params.prompt.empty() || session_tokens.empty()) {
286295
LOG_DBG("tokenize the prompt\n");
287296
embd_inp = common_tokenize(ctx, prompt, true, true);

0 commit comments

Comments
 (0)