From cbdd04f20fc4c72717e25a0c313cc9a0f72d9758 Mon Sep 17 00:00:00 2001 From: zyz254009-crypto Date: Wed, 15 Jul 2026 19:29:12 +0800 Subject: [PATCH] fix Skills public imports --- docs/skills-import-optimization-report.md | 219 ++++++++++++++++++ skills/README.md | 14 +- skills/__init__.py | 4 +- skills/excel/__init__.py | 14 +- skills/excel/excel2pdf/SKILL.md | 4 +- skills/excel/fake2excel/SKILL.md | 4 +- skills/excel/find_excel_data/SKILL.md | 4 +- skills/excel/merge2excel/SKILL.md | 4 +- skills/excel/merge2sheet/SKILL.md | 4 +- skills/excel/sheet2excel/SKILL.md | 4 +- skills/excel/split_excel_by_column/SKILL.md | 4 +- skills/file/__init__.py | 18 +- skills/file/add_line_by_type/SKILL.md | 2 +- skills/file/file_name_add_postfix/SKILL.md | 4 +- skills/file/file_name_add_prefix/SKILL.md | 4 +- skills/file/file_name_insert_content/SKILL.md | 4 +- skills/file/get_files/SKILL.md | 4 +- skills/file/group_by_name/SKILL.md | 2 +- .../file/output_file_list_to_excel/SKILL.md | 4 +- skills/file/replace4filename/SKILL.md | 4 +- skills/file/search_specify_type_file/SKILL.md | 4 +- skills/finance/__init__.py | 2 +- skills/finance/t0/SKILL.md | 4 +- skills/image/__init__.py | 18 +- skills/image/add_watermark/SKILL.md | 4 +- skills/image/compress_image/SKILL.md | 4 +- skills/image/decode_qrcode/SKILL.md | 4 +- skills/image/del_watermark/SKILL.md | 4 +- skills/image/down4img/SKILL.md | 4 +- skills/image/image2gif/SKILL.md | 4 +- skills/image/img2Cartoon/SKILL.md | 4 +- skills/image/pencil4img/SKILL.md | 4 +- skills/image/txt2wordcloud/SKILL.md | 4 +- skills/markdown/__init__.py | 2 +- skills/markdown/excel2markdown/SKILL.md | 4 +- skills/ocr/VatInvoiceOCR2Excel/SKILL.md | 4 +- skills/ocr/__init__.py | 2 +- skills/pdf/__init__.py | 26 +-- skills/pdf/add_img_water/SKILL.md | 4 +- skills/pdf/add_mark/SKILL.md | 4 +- skills/pdf/add_text_watermark/SKILL.md | 4 +- skills/pdf/add_watermark/SKILL.md | 4 +- .../pdf/add_watermark_by_parameters/SKILL.md | 4 +- skills/pdf/decrypt4pdf/SKILL.md | 4 +- skills/pdf/del4pdf/SKILL.md | 4 +- skills/pdf/encrypt4pdf/SKILL.md | 4 +- skills/pdf/merge2pdf/SKILL.md | 4 +- skills/pdf/pdf2docx/SKILL.md | 4 +- skills/pdf/pdf2imgs/SKILL.md | 4 +- skills/pdf/split4pdf/SKILL.md | 4 +- skills/pdf/txt2pdf/SKILL.md | 4 +- skills/ppt/__init__.py | 6 +- skills/ppt/merge4ppt/SKILL.md | 4 +- skills/ppt/ppt2img/SKILL.md | 4 +- skills/ppt/ppt2pdf/SKILL.md | 4 +- skills/ruiming/__init__.py | 6 +- skills/ruiming/change_label_in_xml/SKILL.md | 4 +- skills/ruiming/screen_unmarked_image/SKILL.md | 4 +- .../screen_without_label_json_file/SKILL.md | 4 +- skills/tools/__init__.py | 20 +- skills/tools/course/SKILL.md | 4 +- skills/tools/create_article/SKILL.md | 4 +- skills/tools/lottery8ticket/SKILL.md | 4 +- skills/tools/net_speed_test/SKILL.md | 4 +- skills/tools/passwordtools/SKILL.md | 4 +- skills/tools/pwd4wifi/SKILL.md | 4 +- skills/tools/qrcodetools/SKILL.md | 4 +- skills/tools/transtools/SKILL.md | 4 +- skills/tools/url2ip/SKILL.md | 4 +- skills/tools/weather/SKILL.md | 4 +- skills/video/__init__.py | 8 +- skills/video/audio2txt/SKILL.md | 4 +- skills/video/mark2video/SKILL.md | 4 +- skills/video/txt2mp3/SKILL.md | 4 +- skills/video/video2mp3/SKILL.md | 4 +- skills/wechat/__init__.py | 14 +- skills/wechat/chat_by_keywords/SKILL.md | 4 +- skills/wechat/chat_robot/SKILL.md | 4 +- skills/wechat/group_send/SKILL.md | 4 +- skills/wechat/receive_message/SKILL.md | 4 +- skills/wechat/send_file/SKILL.md | 4 +- skills/wechat/send_message/SKILL.md | 4 +- skills/wechat/send_message_by_time/SKILL.md | 4 +- skills/word/__init__.py | 10 +- skills/word/doc2docx/SKILL.md | 8 +- skills/word/docx2doc/SKILL.md | 4 +- skills/word/docx2pdf/SKILL.md | 4 +- skills/word/docx4imgs/SKILL.md | 4 +- skills/word/merge4docx/SKILL.md | 4 +- tests/test_code/test_skills_imports.py | 39 ++++ 90 files changed, 486 insertions(+), 228 deletions(-) create mode 100644 docs/skills-import-optimization-report.md create mode 100644 tests/test_code/test_skills_imports.py diff --git a/docs/skills-import-optimization-report.md b/docs/skills-import-optimization-report.md new file mode 100644 index 0000000..a0490cc --- /dev/null +++ b/docs/skills-import-optimization-report.md @@ -0,0 +1,219 @@ +# python-office Skills 导入优化对比报告 + +## 1. 对比基线 + +- 项目目录:`E:\项目\python-office` +- 分支基线:`develop` +- 原项目基线提交:`2b1996b557c76a233642e261ae62da92b5dfa73e` +- 基线提交说明:`fix: 修复拆分Excel缺少tqdm导入、废弃API及抠图颜色提取引发的程序崩溃问题 (#161)` +- 对比方式:优化分支与上述 Git 提交进行比较。 + +## 2. 原项目存在的问题 + +项目 README 推荐如下用法: + +```python +from skills.pdf import pdf2docx +from skills.image import compress_image +from skills.tools import qrcodetools +``` + +但各分类包的 `__init__.py` 实际引用了不存在的 `office.skills`: + +```python +from office.skills.pdf.pdf2docx import pdf2docx +``` + +仓库中没有 `office/skills` 包,因此按 README 操作会出现: + +```text +ModuleNotFoundError: No module named 'office.skills' +``` + +这会导致 Skills 功能虽然已经编写,但用户无法通过项目公开入口导入。 + +## 3. 本次优化内容 + +### 3.1 修复分类包导入方式 + +将分类入口由不存在的绝对路径改成包内相对导入。 + +修改前: + +```python +from office.skills.pdf.pdf2docx import pdf2docx +``` + +修改后: + +```python +from .pdf2docx import pdf2docx +``` + +这样分类入口会调用仓库中真实存在的 `skills/<分类>/<功能>/__init__.py`,再由功能入口连接到 `office.api`。 + +### 3.2 统一 Skills 文档 + +将 Skills 文档里的错误示例: + +```python +from office.skills.pdf import pdf2docx +``` + +统一改为项目真实可用的公开入口: + +```python +from skills.pdf import pdf2docx +``` + +### 3.3 新增回归测试 + +新增 `tests/test_code/test_skills_imports.py`,自动检查: + +- 13 个 Skills 分类都能导入; +- 每个分类都有公开导出列表 `__all__`; +- 73 个公开导出对象都存在且可以调用; +- 后续修改不会再次引入同类导入错误。 + +## 4. 修改文件统计 + +| 类型 | 数量 | 说明 | +|---|---:|---| +| 已修改 Python 文件 | 14 | Skills 根说明及 13 个分类入口 | +| 已修改 Markdown 文件 | 74 | Skills 总索引及 73 个功能文档 | +| 新增测试文件 | 1 | Skills 公共导入回归测试 | +| 新增报告文件 | 1 | 本优化对比报告 | +| 合计涉及文件 | 90 | 88 个已有文件加 2 个新文件 | + +已有文件的 Git 文本差异为 228 行新增、228 行删除,全部属于导入路径替换;另新增回归测试和本报告。 + +## 5. Python 代码文件清单 + +以下 14 个已有 Python 文件被修改: + +1. `skills/__init__.py`:修正文档字符串中的示例导入路径。 +2. `skills/excel/__init__.py`:Excel 分类改用相对导入。 +3. `skills/file/__init__.py`:文件处理分类改用相对导入。 +4. `skills/finance/__init__.py`:金融分类改用相对导入。 +5. `skills/image/__init__.py`:图片分类改用相对导入。 +6. `skills/markdown/__init__.py`:Markdown 分类改用相对导入。 +7. `skills/ocr/__init__.py`:OCR 分类改用相对导入。 +8. `skills/pdf/__init__.py`:PDF 分类改用相对导入。 +9. `skills/ppt/__init__.py`:PPT 分类改用相对导入。 +10. `skills/ruiming/__init__.py`:实验 API 分类改用相对导入。 +11. `skills/tools/__init__.py`:工具分类改用相对导入。 +12. `skills/video/__init__.py`:视频分类改用相对导入。 +13. `skills/wechat/__init__.py`:微信分类改用相对导入。 +14. `skills/word/__init__.py`:Word 分类改用相对导入。 + +新增文件: + +- `tests/test_code/test_skills_imports.py`:Skills 分类和 73 个公开导出的回归测试。 + +## 6. Markdown 文档文件清单 + +### 总索引 + +- `skills/README.md` + +### Excel(7 个) + +- `skills/excel/{excel2pdf,fake2excel,find_excel_data,merge2excel,merge2sheet,sheet2excel,split_excel_by_column}/SKILL.md` + +### 文件处理(9 个) + +- `skills/file/{add_line_by_type,file_name_add_postfix,file_name_add_prefix,file_name_insert_content,get_files,group_by_name,output_file_list_to_excel,replace4filename,search_specify_type_file}/SKILL.md` + +### 金融(1 个) + +- `skills/finance/t0/SKILL.md` + +### 图片(9 个) + +- `skills/image/{add_watermark,compress_image,decode_qrcode,del_watermark,down4img,image2gif,img2Cartoon,pencil4img,txt2wordcloud}/SKILL.md` + +### Markdown(1 个) + +- `skills/markdown/excel2markdown/SKILL.md` + +### OCR(1 个) + +- `skills/ocr/VatInvoiceOCR2Excel/SKILL.md` + +### PDF(13 个) + +- `skills/pdf/{add_img_water,add_mark,add_text_watermark,add_watermark,add_watermark_by_parameters,decrypt4pdf,del4pdf,encrypt4pdf,merge2pdf,pdf2docx,pdf2imgs,split4pdf,txt2pdf}/SKILL.md` + +### PPT(3 个) + +- `skills/ppt/{merge4ppt,ppt2img,ppt2pdf}/SKILL.md` + +### 实验 API(3 个) + +- `skills/ruiming/{change_label_in_xml,screen_unmarked_image,screen_without_label_json_file}/SKILL.md` + +### 工具(10 个) + +- `skills/tools/{course,create_article,lottery8ticket,net_speed_test,passwordtools,pwd4wifi,qrcodetools,transtools,url2ip,weather}/SKILL.md` + +### 视频(4 个) + +- `skills/video/{audio2txt,mark2video,txt2mp3,video2mp3}/SKILL.md` + +### 微信(7 个) + +- `skills/wechat/{chat_by_keywords,chat_robot,group_send,receive_message,send_file,send_message,send_message_by_time}/SKILL.md` + +### Word(5 个) + +- `skills/word/{doc2docx,docx2doc,docx2pdf,docx4imgs,merge4docx}/SKILL.md` + +## 7. 优化后的效果 + +以下公开调用方式现已可用: + +```python +from skills.pdf import pdf2docx +from skills.image import compress_image +from skills.tools import qrcodetools +from skills.excel import fake2excel +``` + +本次修复覆盖 13 个分类和 73 个公开功能,使 README、Skills 文档与实际包结构保持一致,也为未来桌面客户端通过统一入口发现和调用功能打下基础。 + +## 8. 验证结果 + +执行的专项测试: + +```powershell +.\venv\Scripts\python.exe -m unittest tests.test_code.test_skills_imports -v +``` + +结果: + +```text +Ran 1 test +OK +``` + +独立测试 Agent 还完成了以下复核: + +- 13 个分类全部导入成功; +- 73 个 `__all__` 导出全部存在且可调用; +- README 常用导入全部通过; +- `setuptools.find_packages()` 能发现顶层 `skills` 及其子包; +- `git diff --check` 通过; +- `skills` 目录中已无残留的 `office.skills` 错误路径; +- 建议保留优化,无需回滚。 + +## 9. 本次没有修改的内容 + +- 没有修改 `office/api` 业务实现; +- 没有修改 PDF、Excel、Word、图片等功能的处理逻辑; +- 没有制作或修改桌面客户端; +- 没有提交用户创建的 `demo.py` 和 `qrcode.png`; +- 没有逐个执行可能修改文件、发送微信或调用外部 API 的功能。 + +## 10. 已知提示 + +Git 在 Windows 上提示部分 Python 文件未来可能由 LF 转换为 CRLF。`git diff --check` 已通过,该提示不影响本次功能,但后续可通过统一 `.gitattributes` 作为单独优化项处理。 diff --git a/skills/README.md b/skills/README.md index af07cf1..fed6bc3 100644 --- a/skills/README.md +++ b/skills/README.md @@ -28,11 +28,11 @@ ```python # 方式 1:直接导入函数 -from office.skills.excel import fake2excel +from skills.excel import fake2excel fake2excel(rows=10) # 方式 2:导入子模块 -from office.skills.excel import fake2excel as fe +from skills.excel import fake2excel as fe fe(rows=10, columns=['name', 'phone']) ``` @@ -63,7 +63,7 @@ fe(rows=10, columns=['name', 'phone']) 调用示例: ```python -from office.skills.excel import fake2excel +from skills.excel import fake2excel fake2excel(columns=['name', 'phone'], rows=100, path='./test.xlsx') ``` @@ -85,7 +85,7 @@ fake2excel(columns=['name', 'phone'], rows=100, path='./test.xlsx') 调用示例: ```python -from office.skills.file import replace4filename +from skills.file import replace4filename replace4filename(path='./test_dir', del_content='old', replace_content='new') ``` @@ -99,7 +99,7 @@ replace4filename(path='./test_dir', del_content='old', replace_content='new') 调用示例: ```python -from office.skills.finance import t0 +from skills.finance import t0 profit = t0(buy_price=11.99, sale_price=12.26, shares=700) print(profit) ``` @@ -122,7 +122,7 @@ print(profit) 调用示例: ```python -from office.skills.image import add_watermark +from skills.image import add_watermark add_watermark(file='test.png', mark='python-office') ``` @@ -249,7 +249,7 @@ office/skills/// ``` - **细粒度**:每个方法对应一个独立 Skill -- **可单独调用**:每个 Skill 都可通过 `from office.skills. import ` 单独使用 +- **可单独调用**:每个 Skill 都可通过 `from skills. import ` 单独使用 - **文档齐全**:每个 Skill 都有对应的 `SKILL.md` 详细说明 --- diff --git a/skills/__init__.py b/skills/__init__.py index f0007e1..3851bc4 100644 --- a/skills/__init__.py +++ b/skills/__init__.py @@ -6,10 +6,10 @@ 每个 Skill 都是一个独立的子目录,可以单独调用。 使用方式: - from office.skills.excel import fake2excel + from skills.excel import fake2excel fake2excel(rows=10) - from office.skills.image import add_watermark + from skills.image import add_watermark add_watermark(file='test.png', mark='python-office') 详细功能列表见本目录下的 README.md。 diff --git a/skills/excel/__init__.py b/skills/excel/__init__.py index 495b3e5..30dbf82 100644 --- a/skills/excel/__init__.py +++ b/skills/excel/__init__.py @@ -1,12 +1,12 @@ # -*- coding: UTF-8 -*- """Excel Skills 包 - 统一暴露 Excel 处理相关的所有 Skills""" -from office.skills.excel.fake2excel import fake2excel -from office.skills.excel.merge2excel import merge2excel -from office.skills.excel.sheet2excel import sheet2excel -from office.skills.excel.merge2sheet import merge2sheet -from office.skills.excel.find_excel_data import find_excel_data -from office.skills.excel.split_excel_by_column import split_excel_by_column -from office.skills.excel.excel2pdf import excel2pdf +from .fake2excel import fake2excel +from .merge2excel import merge2excel +from .sheet2excel import sheet2excel +from .merge2sheet import merge2sheet +from .find_excel_data import find_excel_data +from .split_excel_by_column import split_excel_by_column +from .excel2pdf import excel2pdf __all__ = [ 'fake2excel', diff --git a/skills/excel/excel2pdf/SKILL.md b/skills/excel/excel2pdf/SKILL.md index 0f7b805..9c4ee8d 100644 --- a/skills/excel/excel2pdf/SKILL.md +++ b/skills/excel/excel2pdf/SKILL.md @@ -18,7 +18,7 @@ description: 将 Excel 文件的指定工作表转换为 PDF 格式。当用户 ## 调用方式 ```python -from office.skills.excel import excel2pdf +from skills.excel import excel2pdf excel2pdf( excel_path='./data.xlsx', @@ -42,7 +42,7 @@ excel2pdf( ## 使用示例 ```python -from office.skills.excel import excel2pdf +from skills.excel import excel2pdf excel2pdf(excel_path='./report.xlsx', pdf_path='./report.pdf', sheet_id=0) ``` diff --git a/skills/excel/fake2excel/SKILL.md b/skills/excel/fake2excel/SKILL.md index 3f55b8c..a10d9fa 100644 --- a/skills/excel/fake2excel/SKILL.md +++ b/skills/excel/fake2excel/SKILL.md @@ -18,7 +18,7 @@ description: 自动创建 Excel 并模拟数据。当用户提到生成测试数 ## 调用方式 ```python -from office.skills.excel import fake2excel +from skills.excel import fake2excel fake2excel( columns=['name', 'phone'], @@ -45,7 +45,7 @@ fake2excel( ```python # 示例 1:生成中文测试数据 -from office.skills.excel import fake2excel +from skills.excel import fake2excel fake2excel(columns=['name', 'phone', 'address'], rows=1000, path='./test_cn.xlsx') # 示例 2:生成英文测试数据 diff --git a/skills/excel/find_excel_data/SKILL.md b/skills/excel/find_excel_data/SKILL.md index 325f5bc..6908ef4 100644 --- a/skills/excel/find_excel_data/SKILL.md +++ b/skills/excel/find_excel_data/SKILL.md @@ -18,7 +18,7 @@ description: 在 Excel 文件中搜索指定关键词并返回文件、行号、 ## 调用方式 ```python -from office.skills.excel import find_excel_data +from skills.excel import find_excel_data find_excel_data( search_key='python', @@ -40,7 +40,7 @@ find_excel_data( ## 使用示例 ```python -from office.skills.excel import find_excel_data +from skills.excel import find_excel_data find_excel_data(search_key='订单', target_dir='./订单数据') ``` diff --git a/skills/excel/merge2excel/SKILL.md b/skills/excel/merge2excel/SKILL.md index 9ce297f..e96614e 100644 --- a/skills/excel/merge2excel/SKILL.md +++ b/skills/excel/merge2excel/SKILL.md @@ -18,7 +18,7 @@ description: 将多个 Excel 文件合并到一个 Excel 的不同 sheet 中。 ## 调用方式 ```python -from office.skills.excel import merge2excel +from skills.excel import merge2excel merge2excel( dir_path='./excel_files', @@ -40,7 +40,7 @@ merge2excel( ## 使用示例 ```python -from office.skills.excel import merge2excel +from skills.excel import merge2excel merge2excel(dir_path='./excels', output_file='./all_in_one.xlsx') ``` diff --git a/skills/excel/merge2sheet/SKILL.md b/skills/excel/merge2sheet/SKILL.md index 0472a72..8e565e4 100644 --- a/skills/excel/merge2sheet/SKILL.md +++ b/skills/excel/merge2sheet/SKILL.md @@ -18,7 +18,7 @@ description: 将多个 Excel 文件的多个 sheet 合并到同一个 sheet。 ## 调用方式 ```python -from office.skills.excel import merge2sheet +from skills.excel import merge2sheet merge2sheet( dir_path='./excels', @@ -42,7 +42,7 @@ merge2sheet( ## 使用示例 ```python -from office.skills.excel import merge2sheet +from skills.excel import merge2sheet merge2sheet(dir_path='./my_excels', output_sheet_name='AllData', output_excel_name='all_merged') ``` diff --git a/skills/excel/sheet2excel/SKILL.md b/skills/excel/sheet2excel/SKILL.md index 326e6c2..0997413 100644 --- a/skills/excel/sheet2excel/SKILL.md +++ b/skills/excel/sheet2excel/SKILL.md @@ -18,7 +18,7 @@ description: 将同一个 Excel 文件的多个 sheet 拆分为独立文件。 ## 调用方式 ```python -from office.skills.excel import sheet2excel +from skills.excel import sheet2excel sheet2excel( file_path='./multi_sheet.xlsx', @@ -40,7 +40,7 @@ sheet2excel( ## 使用示例 ```python -from office.skills.excel import sheet2excel +from skills.excel import sheet2excel sheet2excel(file_path='./data.xlsx', output_path='./split_output/') ``` diff --git a/skills/excel/split_excel_by_column/SKILL.md b/skills/excel/split_excel_by_column/SKILL.md index da9a69c..80739c9 100644 --- a/skills/excel/split_excel_by_column/SKILL.md +++ b/skills/excel/split_excel_by_column/SKILL.md @@ -18,7 +18,7 @@ description: 按指定列的内容拆分 Excel 文件,每个唯一值一个文 ## 调用方式 ```python -from office.skills.excel import split_excel_by_column +from skills.excel import split_excel_by_column split_excel_by_column( filepath='./data.xlsx', @@ -42,7 +42,7 @@ split_excel_by_column( ## 使用示例 ```python -from office.skills.excel import split_excel_by_column +from skills.excel import split_excel_by_column # 按第 0 列拆分 split_excel_by_column(filepath='./orders.xlsx', column=0) ``` diff --git a/skills/file/__init__.py b/skills/file/__init__.py index 59ebb3c..cb6ff74 100644 --- a/skills/file/__init__.py +++ b/skills/file/__init__.py @@ -1,14 +1,14 @@ # -*- coding: UTF-8 -*- """File Skills 包 - 统一暴露文件处理相关的所有 Skills""" -from office.skills.file.replace4filename import replace4filename -from office.skills.file.file_name_insert_content import file_name_insert_content -from office.skills.file.file_name_add_prefix import file_name_add_prefix -from office.skills.file.file_name_add_postfix import file_name_add_postfix -from office.skills.file.output_file_list_to_excel import output_file_list_to_excel -from office.skills.file.add_line_by_type import add_line_by_type -from office.skills.file.search_specify_type_file import search_specify_type_file -from office.skills.file.group_by_name import group_by_name -from office.skills.file.get_files import get_files +from .replace4filename import replace4filename +from .file_name_insert_content import file_name_insert_content +from .file_name_add_prefix import file_name_add_prefix +from .file_name_add_postfix import file_name_add_postfix +from .output_file_list_to_excel import output_file_list_to_excel +from .add_line_by_type import add_line_by_type +from .search_specify_type_file import search_specify_type_file +from .group_by_name import group_by_name +from .get_files import get_files __all__ = [ 'replace4filename', diff --git a/skills/file/add_line_by_type/SKILL.md b/skills/file/add_line_by_type/SKILL.md index a1e2e99..00254d3 100644 --- a/skills/file/add_line_by_type/SKILL.md +++ b/skills/file/add_line_by_type/SKILL.md @@ -20,7 +20,7 @@ description: 根据文件类型向指定文件中添加代码行。当用户提 ## 调用方式 ```python -from office.skills.file import add_line_by_type +from skills.file import add_line_by_type add_line_by_type( add_line_dict={'import': 'import os'}, diff --git a/skills/file/file_name_add_postfix/SKILL.md b/skills/file/file_name_add_postfix/SKILL.md index 346de11..c1bcb9b 100644 --- a/skills/file/file_name_add_postfix/SKILL.md +++ b/skills/file/file_name_add_postfix/SKILL.md @@ -18,7 +18,7 @@ description: 给文件名批量增加指定后缀。当用户提到加后缀、 ## 调用方式 ```python -from office.skills.file import file_name_add_postfix +from skills.file import file_name_add_postfix file_name_add_postfix( file_path='./test.txt', @@ -40,7 +40,7 @@ file_name_add_postfix( ## 使用示例 ```python -from office.skills.file import file_name_add_postfix +from skills.file import file_name_add_postfix file_name_add_postfix(file_path='./data.txt', postfix_content='_v1') ``` diff --git a/skills/file/file_name_add_prefix/SKILL.md b/skills/file/file_name_add_prefix/SKILL.md index 6c3b710..cfb3159 100644 --- a/skills/file/file_name_add_prefix/SKILL.md +++ b/skills/file/file_name_add_prefix/SKILL.md @@ -18,7 +18,7 @@ description: 给文件名批量增加指定前缀。当用户提到加前缀、 ## 调用方式 ```python -from office.skills.file import file_name_add_prefix +from skills.file import file_name_add_prefix file_name_add_prefix( file_path='./test.txt', @@ -40,7 +40,7 @@ file_name_add_prefix( ## 使用示例 ```python -from office.skills.file import file_name_add_prefix +from skills.file import file_name_add_prefix file_name_add_prefix(file_path='./doc.txt', prefix_content='backup_') ``` diff --git a/skills/file/file_name_insert_content/SKILL.md b/skills/file/file_name_insert_content/SKILL.md index 12bbe3d..180b14b 100644 --- a/skills/file/file_name_insert_content/SKILL.md +++ b/skills/file/file_name_insert_content/SKILL.md @@ -18,7 +18,7 @@ description: 在文件名中间指定位置插入字符。当用户提到文件 ## 调用方式 ```python -from office.skills.file import file_name_insert_content +from skills.file import file_name_insert_content file_name_insert_content( file_path='./test.txt', @@ -42,7 +42,7 @@ file_name_insert_content( ## 使用示例 ```python -from office.skills.file import file_name_insert_content +from skills.file import file_name_insert_content file_name_insert_content(file_path='./report.txt', insert_position=2, insert_content='_2024') ``` diff --git a/skills/file/get_files/SKILL.md b/skills/file/get_files/SKILL.md index 3f93f71..47139fd 100644 --- a/skills/file/get_files/SKILL.md +++ b/skills/file/get_files/SKILL.md @@ -18,7 +18,7 @@ description: 在指定路径下搜索文件并返回路径列表,支持按后 ## 调用方式 ```python -from office.skills.file import get_files +from skills.file import get_files files = get_files( path='./data', @@ -46,7 +46,7 @@ files = get_files( ## 使用示例 ```python -from office.skills.file import get_files +from skills.file import get_files # 获取所有 .txt 文件 txt_files = get_files(path='./docs', suffix='.txt', sub=True) # 获取所有名为 report 的文件 diff --git a/skills/file/group_by_name/SKILL.md b/skills/file/group_by_name/SKILL.md index e46a376..1988140 100644 --- a/skills/file/group_by_name/SKILL.md +++ b/skills/file/group_by_name/SKILL.md @@ -20,7 +20,7 @@ description: 按文件名的规则将文件分组整理到不同目录。当用 ## 调用方式 ```python -from office.skills.file import group_by_name +from skills.file import group_by_name group_by_name( path='./data', diff --git a/skills/file/output_file_list_to_excel/SKILL.md b/skills/file/output_file_list_to_excel/SKILL.md index 69667b5..9f2e1e6 100644 --- a/skills/file/output_file_list_to_excel/SKILL.md +++ b/skills/file/output_file_list_to_excel/SKILL.md @@ -18,7 +18,7 @@ description: 将文件夹下的所有文件名整理到一个 Excel 表格中。 ## 调用方式 ```python -from office.skills.file import output_file_list_to_excel +from skills.file import output_file_list_to_excel output_file_list_to_excel(dir_path='./data') ``` @@ -36,7 +36,7 @@ output_file_list_to_excel(dir_path='./data') ## 使用示例 ```python -from office.skills.file import output_file_list_to_excel +from skills.file import output_file_list_to_excel output_file_list_to_excel(dir_path='./我的文件夹') ``` diff --git a/skills/file/replace4filename/SKILL.md b/skills/file/replace4filename/SKILL.md index 7119e78..c9e041f 100644 --- a/skills/file/replace4filename/SKILL.md +++ b/skills/file/replace4filename/SKILL.md @@ -18,7 +18,7 @@ description: 批量修改文件/文件夹名称,替换或删除指定内容。 ## 调用方式 ```python -from office.skills.file import replace4filename +from skills.file import replace4filename replace4filename( path='./my_folder', @@ -48,7 +48,7 @@ replace4filename( ## 使用示例 ```python -from office.skills.file import replace4filename +from skills.file import replace4filename # 批量替换文件名中的"old"为"new" replace4filename(path='./data', del_content='old', replace_content='new') # 批量删除文件名中的"tmp" diff --git a/skills/file/search_specify_type_file/SKILL.md b/skills/file/search_specify_type_file/SKILL.md index 60a142c..757b0f1 100644 --- a/skills/file/search_specify_type_file/SKILL.md +++ b/skills/file/search_specify_type_file/SKILL.md @@ -18,7 +18,7 @@ description: 在指定路径下搜索指定类型的文件(如 .txt、.pdf) ## 调用方式 ```python -from office.skills.file import search_specify_type_file +from skills.file import search_specify_type_file search_specify_type_file( file_path='./data', @@ -40,7 +40,7 @@ search_specify_type_file( ## 使用示例 ```python -from office.skills.file import search_specify_type_file +from skills.file import search_specify_type_file search_specify_type_file(file_path='./docs', file_type='.pdf') ``` diff --git a/skills/finance/__init__.py b/skills/finance/__init__.py index fee1e68..217800f 100644 --- a/skills/finance/__init__.py +++ b/skills/finance/__init__.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 -*- """Finance Skills 包 - 统一暴露金融计算相关的所有 Skills""" -from office.skills.finance.t0 import t0 +from .t0 import t0 __all__ = ['t0'] diff --git a/skills/finance/t0/SKILL.md b/skills/finance/t0/SKILL.md index aee8910..a4911ea 100644 --- a/skills/finance/t0/SKILL.md +++ b/skills/finance/t0/SKILL.md @@ -18,7 +18,7 @@ description: 计算股票 T+0 交易的收益,考虑买入价、卖出价、 ## 调用方式 ```python -from office.skills.finance import t0 +from skills.finance import t0 profit = t0( buy_price=11.99, @@ -46,7 +46,7 @@ print(profit) ## 使用示例 ```python -from office.skills.finance import t0 +from skills.finance import t0 # 买 11.99 卖 12.26,700 股 profit = t0(buy_price=11.99, sale_price=12.26, shares=700) print(f"本次做T收益: {profit} 元") diff --git a/skills/image/__init__.py b/skills/image/__init__.py index 9ca4979..fcf59d8 100644 --- a/skills/image/__init__.py +++ b/skills/image/__init__.py @@ -1,14 +1,14 @@ # -*- coding: UTF-8 -*- """Image Skills 包 - 统一暴露图像处理相关的所有 Skills""" -from office.skills.image.compress_image import compress_image -from office.skills.image.image2gif import image2gif -from office.skills.image.add_watermark import add_watermark -from office.skills.image.img2Cartoon import img2Cartoon -from office.skills.image.down4img import down4img -from office.skills.image.txt2wordcloud import txt2wordcloud -from office.skills.image.pencil4img import pencil4img -from office.skills.image.decode_qrcode import decode_qrcode -from office.skills.image.del_watermark import del_watermark +from .compress_image import compress_image +from .image2gif import image2gif +from .add_watermark import add_watermark +from .img2Cartoon import img2Cartoon +from .down4img import down4img +from .txt2wordcloud import txt2wordcloud +from .pencil4img import pencil4img +from .decode_qrcode import decode_qrcode +from .del_watermark import del_watermark __all__ = [ 'compress_image', diff --git a/skills/image/add_watermark/SKILL.md b/skills/image/add_watermark/SKILL.md index bf18e48..617d761 100644 --- a/skills/image/add_watermark/SKILL.md +++ b/skills/image/add_watermark/SKILL.md @@ -18,7 +18,7 @@ description: 通过交互方式给 PDF 添加水印。当用户提到 PDF 互动 ## 调用方式 ```python -from office.skills.image import add_watermark +from skills.image import add_watermark add_watermark( file='./test.png', @@ -52,7 +52,7 @@ add_watermark( ## 使用示例 ```python -from office.skills.image import add_watermark +from skills.image import add_watermark add_watermark(file='./photo.jpg', mark='我的水印') ``` diff --git a/skills/image/compress_image/SKILL.md b/skills/image/compress_image/SKILL.md index fc15d8d..f5d7fd6 100644 --- a/skills/image/compress_image/SKILL.md +++ b/skills/image/compress_image/SKILL.md @@ -18,7 +18,7 @@ description: 压缩图片文件大小,通过调整质量参数控制输出体 ## 调用方式 ```python -from office.skills.image import compress_image +from skills.image import compress_image compress_image( input_file='./test.png', @@ -42,7 +42,7 @@ compress_image( ## 使用示例 ```python -from office.skills.image import compress_image +from skills.image import compress_image compress_image(input_file='./photo.jpg', output_file='./photo_small.jpg', quality=30) ``` diff --git a/skills/image/decode_qrcode/SKILL.md b/skills/image/decode_qrcode/SKILL.md index 20f7854..4d10057 100644 --- a/skills/image/decode_qrcode/SKILL.md +++ b/skills/image/decode_qrcode/SKILL.md @@ -18,7 +18,7 @@ description: 解析二维码图片并提取其中的文本内容。当用户提 ## 调用方式 ```python -from office.skills.image import decode_qrcode +from skills.image import decode_qrcode decode_qrcode(qrcode_path='./qrcode.png') ``` @@ -36,7 +36,7 @@ decode_qrcode(qrcode_path='./qrcode.png') ## 使用示例 ```python -from office.skills.image import decode_qrcode +from skills.image import decode_qrcode decode_qrcode(qrcode_path='./my_qrcode.png') ``` diff --git a/skills/image/del_watermark/SKILL.md b/skills/image/del_watermark/SKILL.md index 9b8744a..29ccfec 100644 --- a/skills/image/del_watermark/SKILL.md +++ b/skills/image/del_watermark/SKILL.md @@ -18,7 +18,7 @@ description: 从图片中删除水印并保存。当用户提到去水印、去 ## 调用方式 ```python -from office.skills.image import del_watermark +from skills.image import del_watermark del_watermark( input_image='./with_watermark.jpg', @@ -40,7 +40,7 @@ del_watermark( ## 使用示例 ```python -from office.skills.image import del_watermark +from skills.image import del_watermark del_watermark(input_image='./photo.jpg') ``` diff --git a/skills/image/down4img/SKILL.md b/skills/image/down4img/SKILL.md index dc8b071..5ddad0b 100644 --- a/skills/image/down4img/SKILL.md +++ b/skills/image/down4img/SKILL.md @@ -18,7 +18,7 @@ description: 从指定 URL 下载图片并保存到本地。当用户提到下 ## 调用方式 ```python -from office.skills.image import down4img +from skills.image import down4img down4img( url='https://example.com/image.png', @@ -44,7 +44,7 @@ down4img( ## 使用示例 ```python -from office.skills.image import down4img +from skills.image import down4img down4img(url='https://example.com/photo.jpg') ``` diff --git a/skills/image/image2gif/SKILL.md b/skills/image/image2gif/SKILL.md index 3db40fa..4d0c310 100644 --- a/skills/image/image2gif/SKILL.md +++ b/skills/image/image2gif/SKILL.md @@ -18,7 +18,7 @@ description: 将一组图像转换为 GIF 动图格式。当用户提到图片 ## 调用方式 ```python -from office.skills.image import image2gif +from skills.image import image2gif image2gif() ``` @@ -34,7 +34,7 @@ image2gif() ## 使用示例 ```python -from office.skills.image import image2gif +from skills.image import image2gif image2gif() ``` diff --git a/skills/image/img2Cartoon/SKILL.md b/skills/image/img2Cartoon/SKILL.md index 3bc0cb5..5e14e9b 100644 --- a/skills/image/img2Cartoon/SKILL.md +++ b/skills/image/img2Cartoon/SKILL.md @@ -18,7 +18,7 @@ description: 通过百度 API 将图片转换为卡通风格。当用户提到 ## 调用方式 ```python -from office.skills.image import img2Cartoon +from skills.image import img2Cartoon img2Cartoon( path='./test.png', @@ -42,7 +42,7 @@ img2Cartoon( ## 使用示例 ```python -from office.skills.image import img2Cartoon +from skills.image import img2Cartoon img2Cartoon(path='./photo.jpg') ``` diff --git a/skills/image/pencil4img/SKILL.md b/skills/image/pencil4img/SKILL.md index 5bd280c..d71add4 100644 --- a/skills/image/pencil4img/SKILL.md +++ b/skills/image/pencil4img/SKILL.md @@ -18,7 +18,7 @@ description: 将输入的图片转换为铅笔画风格。当用户提到铅笔 ## 调用方式 ```python -from office.skills.image import pencil4img +from skills.image import pencil4img pencil4img( input_img='./test.jpg', @@ -42,7 +42,7 @@ pencil4img( ## 使用示例 ```python -from office.skills.image import pencil4img +from skills.image import pencil4img pencil4img(input_img='./photo.jpg') ``` diff --git a/skills/image/txt2wordcloud/SKILL.md b/skills/image/txt2wordcloud/SKILL.md index b8cf109..49be249 100644 --- a/skills/image/txt2wordcloud/SKILL.md +++ b/skills/image/txt2wordcloud/SKILL.md @@ -18,7 +18,7 @@ description: 根据文本文件生成词云图片,支持自定义背景色。 ## 调用方式 ```python -from office.skills.image import txt2wordcloud +from skills.image import txt2wordcloud txt2wordcloud( filename='./text.txt', @@ -42,7 +42,7 @@ txt2wordcloud( ## 使用示例 ```python -from office.skills.image import txt2wordcloud +from skills.image import txt2wordcloud txt2wordcloud(filename='./article.txt', result_file='./my_wordcloud.png') ``` diff --git a/skills/markdown/__init__.py b/skills/markdown/__init__.py index 615b31a..4af27c6 100644 --- a/skills/markdown/__init__.py +++ b/skills/markdown/__init__.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 -*- """Markdown Skills 包 - 统一暴露 Markdown 处理相关的所有 Skills""" -from office.skills.markdown.excel2markdown import excel2markdown +from .excel2markdown import excel2markdown __all__ = ['excel2markdown'] diff --git a/skills/markdown/excel2markdown/SKILL.md b/skills/markdown/excel2markdown/SKILL.md index 321fea9..1ba75eb 100644 --- a/skills/markdown/excel2markdown/SKILL.md +++ b/skills/markdown/excel2markdown/SKILL.md @@ -18,7 +18,7 @@ description: 将 Excel 文件转换为 Markdown 格式的文档。当用户提 ## 调用方式 ```python -from office.skills.markdown import excel2markdown +from skills.markdown import excel2markdown excel2markdown( input_file='./data.xlsx', @@ -42,7 +42,7 @@ excel2markdown( ## 使用示例 ```python -from office.skills.markdown import excel2markdown +from skills.markdown import excel2markdown excel2markdown(input_file='./report.xlsx', output_file='./report.md') ``` diff --git a/skills/ocr/VatInvoiceOCR2Excel/SKILL.md b/skills/ocr/VatInvoiceOCR2Excel/SKILL.md index 22a094b..bd9a410 100644 --- a/skills/ocr/VatInvoiceOCR2Excel/SKILL.md +++ b/skills/ocr/VatInvoiceOCR2Excel/SKILL.md @@ -18,7 +18,7 @@ description: 用 OCR 技术识别增值税发票图片并导出到 Excel,支 ## 调用方式 ```python -from office.skills.ocr import VatInvoiceOCR2Excel +from skills.ocr import VatInvoiceOCR2Excel VatInvoiceOCR2Excel( input_path='./invoices', @@ -49,7 +49,7 @@ VatInvoiceOCR2Excel( ## 使用示例 ```python -from office.skills.ocr import VatInvoiceOCR2Excel +from skills.ocr import VatInvoiceOCR2Excel VatInvoiceOCR2Excel(input_path='./发票图片', output_excel='所有发票汇总.xlsx') ``` diff --git a/skills/ocr/__init__.py b/skills/ocr/__init__.py index e3e1bc6..7508976 100644 --- a/skills/ocr/__init__.py +++ b/skills/ocr/__init__.py @@ -1,5 +1,5 @@ # -*- coding: UTF-8 -*- """OCR Skills 包 - 统一暴露 OCR 识别相关的所有 Skills""" -from office.skills.ocr.VatInvoiceOCR2Excel import VatInvoiceOCR2Excel +from .VatInvoiceOCR2Excel import VatInvoiceOCR2Excel __all__ = ['VatInvoiceOCR2Excel'] diff --git a/skills/pdf/__init__.py b/skills/pdf/__init__.py index eac05e3..48f1260 100644 --- a/skills/pdf/__init__.py +++ b/skills/pdf/__init__.py @@ -1,18 +1,18 @@ # -*- coding: UTF-8 -*- """PDF Skills 包 - 统一暴露 PDF 处理相关的所有 Skills""" -from office.skills.pdf.pdf2docx import pdf2docx -from office.skills.pdf.pdf2imgs import pdf2imgs -from office.skills.pdf.txt2pdf import txt2pdf -from office.skills.pdf.split4pdf import split4pdf -from office.skills.pdf.encrypt4pdf import encrypt4pdf -from office.skills.pdf.decrypt4pdf import decrypt4pdf -from office.skills.pdf.add_text_watermark import add_text_watermark -from office.skills.pdf.merge2pdf import merge2pdf -from office.skills.pdf.del4pdf import del4pdf -from office.skills.pdf.add_img_water import add_img_water -from office.skills.pdf.add_watermark import add_watermark -from office.skills.pdf.add_mark import add_mark -from office.skills.pdf.add_watermark_by_parameters import add_watermark_by_parameters +from .pdf2docx import pdf2docx +from .pdf2imgs import pdf2imgs +from .txt2pdf import txt2pdf +from .split4pdf import split4pdf +from .encrypt4pdf import encrypt4pdf +from .decrypt4pdf import decrypt4pdf +from .add_text_watermark import add_text_watermark +from .merge2pdf import merge2pdf +from .del4pdf import del4pdf +from .add_img_water import add_img_water +from .add_watermark import add_watermark +from .add_mark import add_mark +from .add_watermark_by_parameters import add_watermark_by_parameters __all__ = [ 'pdf2docx', diff --git a/skills/pdf/add_img_water/SKILL.md b/skills/pdf/add_img_water/SKILL.md index cd9c76b..906ae74 100644 --- a/skills/pdf/add_img_water/SKILL.md +++ b/skills/pdf/add_img_water/SKILL.md @@ -18,7 +18,7 @@ description: 给 PDF 添加图片水印(logo 等)。当用户提到 PDF 图 ## 调用方式 ```python -from office.skills.pdf import add_img_water +from skills.pdf import add_img_water add_img_water( input_file='./test.pdf', @@ -45,7 +45,7 @@ add_img_water( ## 使用示例 ```python -from office.skills.pdf import add_img_water +from skills.pdf import add_img_water add_img_water( input_file='./report.pdf', mark_file='./logo.png', diff --git a/skills/pdf/add_mark/SKILL.md b/skills/pdf/add_mark/SKILL.md index a3d4199..5d61c8f 100644 --- a/skills/pdf/add_mark/SKILL.md +++ b/skills/pdf/add_mark/SKILL.md @@ -18,7 +18,7 @@ description: 给 PDF 添加文字水印(简化接口)。当用户提到 PDF ## 调用方式 ```python -from office.skills.pdf import add_mark +from skills.pdf import add_mark add_mark( input_file='./test.pdf', @@ -46,7 +46,7 @@ add_mark( ## 使用示例 ```python -from office.skills.pdf import add_mark +from skills.pdf import add_mark add_mark(input_file='./report.pdf', mark_str='机密') ``` diff --git a/skills/pdf/add_text_watermark/SKILL.md b/skills/pdf/add_text_watermark/SKILL.md index ba74419..4c97187 100644 --- a/skills/pdf/add_text_watermark/SKILL.md +++ b/skills/pdf/add_text_watermark/SKILL.md @@ -18,7 +18,7 @@ description: 给 PDF 添加文字水印,支持自定义字体、字号、颜 ## 调用方式 ```python -from office.skills.pdf import add_text_watermark +from skills.pdf import add_text_watermark add_text_watermark( input_file='./test.pdf', @@ -50,7 +50,7 @@ add_text_watermark( ## 使用示例 ```python -from office.skills.pdf import add_text_watermark +from skills.pdf import add_text_watermark add_text_watermark(input_file='./report.pdf', text='机密文件') ``` diff --git a/skills/pdf/add_watermark/SKILL.md b/skills/pdf/add_watermark/SKILL.md index cbc255b..2c1ce9d 100644 --- a/skills/pdf/add_watermark/SKILL.md +++ b/skills/pdf/add_watermark/SKILL.md @@ -18,7 +18,7 @@ description: 通过交互方式给 PDF 添加水印。当用户提到 PDF 互动 ## 调用方式 ```python -from office.skills.pdf import add_watermark +from skills.pdf import add_watermark add_watermark() ``` @@ -34,7 +34,7 @@ add_watermark() ## 使用示例 ```python -from office.skills.pdf import add_watermark +from skills.pdf import add_watermark add_watermark() ``` diff --git a/skills/pdf/add_watermark_by_parameters/SKILL.md b/skills/pdf/add_watermark_by_parameters/SKILL.md index aca80e3..d5db83c 100644 --- a/skills/pdf/add_watermark_by_parameters/SKILL.md +++ b/skills/pdf/add_watermark_by_parameters/SKILL.md @@ -18,7 +18,7 @@ description: 通过参数化方式给 PDF 添加水印。当用户提到参数 ## 调用方式 ```python -from office.skills.pdf import add_watermark_by_parameters +from skills.pdf import add_watermark_by_parameters add_watermark_by_parameters( input_file='./test.pdf', @@ -46,7 +46,7 @@ add_watermark_by_parameters( ## 使用示例 ```python -from office.skills.pdf import add_watermark_by_parameters +from skills.pdf import add_watermark_by_parameters add_watermark_by_parameters(input_file='./report.pdf', mark_str='机密') ``` diff --git a/skills/pdf/decrypt4pdf/SKILL.md b/skills/pdf/decrypt4pdf/SKILL.md index 460d244..28f2233 100644 --- a/skills/pdf/decrypt4pdf/SKILL.md +++ b/skills/pdf/decrypt4pdf/SKILL.md @@ -18,7 +18,7 @@ description: 对加密的 PDF 文件进行解密。当用户提到 PDF 解密、 ## 调用方式 ```python -from office.skills.pdf import decrypt4pdf +from skills.pdf import decrypt4pdf decrypt4pdf( password='123456', @@ -44,7 +44,7 @@ decrypt4pdf( ## 使用示例 ```python -from office.skills.pdf import decrypt4pdf +from skills.pdf import decrypt4pdf decrypt4pdf(password='mypassword', input_file='./encrypted.pdf', output_file='./decrypted.pdf') ``` diff --git a/skills/pdf/del4pdf/SKILL.md b/skills/pdf/del4pdf/SKILL.md index 5086761..802b88e 100644 --- a/skills/pdf/del4pdf/SKILL.md +++ b/skills/pdf/del4pdf/SKILL.md @@ -18,7 +18,7 @@ description: 删除 PDF 文件中指定的页面。当用户提到 PDF 删除页 ## 调用方式 ```python -from office.skills.pdf import del4pdf +from skills.pdf import del4pdf del4pdf( input_file='./test.pdf', @@ -42,7 +42,7 @@ del4pdf( ## 使用示例 ```python -from office.skills.pdf import del4pdf +from skills.pdf import del4pdf # 删除第 1 页和第 3 页 del4pdf(input_file='./report.pdf', output_file='./new.pdf', page_nums=[0, 2]) ``` diff --git a/skills/pdf/encrypt4pdf/SKILL.md b/skills/pdf/encrypt4pdf/SKILL.md index e2f4981..eee2546 100644 --- a/skills/pdf/encrypt4pdf/SKILL.md +++ b/skills/pdf/encrypt4pdf/SKILL.md @@ -18,7 +18,7 @@ description: 对 PDF 文件设置密码进行加密保护。当用户提到 PDF ## 调用方式 ```python -from office.skills.pdf import encrypt4pdf +from skills.pdf import encrypt4pdf encrypt4pdf( password='123456', @@ -44,7 +44,7 @@ encrypt4pdf( ## 使用示例 ```python -from office.skills.pdf import encrypt4pdf +from skills.pdf import encrypt4pdf encrypt4pdf(password='mypassword', input_file='./report.pdf', output_file='./encrypted.pdf') ``` diff --git a/skills/pdf/merge2pdf/SKILL.md b/skills/pdf/merge2pdf/SKILL.md index 7f3f675..f3ab1cb 100644 --- a/skills/pdf/merge2pdf/SKILL.md +++ b/skills/pdf/merge2pdf/SKILL.md @@ -18,7 +18,7 @@ description: 将多个 PDF 文件合并为一个 PDF。当用户提到 PDF 合 ## 调用方式 ```python -from office.skills.pdf import merge2pdf +from skills.pdf import merge2pdf merge2pdf( input_file_list=['./1.pdf', './2.pdf', './3.pdf'], @@ -42,7 +42,7 @@ merge2pdf( ## 使用示例 ```python -from office.skills.pdf import merge2pdf +from skills.pdf import merge2pdf merge2pdf( input_file_list=['./part1.pdf', './part2.pdf'], output_file='./all.pdf' diff --git a/skills/pdf/pdf2docx/SKILL.md b/skills/pdf/pdf2docx/SKILL.md index 6223e13..0fbb68a 100644 --- a/skills/pdf/pdf2docx/SKILL.md +++ b/skills/pdf/pdf2docx/SKILL.md @@ -18,7 +18,7 @@ description: 将 PDF 文件转换为 Word 文档(.docx),支持单文件和 ## 调用方式 ```python -from office.skills.pdf import pdf2docx +from skills.pdf import pdf2docx # 单个文件 pdf2docx(input_file='./test.pdf', output_file='./test.docx') @@ -46,7 +46,7 @@ pdf2docx(input_path='./pdfs/', output_path='./docs/') ## 使用示例 ```python -from office.skills.pdf import pdf2docx +from skills.pdf import pdf2docx pdf2docx(input_file='./report.pdf', output_file='./report.docx') ``` diff --git a/skills/pdf/pdf2imgs/SKILL.md b/skills/pdf/pdf2imgs/SKILL.md index b3040d2..5553029 100644 --- a/skills/pdf/pdf2imgs/SKILL.md +++ b/skills/pdf/pdf2imgs/SKILL.md @@ -18,7 +18,7 @@ description: 将 PDF 文件转换为图片,可合并为一张长图或多张 ## 调用方式 ```python -from office.skills.pdf import pdf2imgs +from skills.pdf import pdf2imgs pdf2imgs( input_file='./test.pdf', @@ -44,7 +44,7 @@ pdf2imgs( ## 使用示例 ```python -from office.skills.pdf import pdf2imgs +from skills.pdf import pdf2imgs pdf2imgs(input_file='./report.pdf', output_file='./images/', merge=True) ``` diff --git a/skills/pdf/split4pdf/SKILL.md b/skills/pdf/split4pdf/SKILL.md index bdbb3ec..3969a7b 100644 --- a/skills/pdf/split4pdf/SKILL.md +++ b/skills/pdf/split4pdf/SKILL.md @@ -18,7 +18,7 @@ description: 按指定页码范围拆分 PDF 文件。当用户提到 PDF 拆分 ## 调用方式 ```python -from office.skills.pdf import split4pdf +from skills.pdf import split4pdf split4pdf( input_file='./test.pdf', @@ -44,7 +44,7 @@ split4pdf( ## 使用示例 ```python -from office.skills.pdf import split4pdf +from skills.pdf import split4pdf # 拆分第 1-5 页 split4pdf(input_file='./report.pdf', output_file='./part1.pdf', from_page=0, to_page=4) ``` diff --git a/skills/pdf/txt2pdf/SKILL.md b/skills/pdf/txt2pdf/SKILL.md index be9e080..4f871ed 100644 --- a/skills/pdf/txt2pdf/SKILL.md +++ b/skills/pdf/txt2pdf/SKILL.md @@ -18,7 +18,7 @@ description: 将文本文件转换为 PDF 文件。当用户提到文本转 PDF ## 调用方式 ```python -from office.skills.pdf import txt2pdf +from skills.pdf import txt2pdf txt2pdf( input_file='./test.txt', @@ -40,7 +40,7 @@ txt2pdf( ## 使用示例 ```python -from office.skills.pdf import txt2pdf +from skills.pdf import txt2pdf txt2pdf(input_file='./article.txt', output_file='./article.pdf') ``` diff --git a/skills/ppt/__init__.py b/skills/ppt/__init__.py index 65a689f..c3033bf 100644 --- a/skills/ppt/__init__.py +++ b/skills/ppt/__init__.py @@ -1,8 +1,8 @@ # -*- coding: UTF-8 -*- """PPT Skills 包 - 统一暴露 PPT 处理相关的所有 Skills""" -from office.skills.ppt.ppt2pdf import ppt2pdf -from office.skills.ppt.ppt2img import ppt2img -from office.skills.ppt.merge4ppt import merge4ppt +from .ppt2pdf import ppt2pdf +from .ppt2img import ppt2img +from .merge4ppt import merge4ppt __all__ = [ 'ppt2pdf', diff --git a/skills/ppt/merge4ppt/SKILL.md b/skills/ppt/merge4ppt/SKILL.md index c497d59..14d1c42 100644 --- a/skills/ppt/merge4ppt/SKILL.md +++ b/skills/ppt/merge4ppt/SKILL.md @@ -18,7 +18,7 @@ description: 将多个 PowerPoint 文件合并为一个 PPT。当用户提到 PP ## 调用方式 ```python -from office.skills.ppt import merge4ppt +from skills.ppt import merge4ppt merge4ppt( input_path='./ppt_files', @@ -42,7 +42,7 @@ merge4ppt( ## 使用示例 ```python -from office.skills.ppt import merge4ppt +from skills.ppt import merge4ppt merge4ppt(input_path='./ppt_files', output_name='all_merged.pptx') ``` diff --git a/skills/ppt/ppt2img/SKILL.md b/skills/ppt/ppt2img/SKILL.md index 89c4c31..c2d32ff 100644 --- a/skills/ppt/ppt2img/SKILL.md +++ b/skills/ppt/ppt2img/SKILL.md @@ -18,7 +18,7 @@ description: 将 PowerPoint 转换为图片,可合并为一张长图或多张 ## 调用方式 ```python -from office.skills.ppt import ppt2img +from skills.ppt import ppt2img ppt2img( input_path='./test.pptx', @@ -42,7 +42,7 @@ ppt2img( ## 使用示例 ```python -from office.skills.ppt import ppt2img +from skills.ppt import ppt2img # 转为多张图片 ppt2img(input_path='./presentation.pptx', output_path='./images/') # 转为一张长图 diff --git a/skills/ppt/ppt2pdf/SKILL.md b/skills/ppt/ppt2pdf/SKILL.md index c5664aa..957582a 100644 --- a/skills/ppt/ppt2pdf/SKILL.md +++ b/skills/ppt/ppt2pdf/SKILL.md @@ -18,7 +18,7 @@ description: 将 PowerPoint 文件转换为 PDF。当用户提到 PPT 转 PDF、 ## 调用方式 ```python -from office.skills.ppt import ppt2pdf +from skills.ppt import ppt2pdf ppt2pdf( path='./test.pptx', @@ -40,7 +40,7 @@ ppt2pdf( ## 使用示例 ```python -from office.skills.ppt import ppt2pdf +from skills.ppt import ppt2pdf ppt2pdf(path='./presentation.pptx', output_path='./output/') ``` diff --git a/skills/ruiming/__init__.py b/skills/ruiming/__init__.py index e861d4a..dec90f0 100644 --- a/skills/ruiming/__init__.py +++ b/skills/ruiming/__init__.py @@ -1,8 +1,8 @@ # -*- coding: UTF-8 -*- """Ruiming Skills 包 - 统一暴露 Ruiming(testApi)相关的所有 Skills""" -from office.skills.ruiming.screen_unmarked_image import screen_unmarked_image -from office.skills.ruiming.change_label_in_xml import change_label_in_xml -from office.skills.ruiming.screen_without_label_json_file import screen_without_label_json_file +from .screen_unmarked_image import screen_unmarked_image +from .change_label_in_xml import change_label_in_xml +from .screen_without_label_json_file import screen_without_label_json_file __all__ = [ 'screen_unmarked_image', diff --git a/skills/ruiming/change_label_in_xml/SKILL.md b/skills/ruiming/change_label_in_xml/SKILL.md index cbda918..e145a88 100644 --- a/skills/ruiming/change_label_in_xml/SKILL.md +++ b/skills/ruiming/change_label_in_xml/SKILL.md @@ -18,7 +18,7 @@ description: 批量修改指定目录下所有 XML 标注文件中的标签名 ## 调用方式 ```python -from office.skills.ruiming import change_label_in_xml +from skills.ruiming import change_label_in_xml change_label_in_xml( dir_path='./dataset', @@ -42,7 +42,7 @@ change_label_in_xml( ## 使用示例 ```python -from office.skills.ruiming import change_label_in_xml +from skills.ruiming import change_label_in_xml change_label_in_xml(dir_path='./annotations', old_label='person', new_label='human') ``` diff --git a/skills/ruiming/screen_unmarked_image/SKILL.md b/skills/ruiming/screen_unmarked_image/SKILL.md index 3f03668..c47ea7f 100644 --- a/skills/ruiming/screen_unmarked_image/SKILL.md +++ b/skills/ruiming/screen_unmarked_image/SKILL.md @@ -18,7 +18,7 @@ description: 在指定目录下筛选没有对应标注文件(.xml)的图片 ## 调用方式 ```python -from office.skills.ruiming import screen_unmarked_image +from skills.ruiming import screen_unmarked_image screen_unmarked_image(dir_path='./dataset') ``` @@ -38,7 +38,7 @@ screen_unmarked_image(dir_path='./dataset') ## 使用示例 ```python -from office.skills.ruiming import screen_unmarked_image +from skills.ruiming import screen_unmarked_image screen_unmarked_image(dir_path='./my_dataset') ``` diff --git a/skills/ruiming/screen_without_label_json_file/SKILL.md b/skills/ruiming/screen_without_label_json_file/SKILL.md index 9afb2d5..7a0ae02 100644 --- a/skills/ruiming/screen_without_label_json_file/SKILL.md +++ b/skills/ruiming/screen_without_label_json_file/SKILL.md @@ -18,7 +18,7 @@ description: 筛选 shapes 字段为空的 JSON 标注文件,并移动到「 ## 调用方式 ```python -from office.skills.ruiming import screen_without_label_json_file +from skills.ruiming import screen_without_label_json_file screen_without_label_json_file(dir_path='./jsons') ``` @@ -36,7 +36,7 @@ screen_without_label_json_file(dir_path='./jsons') ## 使用示例 ```python -from office.skills.ruiming import screen_without_label_json_file +from skills.ruiming import screen_without_label_json_file screen_without_label_json_file(dir_path='./annotations') ``` diff --git a/skills/tools/__init__.py b/skills/tools/__init__.py index 9d02c3b..3f90b4b 100644 --- a/skills/tools/__init__.py +++ b/skills/tools/__init__.py @@ -1,15 +1,15 @@ # -*- coding: UTF-8 -*- """Tools Skills 包 - 统一暴露工具类相关的所有 Skills""" -from office.skills.tools.transtools import transtools -from office.skills.tools.qrcodetools import qrcodetools -from office.skills.tools.passwordtools import passwordtools -from office.skills.tools.weather import weather -from office.skills.tools.url2ip import url2ip -from office.skills.tools.lottery8ticket import lottery8ticket -from office.skills.tools.create_article import create_article -from office.skills.tools.pwd4wifi import pwd4wifi -from office.skills.tools.net_speed_test import net_speed_test -from office.skills.tools.course import course +from .transtools import transtools +from .qrcodetools import qrcodetools +from .passwordtools import passwordtools +from .weather import weather +from .url2ip import url2ip +from .lottery8ticket import lottery8ticket +from .create_article import create_article +from .pwd4wifi import pwd4wifi +from .net_speed_test import net_speed_test +from .course import course __all__ = [ 'transtools', diff --git a/skills/tools/course/SKILL.md b/skills/tools/course/SKILL.md index 1ba52f1..0948da2 100644 --- a/skills/tools/course/SKILL.md +++ b/skills/tools/course/SKILL.md @@ -18,7 +18,7 @@ description: 显示 python-office 库的使用教程、群组信息、源码地 ## 调用方式 ```python -from office.skills.tools import course +from skills.tools import course course() ``` @@ -34,7 +34,7 @@ course() ## 使用示例 ```python -from office.skills.tools import course +from skills.tools import course course() ``` diff --git a/skills/tools/create_article/SKILL.md b/skills/tools/create_article/SKILL.md index 22497d2..392fd8b 100644 --- a/skills/tools/create_article/SKILL.md +++ b/skills/tools/create_article/SKILL.md @@ -18,7 +18,7 @@ description: 根据给定主题自动生成指定行数的文章。当用户提 ## 调用方式 ```python -from office.skills.tools import create_article +from skills.tools import create_article create_article( theme='人工智能的发展', @@ -40,7 +40,7 @@ create_article( ## 使用示例 ```python -from office.skills.tools import create_article +from skills.tools import create_article create_article(theme='Python 自动化办公', line_num=500) ``` diff --git a/skills/tools/lottery8ticket/SKILL.md b/skills/tools/lottery8ticket/SKILL.md index 628f3b8..6cba316 100644 --- a/skills/tools/lottery8ticket/SKILL.md +++ b/skills/tools/lottery8ticket/SKILL.md @@ -18,7 +18,7 @@ description: 随机生成一组 8 位彩票号码。当用户提到生成彩票 ## 调用方式 ```python -from office.skills.tools import lottery8ticket +from skills.tools import lottery8ticket lottery8ticket() ``` @@ -34,7 +34,7 @@ lottery8ticket() ## 使用示例 ```python -from office.skills.tools import lottery8ticket +from skills.tools import lottery8ticket lottery8ticket() ``` diff --git a/skills/tools/net_speed_test/SKILL.md b/skills/tools/net_speed_test/SKILL.md index f758892..3b33cb0 100644 --- a/skills/tools/net_speed_test/SKILL.md +++ b/skills/tools/net_speed_test/SKILL.md @@ -18,7 +18,7 @@ description: 测试网络的上传和下载速度。当用户提到测网速、 ## 调用方式 ```python -from office.skills.tools import net_speed_test +from skills.tools import net_speed_test net_speed_test() ``` @@ -34,7 +34,7 @@ net_speed_test() ## 使用示例 ```python -from office.skills.tools import net_speed_test +from skills.tools import net_speed_test net_speed_test() ``` diff --git a/skills/tools/passwordtools/SKILL.md b/skills/tools/passwordtools/SKILL.md index a014acb..ed00944 100644 --- a/skills/tools/passwordtools/SKILL.md +++ b/skills/tools/passwordtools/SKILL.md @@ -18,7 +18,7 @@ description: 生成指定长度的随机密码。当用户提到生成密码、 ## 调用方式 ```python -from office.skills.tools import passwordtools +from skills.tools import passwordtools pwd = passwordtools(len=12) print(pwd) @@ -37,7 +37,7 @@ print(pwd) ## 使用示例 ```python -from office.skills.tools import passwordtools +from skills.tools import passwordtools pwd = passwordtools(len=16) print(f"生成的密码: {pwd}") ``` diff --git a/skills/tools/pwd4wifi/SKILL.md b/skills/tools/pwd4wifi/SKILL.md index 5e5d7f7..29fcf20 100644 --- a/skills/tools/pwd4wifi/SKILL.md +++ b/skills/tools/pwd4wifi/SKILL.md @@ -18,7 +18,7 @@ description: 生成 WiFi 密码字典列表。当用户提到 WiFi 密码字典 ## 调用方式 ```python -from office.skills.tools import pwd4wifi +from skills.tools import pwd4wifi pwd4wifi(len_pwd=8, pwd_list=[]) ``` @@ -37,7 +37,7 @@ pwd4wifi(len_pwd=8, pwd_list=[]) ## 使用示例 ```python -from office.skills.tools import pwd4wifi +from skills.tools import pwd4wifi pwd4wifi(len_pwd=10) ``` diff --git a/skills/tools/qrcodetools/SKILL.md b/skills/tools/qrcodetools/SKILL.md index 77e15e5..7e98273 100644 --- a/skills/tools/qrcodetools/SKILL.md +++ b/skills/tools/qrcodetools/SKILL.md @@ -18,7 +18,7 @@ description: 根据 URL 生成对应的二维码图片。当用户提到生成 ## 调用方式 ```python -from office.skills.tools import qrcodetools +from skills.tools import qrcodetools qrcodetools( url='https://www.python-office.com', @@ -40,7 +40,7 @@ qrcodetools( ## 使用示例 ```python -from office.skills.tools import qrcodetools +from skills.tools import qrcodetools qrcodetools(url='https://www.python-office.com', output='./my_qrcode.png') ``` diff --git a/skills/tools/transtools/SKILL.md b/skills/tools/transtools/SKILL.md index 33ee8a4..2628cfa 100644 --- a/skills/tools/transtools/SKILL.md +++ b/skills/tools/transtools/SKILL.md @@ -18,7 +18,7 @@ description: 将内容从一种语言翻译为另一种语言。当用户提到 ## 调用方式 ```python -from office.skills.tools import transtools +from skills.tools import transtools result = transtools( to_lang='en', @@ -43,7 +43,7 @@ print(result) ## 使用示例 ```python -from office.skills.tools import transtools +from skills.tools import transtools result = transtools(to_lang='en', content='你好,世界!') print(result) # Hello, world! ``` diff --git a/skills/tools/url2ip/SKILL.md b/skills/tools/url2ip/SKILL.md index d597130..3eebfa2 100644 --- a/skills/tools/url2ip/SKILL.md +++ b/skills/tools/url2ip/SKILL.md @@ -18,7 +18,7 @@ description: 将 URL 解析为对应的 IP 地址。当用户提到 URL 转 IP ## 调用方式 ```python -from office.skills.tools import url2ip +from skills.tools import url2ip ip = url2ip(url='https://www.python-office.com') print(ip) @@ -37,7 +37,7 @@ print(ip) ## 使用示例 ```python -from office.skills.tools import url2ip +from skills.tools import url2ip ip = url2ip(url='https://www.baidu.com') print(f"百度 IP: {ip}") ``` diff --git a/skills/tools/weather/SKILL.md b/skills/tools/weather/SKILL.md index 187db7e..3e3f361 100644 --- a/skills/tools/weather/SKILL.md +++ b/skills/tools/weather/SKILL.md @@ -18,7 +18,7 @@ description: 获取当前天气信息。当用户提到查天气、天气查询 ## 调用方式 ```python -from office.skills.tools import weather +from skills.tools import weather weather() ``` @@ -34,7 +34,7 @@ weather() ## 使用示例 ```python -from office.skills.tools import weather +from skills.tools import weather weather() ``` diff --git a/skills/video/__init__.py b/skills/video/__init__.py index a754200..9b0a780 100644 --- a/skills/video/__init__.py +++ b/skills/video/__init__.py @@ -1,9 +1,9 @@ # -*- coding: UTF-8 -*- """Video Skills 包 - 统一暴露视频处理相关的所有 Skills""" -from office.skills.video.video2mp3 import video2mp3 -from office.skills.video.audio2txt import audio2txt -from office.skills.video.mark2video import mark2video -from office.skills.video.txt2mp3 import txt2mp3 +from .video2mp3 import video2mp3 +from .audio2txt import audio2txt +from .mark2video import mark2video +from .txt2mp3 import txt2mp3 __all__ = [ 'video2mp3', diff --git a/skills/video/audio2txt/SKILL.md b/skills/video/audio2txt/SKILL.md index bd39432..9bd20e9 100644 --- a/skills/video/audio2txt/SKILL.md +++ b/skills/video/audio2txt/SKILL.md @@ -20,7 +20,7 @@ description: 从音频文件中提取文字(语音转文字),需要腾讯 ## 调用方式 ```python -from office.skills.video import audio2txt +from skills.video import audio2txt audio2txt( audio_path='./test.mp3', @@ -46,7 +46,7 @@ audio2txt( ## 使用示例 ```python -from office.skills.video import audio2txt +from skills.video import audio2txt audio2txt( audio_path='./audio.mp3', appid='your_appid', diff --git a/skills/video/mark2video/SKILL.md b/skills/video/mark2video/SKILL.md index d66a0ac..9bdfe69 100644 --- a/skills/video/mark2video/SKILL.md +++ b/skills/video/mark2video/SKILL.md @@ -18,7 +18,7 @@ description: 给视频添加文字水印,支持自定义字体大小、类型 ## 调用方式 ```python -from office.skills.video import mark2video +from skills.video import mark2video mark2video( video_path='./test.mp4', @@ -50,7 +50,7 @@ mark2video( ## 使用示例 ```python -from office.skills.video import mark2video +from skills.video import mark2video mark2video(video_path='./demo.mp4', mark_str='My Channel') ``` diff --git a/skills/video/txt2mp3/SKILL.md b/skills/video/txt2mp3/SKILL.md index d726be5..55cce19 100644 --- a/skills/video/txt2mp3/SKILL.md +++ b/skills/video/txt2mp3/SKILL.md @@ -18,7 +18,7 @@ description: 将文本内容转换为 MP3 语音文件,可选择直接朗读 ## 调用方式 ```python -from office.skills.video import txt2mp3 +from skills.video import txt2mp3 txt2mp3( content='你好,世界', @@ -44,7 +44,7 @@ txt2mp3( ## 使用示例 ```python -from office.skills.video import txt2mp3 +from skills.video import txt2mp3 # 直接朗读 txt2mp3(content='你好,世界', mp3=None, speak=True) # 保存为 mp3 文件 diff --git a/skills/video/video2mp3/SKILL.md b/skills/video/video2mp3/SKILL.md index 7c73922..c1f2959 100644 --- a/skills/video/video2mp3/SKILL.md +++ b/skills/video/video2mp3/SKILL.md @@ -18,7 +18,7 @@ description: 从视频文件中提取音频并保存为 MP3。当用户提到视 ## 调用方式 ```python -from office.skills.video import video2mp3 +from skills.video import video2mp3 video2mp3( path='./test.mp4', @@ -42,7 +42,7 @@ video2mp3( ## 使用示例 ```python -from office.skills.video import video2mp3 +from skills.video import video2mp3 video2mp3(path='./movie.mp4', mp3_name='movie_audio.mp3') ``` diff --git a/skills/wechat/__init__.py b/skills/wechat/__init__.py index bbd4618..d7bee7e 100644 --- a/skills/wechat/__init__.py +++ b/skills/wechat/__init__.py @@ -1,12 +1,12 @@ # -*- coding: UTF-8 -*- """WeChat Skills 包 - 统一暴露微信自动化相关的所有 Skills""" -from office.skills.wechat.send_message import send_message -from office.skills.wechat.send_message_by_time import send_message_by_time -from office.skills.wechat.chat_by_keywords import chat_by_keywords -from office.skills.wechat.send_file import send_file -from office.skills.wechat.group_send import group_send -from office.skills.wechat.receive_message import receive_message -from office.skills.wechat.chat_robot import chat_robot +from .send_message import send_message +from .send_message_by_time import send_message_by_time +from .chat_by_keywords import chat_by_keywords +from .send_file import send_file +from .group_send import group_send +from .receive_message import receive_message +from .chat_robot import chat_robot __all__ = [ 'send_message', diff --git a/skills/wechat/chat_by_keywords/SKILL.md b/skills/wechat/chat_by_keywords/SKILL.md index 6c1b077..25e6518 100644 --- a/skills/wechat/chat_by_keywords/SKILL.md +++ b/skills/wechat/chat_by_keywords/SKILL.md @@ -18,7 +18,7 @@ description: 通过微信按关键词列表与指定联系人自动聊天。当 ## 调用方式 ```python -from office.skills.wechat import chat_by_keywords +from skills.wechat import chat_by_keywords chat_by_keywords(who='文件传输助手', keywords=['你好', '在吗']) ``` @@ -37,7 +37,7 @@ chat_by_keywords(who='文件传输助手', keywords=['你好', '在吗']) ## 使用示例 ```python -from office.skills.wechat import chat_by_keywords +from skills.wechat import chat_by_keywords chat_by_keywords(who='文件传输助手', keywords=['你好', 'hello', 'hi']) ``` diff --git a/skills/wechat/chat_robot/SKILL.md b/skills/wechat/chat_robot/SKILL.md index be2f814..1f6d302 100644 --- a/skills/wechat/chat_robot/SKILL.md +++ b/skills/wechat/chat_robot/SKILL.md @@ -18,7 +18,7 @@ description: 通过微信与指定联系人进行智能聊天(基于 AI 回复 ## 调用方式 ```python -from office.skills.wechat import chat_robot +from skills.wechat import chat_robot chat_robot(who='程序员晚枫') ``` @@ -36,7 +36,7 @@ chat_robot(who='程序员晚枫') ## 使用示例 ```python -from office.skills.wechat import chat_robot +from skills.wechat import chat_robot chat_robot(who='文件传输助手') ``` diff --git a/skills/wechat/group_send/SKILL.md b/skills/wechat/group_send/SKILL.md index a45a7ab..57cf749 100644 --- a/skills/wechat/group_send/SKILL.md +++ b/skills/wechat/group_send/SKILL.md @@ -18,7 +18,7 @@ description: 通过微信向多个联系人群发消息。当用户提到微信 ## 调用方式 ```python -from office.skills.wechat import group_send +from skills.wechat import group_send group_send() ``` @@ -34,7 +34,7 @@ group_send() ## 使用示例 ```python -from office.skills.wechat import group_send +from skills.wechat import group_send group_send() ``` diff --git a/skills/wechat/receive_message/SKILL.md b/skills/wechat/receive_message/SKILL.md index 031d41d..91f18d3 100644 --- a/skills/wechat/receive_message/SKILL.md +++ b/skills/wechat/receive_message/SKILL.md @@ -18,7 +18,7 @@ description: 通过微信接收消息并保存到本地文件。当用户提到 ## 调用方式 ```python -from office.skills.wechat import receive_message +from skills.wechat import receive_message receive_message( who='文件传输助手', @@ -42,7 +42,7 @@ receive_message( ## 使用示例 ```python -from office.skills.wechat import receive_message +from skills.wechat import receive_message receive_message(who='文件传输助手', txt='messages.txt', output_path='./received/') ``` diff --git a/skills/wechat/send_file/SKILL.md b/skills/wechat/send_file/SKILL.md index b96fb44..e0b19ef 100644 --- a/skills/wechat/send_file/SKILL.md +++ b/skills/wechat/send_file/SKILL.md @@ -18,7 +18,7 @@ description: 通过微信向指定联系人发送文件。当用户提到微信 ## 调用方式 ```python -from office.skills.wechat import send_file +from skills.wechat import send_file send_file(who='文件传输助手', file='./test.txt') ``` @@ -37,7 +37,7 @@ send_file(who='文件传输助手', file='./test.txt') ## 使用示例 ```python -from office.skills.wechat import send_file +from skills.wechat import send_file send_file(who='文件传输助手', file='./report.pdf') ``` diff --git a/skills/wechat/send_message/SKILL.md b/skills/wechat/send_message/SKILL.md index 4de4373..3c19a3b 100644 --- a/skills/wechat/send_message/SKILL.md +++ b/skills/wechat/send_message/SKILL.md @@ -18,7 +18,7 @@ description: 通过微信自动化向指定联系人发送消息。当用户提 ## 调用方式 ```python -from office.skills.wechat import send_message +from skills.wechat import send_message send_message(who='文件传输助手', message='Hello, World!') ``` @@ -37,7 +37,7 @@ send_message(who='文件传输助手', message='Hello, World!') ## 使用示例 ```python -from office.skills.wechat import send_message +from skills.wechat import send_message send_message(who='文件传输助手', message='Hello, World!') ``` diff --git a/skills/wechat/send_message_by_time/SKILL.md b/skills/wechat/send_message_by_time/SKILL.md index 60d9947..c9243c7 100644 --- a/skills/wechat/send_message_by_time/SKILL.md +++ b/skills/wechat/send_message_by_time/SKILL.md @@ -18,7 +18,7 @@ description: 通过微信在指定时间向联系人发送定时消息。当用 ## 调用方式 ```python -from office.skills.wechat import send_message_by_time +from skills.wechat import send_message_by_time send_message_by_time( who='文件传输助手', @@ -42,7 +42,7 @@ send_message_by_time( ## 使用示例 ```python -from office.skills.wechat import send_message_by_time +from skills.wechat import send_message_by_time send_message_by_time(who='文件传输助手', message='早安', time='08:00:00') ``` diff --git a/skills/word/__init__.py b/skills/word/__init__.py index f03916b..42be737 100644 --- a/skills/word/__init__.py +++ b/skills/word/__init__.py @@ -1,10 +1,10 @@ # -*- coding: UTF-8 -*- """Word Skills 包 - 统一暴露 Word 处理相关的所有 Skills""" -from office.skills.word.docx2pdf import docx2pdf -from office.skills.word.merge4docx import merge4docx -from office.skills.word.doc2docx import doc2docx -from office.skills.word.docx2doc import docx2doc -from office.skills.word.docx4imgs import docx4imgs +from .docx2pdf import docx2pdf +from .merge4docx import merge4docx +from .doc2docx import doc2docx +from .docx2doc import docx2doc +from .docx4imgs import docx4imgs __all__ = [ 'docx2pdf', diff --git a/skills/word/doc2docx/SKILL.md b/skills/word/doc2docx/SKILL.md index 9d5d447..3994e49 100644 --- a/skills/word/doc2docx/SKILL.md +++ b/skills/word/doc2docx/SKILL.md @@ -18,7 +18,7 @@ description: 将旧版 Word 文档(.doc)转换为新版(.docx)。当用 ## 调用方式 ```python -from office.skills.word import doc2docx +from skills.word import doc2docx doc2docx( input_path='./old.doc', @@ -30,7 +30,7 @@ doc2docx( 也可以直接把目标文件路径传给 `output_path`: ```python -from office.skills.word import doc2docx +from skills.word import doc2docx doc2docx( input_path='./old.doc', @@ -53,12 +53,12 @@ doc2docx( ## 使用示例 ```python -from office.skills.word import doc2docx +from skills.word import doc2docx doc2docx(input_path='./old.doc', output_path='./new/') ``` ```python -from office.skills.word import doc2docx +from skills.word import doc2docx doc2docx(input_path='./old.doc', output_path='./new/new.docx') ``` diff --git a/skills/word/docx2doc/SKILL.md b/skills/word/docx2doc/SKILL.md index ca70a7d..ec2d55c 100644 --- a/skills/word/docx2doc/SKILL.md +++ b/skills/word/docx2doc/SKILL.md @@ -18,7 +18,7 @@ description: 将新版 Word 文档(.docx)转换为旧版(.doc)。当用 ## 调用方式 ```python -from office.skills.word import docx2doc +from skills.word import docx2doc docx2doc( input_path='./new.docx', @@ -42,7 +42,7 @@ docx2doc( ## 使用示例 ```python -from office.skills.word import docx2doc +from skills.word import docx2doc docx2doc(input_path='./new.docx', output_path='./old/') ``` diff --git a/skills/word/docx2pdf/SKILL.md b/skills/word/docx2pdf/SKILL.md index 68917f0..12a2967 100644 --- a/skills/word/docx2pdf/SKILL.md +++ b/skills/word/docx2pdf/SKILL.md @@ -18,7 +18,7 @@ description: 将 Word 文档(.docx)转换为 PDF,支持单文件和整个 ## 调用方式 ```python -from office.skills.word import docx2pdf +from skills.word import docx2pdf # 单个文件 docx2pdf(path='./test.docx', output_path='./output/') @@ -41,7 +41,7 @@ docx2pdf(path='./word_files/', output_path='./pdfs/') ## 使用示例 ```python -from office.skills.word import docx2pdf +from skills.word import docx2pdf docx2pdf(path='./report.docx', output_path='./output/') ``` diff --git a/skills/word/docx4imgs/SKILL.md b/skills/word/docx4imgs/SKILL.md index 7f33475..29f1177 100644 --- a/skills/word/docx4imgs/SKILL.md +++ b/skills/word/docx4imgs/SKILL.md @@ -18,7 +18,7 @@ description: 从 Word 文档中提取所有图片并保存到指定目录。当 ## 调用方式 ```python -from office.skills.word import docx4imgs +from skills.word import docx4imgs docx4imgs( word_path='./test.docx', @@ -40,7 +40,7 @@ docx4imgs( ## 使用示例 ```python -from office.skills.word import docx4imgs +from skills.word import docx4imgs docx4imgs(word_path='./document.docx', img_path='./extracted_images/') ``` diff --git a/skills/word/merge4docx/SKILL.md b/skills/word/merge4docx/SKILL.md index 6aecac7..f08638e 100644 --- a/skills/word/merge4docx/SKILL.md +++ b/skills/word/merge4docx/SKILL.md @@ -18,7 +18,7 @@ description: 将多个 Word 文档合并为一个文件。当用户提到 Word ## 调用方式 ```python -from office.skills.word import merge4docx +from skills.word import merge4docx merge4docx( input_path='./word_files', @@ -42,7 +42,7 @@ merge4docx( ## 使用示例 ```python -from office.skills.word import merge4docx +from skills.word import merge4docx merge4docx( input_path='./word_files', output_path='./output/', diff --git a/tests/test_code/test_skills_imports.py b/tests/test_code/test_skills_imports.py new file mode 100644 index 0000000..40ea141 --- /dev/null +++ b/tests/test_code/test_skills_imports.py @@ -0,0 +1,39 @@ +# -*- coding: UTF-8 -*- +"""Tests for the public ``skills.`` import surface.""" + +import importlib +import unittest + + +CATEGORIES = ( + "excel", + "file", + "finance", + "image", + "markdown", + "ocr", + "pdf", + "ppt", + "ruiming", + "tools", + "video", + "wechat", + "word", +) + + +class TestSkillsImports(unittest.TestCase): + def test_category_exports_are_importable(self): + for category in CATEGORIES: + with self.subTest(category=category): + module = importlib.import_module(f"skills.{category}") + self.assertTrue(module.__all__) + for name in module.__all__: + self.assertTrue( + callable(getattr(module, name, None)), + f"skills.{category}.{name} is not callable", + ) + + +if __name__ == "__main__": + unittest.main()