Skip to main content

AI-powered Chinese patent disclosure drafting tool

Project description

Patent Drafting Assistant

专利撰写助手 — AI-powered patent disclosure drafting

MIT License Python 3.10+ FastAPI Anthropic SDK PyPI Downloads

FeaturesQuick StartUsageStructureCustomizeContributing


Input your core technical concept and let AI generate a complete 10-chapter Chinese patent disclosure. Supports streaming generation, per-chapter editing, auto figure prompts, version history, and DOCX/Markdown export — all through a clean local web UI.

Features

  • AI-driven drafting — Generate a complete patent disclosure from a single technical concept
  • 10-chapter standard structure — Follows Chinese patent disclosure conventions
  • Concept-first workflow — Analyze your concept first, then generate chapters based on structured extraction
  • Technical feature analysis — AI extracts key elements, innovation points, and expected effects
  • Streaming generation — Watch each chapter generate in real time via SSE
  • Per-chapter editing — Edit any chapter manually, switch between Markdown edit and preview modes
  • Auto figure prompts — AI inserts [Figure N: description] markers; right panel shows the figure checklist
  • Version history — Every save creates a snapshot; rollback anytime
  • DOCX export — Professional Word documents with correct Chinese fonts (Song Ti / Hei Ti)
  • Markdown export — Plain text for other editing tools
  • Zero-config LLM — Auto-reads API keys from Claude Code settings or environment variables

Quick Start

Prerequisites

  • Python 3.10+
  • An Anthropic-compatible LLM API (e.g. DeepSeek, OpenAI, Claude)

Install

git clone https://github.com/Dyp130/Patent-assistant.git
cd Patent-assistant
pip install -r requirements.txt

Configure

Copy the example env file and set your credentials:

cp .env.example .env
# Edit .env with your API key, base URL, and model

Or export as environment variables:

export ANTHROPIC_BASE_URL="https://api.deepseek.com"
export ANTHROPIC_AUTH_TOKEN="your-api-key"
export ANTHROPIC_MODEL="deepseek-chat"

If you have Claude Code installed, the app automatically reads API config from ~/.claude/settings.json.

Launch

python run.py

Open http://127.0.0.1:8000

Usage

Workflow

Step Action
1 Click New Patent Draft, choose patent type, and enter your core technical concept
2 Click Save Concept, then optionally Analyze Technical Features
3 Click Generate All (or select individual chapters via AI Generate)
4 Review, edit, and preview each chapter
5 Export as DOCX or Markdown

Screenshots

Screenshots coming soon — run python run.py to see it in action.

Chapter Structure

# Chapter (EN) Chapter (中文) Description
1 Title 发明名称 Concise, ≤25 characters, no marketing terms
2 Technical Field 技术领域 Specific technical domain
3 Background Art 背景技术 2-3 existing solutions and their shortcomings
4 Purpose 发明目的 Technical problems to be solved
5 Technical Solution 技术方案 Core chapter: elements, relationships, mechanisms
6 Beneficial Effects 有益效果 Quantitative/qualitative advantages
7 Drawing Description 附图说明 Numbered list of all required figures
8 Detailed Embodiments 具体实施方式 At least one complete, reproducible embodiment
9 Alternative Embodiments 替代方案 Optional variants and alternatives
10 Key Points & Protection 关键点与保护点 Innovation points ranked by importance

Customizing

Edit config/prompts.yaml to adjust AI generation behavior for each chapter — no code changes needed. Variables use {placeholder} syntax.

chapter_5_technical_solution:
  system: |
    你是一位资深的中国专利代理人。
    请根据以下核心技术构思,撰写"技术方案"章节。
    ...
  user: |
    发明名称:{title}
    核心技术构思:{technical_concept}
    ...

Project Structure

Patent-assistant/
├── config/
│   ├── settings.py           # Configuration & env reading
│   ├── prompts.yaml          # AI prompt templates
│   └── chapter_schema.yaml   # Chapter definitions
├── src/
│   ├── main.py               # FastAPI application entry
│   ├── db/                   # Database setup (SQLAlchemy + SQLite)
│   ├── routes/               # Project, chapter, generation, export APIs
│   ├── models/               # ORM models and Pydantic schemas
│   ├── services/             # AI generation, analysis, export
│   ├── templates/            # Jinja2 HTML templates
│   └── static/               # CSS & vanilla JavaScript
├── .env.example              # API configuration template
├── requirements.txt
├── run.py                    # Launch script
└── README.md

Tech Stack

Layer Technology
Backend Python 3.10+ / FastAPI / SQLAlchemy
Database SQLite (zero-config, auto-created)
Frontend Jinja2 + vanilla JS + SSE streaming
AI Anthropic SDK (DeepSeek / OpenAI / Claude compatible)
Export python-docx (Chinese font configured), markdown
Design Zero build tools, single CSS file

Contributing

Contributions are welcome — see CONTRIBUTING.md.

  1. Fork the repo
  2. Create a branch (git checkout -b feat/your-feature)
  3. Commit your changes
  4. Push and open a Pull Request

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

patent_drafting_assistant-0.1.1.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patent_drafting_assistant-0.1.1-py3-none-any.whl (42.8 kB view details)

Uploaded Python 3

File details

Details for the file patent_drafting_assistant-0.1.1.tar.gz.

File metadata

File hashes

Hashes for patent_drafting_assistant-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0c3162e2b4f9918bb3d374968c82b8124fb787da532a768b7c48dd6f394642c8
MD5 252eb066bba447afaae46612fee9f0a7
BLAKE2b-256 f9a80465a3a38912a2d7fa62ddf0a05fe1e4ef17d63bb9300890e781d5659acd

See more details on using hashes here.

File details

Details for the file patent_drafting_assistant-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for patent_drafting_assistant-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 319afc6b36e96080840f9d2f77b35ac264fb42b6cae92bca560e2b27c226f4a1
MD5 d6350b84547f7ca76f31fb610a5959c7
BLAKE2b-256 c027605fd75cbbf669f16346f35a306e5f8232756881ceaaed7aa3c6070787d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page