Upload thinking-engine.html with huggingface_hub
Browse files- thinking-engine.html +2 -0
thinking-engine.html
CHANGED
|
@@ -195,6 +195,8 @@ async function generate(entity, msg, keywords, grepResults, systemContext) {
|
|
| 195 |
|
| 196 |
let text = result?.choices?.[0]?.text?.trim() || '';
|
| 197 |
text = text.replace(/<\|channel\|?>.*?<\|?channel\|?>/gs, '').replace(/<\|?channel\|?>\s*/g, '').replace(/<\|?thought\|?>\s*/g, '').replace(/<\|?end_of_turn\|?>/g, '').replace(/<\|?response\|?>\s*/g, '').replace(/^thought\s*$/m, '').replace(/^response\s*$/m, '').replace(/^Thinking Process:[\s\S]*?(?=\n[A-Z~*"])/m, '').trim();
|
|
|
|
|
|
|
| 198 |
// Kill repetition loops: if any 4+ word phrase repeats 3+ times, cut at first repeat
|
| 199 |
const repMatch = text.match(/(\b\w+(?:\s+\w+){3,})\s*(?:\1\s*){2,}/);
|
| 200 |
if (repMatch) text = text.slice(0, repMatch.index + repMatch[1].length).trim();
|
|
|
|
| 195 |
|
| 196 |
let text = result?.choices?.[0]?.text?.trim() || '';
|
| 197 |
text = text.replace(/<\|channel\|?>.*?<\|?channel\|?>/gs, '').replace(/<\|?channel\|?>\s*/g, '').replace(/<\|?thought\|?>\s*/g, '').replace(/<\|?end_of_turn\|?>/g, '').replace(/<\|?response\|?>\s*/g, '').replace(/^thought\s*$/m, '').replace(/^response\s*$/m, '').replace(/^Thinking Process:[\s\S]*?(?=\n[A-Z~*"])/m, '').trim();
|
| 198 |
+
// Kill meta-reasoning leaking into output
|
| 199 |
+
text = text.replace(/\(Wait,? no[—\-].*/gs, '').replace(/Let me refine[\s\S]*/gs, '').replace(/Refined Response:[\s\S]*/gs, '').replace(/\(I should[n']t break character.*/gs, '').trim();
|
| 200 |
// Kill repetition loops: if any 4+ word phrase repeats 3+ times, cut at first repeat
|
| 201 |
const repMatch = text.match(/(\b\w+(?:\s+\w+){3,})\s*(?:\1\s*){2,}/);
|
| 202 |
if (repMatch) text = text.slice(0, repMatch.index + repMatch[1].length).trim();
|