A mkdocs plugin to generage summary with the help of AI.
Project description
mkdocs-ai-summary
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 tongyi ai and ChatGPT for now.
To use ChatGPT(default), you should set a Environmental Variable for api key:
export OPENAI_API_KEY='sk-xxxxxxx'To use tongyi ai, you should set a Environmental Variable for api key:
export DASHSCOPE_API_KEY='sk-xxxxxxx'
[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
Built Distribution
File details
Details for the file mkdocs_ai_summary-0.2.0.tar.gz
.
File metadata
- Download URL: mkdocs_ai_summary-0.2.0.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bdc501f8b7276b1b17a106c5ddac8ffedeb271ffe8cfdf45fd0807d3c249df54 |
|
MD5 | a4e48abf91de83d7c2ff361d6444d65b |
|
BLAKE2b-256 | a286b8a58e68154411376061aa0837d622a7f60f599ad02f7409fcedc7fef779 |
File details
Details for the file mkdocs_ai_summary-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: mkdocs_ai_summary-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77da13fbc73c36443a3efc6d1a92dabfd791d9c94b0bd0cd666cb49ce52240cd |
|
MD5 | 9a7fe88274c5563488f3953b1633710f |
|
BLAKE2b-256 | 472c22f735a1fed2d9596eedbd64cad13f90c1bf53e5f067f42ca286df928a31 |