cont : fix [no ci]
This commit is contained in:
parent
71293a6456
commit
0daebc6b8d
1 changed files with 6 additions and 0 deletions
|
@ -973,8 +973,14 @@ struct llama_constraint * llama_constraint_init_grammar_impl(const struct llama_
|
||||||
auto * ctx = (llama_constraint_context_grammar *) result->ctx;
|
auto * ctx = (llama_constraint_context_grammar *) result->ctx;
|
||||||
|
|
||||||
if (grammar_str != nullptr && grammar_str[0] != '\0') {
|
if (grammar_str != nullptr && grammar_str[0] != '\0') {
|
||||||
|
ctx->grammar_str = grammar_str;
|
||||||
|
ctx->grammar_root = grammar_root;
|
||||||
|
|
||||||
ctx->grammar = llama_grammar_init_impl(&vocab, grammar_str, grammar_root);
|
ctx->grammar = llama_grammar_init_impl(&vocab, grammar_str, grammar_root);
|
||||||
} else {
|
} else {
|
||||||
|
ctx->grammar_str.clear();
|
||||||
|
ctx->grammar_root.clear();
|
||||||
|
|
||||||
ctx->grammar = nullptr;
|
ctx->grammar = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue