Add configurable SystemOne batching and release version 4.1.0

This commit is contained in:
Jordan Wages 2026-10-08 09:42:26 -05:00
commit 7edae937b3
13 changed files with 400 additions and 31 deletions

View file

@ -39,10 +39,13 @@ function runner({ fail = false, changeSettings = false } = {}) {
AiClassifier: {
getConfig() { return structuredClone(currentConfig); },
async buildCacheKey(id, criterion) { return `${id}:${criterion}`; },
async classify(text, criterion, options) {
evaluated.push({ text, criterion, ...options });
if (fail && options.cacheKey.startsWith('1:')) throw new Error('inference failed');
return { matched: true };
async *classifyRules(text, candidates, snapshot) {
for (const { rule, cacheKey } of candidates) {
evaluated.push({ text, criterion: rule.criterion, cacheKey, snapshot,
threshold: rule.decisionThreshold ?? snapshot.decisionThreshold });
if (fail && cacheKey.startsWith('1:')) throw new Error('inference failed');
yield { rule, result: { matched: true } };
}
}
}
});