fix(keys): drop the allowed-models picker from the new-key dialog
Creating a key now asks only account, rate limit and optional custom value — allow_models is sent empty (= all models). Per-key model restrictions stay editable in Settings for whoever actually needs them.
This commit is contained in:
Vendored
+1
-11
@@ -4,27 +4,17 @@ import { t } from "../i18n.js";
|
|||||||
import { api } from "../api.js";
|
import { api } from "../api.js";
|
||||||
|
|
||||||
export async function renderKeys() {
|
export async function renderKeys() {
|
||||||
const modelsData = await api.listModels();
|
|
||||||
const ids = (modelsData.models || []).map((m) => m.id);
|
|
||||||
const root = h("div");
|
const root = h("div");
|
||||||
|
|
||||||
function openCreate(reload) {
|
function openCreate(reload) {
|
||||||
const accountIn = h("input", { placeholder: "team-a" });
|
const accountIn = h("input", { placeholder: "team-a" });
|
||||||
const rateIn = h("input", { type: "number", value: 600 });
|
const rateIn = h("input", { type: "number", value: 600 });
|
||||||
const customIn = h("input", { placeholder: "sk-gw-…" });
|
const customIn = h("input", { placeholder: "sk-gw-…" });
|
||||||
const allowInputs = ids.map((id) => ({ id, cb: h("input", { type: "checkbox" }) }));
|
|
||||||
const body = h(
|
const body = h(
|
||||||
"div",
|
"div",
|
||||||
{},
|
{},
|
||||||
h("label", { class: "field" }, h("span", {}, t("keys.form.account")), accountIn),
|
h("label", { class: "field" }, h("span", {}, t("keys.form.account")), accountIn),
|
||||||
h("label", { class: "field" }, h("span", {}, t("keys.form.rate")), rateIn),
|
h("label", { class: "field" }, h("span", {}, t("keys.form.rate")), rateIn),
|
||||||
h(
|
|
||||||
"label",
|
|
||||||
{ class: "field" },
|
|
||||||
h("span", {}, t("keys.form.allow")),
|
|
||||||
h("div", { class: "flex wrap" }, ...allowInputs.map(({ id, cb }) => h("label", { class: "check" }, cb, id))),
|
|
||||||
h("div", { class: "hint" }, t("keys.form.allowHint"))
|
|
||||||
),
|
|
||||||
h("label", { class: "field" }, h("span", {}, t("keys.form.custom")), customIn, h("div", { class: "hint" }, t("keys.form.customHint")))
|
h("label", { class: "field" }, h("span", {}, t("keys.form.custom")), customIn, h("div", { class: "hint" }, t("keys.form.customHint")))
|
||||||
);
|
);
|
||||||
modal(t("keys.form.title"), body, async () => {
|
modal(t("keys.form.title"), body, async () => {
|
||||||
@@ -33,7 +23,7 @@ export async function renderKeys() {
|
|||||||
key: customIn.value.trim(),
|
key: customIn.value.trim(),
|
||||||
account: accountIn.value.trim() || "default",
|
account: accountIn.value.trim() || "default",
|
||||||
rate_per_min: parseInt(rateIn.value) || 0,
|
rate_per_min: parseInt(rateIn.value) || 0,
|
||||||
allow_models: allowInputs.filter(({ cb }) => cb.checked).map(({ id }) => id),
|
allow_models: [],
|
||||||
});
|
});
|
||||||
reload();
|
reload();
|
||||||
showCreated(r.key);
|
showCreated(r.key);
|
||||||
|
|||||||
Reference in New Issue
Block a user