quantology-modelmaker 0.1.0__tar.gz → 0.1.2__tar.gz
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.
- {quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info → quantology_modelmaker-0.1.2}/PKG-INFO +38 -13
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/README.md +27 -12
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/App.tsx +61 -6
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/BlockNode.tsx +4 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/DataModal.tsx +74 -1
- quantology_modelmaker-0.1.2/frontend/src/EnvVarField.tsx +89 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/FileBrowser.tsx +36 -7
- quantology_modelmaker-0.1.2/frontend/src/GitPanel.tsx +161 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/Inspector.tsx +65 -6
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/Palette.tsx +3 -1
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/ParamsForm.tsx +141 -0
- quantology_modelmaker-0.1.2/frontend/src/PortDataView.tsx +311 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/Toolbar.tsx +64 -6
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/api.ts +34 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/types.ts +87 -2
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/api.py +402 -7
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/blocks/base.py +15 -1
- quantology_modelmaker-0.1.2/modelmaker/blocks/data_quality.py +297 -0
- quantology_modelmaker-0.1.2/modelmaker/blocks/feature_analysis.py +140 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/blocks/library.py +128 -2
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/blocks/modelling.py +297 -0
- quantology_modelmaker-0.1.2/modelmaker/blocks/stat_tests.py +312 -0
- quantology_modelmaker-0.1.2/modelmaker/blocks/stochastic.py +858 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/compiler.py +18 -1
- quantology_modelmaker-0.1.2/modelmaker/gitops.py +102 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/graph.py +51 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/base.py +28 -5
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/prompts.py +69 -1
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/stub_provider.py +21 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/project.py +66 -3
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/run_worker.py +67 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/runner.py +284 -32
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/session.py +139 -6
- quantology_modelmaker-0.1.2/modelmaker/stochastic/__init__.py +12 -0
- quantology_modelmaker-0.1.2/modelmaker/stochastic/accumulate.py +174 -0
- quantology_modelmaker-0.1.2/modelmaker/stochastic/credit.py +107 -0
- quantology_modelmaker-0.1.2/modelmaker/stochastic/dependency.py +118 -0
- quantology_modelmaker-0.1.2/modelmaker/stochastic/distributions.py +200 -0
- quantology_modelmaker-0.1.2/modelmaker/stochastic/proxy.py +137 -0
- quantology_modelmaker-0.1.2/modelmaker/stochastic/seed.py +28 -0
- quantology_modelmaker-0.1.2/modelmaker/stochastic/var_covar.py +206 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/app.py +3 -3
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/paramspecs.py +29 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/pyproject.toml +13 -2
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2/quantology_modelmaker.egg-info}/PKG-INFO +38 -13
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/SOURCES.txt +26 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/requires.txt +12 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_api.py +323 -5
- quantology_modelmaker-0.1.2/tests/test_data_quality.py +155 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_demo_project.py +1 -1
- quantology_modelmaker-0.1.2/tests/test_env_vars.py +91 -0
- quantology_modelmaker-0.1.2/tests/test_feature_analysis.py +41 -0
- quantology_modelmaker-0.1.2/tests/test_gitops.py +62 -0
- quantology_modelmaker-0.1.2/tests/test_input_blocks.py +241 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_llm.py +103 -0
- quantology_modelmaker-0.1.2/tests/test_modelling.py +183 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_project.py +54 -2
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_runner.py +24 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_session.py +135 -0
- quantology_modelmaker-0.1.2/tests/test_stat_tests.py +53 -0
- quantology_modelmaker-0.1.2/tests/test_stochastic_blocks.py +213 -0
- quantology_modelmaker-0.1.2/tests/test_stochastic_core.py +334 -0
- quantology_modelmaker-0.1.2/tests/test_stochastic_credit.py +231 -0
- quantology_modelmaker-0.1.2/tests/test_stochastic_fan_out.py +209 -0
- quantology_modelmaker-0.1.2/tests/test_stochastic_runner.py +95 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_tui_app.py +5 -4
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_tui_client.py +2 -2
- quantology_modelmaker-0.1.0/frontend/src/PortDataView.tsx +0 -95
- quantology_modelmaker-0.1.0/modelmaker/blocks/stat_tests.py +0 -133
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/LICENSE +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/MANIFEST.in +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/NOTICE +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/.gitignore +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/.npmrc +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/.oxlintrc.json +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/README.md +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/index.html +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/package-lock.json +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/package.json +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/public/brand-quantology/favicon.svg +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/public/brand-quantology/icon-mark-light.svg +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/public/icons.svg +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/CodeEditor.tsx +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/DataWireEdge.tsx +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/LaneBand.tsx +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/LaneLabels.tsx +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/PortInspector.tsx +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/SettingsPanel.tsx +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/assets/hero.png +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/assets/react.svg +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/assets/vite.svg +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/index.css +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/main.tsx +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/src/roles.ts +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/tsconfig.app.json +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/tsconfig.json +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/tsconfig.node.json +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/frontend/vite.config.ts +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/__init__.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/blocks/__init__.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/cache.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/__init__.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/anthropic_provider.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/claude_cli_provider.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/gemini_provider.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/lmstudio_provider.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/openai_provider.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/llm/settings.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/metadata_transforms.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/packet.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/__init__.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/canvas.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/charts.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/client.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/inspector.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/preview.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/tui/screens.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/modelmaker/util.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/dependency_links.txt +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/entry_points.txt +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/quantology_modelmaker.egg-info/top_level.txt +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/run.bat +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/setup.cfg +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/setup.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_compiler.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_graph.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_library.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_master_scale.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_packet.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_runner_streaming.py +0 -0
- {quantology_modelmaker-0.1.0 → quantology_modelmaker-0.1.2}/tests/test_tui_charts.py +0 -0
{quantology_modelmaker-0.1.0/quantology_modelmaker.egg-info → quantology_modelmaker-0.1.2}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: quantology-modelmaker
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Visual pipeline builder for financial model development
|
|
5
5
|
Author-email: Maurits Malkus <10948172+mmalkus@users.noreply.github.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -26,16 +26,26 @@ Requires-Dist: uvicorn>=0.29.0
|
|
|
26
26
|
Requires-Dist: matplotlib>=3.8.0
|
|
27
27
|
Requires-Dist: scikit-learn>=1.4.0
|
|
28
28
|
Requires-Dist: scipy>=1.11.0
|
|
29
|
+
Requires-Dist: numpy>=1.26.0
|
|
29
30
|
Requires-Dist: python-dotenv>=1.0.0
|
|
30
31
|
Provides-Extra: dev
|
|
31
32
|
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
32
33
|
Requires-Dist: httpx>=0.27.0; extra == "dev"
|
|
34
|
+
Requires-Dist: fastexcel>=0.10.0; extra == "dev"
|
|
35
|
+
Requires-Dist: xlsxwriter>=3.0.0; extra == "dev"
|
|
36
|
+
Requires-Dist: connectorx>=0.3.3; extra == "dev"
|
|
37
|
+
Requires-Dist: pyarrow>=16.0.0; extra == "dev"
|
|
33
38
|
Provides-Extra: anthropic
|
|
34
39
|
Requires-Dist: anthropic>=0.70.0; extra == "anthropic"
|
|
35
40
|
Provides-Extra: tui
|
|
36
41
|
Requires-Dist: textual>=0.80.0; extra == "tui"
|
|
37
42
|
Requires-Dist: httpx>=0.27.0; extra == "tui"
|
|
38
43
|
Requires-Dist: plotext<6,>=5.2.0; extra == "tui"
|
|
44
|
+
Provides-Extra: excel
|
|
45
|
+
Requires-Dist: fastexcel>=0.10.0; extra == "excel"
|
|
46
|
+
Provides-Extra: db
|
|
47
|
+
Requires-Dist: connectorx>=0.3.3; extra == "db"
|
|
48
|
+
Requires-Dist: pyarrow>=16.0.0; extra == "db"
|
|
39
49
|
Dynamic: license-file
|
|
40
50
|
|
|
41
51
|
# Model-Maker
|
|
@@ -91,19 +101,29 @@ it. It creates a `.venv` next to itself if missing, installs/upgrades
|
|
|
91
101
|
`quantology-modelmaker` into it, and starts `modelmaker-api` at
|
|
92
102
|
`http://127.0.0.1:8001`. Safe to re-run any time to pick up updates.
|
|
93
103
|
|
|
104
|
+
## Projects
|
|
105
|
+
|
|
106
|
+
A project is a folder, not a file: **Save**/**Load** browse for a folder
|
|
107
|
+
rather than a filename, and a folder is a project once it holds a
|
|
108
|
+
`model.json` (everything else in it -- `files/`, a `.gitignore`, custom
|
|
109
|
+
block code sidecars -- is the project's own working area, versioned
|
|
110
|
+
alongside it). Saving for the first time scaffolds that folder (see
|
|
111
|
+
[The demo project](#the-demo-project) for an example) and git-inits it, so
|
|
112
|
+
it's ready to commit and push right away from the **Git** panel.
|
|
113
|
+
|
|
94
114
|
## The demo project
|
|
95
115
|
|
|
96
|
-
[`projects/demo_pd_model
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
116
|
+
[`projects/demo_pd_model/`](projects/demo_pd_model) is a complete, runnable
|
|
117
|
+
PD pipeline over [`sample_data/pd_model_data.csv`](sample_data): load →
|
|
118
|
+
clean → weight-of-evidence → train/test split → logistic regression → Gini,
|
|
119
|
+
KS and PSI. Open it with **Load** (it's what the folder dialog opens on),
|
|
100
120
|
then **Run all** — it reads the CSV source itself since it's never been read
|
|
101
121
|
before, then runs the rest of the pipeline.
|
|
102
122
|
|
|
103
123
|
It's the quickest way to see what a finished graph looks like, and the test
|
|
104
|
-
suite runs it end to end so it can't rot.
|
|
124
|
+
suite runs it end to end so it can't rot. This folder lives in the git
|
|
105
125
|
repository rather than the PyPI package — clone the repo (or just download
|
|
106
|
-
|
|
126
|
+
it) to try it.
|
|
107
127
|
|
|
108
128
|
## Working in the tool
|
|
109
129
|
|
|
@@ -123,11 +143,16 @@ A few things worth knowing beyond the canvas itself.
|
|
|
123
143
|
their own undo. Undo restores the graph, not what you've run: reverting a
|
|
124
144
|
param lands back on a cache key that's already computed, so results you
|
|
125
145
|
already have aren't thrown away.
|
|
126
|
-
- **Unsaved work** —
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
146
|
+
- **Unsaved work** — once a project has a folder to save into, a dirty edit
|
|
147
|
+
autosaves back to it a couple of seconds after you stop typing/dragging (a
|
|
148
|
+
`•` on the Save button marks the brief window before that happens; the bar
|
|
149
|
+
says "autosaved HH:MM:SS" once it has). Every edit is also snapshotted to
|
|
150
|
+
`.modelmaker-cache/recovery.json` regardless -- crash recovery doesn't wait
|
|
151
|
+
on the debounce, and it's what covers a project that's never been saved at
|
|
152
|
+
all yet. After a crash or a closed browser, the app offers to restore it on
|
|
153
|
+
next start. Autosave only ever writes to your project's own `model.json`;
|
|
154
|
+
it never stages or commits anything -- git stays entirely manual, via the
|
|
155
|
+
Git panel.
|
|
131
156
|
- **Editing during a run** — a run is pinned to the graph as it stood when
|
|
132
157
|
it started, so you can keep editing (or undo, or toggle sample mode) while
|
|
133
158
|
a long sweep executes. The run finishes against its own version; anything
|
|
@@ -150,7 +175,7 @@ can be saved to a `.txt`/`.html` file alongside the block's own PNG.
|
|
|
150
175
|
|
|
151
176
|
```bash
|
|
152
177
|
modelmaker-tui # spawns its own modelmaker-api, zero setup
|
|
153
|
-
modelmaker-tui projects/demo_pd_model
|
|
178
|
+
modelmaker-tui projects/demo_pd_model # ...and loads a project (a folder) on startup
|
|
154
179
|
modelmaker-tui --host 127.0.0.1 --port 8001 # attach to an already-running modelmaker-api instead
|
|
155
180
|
```
|
|
156
181
|
|
|
@@ -51,19 +51,29 @@ it. It creates a `.venv` next to itself if missing, installs/upgrades
|
|
|
51
51
|
`quantology-modelmaker` into it, and starts `modelmaker-api` at
|
|
52
52
|
`http://127.0.0.1:8001`. Safe to re-run any time to pick up updates.
|
|
53
53
|
|
|
54
|
+
## Projects
|
|
55
|
+
|
|
56
|
+
A project is a folder, not a file: **Save**/**Load** browse for a folder
|
|
57
|
+
rather than a filename, and a folder is a project once it holds a
|
|
58
|
+
`model.json` (everything else in it -- `files/`, a `.gitignore`, custom
|
|
59
|
+
block code sidecars -- is the project's own working area, versioned
|
|
60
|
+
alongside it). Saving for the first time scaffolds that folder (see
|
|
61
|
+
[The demo project](#the-demo-project) for an example) and git-inits it, so
|
|
62
|
+
it's ready to commit and push right away from the **Git** panel.
|
|
63
|
+
|
|
54
64
|
## The demo project
|
|
55
65
|
|
|
56
|
-
[`projects/demo_pd_model
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
[`projects/demo_pd_model/`](projects/demo_pd_model) is a complete, runnable
|
|
67
|
+
PD pipeline over [`sample_data/pd_model_data.csv`](sample_data): load →
|
|
68
|
+
clean → weight-of-evidence → train/test split → logistic regression → Gini,
|
|
69
|
+
KS and PSI. Open it with **Load** (it's what the folder dialog opens on),
|
|
60
70
|
then **Run all** — it reads the CSV source itself since it's never been read
|
|
61
71
|
before, then runs the rest of the pipeline.
|
|
62
72
|
|
|
63
73
|
It's the quickest way to see what a finished graph looks like, and the test
|
|
64
|
-
suite runs it end to end so it can't rot.
|
|
74
|
+
suite runs it end to end so it can't rot. This folder lives in the git
|
|
65
75
|
repository rather than the PyPI package — clone the repo (or just download
|
|
66
|
-
|
|
76
|
+
it) to try it.
|
|
67
77
|
|
|
68
78
|
## Working in the tool
|
|
69
79
|
|
|
@@ -83,11 +93,16 @@ A few things worth knowing beyond the canvas itself.
|
|
|
83
93
|
their own undo. Undo restores the graph, not what you've run: reverting a
|
|
84
94
|
param lands back on a cache key that's already computed, so results you
|
|
85
95
|
already have aren't thrown away.
|
|
86
|
-
- **Unsaved work** —
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
96
|
+
- **Unsaved work** — once a project has a folder to save into, a dirty edit
|
|
97
|
+
autosaves back to it a couple of seconds after you stop typing/dragging (a
|
|
98
|
+
`•` on the Save button marks the brief window before that happens; the bar
|
|
99
|
+
says "autosaved HH:MM:SS" once it has). Every edit is also snapshotted to
|
|
100
|
+
`.modelmaker-cache/recovery.json` regardless -- crash recovery doesn't wait
|
|
101
|
+
on the debounce, and it's what covers a project that's never been saved at
|
|
102
|
+
all yet. After a crash or a closed browser, the app offers to restore it on
|
|
103
|
+
next start. Autosave only ever writes to your project's own `model.json`;
|
|
104
|
+
it never stages or commits anything -- git stays entirely manual, via the
|
|
105
|
+
Git panel.
|
|
91
106
|
- **Editing during a run** — a run is pinned to the graph as it stood when
|
|
92
107
|
it started, so you can keep editing (or undo, or toggle sample mode) while
|
|
93
108
|
a long sweep executes. The run finishes against its own version; anything
|
|
@@ -110,7 +125,7 @@ can be saved to a `.txt`/`.html` file alongside the block's own PNG.
|
|
|
110
125
|
|
|
111
126
|
```bash
|
|
112
127
|
modelmaker-tui # spawns its own modelmaker-api, zero setup
|
|
113
|
-
modelmaker-tui projects/demo_pd_model
|
|
128
|
+
modelmaker-tui projects/demo_pd_model # ...and loads a project (a folder) on startup
|
|
114
129
|
modelmaker-tui --host 127.0.0.1 --port 8001 # attach to an already-running modelmaker-api instead
|
|
115
130
|
```
|
|
116
131
|
|
|
@@ -25,6 +25,18 @@ import type { BlockOut, GraphOut, LaneOut, LLMSettingsOut, PortType, RecoveryInf
|
|
|
25
25
|
const nodeTypes = { modelBlock: BlockNode, laneBand: LaneBand }
|
|
26
26
|
const edgeTypes = { dataWire: DataWireEdge }
|
|
27
27
|
|
|
28
|
+
// How long to sit idle after the last edit before writing the project file.
|
|
29
|
+
// Short enough that a save is never more than a few clicks stale, long
|
|
30
|
+
// enough that dragging a block across the canvas or stepping through a
|
|
31
|
+
// dozen param tweaks coalesces into one write instead of one per edit.
|
|
32
|
+
const AUTOSAVE_DEBOUNCE_MS = 2000
|
|
33
|
+
|
|
34
|
+
export type AutosaveStatus =
|
|
35
|
+
| { state: 'idle' }
|
|
36
|
+
| { state: 'saving' }
|
|
37
|
+
| { state: 'saved'; at: number }
|
|
38
|
+
| { state: 'error'; message: string }
|
|
39
|
+
|
|
28
40
|
type FlowNode = BlockFlowNode | LaneBandNode
|
|
29
41
|
|
|
30
42
|
function toBlockNodes(
|
|
@@ -71,6 +83,7 @@ function AppInner() {
|
|
|
71
83
|
const [collapsedLanes, setCollapsedLanes] = useState<Set<string>>(new Set())
|
|
72
84
|
const [llmSettings, setLlmSettings] = useState<LLMSettingsOut | null>(null)
|
|
73
85
|
const [recovery, setRecovery] = useState<RecoveryInfo | null>(null)
|
|
86
|
+
const [autosave, setAutosave] = useState<AutosaveStatus>({ state: 'idle' })
|
|
74
87
|
const { fitView, screenToFlowPosition } = useReactFlow()
|
|
75
88
|
const didInitialFit = useRef(false)
|
|
76
89
|
|
|
@@ -150,9 +163,11 @@ function AppInner() {
|
|
|
150
163
|
return () => window.removeEventListener('keydown', onKey)
|
|
151
164
|
}, [undo, redo])
|
|
152
165
|
|
|
153
|
-
// Edits are always snapshotted server-side for crash recovery,
|
|
154
|
-
//
|
|
155
|
-
//
|
|
166
|
+
// Edits are always snapshotted server-side for crash recovery, and
|
|
167
|
+
// autosave (below) catches up the project file itself within a couple of
|
|
168
|
+
// seconds -- but that write is debounced and best-effort (e.g. it never
|
|
169
|
+
// fires for a project with no save location yet), so leaving mid-debounce
|
|
170
|
+
// or mid-failure is still worth one confirmation.
|
|
156
171
|
useEffect(() => {
|
|
157
172
|
if (!graph?.dirty) return
|
|
158
173
|
const onBeforeUnload = (e: BeforeUnloadEvent) => e.preventDefault()
|
|
@@ -160,16 +175,55 @@ function AppInner() {
|
|
|
160
175
|
return () => window.removeEventListener('beforeunload', onBeforeUnload)
|
|
161
176
|
}, [graph?.dirty])
|
|
162
177
|
|
|
178
|
+
// Autosave: once a project has somewhere to write to, dirty edits write
|
|
179
|
+
// themselves back after a short idle debounce, same target file as a
|
|
180
|
+
// manual Save. This writes the working tree only -- it never stages or
|
|
181
|
+
// commits -- so it doesn't interact with the project's own git history;
|
|
182
|
+
// nothing here composes a commit, only `git commit` (via the Git panel)
|
|
183
|
+
// does that. Unsaved-with-nowhere-to-write (no project_path yet) still
|
|
184
|
+
// relies on crash recovery alone, same as before.
|
|
185
|
+
const autosaveInFlight = useRef(false)
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
if (!graph?.dirty || !graph.project_path) return
|
|
188
|
+
const timer = setTimeout(() => {
|
|
189
|
+
if (autosaveInFlight.current) return
|
|
190
|
+
autosaveInFlight.current = true
|
|
191
|
+
setAutosave({ state: 'saving' })
|
|
192
|
+
api
|
|
193
|
+
.save()
|
|
194
|
+
.then(() => {
|
|
195
|
+
setAutosave({ state: 'saved', at: Date.now() })
|
|
196
|
+
reload()
|
|
197
|
+
})
|
|
198
|
+
.catch((e) => setAutosave({ state: 'error', message: (e as Error).message }))
|
|
199
|
+
.finally(() => {
|
|
200
|
+
autosaveInFlight.current = false
|
|
201
|
+
})
|
|
202
|
+
}, AUTOSAVE_DEBOUNCE_MS)
|
|
203
|
+
return () => clearTimeout(timer)
|
|
204
|
+
}, [graph?.dirty, graph?.project_path, reload])
|
|
205
|
+
|
|
163
206
|
// Runs (a single block, a cascade, or a full sweep) execute on the server
|
|
164
207
|
// in the background -- see api.py -- so a block that's still "running"
|
|
165
208
|
// by the time reload() above returns means the run outlived its bounded
|
|
166
209
|
// wait and is genuinely still in flight. Keep polling until nothing is,
|
|
167
210
|
// so status badges (see BlockNode) and the Stop button (see Toolbar)
|
|
168
|
-
// stay live without the user having to manually refresh.
|
|
169
|
-
|
|
211
|
+
// stay live without the user having to manually refresh. sweep_running is
|
|
212
|
+
// included too: between one block's dispatch ending and the next one
|
|
213
|
+
// starting there's a real gap where nothing is individually "running" yet
|
|
214
|
+
// the sweep itself is still going -- without it, polling could stop mid-
|
|
215
|
+
// sweep and the canvas would sit on a half-updated, stale-looking state.
|
|
216
|
+
const anyRunning = useMemo(
|
|
217
|
+
() => (graph ? Object.values(graph.blocks).some((b) => b.status === 'running') || graph.sweep_running : false),
|
|
218
|
+
[graph],
|
|
219
|
+
)
|
|
170
220
|
useEffect(() => {
|
|
171
221
|
if (!anyRunning) return
|
|
172
|
-
|
|
222
|
+
// Faster than the steady-state UI needs on its own, so each block's
|
|
223
|
+
// grey -> running -> green/red transition during a Run all/Force run
|
|
224
|
+
// all sweep is actually visible rather than the canvas jumping straight
|
|
225
|
+
// from all-grey to done between two 700ms-apart polls.
|
|
226
|
+
const id = setInterval(reload, 200)
|
|
173
227
|
return () => clearInterval(id)
|
|
174
228
|
}, [anyRunning, reload])
|
|
175
229
|
|
|
@@ -402,6 +456,7 @@ function AppInner() {
|
|
|
402
456
|
onUndo={undo}
|
|
403
457
|
onRedo={redo}
|
|
404
458
|
sampleRows={graph?.sample_rows ?? null}
|
|
459
|
+
autosave={autosave}
|
|
405
460
|
/>
|
|
406
461
|
{graph?.sample_rows != null && (
|
|
407
462
|
<div
|
|
@@ -19,6 +19,10 @@ const PORT_BADGE: Record<PortType, { icon: string; label: string; color: string
|
|
|
19
19
|
image: { icon: '▨', label: 'image', color: '#ea580c' },
|
|
20
20
|
master_scale: { icon: '▤', label: 'scale', color: '#0891b2' },
|
|
21
21
|
any: { icon: '?', label: 'value', color: '#6b7280' },
|
|
22
|
+
distribution: { icon: '~', label: 'distribution', color: '#db2777' },
|
|
23
|
+
dependency: { icon: '⋈', label: 'dependency', color: '#4338ca' },
|
|
24
|
+
proxy_function: { icon: '≈', label: 'proxy', color: '#b45309' },
|
|
25
|
+
simulation_result: { icon: '◈', label: 'sim result', color: '#0d9488' },
|
|
22
26
|
}
|
|
23
27
|
|
|
24
28
|
function formatParamValue(v: unknown): string {
|
|
@@ -30,6 +30,28 @@ export function DataModal({
|
|
|
30
30
|
// the click did nothing. Tracked here rather than bumping preview itself,
|
|
31
31
|
// since there's nothing valid to bump it to before that re-run happens.
|
|
32
32
|
const [pendingRoles, setPendingRoles] = useState<Record<string, string>>({})
|
|
33
|
+
// Same staleness problem as pendingRoles above: tags apply immediately
|
|
34
|
+
// server-side, but `preview` won't reflect them until this block is
|
|
35
|
+
// re-run, so the just-applied tags are tracked here for instant feedback.
|
|
36
|
+
const [pendingTags, setPendingTags] = useState<Record<string, string[]> | null>(null)
|
|
37
|
+
const [analyzing, setAnalyzing] = useState(false)
|
|
38
|
+
const [analysis, setAnalysis] = useState<{ document: string; documentPath: string | null } | null>(null)
|
|
39
|
+
const [showDocument, setShowDocument] = useState(false)
|
|
40
|
+
|
|
41
|
+
const analyzeData = () => {
|
|
42
|
+
if (!blockId) return
|
|
43
|
+
setAnalyzing(true)
|
|
44
|
+
api
|
|
45
|
+
.analyzeData(blockId)
|
|
46
|
+
.then((result) => {
|
|
47
|
+
setPendingTags(result.tags)
|
|
48
|
+
setAnalysis({ document: result.document, documentPath: result.document_path })
|
|
49
|
+
setShowDocument(true)
|
|
50
|
+
onChanged?.()
|
|
51
|
+
})
|
|
52
|
+
.catch((e) => alert((e as Error).message))
|
|
53
|
+
.finally(() => setAnalyzing(false))
|
|
54
|
+
}
|
|
33
55
|
|
|
34
56
|
const setRole = (column: string, role: string) => {
|
|
35
57
|
if (!blockId) return
|
|
@@ -76,8 +98,55 @@ export function DataModal({
|
|
|
76
98
|
{preview.row_count} rows shown · lineage: {preview.lineage.join(' -> ') || '(none)'}
|
|
77
99
|
</span>
|
|
78
100
|
</div>
|
|
79
|
-
<
|
|
101
|
+
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
|
|
102
|
+
{blockId && (
|
|
103
|
+
<button
|
|
104
|
+
disabled={analyzing}
|
|
105
|
+
onClick={analyzeData}
|
|
106
|
+
title="Look at this data's column names and summary statistics, tag columns worth flagging, and write a short description -- see the Data Analysis panel below once it's done."
|
|
107
|
+
>
|
|
108
|
+
{analyzing ? 'Analyzing…' : 'AI analyze data'}
|
|
109
|
+
</button>
|
|
110
|
+
)}
|
|
111
|
+
<button onClick={onClose}>Close</button>
|
|
112
|
+
</div>
|
|
80
113
|
</div>
|
|
114
|
+
{analysis && (
|
|
115
|
+
<div style={{ marginBottom: 8, border: '1px solid #e5e7eb', borderRadius: 6, background: '#f9fafb' }}>
|
|
116
|
+
<button
|
|
117
|
+
onClick={() => setShowDocument((s) => !s)}
|
|
118
|
+
style={{
|
|
119
|
+
width: '100%',
|
|
120
|
+
textAlign: 'left',
|
|
121
|
+
border: 'none',
|
|
122
|
+
background: 'transparent',
|
|
123
|
+
padding: 8,
|
|
124
|
+
fontSize: 12,
|
|
125
|
+
fontWeight: 600,
|
|
126
|
+
}}
|
|
127
|
+
>
|
|
128
|
+
{showDocument ? '▾' : '▸'} Data analysis
|
|
129
|
+
{analysis.documentPath && (
|
|
130
|
+
<span style={{ fontWeight: 400, color: '#6b7280' }}> — saved to {analysis.documentPath}</span>
|
|
131
|
+
)}
|
|
132
|
+
</button>
|
|
133
|
+
{showDocument && (
|
|
134
|
+
<pre
|
|
135
|
+
style={{
|
|
136
|
+
margin: 0,
|
|
137
|
+
padding: '0 8px 8px',
|
|
138
|
+
fontSize: 12,
|
|
139
|
+
whiteSpace: 'pre-wrap',
|
|
140
|
+
fontFamily: 'inherit',
|
|
141
|
+
maxHeight: 240,
|
|
142
|
+
overflow: 'auto',
|
|
143
|
+
}}
|
|
144
|
+
>
|
|
145
|
+
{analysis.document}
|
|
146
|
+
</pre>
|
|
147
|
+
)}
|
|
148
|
+
</div>
|
|
149
|
+
)}
|
|
81
150
|
<div style={{ overflow: 'auto', flex: 1, border: '1px solid #e5e7eb', borderRadius: 6 }}>
|
|
82
151
|
<table style={{ borderCollapse: 'collapse', fontSize: 12, width: '100%' }}>
|
|
83
152
|
<thead style={{ position: 'sticky', top: 0, background: '#f9fafb', zIndex: 1 }}>
|
|
@@ -86,6 +155,7 @@ export function DataModal({
|
|
|
86
155
|
const s = preview.summary?.[c.name]
|
|
87
156
|
const pending = pendingRoles[c.name]
|
|
88
157
|
const displayedRole = pending ?? c.role
|
|
158
|
+
const displayedTags = pendingTags ? (pendingTags[c.name] ?? []) : c.tags
|
|
89
159
|
return (
|
|
90
160
|
<th key={c.name} style={{ textAlign: 'left', padding: 6, borderBottom: '1px solid #e5e7eb' }}>
|
|
91
161
|
{c.name}
|
|
@@ -112,6 +182,9 @@ export function DataModal({
|
|
|
112
182
|
{pending !== undefined && pending !== c.role && (
|
|
113
183
|
<div style={{ fontWeight: 400, color: 'var(--brand-dark, #b45309)' }}>re-run to apply</div>
|
|
114
184
|
)}
|
|
185
|
+
{displayedTags.length > 0 && (
|
|
186
|
+
<div style={{ fontWeight: 400, color: '#7c3aed', fontSize: 10 }}>{displayedTags.join(', ')}</div>
|
|
187
|
+
)}
|
|
115
188
|
{s && (
|
|
116
189
|
<div style={{ fontWeight: 400, color: '#9ca3af' }}>
|
|
117
190
|
{s.null_count > 0 && `${s.null_count} null `}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
import { api } from './api'
|
|
3
|
+
import type { EnvVarStatus } from './types'
|
|
4
|
+
|
|
5
|
+
// Lets the user set an env var's value straight from the UI -- e.g. a Read
|
|
6
|
+
// SQL block's connection_env -- instead of having to edit a .env file or
|
|
7
|
+
// export it in their shell before starting the server. The value itself
|
|
8
|
+
// never comes back from the API (see types.EnvVarStatus); only whether
|
|
9
|
+
// it's set, and whether that came from here ("override", session-only) or
|
|
10
|
+
// was already present in the environment ("env").
|
|
11
|
+
export function EnvVarField({ name }: { name: string }) {
|
|
12
|
+
const [status, setStatus] = useState<EnvVarStatus | null>(null)
|
|
13
|
+
const [value, setValue] = useState('')
|
|
14
|
+
const [busy, setBusy] = useState(false)
|
|
15
|
+
const [error, setError] = useState<string | null>(null)
|
|
16
|
+
|
|
17
|
+
useEffect(() => {
|
|
18
|
+
setStatus(null)
|
|
19
|
+
setValue('')
|
|
20
|
+
setError(null)
|
|
21
|
+
const trimmed = name.trim()
|
|
22
|
+
if (!trimmed) return
|
|
23
|
+
api
|
|
24
|
+
.envVar(trimmed)
|
|
25
|
+
.then(setStatus)
|
|
26
|
+
.catch((e) => setError((e as Error).message))
|
|
27
|
+
}, [name])
|
|
28
|
+
|
|
29
|
+
const trimmedName = name.trim()
|
|
30
|
+
if (!trimmedName) return null
|
|
31
|
+
|
|
32
|
+
const save = () => {
|
|
33
|
+
if (!value.trim()) return
|
|
34
|
+
setBusy(true)
|
|
35
|
+
api
|
|
36
|
+
.setEnvVar(trimmedName, value)
|
|
37
|
+
.then((s) => {
|
|
38
|
+
setStatus(s)
|
|
39
|
+
setValue('')
|
|
40
|
+
setError(null)
|
|
41
|
+
})
|
|
42
|
+
.catch((e) => setError((e as Error).message))
|
|
43
|
+
.finally(() => setBusy(false))
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const clear = () => {
|
|
47
|
+
setBusy(true)
|
|
48
|
+
api
|
|
49
|
+
.clearEnvVar(trimmedName)
|
|
50
|
+
.then(setStatus)
|
|
51
|
+
.catch((e) => setError((e as Error).message))
|
|
52
|
+
.finally(() => setBusy(false))
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div style={{ marginBottom: 12 }}>
|
|
57
|
+
<div style={{ fontWeight: 600, marginBottom: 4 }}>Env var: {trimmedName}</div>
|
|
58
|
+
<div style={{ fontSize: 11, color: '#6b7280', marginBottom: 4 }}>
|
|
59
|
+
{status === null
|
|
60
|
+
? '…'
|
|
61
|
+
: status.is_set
|
|
62
|
+
? status.source === 'override'
|
|
63
|
+
? 'Set for this session only -- not saved to disk, gone on restart.'
|
|
64
|
+
: 'Already set from your shell environment or .env file.'
|
|
65
|
+
: 'Not set -- the block will fail to read this until it is.'}
|
|
66
|
+
</div>
|
|
67
|
+
<div style={{ display: 'flex', gap: 6 }}>
|
|
68
|
+
<input
|
|
69
|
+
type="password"
|
|
70
|
+
value={value}
|
|
71
|
+
onChange={(e) => setValue(e.target.value)}
|
|
72
|
+
onKeyDown={(e) => e.key === 'Enter' && save()}
|
|
73
|
+
placeholder="paste value, e.g. postgresql://user:pass@host/db"
|
|
74
|
+
disabled={busy}
|
|
75
|
+
style={{ flex: 1, fontFamily: 'monospace', fontSize: 11, boxSizing: 'border-box' }}
|
|
76
|
+
/>
|
|
77
|
+
<button disabled={busy || !value.trim()} onClick={save}>
|
|
78
|
+
Set
|
|
79
|
+
</button>
|
|
80
|
+
{status?.source === 'override' && (
|
|
81
|
+
<button disabled={busy} onClick={clear}>
|
|
82
|
+
Clear
|
|
83
|
+
</button>
|
|
84
|
+
)}
|
|
85
|
+
</div>
|
|
86
|
+
{error && <div style={{ color: '#b91c1c', fontSize: 11 }}>{error}</div>}
|
|
87
|
+
</div>
|
|
88
|
+
)
|
|
89
|
+
}
|
|
@@ -6,6 +6,7 @@ export function FileBrowser({
|
|
|
6
6
|
startPath,
|
|
7
7
|
ext,
|
|
8
8
|
mode = 'open',
|
|
9
|
+
folders = false,
|
|
9
10
|
defaultName,
|
|
10
11
|
onPick,
|
|
11
12
|
onClose,
|
|
@@ -18,6 +19,11 @@ export function FileBrowser({
|
|
|
18
19
|
// and a Save button combines it with the current directory into the path
|
|
19
20
|
// handed to onPick, since the target file need not exist yet.
|
|
20
21
|
mode?: 'open' | 'save'
|
|
22
|
+
// Project-folder picker instead of a file picker: only directories are
|
|
23
|
+
// listed, and a folder that already holds a project (BrowseEntry.is_project
|
|
24
|
+
// -- see project.PROJECT_FILENAME) is a pickable/reusable leaf rather than
|
|
25
|
+
// something to navigate into, the way a file is in the ext-filtered picker.
|
|
26
|
+
folders?: boolean
|
|
21
27
|
defaultName?: string
|
|
22
28
|
onPick: (path: string) => void
|
|
23
29
|
onClose: () => void
|
|
@@ -28,7 +34,7 @@ export function FileBrowser({
|
|
|
28
34
|
|
|
29
35
|
const load = (path?: string) => {
|
|
30
36
|
api
|
|
31
|
-
.browse(path, ext)
|
|
37
|
+
.browse(path, folders ? undefined : ext)
|
|
32
38
|
.then((l) => {
|
|
33
39
|
setListing(l)
|
|
34
40
|
setError(null)
|
|
@@ -48,10 +54,31 @@ export function FileBrowser({
|
|
|
48
54
|
|
|
49
55
|
const doSave = () => {
|
|
50
56
|
if (!listing || !fileName.trim()) return
|
|
51
|
-
const
|
|
57
|
+
const trimmed = fileName.trim()
|
|
58
|
+
const name = !folders && ext && !trimmed.toLowerCase().endsWith(ext.toLowerCase()) ? `${trimmed}${ext}` : trimmed
|
|
52
59
|
onPick(joinPath(listing.path, name))
|
|
53
60
|
}
|
|
54
61
|
|
|
62
|
+
const entries = folders ? (listing?.entries.filter((e) => e.is_dir) ?? []) : (listing?.entries ?? [])
|
|
63
|
+
|
|
64
|
+
const onEntryClick = (e: BrowseOut['entries'][number]) => {
|
|
65
|
+
if (folders) {
|
|
66
|
+
// A folder that's already a project is the pickable leaf here (like a
|
|
67
|
+
// file in the ext-filtered picker); a plain folder is just somewhere
|
|
68
|
+
// to browse through on the way to one.
|
|
69
|
+
if (e.is_project) {
|
|
70
|
+
if (mode === 'save') setFileName(e.name)
|
|
71
|
+
else onPick(e.path)
|
|
72
|
+
} else {
|
|
73
|
+
load(e.path)
|
|
74
|
+
}
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
if (e.is_dir) load(e.path)
|
|
78
|
+
else if (mode === 'save') setFileName(e.name)
|
|
79
|
+
else onPick(e.path)
|
|
80
|
+
}
|
|
81
|
+
|
|
55
82
|
return (
|
|
56
83
|
<div
|
|
57
84
|
style={{
|
|
@@ -90,22 +117,24 @@ export function FileBrowser({
|
|
|
90
117
|
</div>
|
|
91
118
|
<div style={{ overflowY: 'auto', flex: 1 }}>
|
|
92
119
|
{error && <div style={{ padding: 10, color: '#b91c1c' }}>{error}</div>}
|
|
93
|
-
{
|
|
94
|
-
{
|
|
120
|
+
{entries.length === 0 && <div style={{ padding: 10, color: '#9ca3af' }}>(empty)</div>}
|
|
121
|
+
{entries.map((e) => (
|
|
95
122
|
<div
|
|
96
123
|
key={e.path}
|
|
97
|
-
onClick={() => (e
|
|
124
|
+
onClick={() => onEntryClick(e)}
|
|
125
|
+
title={folders && e.is_project ? 'Project folder' : undefined}
|
|
98
126
|
style={{
|
|
99
127
|
padding: '6px 10px',
|
|
100
128
|
cursor: 'pointer',
|
|
101
129
|
display: 'flex',
|
|
102
130
|
gap: 6,
|
|
103
131
|
borderBottom: '1px solid #f3f4f6',
|
|
132
|
+
fontWeight: folders && e.is_project ? 600 : undefined,
|
|
104
133
|
}}
|
|
105
134
|
onMouseEnter={(ev) => (ev.currentTarget.style.background = '#f9fafb')}
|
|
106
135
|
onMouseLeave={(ev) => (ev.currentTarget.style.background = 'transparent')}
|
|
107
136
|
>
|
|
108
|
-
<span>{e.is_dir ? '\u{1F4C1}' : '\u{1F4C4}'}</span>
|
|
137
|
+
<span>{folders ? (e.is_project ? '\u{1F4E6}' : '\u{1F4C1}') : e.is_dir ? '\u{1F4C1}' : '\u{1F4C4}'}</span>
|
|
109
138
|
<span>{e.name}</span>
|
|
110
139
|
</div>
|
|
111
140
|
))}
|
|
@@ -117,7 +146,7 @@ export function FileBrowser({
|
|
|
117
146
|
value={fileName}
|
|
118
147
|
onChange={(e) => setFileName(e.target.value)}
|
|
119
148
|
onKeyDown={(e) => e.key === 'Enter' && doSave()}
|
|
120
|
-
placeholder=
|
|
149
|
+
placeholder={folders ? 'folder name' : 'filename'}
|
|
121
150
|
style={{ flex: 1, fontFamily: 'monospace', fontSize: 12, boxSizing: 'border-box' }}
|
|
122
151
|
/>
|
|
123
152
|
<button disabled={!fileName.trim()} onClick={doSave}>
|