[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-80864":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":8,"htmlUrl":8,"language":9,"languages":8,"totalLinesOfCode":8,"stars":10,"forks":11,"watchers":12,"openIssues":13,"contributorsCount":14,"subscribersCount":14,"size":14,"stars1d":13,"stars7d":15,"stars30d":16,"stars90d":14,"forks30d":14,"starsTrendScore":17,"compositeScore":18,"rankGlobal":8,"rankLanguage":8,"license":8,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":21,"hasPages":19,"topics":22,"createdAt":8,"pushedAt":8,"updatedAt":23,"readmeContent":24,"aiSummary":25,"trendingCount":14,"starSnapshotCount":14,"syncStatus":13,"lastSyncTime":26,"discoverSource":27},80864,"nano-ontoprompt","jingw2\u002Fnano-ontoprompt","jingw2",null,"Python",67,25,35,2,0,13,32,9,51.94,false,"master",true,[],"2026-06-12 04:01:30","# nano-ontoprompt\n\n**[中文文档](.\u002FREADME_zh.md)**\n\nA lightweight, LLM-powered platform for building domain ontologies from unstructured documents. Upload your PDFs, Word files, or spreadsheets, configure a prompt and model, and let the LLM extract a structured knowledge graph — complete with entities, logic rules, and actions.\n\n---\n\n## What is an Ontology?\n\nAn ontology is a formal representation of knowledge in a specific domain — a shared vocabulary of concepts and the relationships between them. Think of it as the structured backbone that turns raw text into machine-readable, queryable knowledge.\n\nIn nano-ontoprompt, every ontology is made of three building blocks:\n\n| Building Block | What it captures | Example |\n|---|---|---|\n| **Entity** | A key concept in the domain, with Chinese\u002FEnglish names, type, description, and a confidence score | `供应商 \u002F Supplier`, type: `Organization` |\n| **Logic Rule** | A formal constraint or relationship between entities, optionally expressed as a formula | `∀ order → has_supplier` |\n| **Action** | An executable rule that can be triggered based on the ontology's state | `Notify procurement when stock \u003C threshold` |\n\nEntities are linked through relations (edges in the knowledge graph). The graph view lets you visually explore how concepts connect across an entire domain.\n\n**Typical use cases:**\n- Supply chain knowledge modeling\n- Medical \u002F clinical concept extraction\n- Financial compliance rule extraction\n- Legal document structuring\n- Any domain where you need to turn text corpora into structured knowledge\n\n---\n\n## Features\n\n- **LLM extraction** — drive extraction with any OpenAI, Anthropic, or OpenAI-compatible model\n- **Prompt management** — create, version, and reuse domain-specific extraction prompts; one-click template generation\n- **Multi-format upload** — PDF, DOCX, XLSX, CSV, PPTX, PNG, JPG, MD, TXT\n- **Knowledge graph** — interactive Cytoscape.js visualization of entity relationships\n- **Quality report** — post-extraction P0 validation with severity levels (FATAL \u002F ERROR \u002F WARNING \u002F INFO)\n- **Export** — JSON, YAML, CSV, Turtle (RDF), HTML\n- **Extraction rules** — client-side constraints appended to prompts (min confidence, multi-document validation, etc.)\n- **Multi-language UI** — English \u002F Chinese toggle\n- **User management** — JWT auth, admin\u002Fuser roles\n\n---\n\n## Tech Stack\n\n| Layer | Technology |\n|---|---|\n| Frontend | React 18, TypeScript, Vite, Tailwind CSS, react-i18next |\n| Backend | FastAPI, SQLAlchemy, SQLite \u002F PostgreSQL |\n| Task queue | Celery + Redis |\n| LLM clients | OpenAI SDK, Anthropic SDK |\n| Graph | Cytoscape.js |\n| Export | rdflib (Turtle\u002FRDF), PyYAML |\n\n---\n\n## Quick Start\n\n### Option 1 — Docker Compose (recommended)\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjingw2\u002Fnano-ontoprompt.git\ncd nano-ontoprompt\ncp .env.example .env          # edit API keys and secrets\ndocker compose up --build\n```\n\nOpen [http:\u002F\u002Flocalhost:5173](http:\u002F\u002Flocalhost:5173). Default credentials: `admin \u002F changeme123`.\n\n### Option 2 — Manual setup\n\n**Prerequisites:** Python 3.11+, Node.js 18+, Redis\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fjingw2\u002Fnano-ontoprompt.git\ncd nano-ontoprompt\n```\n\n**Backend**\n\n```bash\ncd backend\npython -m venv .venv && source .venv\u002Fbin\u002Factivate   # Windows: .venv\\Scripts\\activate\npip install -r requirements.txt\nuvicorn app.main:app --reload --port 8000\n```\n\n**Celery worker** (separate terminal, same venv)\n\n```bash\ncd backend\ncelery -A app.tasks.extraction worker --loglevel=info\n```\n\n**Frontend**\n\n```bash\ncd frontend\nnpm install\nnpm run dev\n```\n\nOpen [http:\u002F\u002Flocalhost:5173](http:\u002F\u002Flocalhost:5173).\n\n---\n\n## Usage\n\n### 1. Add a model\n\nGo to **Models → Add Model**. Enter your provider (OpenAI \u002F Anthropic \u002F compatible), API key, base URL, and the specific model names you want to use.\n\n### 2. Create a prompt\n\nGo to **Prompts → Create Prompt**. Pick a domain, click **Auto-fill Template** to load a built-in extraction prompt, then customise it for your needs.\n\n### 3. Create an ontology\n\nGo to **Ontologies → Create Ontology**. Give it a name and domain.\n\n### 4. Upload documents\n\nOpen the ontology → **Files** tab. Drag and drop your source documents (PDF, DOCX, XLSX, etc.).\n\n### 5. Run LLM extraction\n\nOpen the ontology → **Info** tab. Select the prompt and model, then click **Start Extraction**. A progress bar tracks each stage (queued → loading files → LLM extraction → validating → saving). A quality report appears on completion.\n\n### 6. Explore the knowledge graph\n\nOpen the ontology → **Graph** tab. Nodes are entities; edges are relations extracted by the LLM.\n\n### 7. Review and edit\n\n- **Entities** tab — browse, add, or delete entities\n- **Logic Rules** tab — view and manage formal rules\n- **Actions** tab — view and manage executable actions\n\n### 8. Export\n\nIn the **Info** tab, download the ontology in JSON, YAML, CSV, Turtle (RDF), or HTML format.\n\n---\n\n## Project Structure\n\n```\nnano-ontoprompt\u002F\n├── backend\u002F\n│   ├── app\u002F\n│   │   ├── api\u002F           # REST API endpoints\n│   │   ├── models\u002F        # SQLAlchemy ORM models\n│   │   ├── tasks\u002F         # Celery extraction tasks + LLM orchestration\n│   │   └── utils\u002F         # Export (JSON\u002FYAML\u002FCSV\u002FTTL\u002FHTML)\n│   └── requirements.txt\n├── frontend\u002F\n│   └── src\u002F\n│       ├── pages\u002F         # Route-level components (overview, ontologies, prompts…)\n│       ├── components\u002F    # Shared UI (ConfidenceBar, StatusBadge, KnowledgeGraph…)\n│       ├── api\u002F           # Axios API client\n│       └── i18n\u002F          # en.json \u002F zh.json translations\n├── docker-compose.yml\n└── uploads\u002F               # Uploaded document storage (gitignored)\n```\n\n---\n\n## Environment Variables\n\nCreate a `.env` file in the project root (or in `backend\u002F`):\n\n```env\nDATABASE_URL=sqlite:\u002F\u002F\u002F.\u002Fontoprompt.db\nREDIS_URL=redis:\u002F\u002Flocalhost:6379\u002F0\nSECRET_KEY=change-me-in-production\nENCRYPTION_KEY=                         # optional: encrypt stored API keys\nFIRST_ADMIN_USER=admin\nFIRST_ADMIN_PASSWORD=changeme123\n```\n\n---\n\n## Star History\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=jingw2\u002Fnano-ontoprompt&type=Date)](https:\u002F\u002Fstar-history.com\u002F#jingw2\u002Fnano-ontoprompt&Date)\n\n---\n\n## License\n\nMIT\n","nano-ontoprompt 是一个轻量级的、基于大语言模型（LLM）的平台，用于从非结构化文档中构建领域本体。其核心功能包括通过上传PDF、Word文件或电子表格，并配置提示词和模型来提取出包含实体、逻辑规则和动作的知识图谱。技术特点涵盖使用React 18与FastAPI搭建前后端框架，支持多种格式文件上传及知识图谱的可视化展示，以及多语言用户界面等。该项目适用于需要将文本语料转换为结构化知识的各种场景，如供应链知识建模、医学概念提取、金融合规规则抽取、法律文件整理等领域。","2026-06-11 04:02:35","CREATED_QUERY"]