lightpdf-aipdf-mcp 0.1.110__py3-none-any.whl → 0.1.112__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lightpdf_aipdf_mcp/create_pdf.py +4 -4
- lightpdf_aipdf_mcp/server.py +7 -7
- {lightpdf_aipdf_mcp-0.1.110.dist-info → lightpdf_aipdf_mcp-0.1.112.dist-info}/METADATA +1 -1
- {lightpdf_aipdf_mcp-0.1.110.dist-info → lightpdf_aipdf_mcp-0.1.112.dist-info}/RECORD +6 -6
- {lightpdf_aipdf_mcp-0.1.110.dist-info → lightpdf_aipdf_mcp-0.1.112.dist-info}/WHEEL +0 -0
- {lightpdf_aipdf_mcp-0.1.110.dist-info → lightpdf_aipdf_mcp-0.1.112.dist-info}/entry_points.txt +0 -0
lightpdf_aipdf_mcp/create_pdf.py
CHANGED
@@ -5,12 +5,12 @@ import uuid
|
|
5
5
|
from .common import Logger, FileHandler
|
6
6
|
from .editor import Editor, EditResult, EditType
|
7
7
|
|
8
|
-
async def create_pdf_from_latex(
|
8
|
+
async def create_pdf_from_latex(latex_code: str, output_path: Optional[str] = None, logger: Optional[Logger] = None, original_name: Optional[str] = None):
|
9
9
|
"""
|
10
10
|
根据LaTeX内容创建PDF文件。
|
11
11
|
|
12
12
|
参数:
|
13
|
-
|
13
|
+
latex_code (str): LaTeX源内容。
|
14
14
|
output_path (Optional[str]): 可选,输出PDF文件路径。
|
15
15
|
logger (Optional[Logger]): 日志对象。
|
16
16
|
original_name (Optional[str]): 可选,原始文件名。
|
@@ -19,14 +19,14 @@ async def create_pdf_from_latex(latex_content: str, output_path: Optional[str] =
|
|
19
19
|
"""
|
20
20
|
tex_path = None
|
21
21
|
try:
|
22
|
-
# 1. 保存
|
22
|
+
# 1. 保存latex_code为本地.tex文件
|
23
23
|
try:
|
24
24
|
temp_dir = "./tmp"
|
25
25
|
os.makedirs(temp_dir, exist_ok=True)
|
26
26
|
tex_filename = f"latex_{uuid.uuid4().hex}.tex"
|
27
27
|
tex_path = os.path.join(temp_dir, tex_filename)
|
28
28
|
with open(tex_path, "w", encoding="utf-8") as f:
|
29
|
-
f.write(
|
29
|
+
f.write(latex_code)
|
30
30
|
except Exception as e:
|
31
31
|
return EditResult(
|
32
32
|
error_message=f"保存LaTeX内容失败: {e}"
|
lightpdf_aipdf_mcp/server.py
CHANGED
@@ -1155,16 +1155,16 @@ async def handle_list_tools() -> list[types.Tool]:
|
|
1155
1155
|
inputSchema={
|
1156
1156
|
"type": "object",
|
1157
1157
|
"properties": {
|
1158
|
-
"
|
1158
|
+
"latex_code": {
|
1159
1159
|
"type": "string",
|
1160
|
-
"description": "The LaTeX source
|
1160
|
+
"description": "The LaTeX source code to be compiled into a PDF file. Only pure LaTeX code is allowed; other formats are not supported."
|
1161
1161
|
},
|
1162
1162
|
"filename": {
|
1163
1163
|
"type": "string",
|
1164
1164
|
"description": "The filename for the generated PDF"
|
1165
1165
|
}
|
1166
1166
|
},
|
1167
|
-
"required": ["
|
1167
|
+
"required": ["latex_code", "filename"]
|
1168
1168
|
}
|
1169
1169
|
),
|
1170
1170
|
]
|
@@ -1372,10 +1372,10 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
|
|
1372
1372
|
|
1373
1373
|
elif name == "create_pdf":
|
1374
1374
|
from .create_pdf import create_pdf_from_latex
|
1375
|
-
|
1375
|
+
latex_code = arguments.get("latex_code")
|
1376
1376
|
filename = arguments.get("filename")
|
1377
|
-
if not
|
1378
|
-
error_msg = "
|
1377
|
+
if not latex_code:
|
1378
|
+
error_msg = "latex_code参数不能为空"
|
1379
1379
|
await logger.error(error_msg)
|
1380
1380
|
return [types.TextContent(type="text", text=error_msg)]
|
1381
1381
|
if not filename:
|
@@ -1383,7 +1383,7 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
|
|
1383
1383
|
await logger.error(error_msg)
|
1384
1384
|
return [types.TextContent(type="text", text=error_msg)]
|
1385
1385
|
|
1386
|
-
result = await create_pdf_from_latex(
|
1386
|
+
result = await create_pdf_from_latex(latex_code, logger=logger, original_name=filename)
|
1387
1387
|
# 构建结果报告
|
1388
1388
|
report_msg = generate_result_report(
|
1389
1389
|
[result]
|
@@ -1,11 +1,11 @@
|
|
1
1
|
lightpdf_aipdf_mcp/__init__.py,sha256=PPnAgpvJLYLVOTxnHDmJAulFnHJD6wuTwS6tRGjqq6s,141
|
2
2
|
lightpdf_aipdf_mcp/common.py,sha256=PhTf7Zg6mEgn1rTmJDHotXp-4xb2gWFf-Dy_t25qNdY,6660
|
3
3
|
lightpdf_aipdf_mcp/converter.py,sha256=1SQcPTKXbf6UKqC1zJ4Vi-k7GxGTtPiVKyhGYAvK7DY,16299
|
4
|
-
lightpdf_aipdf_mcp/create_pdf.py,sha256=
|
4
|
+
lightpdf_aipdf_mcp/create_pdf.py,sha256=9E8lD3XCUID9nYDV1HN1OkWgV_r4KqPleX99cKYrZ_0,2465
|
5
5
|
lightpdf_aipdf_mcp/editor.py,sha256=vPaahaAV6pDZi_eheRGSgHzfZxc6ZqQyxHDgsNfdgjQ,29899
|
6
|
-
lightpdf_aipdf_mcp/server.py,sha256=
|
6
|
+
lightpdf_aipdf_mcp/server.py,sha256=lqYJg7u0XBx4U1O2eqXCTbuVcMmbctRSttVWAll-ru0,65373
|
7
7
|
lightpdf_aipdf_mcp/translator.py,sha256=NbFDz-mZSD4qCNQVyV0W_0x6xXwbqs_7FiBU13JAxZs,4243
|
8
|
-
lightpdf_aipdf_mcp-0.1.
|
9
|
-
lightpdf_aipdf_mcp-0.1.
|
10
|
-
lightpdf_aipdf_mcp-0.1.
|
11
|
-
lightpdf_aipdf_mcp-0.1.
|
8
|
+
lightpdf_aipdf_mcp-0.1.112.dist-info/METADATA,sha256=rFYGoJB-v1nnbzLbWk4CGRb-dt7cr2R3h5Drtwj3Znk,8120
|
9
|
+
lightpdf_aipdf_mcp-0.1.112.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
10
|
+
lightpdf_aipdf_mcp-0.1.112.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
|
11
|
+
lightpdf_aipdf_mcp-0.1.112.dist-info/RECORD,,
|
File without changes
|
{lightpdf_aipdf_mcp-0.1.110.dist-info → lightpdf_aipdf_mcp-0.1.112.dist-info}/entry_points.txt
RENAMED
File without changes
|