Skip to content

Commit e7bf5c3

Browse files
author
zhangshulin
committed
更新版本至 1.1.8,修复文档文件删除逻辑并优化用户提示信息
1 parent b5c770b commit e7bf5c3

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

docapi/docapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def _write_doc(self, doc_dir, structures):
233233
doc_json_path.unlink(missing_ok=True)
234234

235235
for doc_file in doc_dir.glob('*.md'):
236-
if doc_file.name == 'index.md':
236+
if (doc_file.name == 'index.md') or (doc_file.suffix != '.md'):
237237
continue
238238
doc_file.unlink()
239239

docapi/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from docapi.docapi import DocAPI
1010

1111

12-
VERSION = '1.1.7'
12+
VERSION = '1.1.8'
1313

1414

1515
class Main:
@@ -40,7 +40,7 @@ def generate(app_path, doc_dir='docs', model=None, lang='zh', template=None, env
4040

4141
doc_dir = Path(doc_dir)
4242
if doc_dir.exists():
43-
user = input(f'The `{doc_dir.name}` directory already exists. Do you want to overwrite it? (y/n) ')
43+
user = input(f'The `{doc_dir.name}` directory already exists. Do you want to overwrite it? (y/n): ')
4444
print()
4545
if user.lower() != 'y':
4646
sys.exit(0)
@@ -81,14 +81,14 @@ def update(app_path, doc_dir='docs', model=None, lang='zh', template=None, env='
8181
if not doc_dir.is_dir():
8282
raise ValueError(f'Doc directory does not exist: `{doc_dir.name}`')
8383

84-
user = input(f'Updating the documentation will first clear the `./docs` folder. Do you want to continue? (y/n) ')
84+
user = input(f'Updating the documentation will first remove the API files in `{doc_dir.name}` folder.\nDo you want to continue? (y/n): ')
8585
print()
8686
if user.lower() != 'y':
8787
sys.exit(0)
8888

8989
model = model or os.getenv('DOCAPI_MODEL')
9090
if not model:
91-
raise ValueError('Missing model parameter. Either pass it as an argument or set the DOCAPI_MODEL environment variable. Example: --model=openai:gpt-4o-mini.')
91+
raise ValueError('Missing model parameter. Either pass it as an argument or set the DOCAPI_MODEL environment variable. Example: --model openai:gpt-4o-mini.')
9292

9393
docapi = DocAPI.build(model, lang, template, workers, static)
9494
docapi.update(app_path, doc_dir)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "docapi"
3-
version = "1.1.7"
3+
version = "1.1.8"
44
description = "DocAPI is a Python package that automatically generates API documentation using LLMs. It currently supports Flask and Django frameworks."
55
authors = ["zhangshulin <zhangslwork@yeah.net>"]
66
license = "Apache-2.0"

0 commit comments

Comments
 (0)