robert 2.2.0__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.
- robert/__init__.py +9 -0
- robert/__main__.py +20 -0
- robert/_version.py +3 -0
- robert/api.py +646 -0
- robert/aqme.py +280 -0
- robert/argument_parser.py +98 -0
- robert/checkml.py +433 -0
- robert/checkml_score.py +50 -0
- robert/curate.py +217 -0
- robert/evaluate_bot_retrieval.py +125 -0
- robert/evaluate_bot_support.py +102 -0
- robert/evaluate_workflow_summaries.py +87 -0
- robert/export_bot_docs_knowledge.py +1632 -0
- robert/generate.py +249 -0
- robert/generate_utils.py +311 -0
- robert/gui_easyrob/__init__.py +0 -0
- robert/gui_easyrob/assets/gif_easyrob.gif +0 -0
- robert/gui_easyrob/bot/__init__.py +47 -0
- robert/gui_easyrob/bot/answer_metadata.py +198 -0
- robert/gui_easyrob/bot/bot_context.py +679 -0
- robert/gui_easyrob/bot/bot_engine.py +1100 -0
- robert/gui_easyrob/bot/bot_panel.py +1231 -0
- robert/gui_easyrob/bot/bot_rag.py +1178 -0
- robert/gui_easyrob/bot/bot_window.py +39 -0
- robert/gui_easyrob/bot/bot_worker.py +149 -0
- robert/gui_easyrob/bot/credential_store.py +143 -0
- robert/gui_easyrob/bot/error_parser.py +105 -0
- robert/gui_easyrob/bot/evidence_policy.py +164 -0
- robert/gui_easyrob/bot/heuristics.py +859 -0
- robert/gui_easyrob/bot/icons.py +56 -0
- robert/gui_easyrob/bot/input_csv_audit.py +212 -0
- robert/gui_easyrob/bot/knowledge/aqme_context.json +5907 -0
- robert/gui_easyrob/bot/knowledge/robert_context.json +4817 -0
- robert/gui_easyrob/bot/knowledge/ui_context.json +8293 -0
- robert/gui_easyrob/bot/knowledge_schema.py +1252 -0
- robert/gui_easyrob/bot/knowledge_sources/aqme_user_guidance.json +442 -0
- robert/gui_easyrob/bot/knowledge_sources/coverage_manifest.json +95 -0
- robert/gui_easyrob/bot/knowledge_sources/robert_user_guidance.json +471 -0
- robert/gui_easyrob/bot/knowledge_sources/ui_user_guidance.json +1312 -0
- robert/gui_easyrob/bot/llm_providers.py +1573 -0
- robert/gui_easyrob/bot/online_docs.py +105 -0
- robert/gui_easyrob/bot/prompt_policy.py +575 -0
- robert/gui_easyrob/bot/question_intent.py +562 -0
- robert/gui_easyrob/bot/response_quality.py +104 -0
- robert/gui_easyrob/bot/result_insights.py +225 -0
- robert/gui_easyrob/bot/token_usage.py +75 -0
- robert/gui_easyrob/bot/workflow_results.py +1396 -0
- robert/gui_easyrob/checkml_launcher.py +15 -0
- robert/gui_easyrob/easyrob.py +29 -0
- robert/gui_easyrob/easyrob_launcher.py +113 -0
- robert/gui_easyrob/main/__init__.py +9 -0
- robert/gui_easyrob/main/window.py +5152 -0
- robert/gui_easyrob/result_navigation.py +14 -0
- robert/gui_easyrob/tabs/__init__.py +23 -0
- robert/gui_easyrob/tabs/advanced_options.py +370 -0
- robert/gui_easyrob/tabs/aqme.py +1234 -0
- robert/gui_easyrob/tabs/checkml.py +898 -0
- robert/gui_easyrob/tabs/images.py +427 -0
- robert/gui_easyrob/tabs/interactive_predictions.py +555 -0
- robert/gui_easyrob/tabs/molssi.py +447 -0
- robert/gui_easyrob/tabs/predictions.py +484 -0
- robert/gui_easyrob/tabs/result_catalog.py +170 -0
- robert/gui_easyrob/tabs/results.py +490 -0
- robert/gui_easyrob/tabs/results_workspace.py +120 -0
- robert/gui_easyrob/test_bot_input_csv_audit.py +152 -0
- robert/gui_easyrob/test_bot_question_routing.py +383 -0
- robert/gui_easyrob/test_bot_result_analysis.py +356 -0
- robert/gui_easyrob/test_bot_retrieval_evaluation.py +110 -0
- robert/gui_easyrob/test_bot_ui_integration.py +278 -0
- robert/gui_easyrob/test_checkml_app_mode.py +124 -0
- robert/gui_easyrob/test_checkml_completion.py +57 -0
- robert/gui_easyrob/test_checkml_defaults.py +37 -0
- robert/gui_easyrob/test_checkml_result_summary.py +113 -0
- robert/gui_easyrob/test_checkml_web_mode.py +57 -0
- robert/gui_easyrob/test_dialog_layout.py +33 -0
- robert/gui_easyrob/test_gui_bot_regressions.py +320 -0
- robert/gui_easyrob/test_molssi_auto.py +569 -0
- robert/gui_easyrob/test_tutorial_view.py +215 -0
- robert/gui_easyrob/tutorials/check_model.md +25 -0
- robert/gui_easyrob/tutorials/chemdraw.md +49 -0
- robert/gui_easyrob/tutorials/csv.md +53 -0
- robert/gui_easyrob/tutorials/descriptors.md +21 -0
- robert/gui_easyrob/tutorials/overview.md +65 -0
- robert/gui_easyrob/tutorials/predictions.md +25 -0
- robert/gui_easyrob/tutorials/robbot.md +29 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/check_model/check_model_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_10.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_11.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_12.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_13.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_8.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/chemdraw/chemdraw_9.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_1_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_8.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/csv/csv_9.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/descriptors/descriptors_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_1_8.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_5_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/overview/overview_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_1_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/predictions/predictions_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_1.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_2.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_3.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_4.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_5.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_6.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_7.png +0 -0
- robert/gui_easyrob/tutorials/tutorial_images/robbot/robbot_8.png +0 -0
- robert/gui_easyrob/utils/__init__.py +0 -0
- robert/gui_easyrob/utils/aqme_utils.py +238 -0
- robert/gui_easyrob/utils/molssi_utils.py +584 -0
- robert/gui_easyrob/utils/predictions_utils.py +985 -0
- robert/gui_easyrob/utils/utils_gui.py +738 -0
- robert/gui_easyrob/version.py +68 -0
- robert/gui_easyrob/web/app.css +484 -0
- robert/gui_easyrob/web/app.html +134 -0
- robert/gui_easyrob/web/app.js +764 -0
- robert/gui_easyrob/web/checkml_brand.png +0 -0
- robert/gui_easyrob/web/easyrob_background.gif +0 -0
- robert/gui_easyrob/web/easyrob_background.png +0 -0
- robert/gui_easyrob/web/images.css +89 -0
- robert/gui_easyrob/web/images.html +39 -0
- robert/gui_easyrob/web/images.js +101 -0
- robert/gui_easyrob/web/results.js +499 -0
- robert/gui_easyrob/web/robert_brand.png +0 -0
- robert/gui_easyrob/web_dialogs.py +64 -0
- robert/gui_easyrob/web_results.py +253 -0
- robert/gui_easyrob/web_shell.py +684 -0
- robert/gui_easyrob/workflow_progress.py +89 -0
- robert/gui_easyrob/workflow_run_lock.py +27 -0
- robert/icons/CheckML_icon.png +0 -0
- robert/icons/Robert_icon.png +0 -0
- robert/icons/Robert_logo.jpg +0 -0
- robert/icons/Robert_logo_transparent.png +0 -0
- robert/icons/documentation_icon.png +0 -0
- robert/icons/info_icon.png +0 -0
- robert/icons/pdf_icon.png +0 -0
- robert/icons/play_icon.png +0 -0
- robert/icons/stop_icon.png +0 -0
- robert/icons/youtube_icon.ico +0 -0
- robert/predict.py +193 -0
- robert/predict_utils.py +410 -0
- robert/report/CheckML_logo.jpg +0 -0
- robert/report/GENERATE.png +0 -0
- robert/report/Robert_icon.ico +0 -0
- robert/report/Robert_logo.jpg +0 -0
- robert/report/Robert_logo1.jpg +0 -0
- robert/report/abbrev.png +0 -0
- robert/report/adv_anal.png +0 -0
- robert/report/checkml_pass.svg +3 -0
- robert/report/checkml_unclear.svg +3 -0
- robert/report/checkml_warning.svg +3 -0
- robert/report/features.png +0 -0
- robert/report/outliers.png +0 -0
- robert/report/pred.png +0 -0
- robert/report/repro.png +0 -0
- robert/report/robust_x.png +0 -0
- robert/report/robust_y_high.png +0 -0
- robert/report/robust_y_low.png +0 -0
- robert/report/score.png +0 -0
- robert/report/score_0.jpg +0 -0
- robert/report/score_1.jpg +0 -0
- robert/report/score_10.jpg +0 -0
- robert/report/score_2.jpg +0 -0
- robert/report/score_3.jpg +0 -0
- robert/report/score_4.jpg +0 -0
- robert/report/score_5.jpg +0 -0
- robert/report/score_6.jpg +0 -0
- robert/report/score_7.jpg +0 -0
- robert/report/score_8.jpg +0 -0
- robert/report/score_9.jpg +0 -0
- robert/report/score_gray_0.jpg +0 -0
- robert/report/score_gray_1.jpg +0 -0
- robert/report/score_gray_10.jpg +0 -0
- robert/report/score_gray_2.jpg +0 -0
- robert/report/score_gray_3.jpg +0 -0
- robert/report/score_gray_4.jpg +0 -0
- robert/report/score_gray_5.jpg +0 -0
- robert/report/score_gray_6.jpg +0 -0
- robert/report/score_gray_7.jpg +0 -0
- robert/report/score_gray_8.jpg +0 -0
- robert/report/score_gray_9.jpg +0 -0
- robert/report/score_w_1_0.jpg +0 -0
- robert/report/score_w_1_1.jpg +0 -0
- robert/report/score_w_2_0.jpg +0 -0
- robert/report/score_w_2_1.jpg +0 -0
- robert/report/score_w_2_2.jpg +0 -0
- robert/report/score_w_2_gray_0.jpg +0 -0
- robert/report/score_w_2_gray_1.jpg +0 -0
- robert/report/score_w_2_gray_2.jpg +0 -0
- robert/report/score_w_3_0.jpg +0 -0
- robert/report/score_w_3_1.jpg +0 -0
- robert/report/score_w_3_2.jpg +0 -0
- robert/report/score_w_3_3.jpg +0 -0
- robert/report/score_w_4_0.jpg +0 -0
- robert/report/score_w_4_1.JPG +0 -0
- robert/report/score_w_4_2.jpg +0 -0
- robert/report/score_w_4_3.jpg +0 -0
- robert/report/score_w_4_4.jpg +0 -0
- robert/report/transpa.png +0 -0
- robert/report/y_distrib.png +0 -0
- robert/report.py +2880 -0
- robert/report_utils.py +2270 -0
- robert/robert.py +181 -0
- robert/utils.py +4763 -0
- robert/verify.py +606 -0
- robert-2.2.0.dist-info/METADATA +55 -0
- robert-2.2.0.dist-info/RECORD +261 -0
- robert-2.2.0.dist-info/WHEEL +5 -0
- robert-2.2.0.dist-info/entry_points.txt +3 -0
- robert-2.2.0.dist-info/licenses/LICENSE +21 -0
- robert-2.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,764 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
(() => {
|
|
4
|
+
const checkmlMode = new URLSearchParams(window.location.search).get("mode") === "checkml";
|
|
5
|
+
let bridge = null;
|
|
6
|
+
let focusBotDraftAfterSend = false;
|
|
7
|
+
let lastBotProvider = null;
|
|
8
|
+
let lastBotApiSaved = null;
|
|
9
|
+
const fieldSnapshots = new Map();
|
|
10
|
+
const stages = ["CURATE", "GENERATE", "VERIFY", "PREDICT", "REPORT"];
|
|
11
|
+
let galleryStage = "all";
|
|
12
|
+
let galleryState = { stages: [], total: 0 };
|
|
13
|
+
let tutorials = [];
|
|
14
|
+
let tutorialTopic = 0;
|
|
15
|
+
let tutorialStep = 0;
|
|
16
|
+
let chemdrawRows = [];
|
|
17
|
+
const logBuffers = { workflow: "", checkml: "" };
|
|
18
|
+
const chemdrawOptionalColumns = ["charge", "mult", "complex_type", "sample", "geom"];
|
|
19
|
+
const chemdrawColumns = document.getElementById("chemdraw-columns");
|
|
20
|
+
for (const name of chemdrawOptionalColumns) {
|
|
21
|
+
const label = document.createElement("label");
|
|
22
|
+
const input = document.createElement("input");
|
|
23
|
+
input.type = "checkbox";
|
|
24
|
+
input.dataset.chemdrawColumn = name;
|
|
25
|
+
label.append(input, document.createTextNode(name));
|
|
26
|
+
chemdrawColumns.appendChild(label);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function renderChemdrawTable() {
|
|
30
|
+
const optional = chemdrawOptionalColumns.filter(name => document.querySelector(`[data-chemdraw-column="${name}"]`).checked);
|
|
31
|
+
const columns = ["Image", "SMILES", "code_name", "target", ...optional];
|
|
32
|
+
const head = document.getElementById("chemdraw-head");
|
|
33
|
+
const body = document.getElementById("chemdraw-body");
|
|
34
|
+
head.replaceChildren();
|
|
35
|
+
body.replaceChildren();
|
|
36
|
+
const header = document.createElement("tr");
|
|
37
|
+
for (const column of columns) {
|
|
38
|
+
const cell = document.createElement("th");
|
|
39
|
+
cell.textContent = column === "target" ? document.getElementById("chemdraw-target-name").value || "target" : column;
|
|
40
|
+
header.appendChild(cell);
|
|
41
|
+
}
|
|
42
|
+
head.appendChild(header);
|
|
43
|
+
chemdrawRows.forEach((row, rowIndex) => {
|
|
44
|
+
const line = document.createElement("tr");
|
|
45
|
+
for (const column of columns) {
|
|
46
|
+
const cell = document.createElement("td");
|
|
47
|
+
if (column === "Image") {
|
|
48
|
+
if (row.image) {
|
|
49
|
+
const image = document.createElement("img");
|
|
50
|
+
image.src = row.image;
|
|
51
|
+
image.alt = `Molecule ${rowIndex + 1}`;
|
|
52
|
+
cell.appendChild(image);
|
|
53
|
+
}
|
|
54
|
+
} else if (column === "complex_type") {
|
|
55
|
+
const select = document.createElement("select");
|
|
56
|
+
for (const value of ["", "squareplanar", "squarepyramidal", "linear", "trigonalplanar"]) {
|
|
57
|
+
const option = document.createElement("option");
|
|
58
|
+
option.value = value;
|
|
59
|
+
option.textContent = value || "Select geometry";
|
|
60
|
+
select.appendChild(option);
|
|
61
|
+
}
|
|
62
|
+
select.value = row[column] || "";
|
|
63
|
+
select.dataset.chemdrawRow = String(rowIndex);
|
|
64
|
+
select.dataset.chemdrawField = column;
|
|
65
|
+
cell.appendChild(select);
|
|
66
|
+
} else {
|
|
67
|
+
const input = document.createElement("input");
|
|
68
|
+
input.value = row[column] || "";
|
|
69
|
+
input.dataset.chemdrawRow = String(rowIndex);
|
|
70
|
+
input.dataset.chemdrawField = column;
|
|
71
|
+
input.setAttribute("aria-label", `${column} for molecule ${rowIndex + 1}`);
|
|
72
|
+
cell.appendChild(input);
|
|
73
|
+
}
|
|
74
|
+
line.appendChild(cell);
|
|
75
|
+
}
|
|
76
|
+
body.appendChild(line);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function setLog(kind, value) {
|
|
81
|
+
logBuffers[kind] = value;
|
|
82
|
+
const log = document.getElementById(kind === "workflow" ? "workflow-log" : "checkml-log");
|
|
83
|
+
const atBottom = log.scrollHeight - log.scrollTop - log.clientHeight < 30;
|
|
84
|
+
log.textContent = value || "No output yet.";
|
|
85
|
+
if (atBottom) log.scrollTop = log.scrollHeight;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function applyLogChange(payload) {
|
|
89
|
+
const update = JSON.parse(payload);
|
|
90
|
+
if (!(update.kind in logBuffers)) return;
|
|
91
|
+
if (update.replace) {
|
|
92
|
+
setLog(update.kind, update.text);
|
|
93
|
+
} else if (logBuffers[update.kind].length === update.offset) {
|
|
94
|
+
const log = document.getElementById(update.kind === "workflow" ? "workflow-log" : "checkml-log");
|
|
95
|
+
const atBottom = log.scrollHeight - log.scrollTop - log.clientHeight < 30;
|
|
96
|
+
if (!logBuffers[update.kind]) log.textContent = "";
|
|
97
|
+
logBuffers[update.kind] += update.text;
|
|
98
|
+
log.appendChild(document.createTextNode(update.text));
|
|
99
|
+
if (atBottom) log.scrollTop = log.scrollHeight;
|
|
100
|
+
} else if (bridge) {
|
|
101
|
+
bridge.getLogs(snapshot => {
|
|
102
|
+
const logs = JSON.parse(snapshot);
|
|
103
|
+
setLog("workflow", logs.workflow);
|
|
104
|
+
setLog("checkml", logs.checkml);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function showChemdrawEditor(payload) {
|
|
110
|
+
chemdrawRows = JSON.parse(payload).rows;
|
|
111
|
+
document.getElementById("chemdraw-target-name").value = "target";
|
|
112
|
+
document.querySelectorAll("[data-chemdraw-column]").forEach(input => { input.checked = false; });
|
|
113
|
+
document.getElementById("chemdraw-message").textContent = `${chemdrawRows.length} molecules imported. Complete the name and target columns before saving.`;
|
|
114
|
+
document.getElementById("chemdraw-editor").hidden = false;
|
|
115
|
+
renderChemdrawTable();
|
|
116
|
+
showPage("aqme");
|
|
117
|
+
document.getElementById("chemdraw-editor").scrollIntoView({ behavior: "smooth", block: "start" });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function saveChemdrawEditor() {
|
|
121
|
+
if (!bridge || !chemdrawRows.length) return;
|
|
122
|
+
const columns = chemdrawOptionalColumns.filter(name => document.querySelector(`[data-chemdraw-column="${name}"]`).checked);
|
|
123
|
+
const payload = JSON.stringify({ rows: chemdrawRows, columns,
|
|
124
|
+
targetColumn: document.getElementById("chemdraw-target-name").value });
|
|
125
|
+
bridge.saveChemdrawCsv(payload, response => {
|
|
126
|
+
const result = JSON.parse(response);
|
|
127
|
+
const message = document.getElementById("chemdraw-message");
|
|
128
|
+
if (result.error) message.textContent = result.error;
|
|
129
|
+
else if (result.saved) message.textContent = `Saved ${result.saved}`;
|
|
130
|
+
else message.textContent = "Save cancelled.";
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function showPage(name) {
|
|
135
|
+
if (checkmlMode && !["checkml", "results", "bot", "tutorial"].includes(name)) return;
|
|
136
|
+
if (name === "bot" || name === "tutorial") {
|
|
137
|
+
openDrawer(name);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (name === "aqme" && document.querySelector('.nav-item[data-page="aqme"]').disabled) return;
|
|
141
|
+
document.querySelectorAll(".page").forEach(page => page.classList.toggle("active", page.id === `page-${name}`));
|
|
142
|
+
document.querySelectorAll(".nav-item[data-page]").forEach(button => button.classList.toggle("active", button.dataset.page === name));
|
|
143
|
+
document.querySelector(".main").scrollTop = 0;
|
|
144
|
+
if (bridge) bridge.performAction("activePage", name);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function showResult(name) {
|
|
148
|
+
showPage("results");
|
|
149
|
+
window.easyrobResults.open(name);
|
|
150
|
+
if (bridge) bridge.performAction("activeResultView", name);
|
|
151
|
+
const gallery = document.getElementById("embedded-gallery");
|
|
152
|
+
gallery.hidden = name !== "Images";
|
|
153
|
+
if (name === "Images") gallery.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function openDrawer(name) {
|
|
157
|
+
if (checkmlMode && name === "bot") return;
|
|
158
|
+
const previousTutorialOpen = !document.getElementById("tutorial-drawer").hidden;
|
|
159
|
+
const previousBotOpen = !document.getElementById("bot-drawer").hidden;
|
|
160
|
+
document.body.classList.toggle("drawer-open", name === "bot");
|
|
161
|
+
document.getElementById("tutorial-backdrop").hidden = name !== "tutorial";
|
|
162
|
+
for (const element of document.querySelectorAll(".sidebar, .main, #bot-drawer")) {
|
|
163
|
+
element.inert = name === "tutorial";
|
|
164
|
+
}
|
|
165
|
+
for (const drawerName of ["bot", "tutorial"]) {
|
|
166
|
+
const open = drawerName === name;
|
|
167
|
+
document.getElementById(`${drawerName}-drawer`).hidden = !open;
|
|
168
|
+
const toggle = document.querySelector(`.sidebar [data-${drawerName}-toggle]`);
|
|
169
|
+
toggle.classList.toggle("active", open);
|
|
170
|
+
toggle.setAttribute("aria-expanded", String(open));
|
|
171
|
+
}
|
|
172
|
+
if (name === "tutorial" && !previousTutorialOpen) {
|
|
173
|
+
document.querySelector("#tutorial-drawer .drawer-close").focus({ preventScroll: true });
|
|
174
|
+
} else if (name === "bot" && !previousBotOpen) {
|
|
175
|
+
document.getElementById("bot-draft").focus({ preventScroll: true });
|
|
176
|
+
} else if (!name && previousTutorialOpen) {
|
|
177
|
+
document.querySelector(".sidebar [data-tutorial-toggle]").focus({ preventScroll: true });
|
|
178
|
+
} else if (!name && previousBotOpen) {
|
|
179
|
+
document.querySelector(".sidebar [data-bot-toggle]").focus({ preventScroll: true });
|
|
180
|
+
}
|
|
181
|
+
if (name === "bot" && bridge) bridge.performAction("botOpen", "");
|
|
182
|
+
if (name === "tutorial" && bridge && !tutorials.length) {
|
|
183
|
+
bridge.getTutorials(payload => {
|
|
184
|
+
tutorials = JSON.parse(payload);
|
|
185
|
+
renderTutorial();
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function toggleDrawer(name) {
|
|
191
|
+
openDrawer(document.getElementById(`${name}-drawer`).hidden ? name : null);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function renderTutorial() {
|
|
195
|
+
if (!tutorials.length) return;
|
|
196
|
+
const topics = document.getElementById("tutorial-topics");
|
|
197
|
+
if (topics.children.length !== tutorials.length) {
|
|
198
|
+
topics.replaceChildren();
|
|
199
|
+
tutorials.forEach((topic, index) => {
|
|
200
|
+
const button = document.createElement("button");
|
|
201
|
+
button.type = "button";
|
|
202
|
+
button.className = "tutorial-topic";
|
|
203
|
+
button.dataset.tutorial = String(index);
|
|
204
|
+
button.textContent = topic.title;
|
|
205
|
+
topics.appendChild(button);
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
[...topics.children].forEach((button, index) => {
|
|
209
|
+
button.classList.toggle("active", index === tutorialTopic);
|
|
210
|
+
if (index === tutorialTopic) button.setAttribute("aria-current", "true");
|
|
211
|
+
else button.removeAttribute("aria-current");
|
|
212
|
+
});
|
|
213
|
+
const topic = tutorials[tutorialTopic];
|
|
214
|
+
const step = topic.steps[tutorialStep];
|
|
215
|
+
document.getElementById("tutorial-title").textContent = topic.title;
|
|
216
|
+
document.getElementById("tutorial-count").textContent = `${topic.steps.length} STEPS`;
|
|
217
|
+
document.getElementById("tutorial-position").textContent = `${tutorialStep + 1} / ${topic.steps.length}`;
|
|
218
|
+
document.getElementById("tutorial-image").src = step.image;
|
|
219
|
+
document.getElementById("tutorial-image").alt = `${topic.title}, step ${tutorialStep + 1}`;
|
|
220
|
+
document.getElementById("tutorial-copy").innerHTML = step.html;
|
|
221
|
+
document.querySelector(".tutorial-step").scrollTop = 0;
|
|
222
|
+
document.getElementById("tutorial-previous").disabled = tutorialStep === 0;
|
|
223
|
+
document.getElementById("tutorial-next").disabled = tutorialStep === topic.steps.length - 1;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function updateSelect(select, options, current) {
|
|
227
|
+
const signature = JSON.stringify(options);
|
|
228
|
+
if (select.dataset.snapshot !== signature) {
|
|
229
|
+
select.dataset.snapshot = signature;
|
|
230
|
+
select.replaceChildren();
|
|
231
|
+
for (const option of options) {
|
|
232
|
+
const item = document.createElement("option");
|
|
233
|
+
item.value = option.value;
|
|
234
|
+
item.textContent = option.label;
|
|
235
|
+
select.appendChild(item);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
select.value = current;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function renderBot(bot) {
|
|
242
|
+
if ((lastBotProvider !== null && lastBotProvider !== bot.provider)
|
|
243
|
+
|| (lastBotApiSaved !== null && lastBotApiSaved !== bot.apiSaved)) {
|
|
244
|
+
document.getElementById("bot-api-key").value = "";
|
|
245
|
+
}
|
|
246
|
+
lastBotProvider = bot.provider;
|
|
247
|
+
lastBotApiSaved = bot.apiSaved;
|
|
248
|
+
updateSelect(document.getElementById("bot-mode"), bot.modes.map(value => ({ value, label: value })), bot.mode);
|
|
249
|
+
updateSelect(document.getElementById("bot-provider"), bot.providers.map(value => ({ value, label: value })), bot.provider);
|
|
250
|
+
updateSelect(document.getElementById("bot-suggestions"), [{ value: "", label: "Choose a suggested question..." },
|
|
251
|
+
...bot.suggestions.map(item => ({ value: String(item.index), label: item.label }))], "");
|
|
252
|
+
document.getElementById("bot-cloud-settings").hidden = bot.mode !== "Cloud AI";
|
|
253
|
+
document.getElementById("bot-web-search").checked = bot.webSearch;
|
|
254
|
+
document.getElementById("bot-api-status").textContent = bot.apiSaved ? "API key saved locally" : "No saved API key";
|
|
255
|
+
document.getElementById("bot-delete-api").disabled = !bot.apiSaved || bot.busy;
|
|
256
|
+
document.getElementById("bot-send").disabled = !bot.canSend;
|
|
257
|
+
document.getElementById("bot-draft").disabled = bot.busy;
|
|
258
|
+
if (document.activeElement !== document.getElementById("bot-draft")) document.getElementById("bot-draft").value = bot.draft;
|
|
259
|
+
if (focusBotDraftAfterSend && !bot.busy && !document.getElementById("bot-drawer").hidden) {
|
|
260
|
+
document.getElementById("bot-draft").focus({ preventScroll: true });
|
|
261
|
+
focusBotDraftAfterSend = false;
|
|
262
|
+
}
|
|
263
|
+
document.getElementById("bot-last-usage").textContent = bot.lastUsage;
|
|
264
|
+
document.getElementById("bot-session-usage").textContent = bot.sessionUsage;
|
|
265
|
+
document.getElementById("bot-request-stage").textContent = bot.requestStage || "Ask about your workflow, results, or AQME and ROBERT.";
|
|
266
|
+
document.getElementById("bot-summarize").disabled = !bot.canSummarize || bot.busy;
|
|
267
|
+
const history = document.getElementById("bot-messages");
|
|
268
|
+
const signature = JSON.stringify(bot.messages);
|
|
269
|
+
if (history.dataset.snapshot !== signature) {
|
|
270
|
+
history.dataset.snapshot = signature;
|
|
271
|
+
history.replaceChildren();
|
|
272
|
+
for (const message of bot.messages) {
|
|
273
|
+
const bubble = document.createElement("article");
|
|
274
|
+
bubble.className = `bot-message ${message.role.toLowerCase() === "user" ? "user" : "assistant"}`;
|
|
275
|
+
const label = document.createElement("strong");
|
|
276
|
+
label.textContent = message.role;
|
|
277
|
+
const content = document.createElement("div");
|
|
278
|
+
content.className = "bot-message-content";
|
|
279
|
+
if (message.html) content.innerHTML = message.html;
|
|
280
|
+
else content.textContent = message.content;
|
|
281
|
+
bubble.append(label, content);
|
|
282
|
+
history.appendChild(bubble);
|
|
283
|
+
}
|
|
284
|
+
history.scrollTop = history.scrollHeight;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
function displayPath(path) {
|
|
289
|
+
if (!path) return "No file selected";
|
|
290
|
+
return path.replaceAll("\\", "/").split("/").at(-1);
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function renderFields(group, fields) {
|
|
294
|
+
const container = document.getElementById(`${group}-fields`);
|
|
295
|
+
if (!container) return;
|
|
296
|
+
const signature = JSON.stringify(fields);
|
|
297
|
+
if (fieldSnapshots.get(group) === signature) return;
|
|
298
|
+
fieldSnapshots.set(group, signature);
|
|
299
|
+
const active = document.activeElement;
|
|
300
|
+
const draft = container.contains(active) && active.matches('input[type="text"][data-field]')
|
|
301
|
+
? { key: active.dataset.field, value: active.value,
|
|
302
|
+
start: active.selectionStart, end: active.selectionEnd } : null;
|
|
303
|
+
container.replaceChildren();
|
|
304
|
+
for (const field of fields) {
|
|
305
|
+
const wrapper = document.createElement("div");
|
|
306
|
+
wrapper.className = `field ${field.type === "toggle" ? "toggle-field" : ""}`;
|
|
307
|
+
const label = document.createElement("label");
|
|
308
|
+
label.textContent = field.label;
|
|
309
|
+
const input = document.createElement(field.type === "select" ? "select" : "input");
|
|
310
|
+
input.dataset.field = field.key;
|
|
311
|
+
input.disabled = !field.enabled;
|
|
312
|
+
if (field.type === "select") {
|
|
313
|
+
for (const option of field.options) {
|
|
314
|
+
const item = document.createElement("option");
|
|
315
|
+
item.value = option;
|
|
316
|
+
item.textContent = option;
|
|
317
|
+
input.appendChild(item);
|
|
318
|
+
}
|
|
319
|
+
input.value = field.value;
|
|
320
|
+
} else if (field.type === "toggle") {
|
|
321
|
+
input.type = "checkbox";
|
|
322
|
+
input.checked = field.value;
|
|
323
|
+
} else {
|
|
324
|
+
input.type = "text";
|
|
325
|
+
input.value = field.value;
|
|
326
|
+
input.placeholder = field.placeholder || "Default";
|
|
327
|
+
}
|
|
328
|
+
const inputId = `field-${field.key.replaceAll(".", "-")}`;
|
|
329
|
+
input.id = inputId;
|
|
330
|
+
label.htmlFor = inputId;
|
|
331
|
+
wrapper.appendChild(label);
|
|
332
|
+
wrapper.appendChild(input);
|
|
333
|
+
container.appendChild(wrapper);
|
|
334
|
+
}
|
|
335
|
+
if (draft) {
|
|
336
|
+
const restored = [...container.querySelectorAll('input[type="text"][data-field]')]
|
|
337
|
+
.find(input => input.dataset.field === draft.key && !input.disabled);
|
|
338
|
+
if (restored) {
|
|
339
|
+
restored.value = draft.value;
|
|
340
|
+
restored.focus({ preventScroll: true });
|
|
341
|
+
restored.setSelectionRange(draft.start, draft.end);
|
|
342
|
+
if (bridge && fields.find(field => field.key === draft.key)?.value !== draft.value) {
|
|
343
|
+
bridge.setField(draft.key, draft.value);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function renderColumns(containerId, values, action) {
|
|
350
|
+
const container = document.getElementById(containerId);
|
|
351
|
+
const signature = JSON.stringify(values);
|
|
352
|
+
if (container.dataset.snapshot === signature) return;
|
|
353
|
+
container.dataset.snapshot = signature;
|
|
354
|
+
container.replaceChildren();
|
|
355
|
+
if (!values.length) {
|
|
356
|
+
const empty = document.createElement("span");
|
|
357
|
+
empty.className = "column-placeholder";
|
|
358
|
+
empty.textContent = "No columns";
|
|
359
|
+
container.appendChild(empty);
|
|
360
|
+
return;
|
|
361
|
+
}
|
|
362
|
+
for (const name of values) {
|
|
363
|
+
const button = document.createElement("button");
|
|
364
|
+
button.className = `column-chip ${action === "restore" ? "restore" : ""}`;
|
|
365
|
+
button.type = "button";
|
|
366
|
+
button.dataset.action = action;
|
|
367
|
+
button.dataset.value = name;
|
|
368
|
+
button.title = action === "ignore" ? "Exclude this column" : "Use this column";
|
|
369
|
+
button.textContent = action === "ignore" ? `${name} →` : `← ${name}`;
|
|
370
|
+
container.appendChild(button);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function renderProgress(states, aqmeState) {
|
|
375
|
+
const list = document.getElementById("workflow-progress");
|
|
376
|
+
const signature = JSON.stringify([states, aqmeState]);
|
|
377
|
+
if (list.dataset.snapshot === signature) return;
|
|
378
|
+
list.dataset.snapshot = signature;
|
|
379
|
+
list.replaceChildren();
|
|
380
|
+
const items = stages.map((name, index) => ({ name, state: states[index] || "idle" }));
|
|
381
|
+
if (aqmeState !== "inactive") items.unshift({ name: "AQME", state: aqmeState });
|
|
382
|
+
const captions = { done: "Complete", active: "Running", pending: "Up next", inactive: "Not selected",
|
|
383
|
+
failed: "Failed", stopped: "Stopped", idle: "Not started" };
|
|
384
|
+
const descriptions = { AQME: "Calculate molecular descriptors", CURATE: "Prepare the dataset",
|
|
385
|
+
GENERATE: "Train candidate models", VERIFY: "Validate model quality",
|
|
386
|
+
PREDICT: "Generate predictions", REPORT: "Assemble the report" };
|
|
387
|
+
const selected = items.filter(item => item.state !== "inactive");
|
|
388
|
+
const completed = selected.filter(item => item.state === "done").length;
|
|
389
|
+
const total = selected.length;
|
|
390
|
+
const percentage = total ? Math.round(completed * 100 / total) : 0;
|
|
391
|
+
document.getElementById("workflow-completion").textContent = `${completed} of ${total} complete`;
|
|
392
|
+
document.getElementById("workflow-percent").textContent = `${percentage}%`;
|
|
393
|
+
document.getElementById("workflow-meter-fill").style.width = `${percentage}%`;
|
|
394
|
+
document.querySelector(".progress-meter").setAttribute("aria-valuenow", String(percentage));
|
|
395
|
+
const overall = selected.some(item => item.state === "failed") ? "Failed"
|
|
396
|
+
: selected.some(item => item.state === "stopped") ? "Stopped"
|
|
397
|
+
: selected.some(item => item.state === "active") ? "Running"
|
|
398
|
+
: total && completed === total ? "Complete" : "Ready";
|
|
399
|
+
const badge = document.getElementById("workflow-state-badge");
|
|
400
|
+
badge.textContent = overall;
|
|
401
|
+
badge.dataset.state = overall.toLowerCase();
|
|
402
|
+
items.forEach((item, index) => {
|
|
403
|
+
const row = document.createElement("div");
|
|
404
|
+
row.className = `progress-row status-${item.state}`;
|
|
405
|
+
row.setAttribute("role", "listitem");
|
|
406
|
+
row.setAttribute("aria-label", `${item.name}: ${captions[item.state] || "Pending"}`);
|
|
407
|
+
const marker = document.createElement("span");
|
|
408
|
+
marker.className = "progress-marker";
|
|
409
|
+
marker.textContent = item.state === "done" ? "✓" : item.state === "failed" ? "!"
|
|
410
|
+
: item.state === "stopped" ? "■" : String(index + 1).padStart(2, "0");
|
|
411
|
+
const copy = document.createElement("span");
|
|
412
|
+
copy.className = "progress-copy";
|
|
413
|
+
const name = document.createElement("strong");
|
|
414
|
+
name.textContent = item.name;
|
|
415
|
+
const description = document.createElement("small");
|
|
416
|
+
description.textContent = descriptions[item.name] || "Processing stage";
|
|
417
|
+
copy.append(name, description);
|
|
418
|
+
const status = document.createElement("span");
|
|
419
|
+
status.className = "progress-status";
|
|
420
|
+
status.textContent = captions[item.state] || "Pending";
|
|
421
|
+
row.append(marker, copy, status);
|
|
422
|
+
list.appendChild(row);
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function renderResults(results) {
|
|
427
|
+
window.easyrobResults.render(results);
|
|
428
|
+
const gallery = document.getElementById("embedded-gallery");
|
|
429
|
+
if (!results.available.Images && !gallery.hidden) {
|
|
430
|
+
gallery.hidden = true;
|
|
431
|
+
if (bridge) bridge.performAction("activeResultView", "");
|
|
432
|
+
}
|
|
433
|
+
const toolbar = document.getElementById("result-model-toolbar");
|
|
434
|
+
const selector = document.getElementById("result-model");
|
|
435
|
+
toolbar.hidden = results.models.length < 2;
|
|
436
|
+
const modelSignature = JSON.stringify(results.models);
|
|
437
|
+
if (selector.dataset.snapshot !== modelSignature) {
|
|
438
|
+
selector.dataset.snapshot = modelSignature;
|
|
439
|
+
selector.replaceChildren();
|
|
440
|
+
for (const model of results.models) {
|
|
441
|
+
const option = document.createElement("option");
|
|
442
|
+
option.value = model.value;
|
|
443
|
+
option.textContent = model.label;
|
|
444
|
+
selector.appendChild(option);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
selector.value = results.selectedModel;
|
|
448
|
+
for (const card of document.querySelectorAll(".result-card")) {
|
|
449
|
+
const name = card.dataset.value;
|
|
450
|
+
const available = Boolean(results.available[name]);
|
|
451
|
+
card.disabled = !available;
|
|
452
|
+
const list = card.querySelector(".result-files");
|
|
453
|
+
const files = (results.files[name] || []).slice(0, 3);
|
|
454
|
+
const signature = JSON.stringify(files);
|
|
455
|
+
if (list.dataset.snapshot !== signature) {
|
|
456
|
+
list.dataset.snapshot = signature;
|
|
457
|
+
list.replaceChildren();
|
|
458
|
+
for (const filename of files) {
|
|
459
|
+
const item = document.createElement("li");
|
|
460
|
+
item.textContent = filename;
|
|
461
|
+
list.appendChild(item);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
card.querySelector("em").textContent = available ? (name === "Images" ? "Open gallery ↓" : "Explore here ↓") : "No output yet";
|
|
465
|
+
}
|
|
466
|
+
renderGallery(results.gallery);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
function renderGallery(nextState) {
|
|
470
|
+
const signature = JSON.stringify(nextState);
|
|
471
|
+
if (document.getElementById("gallery-grid").dataset.snapshot === `${galleryStage}:${signature}`) return;
|
|
472
|
+
galleryState = nextState;
|
|
473
|
+
if (galleryStage !== "all" && !galleryState.stages.some(stage => stage.id === galleryStage)) galleryStage = "all";
|
|
474
|
+
const filters = document.getElementById("gallery-filters");
|
|
475
|
+
const grid = document.getElementById("gallery-grid");
|
|
476
|
+
filters.replaceChildren();
|
|
477
|
+
grid.replaceChildren();
|
|
478
|
+
const choices = [{ id: "all", label: "All images", count: galleryState.total },
|
|
479
|
+
...galleryState.stages.map(stage => ({ id: stage.id, label: stage.label, count: stage.images.length }))];
|
|
480
|
+
for (const choice of choices) {
|
|
481
|
+
const button = document.createElement("button");
|
|
482
|
+
button.type = "button";
|
|
483
|
+
button.className = "gallery-filter";
|
|
484
|
+
button.dataset.stage = choice.id;
|
|
485
|
+
button.setAttribute("aria-pressed", String(choice.id === galleryStage));
|
|
486
|
+
button.textContent = `${choice.label} ${choice.count}`;
|
|
487
|
+
filters.appendChild(button);
|
|
488
|
+
}
|
|
489
|
+
for (const stage of galleryState.stages) {
|
|
490
|
+
if (galleryStage !== "all" && galleryStage !== stage.id) continue;
|
|
491
|
+
for (const image of stage.images) {
|
|
492
|
+
const card = document.createElement("article");
|
|
493
|
+
card.className = "gallery-card";
|
|
494
|
+
const preview = document.createElement("img");
|
|
495
|
+
preview.src = image.url;
|
|
496
|
+
preview.alt = image.name;
|
|
497
|
+
preview.loading = "lazy";
|
|
498
|
+
const body = document.createElement("div");
|
|
499
|
+
body.className = "gallery-card-body";
|
|
500
|
+
const heading = document.createElement("strong");
|
|
501
|
+
heading.textContent = image.name;
|
|
502
|
+
const stageLabel = document.createElement("small");
|
|
503
|
+
stageLabel.textContent = stage.label;
|
|
504
|
+
const actions = document.createElement("div");
|
|
505
|
+
actions.className = "gallery-actions";
|
|
506
|
+
for (const [action, label] of [["open", "Open"], ["copy", "Copy"], ["save", "Save as"], ["folder", "Folder"]]) {
|
|
507
|
+
const button = document.createElement("button");
|
|
508
|
+
button.type = "button";
|
|
509
|
+
button.className = "text-button";
|
|
510
|
+
button.dataset.action = "imageAction";
|
|
511
|
+
button.dataset.value = `${image.id}|${action}`;
|
|
512
|
+
button.textContent = label;
|
|
513
|
+
actions.appendChild(button);
|
|
514
|
+
}
|
|
515
|
+
body.append(stageLabel, heading, actions);
|
|
516
|
+
card.append(preview, body);
|
|
517
|
+
grid.appendChild(card);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
grid.dataset.snapshot = `${galleryStage}:${signature}`;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
function renderMolecule(molecule) {
|
|
524
|
+
const image = document.getElementById("molecule-image");
|
|
525
|
+
const message = document.getElementById("molecule-message");
|
|
526
|
+
if (image.dataset.snapshot !== molecule.image) {
|
|
527
|
+
image.dataset.snapshot = molecule.image;
|
|
528
|
+
image.src = molecule.image || "";
|
|
529
|
+
}
|
|
530
|
+
image.hidden = !molecule.image;
|
|
531
|
+
image.classList.toggle("selectable", molecule.canSelect);
|
|
532
|
+
message.hidden = Boolean(molecule.image);
|
|
533
|
+
message.textContent = molecule.message || "Choose a CSV with a SMILES column to inspect its common pattern.";
|
|
534
|
+
document.getElementById("molecule-info").textContent = molecule.info;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function render(state) {
|
|
538
|
+
for (const [group, fields] of Object.entries(state.groups)) renderFields(group, fields);
|
|
539
|
+
for (const [id, path] of Object.entries({
|
|
540
|
+
"train-file": state.files.train,
|
|
541
|
+
"test-file": state.files.test,
|
|
542
|
+
"checkml-train-file": state.files.checkmlTrain,
|
|
543
|
+
"checkml-test-file": state.files.checkmlTest,
|
|
544
|
+
"checkml-params-file": state.files.checkmlParams,
|
|
545
|
+
"checkml-model-file": state.files.checkmlModel,
|
|
546
|
+
})) {
|
|
547
|
+
const label = document.getElementById(id);
|
|
548
|
+
label.textContent = path ? displayPath(path) : id.includes("params") || id.includes("model-file") ? "" : "No file selected";
|
|
549
|
+
label.title = path || "";
|
|
550
|
+
}
|
|
551
|
+
document.querySelector('[data-action="clearTest"]').hidden = !state.files.test;
|
|
552
|
+
document.getElementById("clear-checkml-test").hidden = !state.files.checkmlTest;
|
|
553
|
+
document.getElementById("checkml-params-picker").hidden = state.checkmlSource !== 2;
|
|
554
|
+
document.getElementById("checkml-model-picker").hidden = state.checkmlSource !== 3;
|
|
555
|
+
document.getElementById("available-count").textContent = state.columns.available.length;
|
|
556
|
+
document.getElementById("ignored-count").textContent = state.columns.ignored.length;
|
|
557
|
+
renderColumns("available-columns", state.columns.available, "ignore");
|
|
558
|
+
renderColumns("ignored-columns", state.columns.ignored, "restore");
|
|
559
|
+
renderMolecule(state.molecule);
|
|
560
|
+
renderBot(state.bot);
|
|
561
|
+
renderProgress(state.progressStates || [], state.aqmeProgress || "inactive");
|
|
562
|
+
const progressBadge = document.getElementById("workflow-state-badge").textContent;
|
|
563
|
+
const activeStage = document.querySelector(".progress-row.status-active .progress-copy strong")?.textContent;
|
|
564
|
+
document.getElementById("workflow-activity").textContent = state.activity || (activeStage
|
|
565
|
+
? `${activeStage} is running` : progressBadge === "Complete" ? "Workflow complete"
|
|
566
|
+
: progressBadge === "Failed" ? "Workflow stopped with an error"
|
|
567
|
+
: progressBadge === "Stopped" ? "Workflow stopped" : "Waiting for a run");
|
|
568
|
+
if ("log" in state) setLog("workflow", state.log);
|
|
569
|
+
if ("checkmlLog" in state) setLog("checkml", state.checkmlLog);
|
|
570
|
+
document.getElementById("run-button").disabled = !state.actions.run;
|
|
571
|
+
document.getElementById("aqme-run-button").disabled = !state.actions.runAqme;
|
|
572
|
+
document.getElementById("stop-button").disabled = !state.actions.stop;
|
|
573
|
+
document.getElementById("checkml-run-button").disabled = !state.actions.checkmlRun;
|
|
574
|
+
document.getElementById("checkml-stop-button").disabled = !state.actions.checkmlStop;
|
|
575
|
+
const aqmeNavigation = document.querySelector('.nav-item[data-page="aqme"]');
|
|
576
|
+
aqmeNavigation.disabled = !state.actions.aqme;
|
|
577
|
+
aqmeNavigation.title = state.actions.aqme ? "Configure AQME descriptors" : "Enable Calculate descriptors with AQME in Workflow to configure descriptors";
|
|
578
|
+
if (!state.actions.aqme && document.getElementById("page-aqme").classList.contains("active")) showPage("workflow");
|
|
579
|
+
document.getElementById("results-empty").hidden = state.actions.results;
|
|
580
|
+
renderResults(state.results);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
document.addEventListener("click", event => {
|
|
584
|
+
const botLink = event.target.closest("#bot-messages a[href]");
|
|
585
|
+
if (botLink && bridge) {
|
|
586
|
+
event.preventDefault();
|
|
587
|
+
bridge.performAction("openBotLink", botLink.href);
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
if (bridge && event.target.closest("[data-close-result]")) {
|
|
591
|
+
bridge.performAction("activeResultView", "");
|
|
592
|
+
}
|
|
593
|
+
const consoleToggle = event.target.closest("[data-console-toggle]");
|
|
594
|
+
if (consoleToggle) {
|
|
595
|
+
const log = document.getElementById(consoleToggle.getAttribute("aria-controls"));
|
|
596
|
+
log.hidden = !log.hidden;
|
|
597
|
+
consoleToggle.setAttribute("aria-expanded", String(!log.hidden));
|
|
598
|
+
if (!log.hidden) log.scrollTop = log.scrollHeight;
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
if (event.target.id === "chemdraw-close") {
|
|
602
|
+
document.getElementById("chemdraw-editor").hidden = true;
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
if (event.target.id === "chemdraw-save") {
|
|
606
|
+
saveChemdrawEditor();
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
if (event.target.closest("[data-bot-toggle]")) {
|
|
610
|
+
toggleDrawer("bot");
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
if (event.target.closest("[data-tutorial-toggle]")) {
|
|
614
|
+
toggleDrawer("tutorial");
|
|
615
|
+
return;
|
|
616
|
+
}
|
|
617
|
+
if (event.target.id === "tutorial-backdrop") {
|
|
618
|
+
openDrawer(null);
|
|
619
|
+
return;
|
|
620
|
+
}
|
|
621
|
+
const topic = event.target.closest("[data-tutorial]");
|
|
622
|
+
if (topic) {
|
|
623
|
+
tutorialTopic = Number(topic.dataset.tutorial);
|
|
624
|
+
tutorialStep = 0;
|
|
625
|
+
renderTutorial();
|
|
626
|
+
return;
|
|
627
|
+
}
|
|
628
|
+
if (event.target.id === "tutorial-previous" && tutorialStep > 0) {
|
|
629
|
+
tutorialStep -= 1;
|
|
630
|
+
renderTutorial();
|
|
631
|
+
return;
|
|
632
|
+
}
|
|
633
|
+
if (event.target.id === "tutorial-next" && tutorialStep < tutorials[tutorialTopic].steps.length - 1) {
|
|
634
|
+
tutorialStep += 1;
|
|
635
|
+
renderTutorial();
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
const filter = event.target.closest("[data-stage]");
|
|
639
|
+
if (filter) {
|
|
640
|
+
galleryStage = filter.dataset.stage;
|
|
641
|
+
document.getElementById("gallery-grid").dataset.snapshot = "";
|
|
642
|
+
renderGallery(galleryState);
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
if (event.target.id === "close-gallery") {
|
|
646
|
+
document.getElementById("embedded-gallery").hidden = true;
|
|
647
|
+
if (bridge) bridge.performAction("activeResultView", "");
|
|
648
|
+
return;
|
|
649
|
+
}
|
|
650
|
+
if (event.target.id === "molecule-image" && event.target.classList.contains("selectable") && bridge) {
|
|
651
|
+
const bounds = event.target.getBoundingClientRect();
|
|
652
|
+
const x = Math.floor((event.clientX - bounds.left) * 400 / bounds.width);
|
|
653
|
+
const y = Math.floor((event.clientY - bounds.top) * 400 / bounds.height);
|
|
654
|
+
bridge.performAction("selectAtom", `${x},${y}`);
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
const navigation = event.target.closest("[data-page]");
|
|
658
|
+
if (navigation) {
|
|
659
|
+
showPage(navigation.dataset.page);
|
|
660
|
+
return;
|
|
661
|
+
}
|
|
662
|
+
const action = event.target.closest("[data-action]");
|
|
663
|
+
if (action && bridge && !action.disabled) {
|
|
664
|
+
if (action.dataset.action === "openResult") {
|
|
665
|
+
showResult(action.dataset.value);
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
if (action.dataset.action === "botSend") focusBotDraftAfterSend = true;
|
|
669
|
+
bridge.performAction(action.dataset.action, action.dataset.value || "");
|
|
670
|
+
}
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
document.addEventListener("change", event => {
|
|
674
|
+
if (event.target.matches("[data-chemdraw-column]")) {
|
|
675
|
+
renderChemdrawTable();
|
|
676
|
+
return;
|
|
677
|
+
}
|
|
678
|
+
if (event.target.matches("[data-chemdraw-row]")) {
|
|
679
|
+
chemdrawRows[Number(event.target.dataset.chemdrawRow)][event.target.dataset.chemdrawField] = event.target.value;
|
|
680
|
+
return;
|
|
681
|
+
}
|
|
682
|
+
if (bridge && event.target.id === "bot-mode") return bridge.performAction("botMode", event.target.value);
|
|
683
|
+
if (bridge && event.target.id === "bot-provider") {
|
|
684
|
+
document.getElementById("bot-api-key").value = "";
|
|
685
|
+
return bridge.performAction("botProvider", event.target.value);
|
|
686
|
+
}
|
|
687
|
+
if (bridge && event.target.id === "bot-web-search") return bridge.performAction("botWebSearch", String(event.target.checked));
|
|
688
|
+
if (bridge && event.target.id === "bot-suggestions" && event.target.value) return bridge.performAction("botSuggestion", event.target.value);
|
|
689
|
+
if (event.target.id === "result-model" && bridge) {
|
|
690
|
+
bridge.performAction("setResultModel", event.target.value);
|
|
691
|
+
return;
|
|
692
|
+
}
|
|
693
|
+
const input = event.target.closest("[data-field]");
|
|
694
|
+
if (input && bridge) bridge.setField(input.dataset.field, input.type === "checkbox" ? String(input.checked) : input.value);
|
|
695
|
+
});
|
|
696
|
+
|
|
697
|
+
document.addEventListener("input", event => {
|
|
698
|
+
if (event.target.id === "chemdraw-target-name") {
|
|
699
|
+
const targetHeader = document.querySelector("#chemdraw-head th:nth-child(4)");
|
|
700
|
+
if (targetHeader) targetHeader.textContent = event.target.value || "target";
|
|
701
|
+
}
|
|
702
|
+
if (event.target.matches("[data-chemdraw-row]")) {
|
|
703
|
+
chemdrawRows[Number(event.target.dataset.chemdrawRow)][event.target.dataset.chemdrawField] = event.target.value;
|
|
704
|
+
}
|
|
705
|
+
if (!bridge) return;
|
|
706
|
+
if (event.target.id === "bot-draft") bridge.setBotDraft(event.target.value);
|
|
707
|
+
if (event.target.id === "bot-api-key") bridge.setBotApiKey(event.target.value);
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
document.getElementById("bot-draft").addEventListener("keydown", event => {
|
|
711
|
+
if (event.key === "Enter" && bridge) {
|
|
712
|
+
event.preventDefault();
|
|
713
|
+
focusBotDraftAfterSend = true;
|
|
714
|
+
bridge.performAction("botSend", "");
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
document.addEventListener("keydown", event => {
|
|
719
|
+
const tutorial = document.getElementById("tutorial-drawer");
|
|
720
|
+
if (event.key === "Escape" && (!tutorial.hidden || !document.getElementById("bot-drawer").hidden)) {
|
|
721
|
+
openDrawer(null);
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
if (event.key === "Tab" && !tutorial.hidden) {
|
|
725
|
+
const focusable = [...tutorial.querySelectorAll("button:not(:disabled), a[href]")];
|
|
726
|
+
if (!focusable.length) return;
|
|
727
|
+
const first = focusable[0];
|
|
728
|
+
const last = focusable[focusable.length - 1];
|
|
729
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
730
|
+
event.preventDefault();
|
|
731
|
+
last.focus();
|
|
732
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
733
|
+
event.preventDefault();
|
|
734
|
+
first.focus();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
|
|
739
|
+
window.easyrobApp = { bridgeReady: false, showPage, showResult, openDrawer };
|
|
740
|
+
|
|
741
|
+
if (checkmlMode) {
|
|
742
|
+
document.body.classList.add("checkml-mode");
|
|
743
|
+
document.title = "CheckML";
|
|
744
|
+
document.querySelector(".brand img").src = "checkml_brand.png";
|
|
745
|
+
document.querySelector(".brand img").alt = "CheckML";
|
|
746
|
+
document.querySelector(".topbar-version").textContent = "CheckML · Desktop";
|
|
747
|
+
document.querySelector(".tutorial-drawer .drawer-heading h2").innerHTML = "CheckML tutorial<span class=\"dot\">.</span>";
|
|
748
|
+
document.getElementById("bot-request-stage").textContent = "Ask about CheckML and its results.";
|
|
749
|
+
document.getElementById("bot-draft").placeholder = "Ask about CheckML and its results";
|
|
750
|
+
showPage("checkml");
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
if (window.qt && window.qt.webChannelTransport && window.QWebChannel) {
|
|
754
|
+
new QWebChannel(window.qt.webChannelTransport, channel => {
|
|
755
|
+
bridge = channel.objects.workflow;
|
|
756
|
+
window.easyrobResults.connect(bridge);
|
|
757
|
+
window.easyrobApp.bridgeReady = true;
|
|
758
|
+
bridge.stateChanged.connect(payload => render(JSON.parse(payload)));
|
|
759
|
+
bridge.logChanged.connect(applyLogChange);
|
|
760
|
+
bridge.chemdrawReady.connect(showChemdrawEditor);
|
|
761
|
+
bridge.getState(payload => render(JSON.parse(payload)));
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
})();
|