mdify-cli 3.3.5__py3-none-any.whl → 3.3.7__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.
- mdify/__init__.py +1 -1
- mdify/cli.py +26 -27
- {mdify_cli-3.3.5.dist-info → mdify_cli-3.3.7.dist-info}/METADATA +1 -1
- {mdify_cli-3.3.5.dist-info → mdify_cli-3.3.7.dist-info}/RECORD +8 -8
- {mdify_cli-3.3.5.dist-info → mdify_cli-3.3.7.dist-info}/WHEEL +0 -0
- {mdify_cli-3.3.5.dist-info → mdify_cli-3.3.7.dist-info}/entry_points.txt +0 -0
- {mdify_cli-3.3.5.dist-info → mdify_cli-3.3.7.dist-info}/licenses/LICENSE +0 -0
- {mdify_cli-3.3.5.dist-info → mdify_cli-3.3.7.dist-info}/top_level.txt +0 -0
mdify/__init__.py
CHANGED
mdify/cli.py
CHANGED
|
@@ -1056,6 +1056,7 @@ def main_async_remote(args) -> int:
|
|
|
1056
1056
|
async def async_main() -> int:
|
|
1057
1057
|
"""Async implementation of remote conversion."""
|
|
1058
1058
|
from mdify.formatting import Colorizer
|
|
1059
|
+
from mdify.docling_client import _is_error_response, _extract_content
|
|
1059
1060
|
|
|
1060
1061
|
color = Colorizer(sys.stderr)
|
|
1061
1062
|
|
|
@@ -1399,11 +1400,25 @@ def main_async_remote(args) -> int:
|
|
|
1399
1400
|
response_data = json.loads(conversion_output)
|
|
1400
1401
|
color_err = Colorizer(sys.stderr)
|
|
1401
1402
|
|
|
1402
|
-
#
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1403
|
+
# Debug: Print JSON schema structure
|
|
1404
|
+
if DEBUG:
|
|
1405
|
+
def get_schema(obj, depth=0, max_depth=3):
|
|
1406
|
+
"""Get JSON schema structure."""
|
|
1407
|
+
if depth > max_depth:
|
|
1408
|
+
return "..."
|
|
1409
|
+
if isinstance(obj, dict):
|
|
1410
|
+
return "{" + ", ".join(f"{k}: {get_schema(v, depth+1)}" for k, v in list(obj.items())[:5]) + ("..." if len(obj) > 5 else "") + "}"
|
|
1411
|
+
elif isinstance(obj, list):
|
|
1412
|
+
return "[" + (get_schema(obj[0], depth+1) if obj else "") + ("..." if len(obj) > 1 else "") + "]"
|
|
1413
|
+
elif isinstance(obj, str):
|
|
1414
|
+
return f"str({len(obj)} chars)"
|
|
1415
|
+
else:
|
|
1416
|
+
return type(obj).__name__
|
|
1417
|
+
schema = get_schema(response_data)
|
|
1418
|
+
print(f" Response schema: {schema}", file=sys.stderr)
|
|
1419
|
+
|
|
1420
|
+
# Check if response is an error response
|
|
1421
|
+
if _is_error_response(response_data):
|
|
1407
1422
|
error_detail = response_data.get("detail", response_data.get("error", str(response_data)))
|
|
1408
1423
|
print(f" {color_err.error('✗ Failed:')} {error_detail}", file=sys.stderr)
|
|
1409
1424
|
if "DOCLING_SERVE_MAX_SYNC_WAIT" in str(error_detail):
|
|
@@ -1412,26 +1427,8 @@ def main_async_remote(args) -> int:
|
|
|
1412
1427
|
failed += 1
|
|
1413
1428
|
break
|
|
1414
1429
|
|
|
1415
|
-
# Extract content from response
|
|
1416
|
-
|
|
1417
|
-
markdown_content = None
|
|
1418
|
-
if "document" in response_data:
|
|
1419
|
-
document = response_data["document"]
|
|
1420
|
-
if "md_content" in document and document["md_content"]:
|
|
1421
|
-
markdown_content = document["md_content"]
|
|
1422
|
-
elif "text_content" in document and document["text_content"]:
|
|
1423
|
-
markdown_content = document["text_content"]
|
|
1424
|
-
elif "results" in response_data and response_data["results"]:
|
|
1425
|
-
# Legacy format fallback
|
|
1426
|
-
result = response_data["results"][0]
|
|
1427
|
-
if "content" in result:
|
|
1428
|
-
content = result["content"]
|
|
1429
|
-
if isinstance(content, dict) and "markdown" in content:
|
|
1430
|
-
markdown_content = content["markdown"]
|
|
1431
|
-
elif isinstance(content, str):
|
|
1432
|
-
markdown_content = content
|
|
1433
|
-
else:
|
|
1434
|
-
markdown_content = str(content)
|
|
1430
|
+
# Extract content from response using proper extraction function
|
|
1431
|
+
markdown_content = _extract_content(response_data)
|
|
1435
1432
|
|
|
1436
1433
|
# Validate content exists and is not empty/too short
|
|
1437
1434
|
if not markdown_content or len(markdown_content.strip()) < 50:
|
|
@@ -1483,8 +1480,10 @@ def main_async_remote(args) -> int:
|
|
|
1483
1480
|
|
|
1484
1481
|
except (json.JSONDecodeError, KeyError, IndexError):
|
|
1485
1482
|
print(f" ✗ Failed to parse conversion response", file=sys.stderr)
|
|
1486
|
-
if DEBUG:
|
|
1487
|
-
print
|
|
1483
|
+
if DEBUG and conversion_output:
|
|
1484
|
+
# Only print a snippet of the response for debugging
|
|
1485
|
+
response_snippet = conversion_output[:300] + ("..." if len(conversion_output) > 300 else "")
|
|
1486
|
+
print(f" Response snippet: {response_snippet}", file=sys.stderr)
|
|
1488
1487
|
failed += 1
|
|
1489
1488
|
break
|
|
1490
1489
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
assets/mdify.png,sha256=qUj7WXWqNwpI2KNXOW79XJwqFqa-UI0JEkmt1mmy4Rg,1820418
|
|
2
|
-
mdify/__init__.py,sha256=
|
|
2
|
+
mdify/__init__.py,sha256=S0AQGE9bCnWi_fhTQbptgqT9t_-cge0A0NI30VQys78,90
|
|
3
3
|
mdify/__main__.py,sha256=bhpJ00co6MfaVOdH4XLoW04NtLYDa_oJK7ODzfLrn9M,143
|
|
4
|
-
mdify/cli.py,sha256=
|
|
4
|
+
mdify/cli.py,sha256=_8rPzxY3hOjTCdAv_aJ29qQg3aI_K4jzG4EblpQBLb4,88116
|
|
5
5
|
mdify/container.py,sha256=BjL5ZR__n1i_WHifXKllTPoqO7IuOUdPDo5esuNg0Iw,8213
|
|
6
6
|
mdify/docling_client.py,sha256=zrA-KGW3sSup-qxLHPixZWyDVi3tXJck1-MV6NoyQXA,8677
|
|
7
7
|
mdify/formatting.py,sha256=It7yCVQbD5e2G1FqE4ebx783BkBiRWeFdjKrWPs4nEA,3964
|
|
@@ -10,9 +10,9 @@ mdify/ssh/client.py,sha256=lkqnerNTjlwkTlBmVx4B_2i3GA_D-FjH696OgQKUOXE,15009
|
|
|
10
10
|
mdify/ssh/models.py,sha256=IGAf5EfpZuBS2lIGzxmIsl8f44bXg4a8wk4BW9JWKEQ,17275
|
|
11
11
|
mdify/ssh/remote_container.py,sha256=Ibgdx3Joatv7xQRzDxCuCtr1TZBsRb-6Tqa5ynYt1uA,10304
|
|
12
12
|
mdify/ssh/transfer.py,sha256=Zcr-V8Bjmm37tvd9RxlS-Rwk0SPD1-OGlEPlHQWmtSE,10979
|
|
13
|
-
mdify_cli-3.3.
|
|
14
|
-
mdify_cli-3.3.
|
|
15
|
-
mdify_cli-3.3.
|
|
16
|
-
mdify_cli-3.3.
|
|
17
|
-
mdify_cli-3.3.
|
|
18
|
-
mdify_cli-3.3.
|
|
13
|
+
mdify_cli-3.3.7.dist-info/licenses/LICENSE,sha256=NWM66Uv-XuSMKaU-gaPmvfyk4WgE6zcIPr78wyg6GAo,1065
|
|
14
|
+
mdify_cli-3.3.7.dist-info/METADATA,sha256=H3T-AFAymNmelQNrlgzGhfIWKfpCxlixIsm9wVOerjg,14766
|
|
15
|
+
mdify_cli-3.3.7.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
16
|
+
mdify_cli-3.3.7.dist-info/entry_points.txt,sha256=0Xki8f5lADQUtwdt6Eq_FEaieI6Byhk8UE7BuDhChMg,41
|
|
17
|
+
mdify_cli-3.3.7.dist-info/top_level.txt,sha256=qltzf7h8owHq7dxCdfCkSHY8gT21hn1_E8P-VWS_OKM,6
|
|
18
|
+
mdify_cli-3.3.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|