feat: 新增模型轮转、额度看板和密钥管理

This commit is contained in:
haverainlilili committed 2026-09-21 10:18:21 +08:00
1 parent e5f4e3a583
commit 3440273f43
32 files changed
+2918 -32

No files matched your search

+472
View File
@@ -12,6 +12,7 @@ let csrf = "",
logRenderPending = false,
toastTimer = null;
const pages = {
rotation: ["12", "模型轮转", "共享当前模型、故障切换与尝试记录。"],
overview: ["01", "运行桌面", "最近一小时、进程累计与当前资源状态。"],
guide: ["02", "首次运行", "用六个检查点完成从配置到首个请求。"],
access: ["03", "接入手册", "Chat、Responses、Anthropic 与 SDK 示例。"],
@@ -21,6 +22,8 @@ const pages = {
config: ["07", "配置中心", "验证后原子保存,并热应用可变字段。"],
logs: ["08", "事件日志", "来自进程内 Ring Buffer 的结构化 SSE。"],
account: ["09", "账号安全", "更新后撤销全部管理 Session。"],
"model-quotas": ["10", "模型与额度", "可用模型、共享套餐剩余额度与重置时间。"],
"api-keys": ["11", "API Key 管理", "给每个调用方独立的访问密钥。"],
};
async function api(path, options = {}) {
options.headers = { ...(options.headers || {}), Accept: "application/json" };
@@ -52,6 +55,9 @@ function showLogin() {
if (eventSource) eventSource.close();
eventSource = null;
clearInterval(monitorTimer);
clearInterval(quotaTimer);
clearCreatedKey();
$("#api-key-value").value = "";
}
async function enterConsole(session) {
csrf = session.csrf_token;
@@ -62,6 +68,7 @@ async function enterConsole(session) {
clearInterval(monitorTimer);
monitorTimer = setInterval(refreshMonitor, 3000);
connectLogs();
openPage(pages[location.hash.slice(1)] ? location.hash.slice(1) : "overview");
}
async function boot() {
try {
@@ -92,6 +99,10 @@ $("#logout").onclick = async () => {
}
};
function openPage(page) {
if (!pages[page]) return;
history.replaceState(null, "", `#${page}`);
clearInterval(quotaTimer);
if (page !== "api-keys") clearCreatedKey();
$$(".nav button").forEach((button) =>
button.classList.toggle("active", button.dataset.page === page),
);
@@ -102,6 +113,14 @@ function openPage(page) {
$("#page-sub").textContent = meta[2];
if (page === "access") renderAccessExamples();
if (page === "usage") renderUsage();
if (page === "model-quotas") {
loadModelQuotas();
quotaTimer = setInterval(() => {
if (!document.hidden) loadModelQuotas();
}, 60000);
}
if (page === "rotation") loadRotation();
if (page === "api-keys") loadAPIKeys();
if (page === "playground" && !debugData) loadDebugModels();
if (page === "diagnostics") {
loadDebugModels();
@@ -762,6 +781,8 @@ async function refreshMonitor() {
}
$("#refresh-now").onclick = async () => {
await Promise.all([refreshMonitor(), loadConfig(), loadDebugModels()]);
if (location.hash === "#model-quotas") await loadModelQuotas();
if (location.hash === "#api-keys") await loadAPIKeys();
toast("状态已刷新");
};
function derivedAPIBase() {
@@ -903,4 +924,455 @@ $("#log-pause").onclick = () => {
$("#log-pause").textContent = paused ? "继续" : "暂停";
if (!paused) renderLogs();
};
let quotaData = null,
quotaTimer = null,
quotaLoading = false,
createdKey = "",
apiKeysLoading = false;
const localTime = (value) =>
value ? new Date(value).toLocaleString("zh-CN", { hour12: false }) : "—";
function clearCreatedKey() {
createdKey = "";
$("#api-key-env").textContent = "";
$("#api-key-created").classList.add("hidden");
}
async function copyText(text) {
try {
await navigator.clipboard.writeText(text);
toast("已复制");
} catch {
toast("浏览器未允许复制,请手动选中复制", true);
}
}
async function loadModelQuotas() {
if (quotaLoading) return;
quotaLoading = true;
$("#quota-refresh").disabled = true;
$("#quota-refresh").textContent = "读取中…";
try {
const value = await api("/api/model-quotas");
if (!csrf) return;
quotaData = value;
const select = $("#quota-account"),
selected = select.value;
select.replaceChildren();
for (const account of value.accounts || []) {
const option = document.createElement("option");
option.value = account.id;
option.textContent = `Go Key ${account.display}`;
select.appendChild(option);
}
if ([...select.options].some((option) => option.value === selected)) select.value = selected;
if (!select.options.length) select.appendChild(new Option("尚未配置 Go Key", ""));
renderModelQuotas();
} catch (error) {
$("#quota-status").textContent = `查询失败:${error.message}。已有显示仅为上次查询结果。`;
} finally {
quotaLoading = false;
$("#quota-refresh").disabled = false;
$("#quota-refresh").textContent = "刷新额度";
}
}
function renderModelQuotas() {
if (!quotaData) return;
const account = quotaData.accounts.find((item) => item.id === $("#quota-account").value);
const stale = account?.status === "stale";
const cards = $("#quota-cards");
cards.replaceChildren();
$("#quota-status").textContent = !account
? "请先在配置中心添加 OpenCode Go Key。"
: account.error
? `${account.error}${stale ? ";下方显示上次成功数据,当前额度未知。" : ";当前额度未知。"}`
: "已连接 OpenCode · 共享套餐额度。多个 Key 的额度不相加。";
$("#quota-updated").textContent = account?.fetched_at
? `${stale ? "上次成功查询" : "额度更新时间"}:${localTime(account.fetched_at)} · 缓存 60 秒 · 来源:OpenCode Go /v1/usage`
: "";
const windows = [
["rolling", "5 小时窗口"],
["weekly", "每周窗口"],
["monthly", "每月窗口"],
];
for (const [id, label] of windows) {
const item = account?.windows?.[id];
const card = document.createElement("div"),
heading = document.createElement("h3"),
value = document.createElement("div"),
progress = document.createElement("progress"),
reset = document.createElement("div");
card.className = `quota-card${item?.remaining_percent < 20 ? " quota-low" : ""}`;
heading.textContent = label;
value.className = "quota-value";
value.textContent = item ? `≈ ${item.remaining_percent}%` : "未知";
progress.max = 100;
if (item) progress.value = item.remaining_percent;
else progress.value = 0;
progress.setAttribute("aria-label", `${label}剩余额度`);
reset.className = "quota-reset";
reset.textContent = item
? `${stale ? "历史剩余" : "剩余"} · ${item.status === "rate-limited" ? "已限额 · " : ""}重置于 ${localTime(item.resets_at)}`
: "等待上游额度数据";
card.append(heading, value, progress, reset);
cards.appendChild(card);
}
const query = $("#quota-model-search").value.trim().toLowerCase();
const models = quotaData.models.filter((model) => model.id.toLowerCase().includes(query));
$("#quota-model-count").textContent = `${models.length} / ${quotaData.models.length}`;
const catalog = quotaData.catalog;
$("#quota-catalog-status").textContent =
`${catalog?.stale ? "模型目录暂未更新,显示缓存 · " : ""}目录更新时间:${localTime(catalog?.updated_at)}`;
const host = $("#quota-models");
host.replaceChildren();
for (const model of models) {
const row = document.createElement("tr");
appendCell(row, model.id, "mono");
appendCell(
row,
{ chat: "Chat Completions", responses: "Responses", anthropic: "Messages" }[model.protocol] ||
model.protocol,
);
for (const [id] of windows) {
const item = account?.windows?.[id];
appendCell(row, item ? `≈ ${item.remaining_percent}%${stale ? "(历史)" : ""}` : "未知");
}
const cell = document.createElement("td"),
button = document.createElement("button");
button.className = "ghost";
button.textContent = "复制名称";
button.onclick = () => copyText(model.id);
cell.appendChild(button);
row.appendChild(cell);
host.appendChild(row);
}
if (!models.length)
emptyRow(host, 6, quotaData.models.length ? "没有匹配的模型" : "模型目录尚未就绪,请稍后刷新");
}
$("#quota-refresh").onclick = loadModelQuotas;
$("#quota-account").onchange = renderModelQuotas;
$("#quota-model-search").oninput = renderModelQuotas;
async function loadAPIKeys() {
if (apiKeysLoading) return;
apiKeysLoading = true;
$("#api-key-refresh").disabled = true;
try {
const data = await api("/api/api-keys");
if (csrf) renderAPIKeys(data.keys);
} catch (error) {
$("#api-key-status").textContent = `读取失败:${error.message}`;
} finally {
apiKeysLoading = false;
$("#api-key-refresh").disabled = false;
}
}
async function mutateAPIKey(id, method, body, button) {
button.disabled = true;
try {
const data = await api(`/api/api-keys/${encodeURIComponent(id)}`, {
method,
...(body ? { body: JSON.stringify(body) } : {}),
});
if (!csrf) return;
renderAPIKeys(data.keys);
await loadConfig();
toast("已保存并立即生效");
} catch (error) {
toast(error.message, true);
} finally {
button.disabled = false;
}
}
function renderAPIKeys(keys) {
$("#api-key-count").textContent = `${keys.length} 个`;
$("#api-key-status").textContent = `${keys.filter((key) => key.enabled).length} 个已启用`;
const host = $("#api-key-list");
host.replaceChildren();
for (const key of keys) {
const row = document.createElement("tr");
appendCell(row, key.name);
appendCell(row, key.display, "mono");
appendCell(row, key.enabled ? "已启用" : "已停用", key.enabled ? "status ok" : "status warn");
appendCell(row, key.created_at ? localTime(key.created_at) : "已有配置");
const cell = document.createElement("td"),
actions = document.createElement("div");
actions.className = "key-actions";
for (const [label, action] of [
[
"重命名",
(button) => {
const name = prompt("密钥名称", key.name);
if (name !== null) mutateAPIKey(key.id, "PATCH", { name }, button);
},
],
[
key.enabled ? "停用" : "启用",
(button) => mutateAPIKey(key.id, "PATCH", { enabled: !key.enabled }, button),
],
[
"删除",
(button) => {
if (confirm(`删除“${key.name}”后,使用它的应用将无法继续访问。确定删除?`))
mutateAPIKey(key.id, "DELETE", null, button);
},
],
]) {
const button = document.createElement("button");
button.className = "ghost";
button.textContent = label;
button.onclick = () => action(button);
actions.appendChild(button);
}
cell.appendChild(actions);
row.appendChild(cell);
host.appendChild(row);
}
if (!keys.length) emptyRow(host, 5, "暂无 API Key");
}
$("#api-key-form").onsubmit = async (event) => {
event.preventDefault();
const button = $("#api-key-create");
button.disabled = true;
try {
const data = await api("/api/api-keys", {
method: "POST",
body: JSON.stringify({ name: $("#api-key-name").value, value: $("#api-key-value").value }),
});
if (!csrf) return;
createdKey = data.key;
const goModels = debugData?.models?.filter((item) => item.available_go) || [];
const model =
goModels.find((item) => item.model === "glm-5.3-flash")?.model ||
goModels[0]?.model ||
"YOUR_MODEL";
$("#api-key-env").textContent =
`OPENAI_API_KEY=${data.key}\nOPENAI_BASE_URL=${derivedAPIBase()}/v1\nOPENAI_MODEL=${model}`;
$("#api-key-created").classList.remove("hidden");
$("#api-key-form").reset();
renderAPIKeys(data.keys);
await loadConfig();
toast("API Key 已创建");
} catch (error) {
toast(error.message, true);
} finally {
button.disabled = false;
}
};
$("#api-key-refresh").onclick = loadAPIKeys;
$("#api-key-dismiss").onclick = clearCreatedKey;
$("#api-key-copy").onclick = () => copyText(createdKey);
$("#api-key-copy-env").onclick = () => copyText($("#api-key-env").textContent);
let rotationData = null,
rotationDirty = false;
const rotationReasons = {
success: "成功",
client_canceled: "调用方取消",
quota_or_rate_limit: "额度不足 / 限流",
transport_error: "连接错误",
first_output_timeout: "首个输出超时",
stream_error: "输出中断",
response_read_error: "读取响应失败",
response_conversion_error: "响应解析或转换失败",
request_conversion_error: "请求转换失败",
upstream_error: "上游错误",
};
async function loadRotation() {
try {
const value = await api("/api/rotation");
if (!csrf) return;
rotationData = value;
rotationDirty = false;
renderRotation();
} catch (error) {
toast(error.message, true);
}
}
function renderRotation() {
const state = rotationData;
$("#rotation-status").textContent =
state.persistence_error || "状态已更新 · 两组独立轮转,所有调用方共享当前位置。";
$("#rotation-timeout").value = state.first_output_seconds;
const host = $("#rotation-groups");
host.replaceChildren();
for (const group of state.groups) {
const section = document.createElement("div");
section.className = "section";
const title = document.createElement("h2");
title.textContent = group.id === "sota" ? "SOTA" : "甜点";
const label = document.createElement("label");
label.textContent = "调用别名";
label.htmlFor = `rotation-alias-${group.id}`;
const input = document.createElement("input");
input.id = label.htmlFor;
input.value = group.alias;
input.required = true;
input.maxLength = 64;
input.oninput = () => {
group.alias = input.value;
rotationDirty = true;
};
const field = document.createElement("div");
field.className = "field";
field.append(label, input);
const current = document.createElement("p");
current.className = "mono";
current.textContent = `当前模型:${group.current || "等待可用模型"}`;
const table = document.createElement("table");
table.className = "table";
const header = document.createElement("tr");
for (const text of ["顺序", "模型", "状态 / 恢复时间", "操作"]) {
const th = document.createElement("th");
th.textContent = text;
header.append(th);
}
const thead = document.createElement("thead");
thead.append(header);
table.append(thead);
const tbody = document.createElement("tbody");
table.append(tbody);
group.order.forEach((model, index) => {
const row = document.createElement("tr");
appendCell(row, String(index + 1));
appendCell(row, model, "mono");
const until = group.paused[model],
paused = until && new Date(until) > new Date();
appendCell(
row,
!group.available[model]
? "已下架 / 暂不可用"
: paused
? `暂停至 ${localTime(until)}`
: model === group.current
? "当前使用"
: "可用",
);
const actions = document.createElement("td");
actions.className = "rotation-actions";
for (const [text, delta] of [
["上移", -1],
["下移", 1],
]) {
const button = document.createElement("button");
button.type = "button";
button.className = "ghost";
button.textContent = text;
button.setAttribute("aria-label", `${model} ${text}`);
button.disabled = index + delta < 0 || index + delta >= group.order.length;
button.onclick = () => {
[group.order[index], group.order[index + delta]] = [
group.order[index + delta],
group.order[index],
];
state.first_output_seconds = Number($("#rotation-timeout").value);
rotationDirty = true;
renderRotation();
};
actions.append(button);
}
const select = document.createElement("button");
select.type = "button";
select.className = "ghost";
select.textContent = "设为当前";
select.disabled = !group.available[model];
select.setAttribute("aria-label", `使用 ${model}`);
select.onclick = async () => {
select.disabled = true;
try {
const result = await api("/api/rotation/current", {
method: "POST",
body: JSON.stringify({ group: group.id, model }),
});
// Keep unsaved alias/order edits while refreshing operational state.
for (const item of state.groups) {
const live = result.groups.find((x) => x.id === item.id);
Object.assign(item, {
current: live.current,
paused: live.paused,
switches: live.switches,
});
}
state.persistence_error = result.persistence_error;
renderRotation();
toast("当前模型已切换");
} catch (error) {
select.disabled = false;
toast(error.message, true);
}
};
actions.append(select);
row.append(actions);
tbody.append(row);
});
if (!group.order.length) emptyRow(tbody, 4, "等待 Go 模型目录");
const wrap = document.createElement("div");
wrap.className = "table-wrap";
wrap.append(table);
const recent = document.createElement("div");
recent.className = "rotation-switches";
const caption = document.createElement("h3");
caption.textContent = "最近切换";
recent.append(caption);
for (const item of (group.switches || []).slice(-5).reverse()) {
const line = document.createElement("p");
line.textContent = `${localTime(item.time)} · ${item.from} → ${item.to} · ${rotationReasons[item.reason] || item.reason}`;
recent.append(line);
}
if (!group.switches?.length) {
const line = document.createElement("p");
line.textContent = "尚无切换记录";
recent.append(line);
}
section.append(title, field, current, wrap, recent);
host.append(section);
}
const attempts = $("#rotation-attempts");
attempts.replaceChildren();
for (const item of (state.attempts || []).slice().reverse()) {
const row = document.createElement("tr");
for (const value of [
localTime(item.time),
item.request,
item.alias,
item.model,
String(item.number),
rotationReasons[item.outcome] || item.outcome,
])
appendCell(row, value);
attempts.append(row);
}
if (!state.attempts?.length) emptyRow(attempts, 6, "调用分组别名后显示最近 100 次尝试");
}
$("#rotation-refresh").onclick = () => {
if (rotationDirty) {
toast("有未保存的修改,请先保存后刷新", true);
return;
}
loadRotation();
};
$("#rotation-timeout").oninput = () => {
rotationDirty = true;
};
$("#rotation-form").onsubmit = async (event) => {
event.preventDefault();
if (!rotationData) return;
const button = $("#rotation-save");
button.disabled = true;
try {
const body = { first_output_seconds: Number($("#rotation-timeout").value) };
for (const group of rotationData.groups)
body[group.id] = { alias: group.alias.trim(), order: group.order };
rotationData = await api("/api/rotation", { method: "PUT", body: JSON.stringify(body) });
rotationDirty = false;
renderRotation();
toast("模型轮转配置已保存并生效");
} catch (error) {
toast(error.message, true);
} finally {
button.disabled = false;
}
};
boot();
+202
View File
@@ -59,6 +59,13 @@
<button data-page="config"><span class="nav-no">07</span><span>配置中心</span></button>
<button data-page="logs"><span class="nav-no">08</span><span>事件日志</span></button>
<button data-page="account"><span class="nav-no">09</span><span>账号安全</span></button>
<button data-page="model-quotas">
<span class="nav-no">10</span><span>模型与额度</span>
</button>
<button data-page="api-keys">
<span class="nav-no">11</span><span>API Key 管理</span>
</button>
<button data-page="rotation"><span class="nav-no">12</span><span>模型轮转</span></button>
</nav>
<div class="sidebar-foot">
<div class="live-line"><span class="live-dot"></span><span>CONTROL PLANE LIVE</span></div>
@@ -623,6 +630,201 @@
</div>
<div id="log-list" class="logs"></div>
</section>
<section id="page-model-quotas" class="page hidden">
<div class="section">
<div class="section-head">
<div>
<h2>OpenCode Go 套餐额度</h2>
<div class="section-caption">
来自 OpenCode 的实时查询,缓存 60 秒。所有模型共享套餐窗口,百分比由上游取整。
</div>
</div>
<button id="quota-refresh" class="ghost">刷新额度</button>
</div>
<div class="field">
<label for="quota-account">Go Key</label
><select id="quota-account">
<option>读取中…</option>
</select>
</div>
<div id="quota-status" class="quota-status" role="status" aria-live="polite">
进入页面后读取额度。
</div>
<div id="quota-cards" class="quota-grid"></div>
<div id="quota-updated" class="section-caption"></div>
</div>
<div class="section">
<div class="section-head">
<div>
<h2>可用模型 <span id="quota-model-count" class="section-caption"></span></h2>
<div class="section-caption">
模型名称可直接填入
OPENAI_MODEL。额度列对应上方选定套餐,不代表每个模型拥有独立额度。
</div>
</div>
<input
id="quota-model-search"
aria-label="搜索模型"
placeholder="搜索模型名称…"
type="search"
/>
</div>
<div id="quota-catalog-status" class="section-caption"></div>
<div class="table-wrap">
<table class="table">
<thead>
<tr>
<th>模型名称</th>
<th>上游协议</th>
<th>5 小时剩余 · 共享</th>
<th>本周剩余 · 共享</th>
<th>本月剩余 · 共享</th>
<th>操作</th>
</tr>
</thead>
<tbody id="quota-models"></tbody>
</table>
</div>
</div>
</section>
<section id="page-rotation" class="page hidden">
<div class="section">
<div class="section-head">
<div>
<h2>SOTA / 甜点模型轮转</h2>
<div class="section-caption">
成功后继续使用当前模型。额度不足或错误时按顺序切换,仅使用 OpenCode Go。
</div>
</div>
<button id="rotation-refresh" class="ghost">刷新状态</button>
</div>
<p class="section-caption">
沿用现有 Base URL 和 API Key,将 OPENAI_MODEL 设为下方别名。每个模型普通错误最多尝试 3
次,一次请求最多重试 3 个模型;额度不足直接跳过。
</p>
<p class="section-caption">
输出开始后,本次回答固定使用同一模型。中途故障会结束本次输出,下一次请求才换模型。模型共享套餐额度,切换不保证解决套餐耗尽。
</p>
<div id="rotation-status" role="status" class="section-caption"></div>
</div>
<form id="rotation-form">
<div id="rotation-groups"></div>
<div class="section">
<div class="field">
<label for="rotation-timeout">首个有效输出等待上限(秒)</label
><input id="rotation-timeout" type="number" min="1" max="300" value="30" required />
</div>
<div class="actions">
<button id="rotation-save" class="primary">保存别名与顺序</button>
</div>
<p class="section-caption">
保存立即生效;调整顺序不会打断正在输出的回答。手动选择当前模型会立即生效,并解除该模型的临时暂停。
</p>
</div>
</form>
<div class="section">
<div class="section-head"><h2>最近请求尝试</h2></div>
<div class="table-wrap">
<table class="table">
<thead>
<tr>
<th>时间</th>
<th>请求</th>
<th>别名</th>
<th>实际模型</th>
<th>尝试</th>
<th>结果</th>
</tr>
</thead>
<tbody id="rotation-attempts"></tbody>
</table>
</div>
</div>
</section>
<section id="page-api-keys" class="page hidden">
<div class="section">
<div class="section-head">
<div>
<h2>为调用方创建 API Key</h2>
<div class="section-caption">
用于访问本机 B 服务。每个应用可使用独立密钥;创建、启停和删除立即生效。
</div>
</div>
</div>
<form id="api-key-form">
<div class="form-grid">
<div class="field">
<label for="api-key-name">名称</label
><input
id="api-key-name"
placeholder="例如:我的笔记助手"
maxlength="80"
required
/>
</div>
<div class="field">
<label for="api-key-value">自定义 Key(可选)</label
><input
id="api-key-value"
type="password"
autocomplete="new-password"
minlength="16"
maxlength="256"
placeholder="留空自动生成;自定义需 16–256 位"
/>
</div>
</div>
<div class="actions">
<button id="api-key-create" class="primary">创建 API Key</button>
</div>
</form>
</div>
<div id="api-key-created" class="section hidden" role="status">
<div class="section-head">
<div>
<h2>密钥已创建</h2>
<div class="section-caption">
完整密钥仅在创建后展示,请现在保存到调用方的环境变量。
</div>
</div>
<button id="api-key-dismiss" class="ghost">已保存,关闭</button>
</div>
<pre id="api-key-env" class="key-env"></pre>
<div class="actions">
<button id="api-key-copy" class="ghost">复制 Key</button
><button id="api-key-copy-env" class="primary">复制环境变量</button>
</div>
</div>
<div class="section">
<div class="section-head">
<div>
<h2>访问密钥 <span id="api-key-count" class="section-caption"></span></h2>
<div class="section-caption">
此处管理服务 B 的访问权限。OpenCode Go 的上游密钥仍在配置中心管理。
</div>
</div>
<button id="api-key-refresh" class="ghost">刷新列表</button>
</div>
<div id="api-key-status" role="status" aria-live="polite" class="section-caption"></div>
<div class="table-wrap">
<table class="table">
<thead>
<tr>
<th>名称</th>
<th>密钥尾码</th>
<th>状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody id="api-key-list"></tbody>
</table>
</div>
<p class="section-caption">
停用和删除会使对应应用的新请求返回 401。至少保留一个启用的 Key。
</p>
</div>
</section>
<section id="page-account" class="page hidden">
<form id="account-form" class="section">
<div class="section-head">
+92
View File
@@ -22,6 +22,77 @@
--ok: #237056;
--shadow: 0 12px 35px #17231f16;
}
.quota-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 18px;
margin: 20px 0;
}
.quota-card {
padding: 22px;
border: 1px solid var(--line);
border-radius: 8px;
background: var(--white);
}
.quota-card h3 {
margin: 0 0 12px;
font-size: 14px;
color: var(--muted);
}
.quota-card .quota-value {
font-size: 36px;
font-weight: 750;
letter-spacing: -1px;
}
.quota-card progress {
width: 100%;
height: 9px;
accent-color: var(--forest);
margin: 14px 0 8px;
}
.quota-card.quota-low progress {
accent-color: var(--orange);
}
.quota-card .quota-reset {
font-size: 12px;
color: var(--muted);
}
.quota-status {
padding: 10px 14px;
background: var(--paper2);
border-radius: 6px;
}
.key-actions {
display: flex;
gap: 6px;
flex-wrap: wrap;
}
.key-actions button {
padding: 5px 9px;
font-size: 12px;
}
.key-env {
white-space: pre-wrap;
overflow-wrap: anywhere;
padding: 18px;
background: var(--forest);
color: var(--white);
border-radius: 6px;
}
#quota-model-search {
max-width: 250px;
}
#quota-account {
max-width: 360px;
}
#api-key-created {
border-color: var(--ok);
}
@media (max-width: 760px) {
.quota-grid {
grid-template-columns: 1fr;
}
}
* {
box-sizing: border-box;
}
@@ -831,3 +902,24 @@ textarea {
flex-direction: column;
}
}
.rotation-actions {
min-width: 215px;
white-space: nowrap;
}
.rotation-actions button {
margin: 3px;
}
.rotation-switches {
margin-top: 22px;
color: var(--muted);
font-size: 13px;
overflow-wrap: anywhere;
}
#rotation-groups .field {
max-width: 360px;
}
#rotation-attempts td {
max-width: 270px;
overflow-wrap: anywhere;
}