diff --git a/form.js b/form.js index 4318d98..44dfe72 100644 --- a/form.js +++ b/form.js @@ -11,6 +11,24 @@ hideWhenUnchecked: new Set(COLABFOLD_ADVANCED_HIDE_TARGETS) }, }; + const METHOD_TOKEN_LIMITS = { + boltz: { + title: "Boltz", + limit: "5,000" + }, + alphafold2: { + title: "AlphaFold2", + limit: "4,000" + }, + colabfold: { + title: "ColabFold", + limit: "4,000" + }, + esmfold: { + title: "ESMFold", + limit: "600" + } + }; const escapeForSelector = (value) => { if (window.CSS && typeof window.CSS.escape === "function") { @@ -278,6 +296,51 @@ document.addEventListener("turbo:load", initDynamicHide); document.addEventListener("page:load", initDynamicHide); + const initMethodTokenLimitPanel = () => { + const methodControl = getFieldControl("af_method", "select"); + if (!methodControl) return; + + const container = getFieldContainer(methodControl); + if (!container) return; + + let panel = document.getElementById("af_method_token_limits_panel"); + if (!panel) { + panel = document.createElement("div"); + panel.id = "af_method_token_limits_panel"; + panel.className = "alert alert-info mt-2"; + panel.setAttribute("role", "status"); + panel.setAttribute("aria-live", "polite"); + container.insertAdjacentElement("afterend", panel); + } + + const update = () => { + const info = METHOD_TOKEN_LIMITS[methodControl.value]; + if (!info) { + panel.hidden = true; + panel.innerHTML = ""; + return; + } + + const noteHtml = info.note ? `