@digimakers/core 0.2.1 → 0.3.20
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/dist/agents/code-formatter.d.ts +2 -0
- package/dist/agents/code-formatter.d.ts.map +1 -0
- package/dist/agents/code-formatter.js +23 -0
- package/dist/agents/code-formatter.js.map +1 -0
- package/dist/docling-cleaner/cleaner.py +34 -0
- package/dist/docling-cleaner/pyproject.toml +10 -0
- package/dist/docling-cleaner/uv.lock +2077 -0
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/parsing/docling-parser.d.ts +17 -0
- package/dist/parsing/docling-parser.d.ts.map +1 -0
- package/dist/parsing/docling-parser.js +109 -0
- package/dist/parsing/docling-parser.js.map +1 -0
- package/dist/parsing/docling-runners.d.ts +2 -0
- package/dist/parsing/docling-runners.d.ts.map +1 -0
- package/dist/parsing/docling-runners.js +85 -0
- package/dist/parsing/docling-runners.js.map +1 -0
- package/dist/parsing/docx-parser.d.ts +2 -2
- package/dist/parsing/docx-parser.d.ts.map +1 -1
- package/dist/parsing/docx-parser.js +118 -45
- package/dist/parsing/docx-parser.js.map +1 -1
- package/dist/parsing/index.d.ts +3 -0
- package/dist/parsing/index.d.ts.map +1 -1
- package/dist/parsing/index.js +2 -0
- package/dist/parsing/index.js.map +1 -1
- package/dist/parsing/normalise.d.ts +1 -0
- package/dist/parsing/normalise.d.ts.map +1 -1
- package/dist/parsing/normalise.js +41 -1
- package/dist/parsing/normalise.js.map +1 -1
- package/dist/parsing/post-processors.d.ts +6 -0
- package/dist/parsing/post-processors.d.ts.map +1 -0
- package/dist/parsing/post-processors.js +217 -0
- package/dist/parsing/post-processors.js.map +1 -0
- package/dist/parsing/prompts.d.ts +5 -0
- package/dist/parsing/prompts.d.ts.map +1 -0
- package/dist/parsing/prompts.js +24 -0
- package/dist/parsing/prompts.js.map +1 -0
- package/dist/pdf-generator.d.ts +3 -3
- package/dist/pdf-generator.d.ts.map +1 -1
- package/dist/pdf-generator.js +1 -1
- package/dist/pdf-generator.js.map +1 -1
- package/dist/sample-data.d.ts +2 -2
- package/dist/sample-data.d.ts.map +1 -1
- package/dist/sample-data.js +8 -7
- package/dist/sample-data.js.map +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/lesson.d.ts +385 -39
- package/dist/schemas/lesson.d.ts.map +1 -1
- package/dist/schemas/lesson.js +96 -34
- package/dist/schemas/lesson.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-formatter.d.ts","sourceRoot":"","sources":["../../src/agents/code-formatter.ts"],"names":[],"mappings":"AASA,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,mBAcvF"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { generateText } from 'ai';
|
|
2
|
+
import { createGoogleGenerativeAI } from '@ai-sdk/google';
|
|
3
|
+
import { codeFormatterPrompt, codeFormatterSystemPrompt } from '../parsing/prompts.js';
|
|
4
|
+
import { logger } from '../logger.js';
|
|
5
|
+
const google = createGoogleGenerativeAI({
|
|
6
|
+
apiKey: process.env.GEMINI_API_KEY,
|
|
7
|
+
});
|
|
8
|
+
export async function formatDocumentCode(document, footerLanguage) {
|
|
9
|
+
logger.debug('Formatting document code blocks with code formatter LLM');
|
|
10
|
+
if (!footerLanguage || footerLanguage != 'scratch') {
|
|
11
|
+
const { text } = await generateText({
|
|
12
|
+
model: google('gemini-2.0-flash'),
|
|
13
|
+
system: codeFormatterSystemPrompt,
|
|
14
|
+
prompt: codeFormatterPrompt(document),
|
|
15
|
+
temperature: 0,
|
|
16
|
+
});
|
|
17
|
+
logger.debug('Done formatting document code blocks');
|
|
18
|
+
return text;
|
|
19
|
+
}
|
|
20
|
+
logger.debug("Did not format document code blcoks because it's a scratch lesson");
|
|
21
|
+
return document;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=code-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"code-formatter.js","sourceRoot":"","sources":["../../src/agents/code-formatter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAClC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,MAAM,MAAM,GAAG,wBAAwB,CAAC;IACtC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;CACnC,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAgB,EAAE,cAA6B;IACtF,MAAM,CAAC,KAAK,CAAC,yDAAyD,CAAC,CAAC;IACxE,IAAI,CAAC,cAAc,IAAI,cAAc,IAAI,SAAS,EAAE,CAAC;QACnD,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,YAAY,CAAC;YAClC,KAAK,EAAE,MAAM,CAAC,kBAAkB,CAAC;YACjC,MAAM,EAAE,yBAAyB;YACjC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC;YACrC,WAAW,EAAE,CAAC;SACf,CAAC,CAAC;QACH,MAAM,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,mEAAmE,CAAC,CAAC;IAClF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Convert DOCX to markdown with image placeholders using Docling.
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python cleaner.py <path-to-docx>
|
|
7
|
+
|
|
8
|
+
Outputs markdown to stdout with <!-- image --> markers for images.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import sys
|
|
12
|
+
import logging
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
from docling.document_converter import DocumentConverter
|
|
15
|
+
|
|
16
|
+
logging.getLogger('docling.backend.msword_backend').setLevel(logging.ERROR)
|
|
17
|
+
|
|
18
|
+
def main():
|
|
19
|
+
if len(sys.argv) < 2:
|
|
20
|
+
print("Usage: python cleaner.py <path-to-docx>", file=sys.stderr)
|
|
21
|
+
sys.exit(1)
|
|
22
|
+
|
|
23
|
+
src = Path(sys.argv[1])
|
|
24
|
+
if not src.exists():
|
|
25
|
+
print(f"Error: File not found: {src}", file=sys.stderr)
|
|
26
|
+
sys.exit(1)
|
|
27
|
+
|
|
28
|
+
conv = DocumentConverter()
|
|
29
|
+
result = conv.convert(src)
|
|
30
|
+
markdown = result.document.export_to_markdown()
|
|
31
|
+
print(markdown)
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
main()
|