dotmd-cli 0.9.5 → 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/ai.mjs +7 -6
package/package.json
CHANGED
package/src/ai.mjs
CHANGED
|
@@ -34,18 +34,19 @@ export function runMLX(prompt, opts = {}) {
|
|
|
34
34
|
const output = result.stdout.trim();
|
|
35
35
|
const lines = output.split('\n')
|
|
36
36
|
.filter(l => !l.includes('Fetching') && !l.includes('Warning:') && !l.includes('=========='));
|
|
37
|
-
|
|
37
|
+
const text = lines.join(' ').trim();
|
|
38
|
+
return text ? text.replace(/\*\*/g, '').replace(/^#+\s*/gm, '').trim() : null;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export function summarizeDocBody(bodyText, meta, opts = {}) {
|
|
41
42
|
if (!bodyText?.trim()) return null;
|
|
42
|
-
const prompt =
|
|
43
|
+
const prompt = `<|begin_of_text|><|start_header_id|>system<|end_header_id|>
|
|
44
|
+
You write brief, direct summaries. No preamble. No filler. Start with the subject immediately.<|eot_id|><|start_header_id|>user<|end_header_id|>
|
|
45
|
+
Write a 2-3 sentence plain text summary of this document. State what it covers, its current state (${meta.status}), and what remains to be done. No markdown formatting. No bold, headers, or bullets. Do not start with "This document" or "Here is".
|
|
43
46
|
|
|
44
47
|
Title: ${meta.title}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
${bodyText.slice(0, 6000)}`;
|
|
48
|
+
${bodyText.slice(0, 6000)}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
|
|
49
|
+
`;
|
|
49
50
|
return runMLX(prompt, { maxTokens: 200, ...opts });
|
|
50
51
|
}
|
|
51
52
|
|