ChatON: Rather check for tmpl existance in single_ex
This commit is contained in:
parent
01c8db70f7
commit
ea3a0f19cc
1 changed files with 6 additions and 4 deletions
|
@ -224,6 +224,9 @@ inline bool chaton_tmpl_apply_single_ex(
|
||||||
std::string &types,
|
std::string &types,
|
||||||
std::vector<int> &lens
|
std::vector<int> &lens
|
||||||
) {
|
) {
|
||||||
|
if (!chaton_tmpl_exists(tmpl)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
ChatParts cp = {};
|
ChatParts cp = {};
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
std::string beginPrefix = chaton_tmpl_role_kv(tmpl, role, {K_BEGIN, K_PREFIX});
|
std::string beginPrefix = chaton_tmpl_role_kv(tmpl, role, {K_BEGIN, K_PREFIX});
|
||||||
|
@ -252,12 +255,11 @@ inline size_t chaton_tmpl_apply_single(
|
||||||
const std::string &content,
|
const std::string &content,
|
||||||
std::string &tagged
|
std::string &tagged
|
||||||
) {
|
) {
|
||||||
if (!chaton_tmpl_exists(tmpl)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
std::string types;
|
std::string types;
|
||||||
std::vector<int> lens;
|
std::vector<int> lens;
|
||||||
chaton_tmpl_apply_single_ex(tmpl, role, content, tagged, types, lens);
|
if (!chaton_tmpl_apply_single_ex(tmpl, role, content, tagged, types, lens)) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return tagged.size();
|
return tagged.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue