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

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.0.tar.gz (36.3 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.0-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for patent_drafting_assistant-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c0cb988929cb6132557dc6e59e243a6bd62dee885a49b7dbe7963ca4f15c3d11
MD5 e9cfea586b723a7afd547667e46d382c
BLAKE2b-256 c94b251c9c740f591cf7b1d8b8296346b5caa2e30fa2254b23c84bd6483df2cf

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for patent_drafting_assistant-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a7d4215df183cd8b5c9f7cb3fb229e7c01a29ee96631d7a9e8bcd18d1b40ab79
MD5 c70d5ff4d00044841869081a0a0cdb2e
BLAKE2b-256 7439829cb1c5142320b27ead6fa850f65050a94d22ed78db3a196bb43390ca12

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