PageSourceSearch

https://gettheminutes.com/v2-assets/release-20260930-realtime/model-preferences.mjs

js gettheminutes.com collected 2026-10-02 01:31:26 UTC 1,404 bytes, 40 lines download raw bytes

1/** Remember only explicit choices. Loading a preference never substitutes another model. */
2export async function loadPreference(api, purpose) {
3  try {
4    return await api(`/api/v2/model-preferences/${purpose}`);
5  } catch {
6    return { selection: null, reason: "preferences_unavailable" };
7  }
8}
9import { selectionComplete } from "./models.mjs";
10export function rememberButton({ api, purpose, value, verify, status, hosted = false }) {
11  const button = document.createElement("button");
12  button.type = "button";
13  button.className = "btn btn--sm";
14  button.textContent = "Remember this selection";
15  button.onclick = async () => {
16    button.disabled = true;
17    try {
18      const selection = value();
19      if (!selectionComplete(selection, hosted))
20        throw new Error(
21          hosted ? "Choose a model first." : "Choose a provider key and model first.",
22        );
23      await verify();
24      await api(`/api/v2/model-preferences/${purpose}`, {
25        method: "PUT",
26        body: JSON.stringify({ ...selection, effort: null }),
27      });
28      if (button.isConnected)
29        status.textContent = "Selection saved for your account.";
30    } catch (error) {
31      if (button.isConnected)
32        status.textContent = String(
33          error.message || "Could not save selection",
34        ).replaceAll("_", " ");
35    } finally {
36      button.disabled = false;
37    }
38  };
39  return button;
40}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.