lightpdf-aipdf-mcp 0.1.115__py3-none-any.whl → 0.1.117__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.
@@ -100,6 +100,7 @@ class Converter(BaseApiClient):
100
100
  super().__init__(logger, file_handler)
101
101
  api_endpoint = os.getenv("API_ENDPOINT", "techsz.aoscdn.com/api")
102
102
  self.api_base_url = f"https://{api_endpoint}/tasks/document/conversion"
103
+ self.api_wkhtmltopdf_url = f"https://{api_endpoint}/tasks/document/wkhtmltopdf"
103
104
 
104
105
  async def add_page_numbers(self, file_path: str, start_num: int = 1, position: str = "5", margin: int = 30, password: str = None, original_name: Optional[str] = None) -> ConversionResult:
105
106
  """为PDF文档添加页码
@@ -330,6 +331,14 @@ class Converter(BaseApiClient):
330
331
  if extra_params:
331
332
  data.update(extra_params)
332
333
 
334
+ api_url = self.api_base_url
335
+ # html转pdf特殊接口处理
336
+ if format == "pdf":
337
+ # 检查是否html输入
338
+ ext = self.file_handler.get_file_extension(file_path)
339
+ if ext == ".html":
340
+ api_url = self.api_wkhtmltopdf_url
341
+
333
342
  # 检查是否为OSS路径
334
343
  if self.file_handler.is_oss_id(file_path):
335
344
  # OSS路径处理方式,与URL类似,但提取resource_id
@@ -337,7 +346,7 @@ class Converter(BaseApiClient):
337
346
  # 使用JSON方式时添加Content-Type
338
347
  headers["Content-Type"] = "application/json"
339
348
  response = await client.post(
340
- self.api_base_url,
349
+ api_url,
341
350
  json=data,
342
351
  headers=headers
343
352
  )
@@ -354,7 +363,7 @@ class Converter(BaseApiClient):
354
363
  # 使用JSON方式时添加Content-Type
355
364
  headers["Content-Type"] = "application/json"
356
365
  response = await client.post(
357
- self.api_base_url,
366
+ api_url,
358
367
  json=data,
359
368
  headers=headers
360
369
  )
@@ -363,7 +372,7 @@ class Converter(BaseApiClient):
363
372
  with open(file_path, "rb") as f:
364
373
  files = {"file": f}
365
374
  response = await client.post(
366
- self.api_base_url,
375
+ api_url,
367
376
  files=files,
368
377
  data=data,
369
378
  headers=headers
@@ -1271,7 +1271,7 @@ async def handle_call_tool(name: str, arguments: dict | None) -> list[types.Text
1271
1271
  "split_type": "page",
1272
1272
  "merge_all": 0,
1273
1273
  "angle": 90,
1274
- "pages": "all", # 更新默认值为"all"
1274
+ "pages": "",
1275
1275
  "format": "png", # 提取图片的默认格式
1276
1276
  "page_size": "",
1277
1277
  "resolution": 0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: lightpdf-aipdf-mcp
3
- Version: 0.1.115
3
+ Version: 0.1.117
4
4
  Summary: MCP Server for LightPDF AI-PDF
5
5
  Author: LightPDF Team
6
6
  License: Proprietary
@@ -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
- lightpdf_aipdf_mcp/converter.py,sha256=A_p3nsIsc4ajFV3Ox8UwZcv5D_qseukZ2cqw9eiKAcE,16406
3
+ lightpdf_aipdf_mcp/converter.py,sha256=vAFB6XtDFt9NPS9yygKBuL4t43nZU--RqqKPC06Mvkg,16761
4
4
  lightpdf_aipdf_mcp/create_pdf.py,sha256=oALIhOBo60D3Gu_li7d7FF0COhFfSTM-BJpc63r9iAs,2465
5
5
  lightpdf_aipdf_mcp/editor.py,sha256=Ph_ZZNkDrsSMGarS8I625lgt0mEDOxr4AfDoSiG9Rvc,30000
6
- lightpdf_aipdf_mcp/server.py,sha256=Lwl9kQHLKCQ1szQkkBhw1xcbC3MsWy6fm2_1vBNQGuE,65002
6
+ lightpdf_aipdf_mcp/server.py,sha256=ykCB40sQ_LT9lce_sl2ikl_pyN_FHxlP3Gj_WMkbxsM,64972
7
7
  lightpdf_aipdf_mcp/translator.py,sha256=NbFDz-mZSD4qCNQVyV0W_0x6xXwbqs_7FiBU13JAxZs,4243
8
- lightpdf_aipdf_mcp-0.1.115.dist-info/METADATA,sha256=7gRa27u3I3rh1m3ifAlTqgyqlTUq_-6ByvQ9ehGPcj0,8120
9
- lightpdf_aipdf_mcp-0.1.115.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
- lightpdf_aipdf_mcp-0.1.115.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
11
- lightpdf_aipdf_mcp-0.1.115.dist-info/RECORD,,
8
+ lightpdf_aipdf_mcp-0.1.117.dist-info/METADATA,sha256=pI0yL0742_5C9psi9SWL7T056etu05TDr4DvCT3GvdI,8120
9
+ lightpdf_aipdf_mcp-0.1.117.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
10
+ lightpdf_aipdf_mcp-0.1.117.dist-info/entry_points.txt,sha256=X7TGUe52N4sYH-tYt0YUGApeJgw-efQlZA6uAZmlmr4,63
11
+ lightpdf_aipdf_mcp-0.1.117.dist-info/RECORD,,