core: a speech model without instructions, and a refusal's reason from its text_prepare -- an audio generator may declare tmpl_plain alone (a request's instructions refused by name), and the reason a plugin leaves in the output buffer reaches the caller

This commit is contained in:
zivius committed 2026-10-20 23:07:33 +02:00
1 parent 61abb990ab
commit 832a88faac
7 files changed
+30 -9

No files matched your search

+6 -1
View File
@@ -270,7 +270,12 @@ int rad_tools_text_prepare(const LoadedPlugins& lp, int field, const std::string
std::string buf(in.size() * 2 + 64, '\0');
for (int tries = 0; tries < 2; ++tries) {
const int64_t n = ap->arch_text_prepare(field, in.c_str(), &buf[0], (int64_t)buf.size());
if (n < 0) return (int)n;
if (n < 0) {
/* The plugin's reason, when it left one in the (zeroed) buffer. */
buf.resize(std::strlen(buf.c_str()));
*out = std::move(buf);
return (int)n;
}
if (n < (int64_t)buf.size()) {
buf.resize((size_t)n);
*out = std::move(buf);