diff --git a/common/chaton.hpp b/common/chaton.hpp index 7c31ad4dc..e072289f8 100644 --- a/common/chaton.hpp +++ b/common/chaton.hpp @@ -300,7 +300,7 @@ inline size_t chat_tmpl_apply_single_capi( // NOTE: returns types and lens to help identify the parts of the tagged msg, which relate to passed and added tags inline bool chaton_tmpl_apply_ex( const std::string &tmpl, - const std::vector &msgs, + const std::vector &msgs, std::string &tagged, std::string &types, std::vector &lens, @@ -318,8 +318,8 @@ inline bool chaton_tmpl_apply_ex( int cntUser = 0; int cntOthers = 0; for(const auto msg: msgs) { - auto role = msg.role; - auto content = msg.content; + auto role = msg->role; + auto content = msg->content; std::string begin = chaton_tmpl_role_kv(tmpl, role, {K_BEGIN}); auto prefix = chaton_tmpl_role_kv(tmpl, role, {K_PREFIX}); auto suffix = chaton_tmpl_role_kv(tmpl, role, {K_SUFFIX}); @@ -395,7 +395,7 @@ inline bool chaton_tmpl_apply_ex( // then 1st user message will have user-prefix only if systemuser-1st-user-has-prefix is true inline int32_t chaton_tmpl_apply( const std::string &tmpl, - const std::vector &msgs, + const std::vector &msgs, bool alertAssistantAtEnd, std::string &tagged ) { @@ -420,10 +420,17 @@ inline int32_t chaton_tmpl_apply_capi( } std::vector vMsgs; for(size_t i=0; i 0) { + strlcpy(dest, taggedMsgs.c_str(), destLength); + } + return taggedLength; }