-
v0.3.7:修复模板编译器 UTF-8 编码
released this
2026-08-03 11:19:40 +08:00 | 1 commits to main since this release修复说明:模板编译器 6 处逐字节强转改为按字符边界推进,中文模板经 compile + render 后与原文一致。
最小验证代码:
use agcore::prompt::{PromptTemplate, TemplateContext};
let tpl = PromptTemplate::compile("你是助手:{{msg}}").unwrap();
let mut ctx = TemplateContext::new();
ctx.insert("msg", "你好");
assert_eq!(tpl.render(&ctx).unwrap(), "你是助手:你好");行为变更提示:修复后此前被乱码破坏的提示词规则将恢复生效,模型输出可能变化,升级后建议运行真实采集对比验证。
Downloads