Added onboarding progress tracking & landing page

This commit is contained in:
ajaysi
2025-10-02 13:20:15 +05:30
parent e57d2577f8
commit 510b79bbf8
135 changed files with 25917 additions and 5768 deletions

View File

@@ -0,0 +1,59 @@
from typing import Any, Dict, List
def convert_content_to_ricos(content: str, images: List[str] = None) -> Dict[str, Any]:
"""
Convert simple markdown-like text into minimal valid Ricos JSON.
"""
paragraphs = content.split('\n\n')
nodes = []
import uuid
for paragraph in paragraphs:
text = paragraph.strip()
if not text:
continue
node_id = str(uuid.uuid4())
text_node_id = str(uuid.uuid4())
if text.startswith('#'):
level = len(text) - len(text.lstrip('#'))
heading_text = text.lstrip('# ').strip()
nodes.append({
'id': node_id,
'type': 'HEADING',
'nodes': [{
'id': text_node_id,
'type': 'TEXT',
'textData': {
'text': heading_text,
'decorations': []
}
}],
'headingData': { 'level': min(level, 6) }
})
else:
nodes.append({
'id': node_id,
'type': 'PARAGRAPH',
'nodes': [{
'id': text_node_id,
'type': 'TEXT',
'textData': {
'text': text,
'decorations': []
}
}],
'paragraphData': {}
})
return {
'nodes': nodes,
'metadata': { 'version': 1, 'id': str(uuid.uuid4()) },
'documentStyle': {
'paragraph': { 'decorations': [], 'nodeStyle': {}, 'lineHeight': '1.5' }
}
}