Skip to main content

A mkdocs plugin to generage summary with the help of AI.

Project description

mkdocs-ai-summary

PyPI - Version PyPI - Implementation PyPI - Python Version

Generage an ai-summary for the page:

Minimal demo: aiboy996.github.io/mkdocs-ai-summary

Live demo(my homepage): yangzhang.site

Installation

You should install the package with pip:

pip install mkdocs-ai-summary[chatgpt]

or

pip install mkdocs-ai-summary[tongyi]

⚠️⚠️⚠️⚠️

Only support ChatGPT and tongyi ai for now.

To use ChatGPT(default), you should set a Environmental Variable for api key:

export OPENAI_API_KEY='sk-xxxxxxx'

how to get an OPENAI_API_KEY?

To use tongyi ai, you should set a Environmental Variable for api key:

export DASHSCOPE_API_KEY='sk-xxxxxxx'

how to get an DASHSCOPE_API_KEY?

[optional] Then you can include the ai-summary.css(optional, this is for the custom ai summary admonition style) in the config file as below:

Configuration

A demo for mkdocs.yml:

site_name: mkdocs-ai-summary
theme:
  name: material

plugins:
  - ai-summary:
      # these are all default value
      api: "chatgpt"
      model: "gpt-3.5-turbo"
      # we ignore ``` code block when do summary
      ignore_code: true 
      cache: true
      cache_dir: "./"
      prompt: "请帮我把下面的内容总结为200字以内的摘要:"
  - tags

markdown_extensions:
  - admonition
  - pymdownx.details
  - pymdownx.superfences
  - pymdownx.tabbed:
      alternate_style: true 
extra_css:
  - ai-summary.css

Then for each page you can add the ai-summary with a meta tag:

---
include:
- ai-summary
---

# h1

....

or you can use tongyi ai by setting:

plugins:
  - ai-summary:
      api: "tongyi"
      ignore_code: true
      cache: true
      cache_dir: "./"
      prompt: "请帮我把下面的内容总结为200字以内的摘要:"

About Cache

Don't worry about duplicate api calls, we've made the cache function so that if you've done an ai-summary before and the content hasn't changed it will use the cache.

Enjoy it.

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

mkdocs_ai_summary-0.2.1.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

mkdocs_ai_summary-0.2.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file mkdocs_ai_summary-0.2.1.tar.gz.

File metadata

  • Download URL: mkdocs_ai_summary-0.2.1.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.14

File hashes

Hashes for mkdocs_ai_summary-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cd0b7bd2708c94bce1e7d44e3131ebc32932c1b60f27b035d4811f57722feca4
MD5 e7a3b659c5dfde11fbff3c2a2bac63bc
BLAKE2b-256 c3afc5c1b51cb9dd1975d376df9d82753ec811a3985d746e52e1b6575ac447ab

See more details on using hashes here.

File details

Details for the file mkdocs_ai_summary-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for mkdocs_ai_summary-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ba767ce90676534ab9668c5753803c72fc0791876fd35d3f41c63aac5562f60c
MD5 d69229c1d618174baf10082451b117f6
BLAKE2b-256 76c87c383825127d396baba698c61b1b6263448dd584847ff7f41d07f297fffe

See more details on using hashes here.

Supported by

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