m8flow 1.1.2 → 1.1.3
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.
- package/bundled/backend/api/routes/flows.py +43 -3
- package/bundled/backend/api/routes/nodes.py +3 -3
- package/bundled/backend/config.py +4 -2
- package/bundled/backend/core/code_validator.py +1 -1
- package/bundled/backend/core/executor.py +67 -0
- package/bundled/backend/core/runtime.py +36 -1
- package/bundled/backend/main.py +21 -0
- package/bundled/backend/services/llm_service.py +611 -67
- package/bundled/backend/services/pipeline_executor.py +41 -0
- package/bundled/backend/templates.py +8 -13
- package/bundled/frontend-dist/assets/index-BI1hb_gi.js +45 -0
- package/bundled/frontend-dist/assets/index-D9h1Krrv.css +1 -0
- package/bundled/frontend-dist/index.html +2 -2
- package/package.json +1 -1
- package/bundled/frontend-dist/assets/index-CKHHQk3Q.css +0 -1
- package/bundled/frontend-dist/assets/index-DvcUKYKx.js +0 -44
|
@@ -67,6 +67,21 @@ def _serialize_value(value: Any) -> Any:
|
|
|
67
67
|
return bool(value)
|
|
68
68
|
|
|
69
69
|
# ── sklearn ──────────────────────────────────────────────────────────────
|
|
70
|
+
is_display = hasattr(value, "figure_") and hasattr(value.figure_, "savefig")
|
|
71
|
+
if is_display:
|
|
72
|
+
try:
|
|
73
|
+
import io
|
|
74
|
+
import base64
|
|
75
|
+
buf = io.BytesIO()
|
|
76
|
+
value.figure_.savefig(buf, format="png", bbox_inches="tight")
|
|
77
|
+
b64 = base64.b64encode(buf.getvalue()).decode("utf-8")
|
|
78
|
+
return {
|
|
79
|
+
"image_base64": b64,
|
|
80
|
+
"title": getattr(value, "estimator_name", type(value).__name__)
|
|
81
|
+
}
|
|
82
|
+
except Exception:
|
|
83
|
+
pass
|
|
84
|
+
|
|
70
85
|
if isinstance(value, BaseEstimator):
|
|
71
86
|
params = {}
|
|
72
87
|
for k, v in value.get_params().items():
|
|
@@ -76,6 +91,32 @@ def _serialize_value(value: Any) -> Any:
|
|
|
76
91
|
params[k] = str(v)
|
|
77
92
|
return {"_type": "Estimator", "class": type(value).__name__, "params": params}
|
|
78
93
|
|
|
94
|
+
# ── matplotlib / seaborn ──────────────────────────────────────────────────
|
|
95
|
+
is_figure = hasattr(value, "savefig") and type(value).__module__.startswith("matplotlib")
|
|
96
|
+
if is_figure:
|
|
97
|
+
try:
|
|
98
|
+
import io
|
|
99
|
+
import base64
|
|
100
|
+
buf = io.BytesIO()
|
|
101
|
+
value.savefig(buf, format="png", bbox_inches="tight")
|
|
102
|
+
b64 = base64.b64encode(buf.getvalue()).decode("utf-8")
|
|
103
|
+
return {
|
|
104
|
+
"image_base64": b64,
|
|
105
|
+
"title": "Matplotlib / Seaborn Plot"
|
|
106
|
+
}
|
|
107
|
+
except Exception:
|
|
108
|
+
pass
|
|
109
|
+
|
|
110
|
+
# ── plotly ───────────────────────────────────────────────────────────────
|
|
111
|
+
if hasattr(value, "to_html") and type(value).__module__.startswith("plotly"):
|
|
112
|
+
try:
|
|
113
|
+
return {
|
|
114
|
+
"plotly_html": value.to_html(full_html=False, include_plotlyjs="cdn"),
|
|
115
|
+
"title": "Plotly Visualization"
|
|
116
|
+
}
|
|
117
|
+
except Exception:
|
|
118
|
+
pass
|
|
119
|
+
|
|
79
120
|
# ── plain Python scalars ─────────────────────────────────────────────────
|
|
80
121
|
if isinstance(value, float):
|
|
81
122
|
return _safe_float(value)
|
|
@@ -3,20 +3,15 @@
|
|
|
3
3
|
# ── Data ──────────────────────────────────────────────────────────────────────
|
|
4
4
|
|
|
5
5
|
CSV_LOADER = '''import pandas as pd
|
|
6
|
-
import os
|
|
7
|
-
from typing import Annotated
|
|
8
6
|
|
|
9
|
-
def run(file_path
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
df = pd.read_csv(file_path)
|
|
19
|
-
return {"data": df}
|
|
7
|
+
def run(file_path=None):
|
|
8
|
+
if file_path is None:
|
|
9
|
+
raise ValueError("No file path provided")
|
|
10
|
+
try:
|
|
11
|
+
data = pd.read_csv(file_path)
|
|
12
|
+
return {"data": data}
|
|
13
|
+
except Exception as e:
|
|
14
|
+
raise ValueError(f"Failed to load CSV: {str(e)}")
|
|
20
15
|
'''
|
|
21
16
|
|
|
22
17
|
CSV_EXPORTER = '''import pandas as pd
|