feat: redesign UI section Cles API IA - recherche, carte defaut, cartes depliables, footer sticky (#104)
This commit is contained in:
+80
-199
@@ -2038,210 +2038,95 @@
|
||||
</button>
|
||||
</section>
|
||||
|
||||
<!-- Cles API AI -->
|
||||
<!-- Cles API AI (#104 — accordéon fournisseurs) -->
|
||||
<section
|
||||
class="config-section help-section"
|
||||
id="cfg-ai"
|
||||
>
|
||||
<h2>🤖 Cles API Intelligence Artificielle</h2>
|
||||
<p class="config-description">
|
||||
Configurez vos cles API. Cliquez sur
|
||||
<strong data-i18n="config.test">Tester</strong> pour charger les
|
||||
modeles.
|
||||
</p>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-ai-default-provider"
|
||||
data-i18n="config.ai_default_provider"
|
||||
>Fournisseur par defaut</label
|
||||
>
|
||||
<select
|
||||
id="cfg-ai-default-provider"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">--</option>
|
||||
</select>
|
||||
<div class="ai-keys-header">
|
||||
<div class="ai-keys-header-text">
|
||||
<h2 data-i18n="config.section_cles-api-intelligence-artificielle">🤖 Cles API Intelligence Artificielle</h2>
|
||||
<p class="config-description" data-i18n="config.ai_header_desc">
|
||||
Configurez vos cles API fournisseur par fournisseur. Dépliez une carte pour saisir une
|
||||
clé, puis cliquez sur <strong data-i18n="config.test">Tester</strong> pour charger les
|
||||
modeles.
|
||||
</p>
|
||||
</div>
|
||||
<div class="ai-keys-search">
|
||||
<i data-lucide="search" class="icon"></i>
|
||||
<input
|
||||
type="search"
|
||||
id="cfg-ai-search"
|
||||
data-i18n-placeholder="config.ai_search_placeholder"
|
||||
placeholder="Rechercher un fournisseur…"
|
||||
autocomplete="off"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-ai-default-model"
|
||||
data-i18n="config.ai_default_model"
|
||||
>Modele par defaut</label
|
||||
>
|
||||
<select
|
||||
id="cfg-ai-default-model"
|
||||
class="config-select"
|
||||
style="width: 220px"
|
||||
>
|
||||
<option value="">--</option>
|
||||
</select>
|
||||
|
||||
<div class="ai-default-card">
|
||||
<div class="ai-card-title" data-i18n="config.ai_default_section">Configuration par defaut</div>
|
||||
<div class="ai-default-grid">
|
||||
<div class="ai-field">
|
||||
<label
|
||||
class="ai-field-label"
|
||||
for="cfg-ai-default-provider"
|
||||
data-i18n="config.ai_default_provider"
|
||||
>Fournisseur par defaut</label
|
||||
>
|
||||
<select
|
||||
id="cfg-ai-default-provider"
|
||||
class="config-select"
|
||||
>
|
||||
<option value="">--</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="ai-field">
|
||||
<label
|
||||
class="ai-field-label"
|
||||
for="cfg-ai-default-model"
|
||||
data-i18n="config.ai_default_model"
|
||||
>Modele par defaut</label
|
||||
>
|
||||
<select
|
||||
id="cfg-ai-default-model"
|
||||
class="config-select"
|
||||
>
|
||||
<option value="">--</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ai-field">
|
||||
<span
|
||||
class="ai-field-label"
|
||||
data-i18n="config.ai_capabilities"
|
||||
>Capacites du modele</span
|
||||
>
|
||||
<div
|
||||
id="cfg-ai-default-model-caps"
|
||||
class="ai-caps-badges"
|
||||
></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="config-row" style="align-items: flex-start">
|
||||
<label
|
||||
class="config-label"
|
||||
data-i18n="config.ai_capabilities"
|
||||
>Capacites du modele</label
|
||||
|
||||
<div class="ai-providers-header">
|
||||
<h3
|
||||
class="ai-card-title"
|
||||
data-i18n="config.ai_providers_title"
|
||||
>
|
||||
<div
|
||||
id="cfg-ai-default-model-caps"
|
||||
class="ai-picker-caps"
|
||||
style="flex: 1"
|
||||
></div>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-deepseek-key"
|
||||
>DeepSeek API Key</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="cfg-deepseek-key"
|
||||
class="config-input"
|
||||
placeholder="sk-..."
|
||||
autocomplete="off"
|
||||
/>
|
||||
<select
|
||||
id="cfg-deepseek-model"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">-- Modele --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-openrouter-key"
|
||||
>OpenRouter API Key</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="cfg-openrouter-key"
|
||||
class="config-input"
|
||||
placeholder="sk-or-..."
|
||||
autocomplete="off"
|
||||
/>
|
||||
<select
|
||||
id="cfg-openrouter-model"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">-- Modele --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-gemini-key"
|
||||
>Gemini API Key</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="cfg-gemini-key"
|
||||
class="config-input"
|
||||
placeholder="AIza..."
|
||||
autocomplete="off"
|
||||
/>
|
||||
<select
|
||||
id="cfg-gemini-model"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">-- Modele --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-nvidia-key"
|
||||
>NVIDIA API Key</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="cfg-nvidia-key"
|
||||
class="config-input"
|
||||
placeholder="nvapi-..."
|
||||
autocomplete="off"
|
||||
/>
|
||||
<select
|
||||
id="cfg-nvidia-model"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">-- Modele --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-qwencloud-key"
|
||||
>QwenCloud API Key</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="cfg-qwencloud-key"
|
||||
class="config-input"
|
||||
placeholder="sk-..."
|
||||
autocomplete="off"
|
||||
/>
|
||||
<select
|
||||
id="cfg-qwencloud-model"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">-- Modele --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-xiaomi-key"
|
||||
>Xiaomi API Key</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="cfg-xiaomi-key"
|
||||
class="config-input"
|
||||
placeholder="xm-..."
|
||||
autocomplete="off"
|
||||
/>
|
||||
<select
|
||||
id="cfg-xiaomi-model"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">-- Modele --</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="config-row">
|
||||
<label
|
||||
class="config-label"
|
||||
for="cfg-mistral-key"
|
||||
>Mistral API Key</label
|
||||
>
|
||||
<input
|
||||
type="password"
|
||||
id="cfg-mistral-key"
|
||||
class="config-input"
|
||||
placeholder="sk-..."
|
||||
autocomplete="off"
|
||||
/>
|
||||
<select
|
||||
id="cfg-mistral-model"
|
||||
class="config-select"
|
||||
style="width: 200px"
|
||||
>
|
||||
<option value="">-- Modele --</option>
|
||||
</select>
|
||||
Fournisseurs d'API
|
||||
</h3>
|
||||
</div>
|
||||
<div id="cfg-ai-providers" class="ai-providers-list"></div>
|
||||
<div
|
||||
class="config-actions-row"
|
||||
style="margin-top: 16px"
|
||||
id="cfg-ai-providers-empty"
|
||||
class="ai-providers-empty hidden"
|
||||
data-i18n="config.ai_providers_empty"
|
||||
>
|
||||
Aucun fournisseur ne correspond
|
||||
</div>
|
||||
|
||||
<div class="ai-keys-footer">
|
||||
<button class="config-btn-save"
|
||||
id="cfg-save-ai-keys" data-i18n="help.shortcut_save">
|
||||
Sauvegarder
|
||||
@@ -2252,11 +2137,7 @@
|
||||
</button>
|
||||
<span
|
||||
id="cfg-ai-status"
|
||||
style="
|
||||
font-size: 12px;
|
||||
color: var(--text-muted);
|
||||
margin-left: 12px;
|
||||
"
|
||||
class="ai-keys-status"
|
||||
></span>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -82,6 +82,24 @@ function renderCapabilityList(caps) {
|
||||
return box;
|
||||
}
|
||||
|
||||
/**
|
||||
* Render only the *enabled* capabilities as colored tags (#104). Used by the
|
||||
* config panel where a compact read-only summary reads better than checkboxes.
|
||||
*/
|
||||
function renderCapabilityBadges(caps) {
|
||||
const box = document.createElement('div');
|
||||
box.className = 'ai-caps-badges';
|
||||
if (!caps) return box;
|
||||
AI_CAPABILITY_KEYS.forEach((key) => {
|
||||
if (!caps[key]) return;
|
||||
const item = document.createElement('span');
|
||||
item.className = 'ai-cap-badge';
|
||||
item.textContent = t(`ai.cap_${key}`);
|
||||
box.appendChild(item);
|
||||
});
|
||||
return box;
|
||||
}
|
||||
|
||||
/** Accent-insensitive, case-insensitive normalization for model search. */
|
||||
function _normalizeText(value) {
|
||||
return String(value || '')
|
||||
@@ -1019,6 +1037,7 @@ export {
|
||||
AI_CAPABILITY_KEYS,
|
||||
getModelCapabilities,
|
||||
renderCapabilityList,
|
||||
renderCapabilityBadges,
|
||||
_buildPickerUI as buildAIPickerUI,
|
||||
refreshAIPickers,
|
||||
PICKER_SLOT_CLASS,
|
||||
|
||||
+129
-39
@@ -6,7 +6,7 @@ import { syncVaultSelectors, setSelectedVaultContext, refreshSidebarForContext,
|
||||
import { escapeHtml, safeCreateIcons } from './utils.js';
|
||||
import { showToast, closeHeaderMenu, closeMobileSidebar } from './ui.js';
|
||||
import { t, setLocale, getLocale } from './i18n.js';
|
||||
import { getModelCapabilities, renderCapabilityList, refreshAIPickers } from './ai.js';
|
||||
import { getModelCapabilities, renderCapabilityBadges, refreshAIPickers } from './ai.js';
|
||||
|
||||
let _recentTimestampTimer = null;
|
||||
let _recentFilesCache = [];
|
||||
@@ -766,6 +766,11 @@ function initConfigModal() {
|
||||
if (saveAIKeysBtn) saveAIKeysBtn.addEventListener("click", saveAIKeys);
|
||||
const testAIKeysBtn = document.getElementById("cfg-test-ai-keys");
|
||||
if (testAIKeysBtn) testAIKeysBtn.addEventListener("click", testAIKeys);
|
||||
// Provider search filter (#104)
|
||||
const aiProviderSearch = document.getElementById("cfg-ai-search");
|
||||
if (aiProviderSearch) {
|
||||
aiProviderSearch.addEventListener("input", () => filterAIProviders(aiProviderSearch.value));
|
||||
}
|
||||
// Tool & connected-source keys (#103)
|
||||
const saveToolKeysBtn = document.getElementById("cfg-save-tool-keys");
|
||||
if (saveToolKeysBtn) saveToolKeysBtn.addEventListener("click", saveToolKeys);
|
||||
@@ -1510,7 +1515,7 @@ function updateRegexPreview() {
|
||||
}
|
||||
|
||||
|
||||
// ── AI Keys management ──
|
||||
// ── AI Keys management (#104 — accordion redesign) ──
|
||||
const AI_KEY_MAP = {
|
||||
"cfg-deepseek-key": "DEEPSEEK_API_KEY",
|
||||
"cfg-openrouter-key": "OPENROUTER_API_KEY",
|
||||
@@ -1522,57 +1527,140 @@ const AI_KEY_MAP = {
|
||||
};
|
||||
const AI_PROVIDER_NAMES = ["deepseek","openrouter","gemini","nvidia","qwencloud","xiaomi","mistral"];
|
||||
|
||||
function _ensureAIKeyUI() {
|
||||
for (const [inputId] of Object.entries(AI_KEY_MAP)) {
|
||||
const input = document.getElementById(inputId);
|
||||
if (!input) continue;
|
||||
const row = input.closest(".config-row");
|
||||
if (!row || row.dataset.enhanced) continue;
|
||||
row.dataset.enhanced = "1";
|
||||
row.style.cssText += "display:flex;align-items:center;gap:8px;flex-wrap:wrap;";
|
||||
const badge = document.createElement("span");
|
||||
badge.id = inputId.replace("-key", "-badge");
|
||||
badge.style.cssText = "font-size:11px;padding:2px 8px;border-radius:10px;white-space:nowrap;";
|
||||
row.appendChild(badge);
|
||||
const delBtn = document.createElement("button");
|
||||
delBtn.type = "button";
|
||||
delBtn.id = inputId.replace("-key", "-delete");
|
||||
delBtn.className = "config-btn-secondary";
|
||||
delBtn.style.cssText = "font-size:11px;padding:4px 10px;color:var(--danger,#e74c3c);border-color:var(--danger,#e74c3c);cursor:pointer;display:none;";
|
||||
delBtn.textContent = "\u00d7 Supprimer";
|
||||
delBtn.addEventListener("click", () => deleteAIKey(inputId));
|
||||
row.appendChild(delBtn);
|
||||
// Display metadata for the provider accordion cards (#104).
|
||||
const AI_PROVIDER_META = {
|
||||
deepseek: { name: "DeepSeek", placeholder: "sk-..." },
|
||||
openrouter: { name: "OpenRouter", placeholder: "sk-or-..." },
|
||||
gemini: { name: "Gemini", placeholder: "AIza..." },
|
||||
nvidia: { name: "NVIDIA", placeholder: "nvapi-..." },
|
||||
qwencloud: { name: "QwenCloud", placeholder: "sk-..." },
|
||||
xiaomi: { name: "Xiaomi", placeholder: "xm-..." },
|
||||
mistral: { name: "Mistral", placeholder: "sk-..." },
|
||||
};
|
||||
|
||||
function _renderAIProviderCards() {
|
||||
const host = document.getElementById("cfg-ai-providers");
|
||||
if (!host) return;
|
||||
host.innerHTML = "";
|
||||
for (const p of AI_PROVIDER_NAMES) {
|
||||
const meta = AI_PROVIDER_META[p] || { name: p, placeholder: "sk-..." };
|
||||
const card = el("div", { class: "ai-provider-card", "data-provider": p });
|
||||
|
||||
// Header row (div + role=button so the per-provider delete button can
|
||||
// live inside without nesting two interactive elements).
|
||||
const head = el("div", {
|
||||
class: "ai-provider-head",
|
||||
role: "button",
|
||||
tabindex: "0",
|
||||
"aria-expanded": "false",
|
||||
});
|
||||
head.appendChild(el("span", { class: "ai-provider-logo", "aria-hidden": "true" }, [document.createTextNode(meta.name.charAt(0))]));
|
||||
head.appendChild(el("span", { class: "ai-provider-name" }, [document.createTextNode(meta.name)]));
|
||||
head.appendChild(el("span", { class: "ai-provider-badge", id: `cfg-${p}-badge` }));
|
||||
const delBtn = el("button", {
|
||||
type: "button",
|
||||
class: "ai-provider-delete",
|
||||
id: `cfg-${p}-delete`,
|
||||
title: t("config.ai_delete_key_title"),
|
||||
});
|
||||
delBtn.style.display = "none";
|
||||
delBtn.appendChild(icon("trash-2", 14));
|
||||
delBtn.addEventListener("click", (e) => {
|
||||
e.stopPropagation();
|
||||
deleteAIKey(`cfg-${p}-key`);
|
||||
});
|
||||
head.appendChild(delBtn);
|
||||
const chevron = icon("chevron-down", 16);
|
||||
chevron.classList.add("ai-provider-chevron");
|
||||
head.appendChild(chevron);
|
||||
|
||||
const toggle = () => _toggleAICard(card);
|
||||
head.addEventListener("click", toggle);
|
||||
head.addEventListener("keydown", (e) => {
|
||||
if (e.key === "Enter" || e.key === " ") { e.preventDefault(); toggle(); }
|
||||
});
|
||||
|
||||
// Collapsible body: API key (60%) + model (40%), labels above inputs.
|
||||
const body = el("div", { class: "ai-provider-body hidden" });
|
||||
const fields = el("div", { class: "ai-provider-fields" });
|
||||
|
||||
const keyField = el("div", { class: "ai-field ai-field-key" });
|
||||
keyField.appendChild(el("label", { class: "ai-field-label", for: `cfg-${p}-key` }, [document.createTextNode(`${meta.name} API Key`)]));
|
||||
const keyInput = document.createElement("input");
|
||||
keyInput.type = "password";
|
||||
keyInput.id = `cfg-${p}-key`;
|
||||
keyInput.className = "config-input";
|
||||
keyInput.placeholder = meta.placeholder;
|
||||
keyInput.autocomplete = "off";
|
||||
keyField.appendChild(keyInput);
|
||||
|
||||
const modelField = el("div", { class: "ai-field ai-field-model" });
|
||||
modelField.appendChild(el("label", { class: "ai-field-label", for: `cfg-${p}-model` }, [document.createTextNode(t("config.ai_model"))]));
|
||||
const modelSel = document.createElement("select");
|
||||
modelSel.id = `cfg-${p}-model`;
|
||||
modelSel.className = "config-select";
|
||||
modelSel.innerHTML = '<option value="">-- Modele --</option>';
|
||||
modelField.appendChild(modelSel);
|
||||
|
||||
fields.appendChild(keyField);
|
||||
fields.appendChild(modelField);
|
||||
body.appendChild(fields);
|
||||
|
||||
card.appendChild(head);
|
||||
card.appendChild(body);
|
||||
host.appendChild(card);
|
||||
}
|
||||
safeCreateIcons();
|
||||
}
|
||||
|
||||
function _toggleAICard(card) {
|
||||
const open = card.classList.toggle("open");
|
||||
const body = card.querySelector(".ai-provider-body");
|
||||
if (body) body.classList.toggle("hidden", !open);
|
||||
const head = card.querySelector(".ai-provider-head");
|
||||
if (head) head.setAttribute("aria-expanded", open ? "true" : "false");
|
||||
}
|
||||
|
||||
/** Filter the provider accordion cards by the section search input (#104). */
|
||||
export function filterAIProviders(query) {
|
||||
const host = document.getElementById("cfg-ai-providers");
|
||||
const emptyMsg = document.getElementById("cfg-ai-providers-empty");
|
||||
if (!host) return;
|
||||
const q = _sidebarNorm(query);
|
||||
let visible = 0;
|
||||
host.querySelectorAll(".ai-provider-card").forEach((card) => {
|
||||
const p = card.dataset.provider;
|
||||
const meta = AI_PROVIDER_META[p] || { name: p };
|
||||
const match = !q || _sidebarNorm(meta.name).includes(q) || p.includes(q);
|
||||
card.style.display = match ? "" : "none";
|
||||
if (match) visible++;
|
||||
});
|
||||
if (emptyMsg) emptyMsg.classList.toggle("hidden", visible > 0);
|
||||
}
|
||||
|
||||
function _setAIKeyBadge(inputId, hasKey) {
|
||||
const badge = document.getElementById(inputId.replace("-key", "-badge"));
|
||||
const delBtn = document.getElementById(inputId.replace("-key", "-delete"));
|
||||
const provider = inputId.replace("-key", "");
|
||||
const badge = document.getElementById(`${provider}-badge`);
|
||||
const delBtn = document.getElementById(`${provider}-delete`);
|
||||
if (badge) {
|
||||
if (hasKey) {
|
||||
badge.textContent = "\u2713 Configur\u00e9";
|
||||
badge.style.background = "var(--success-bg, #27ae6022)";
|
||||
badge.style.color = "var(--success, #27ae60)";
|
||||
badge.style.border = "1px solid var(--success, #27ae60)";
|
||||
} else {
|
||||
badge.textContent = "Non configur\u00e9";
|
||||
badge.style.background = "var(--muted-bg, #ffffff10)";
|
||||
badge.style.color = "var(--text-muted, #888)";
|
||||
badge.style.border = "1px solid var(--border, #444)";
|
||||
}
|
||||
badge.textContent = hasKey
|
||||
? "\u2713 " + t("config.ai_status_configured")
|
||||
: t("config.ai_status_not_configured");
|
||||
badge.classList.toggle("configured", !!hasKey);
|
||||
}
|
||||
if (delBtn) delBtn.style.display = hasKey ? "inline-block" : "none";
|
||||
if (delBtn) delBtn.style.display = hasKey ? "inline-flex" : "none";
|
||||
}
|
||||
|
||||
async function loadAIKeys() {
|
||||
_ensureAIKeyUI();
|
||||
_renderAIProviderCards();
|
||||
try {
|
||||
const data = await api("/api/config/ai-keys");
|
||||
for (const [inputId, envName] of Object.entries(AI_KEY_MAP)) {
|
||||
const input = document.getElementById(inputId);
|
||||
const val = data[envName] || "";
|
||||
if (input) {
|
||||
input.placeholder = val || (inputId.includes("gemini") ? "AIza..." : inputId.includes("openrouter") ? "sk-or-..." : "sk-...");
|
||||
const meta = AI_PROVIDER_META[inputId.replace("-key", "")] || {};
|
||||
input.placeholder = val || meta.placeholder || "sk-...";
|
||||
}
|
||||
_setAIKeyBadge(inputId, !!val);
|
||||
}
|
||||
@@ -1626,7 +1714,7 @@ async function _renderConfigModelCaps(provider, model) {
|
||||
if (!provider || !model) return;
|
||||
const caps = await getModelCapabilities(provider, model);
|
||||
if (!caps) return;
|
||||
host.appendChild(renderCapabilityList(caps));
|
||||
host.appendChild(renderCapabilityBadges(caps));
|
||||
}
|
||||
|
||||
async function saveAIKeys() {
|
||||
@@ -1830,6 +1918,8 @@ export {
|
||||
initProfile,
|
||||
switchSidebarTab,
|
||||
populateVersions,
|
||||
loadAIKeys,
|
||||
saveAIKeys,
|
||||
};
|
||||
|
||||
// Populate every version display (header badge, About modal, help guide footer)
|
||||
|
||||
@@ -363,6 +363,14 @@
|
||||
"config.ai_keys_desc": "Configure API keys for the AI editor.",
|
||||
"config.ai_model": "Model",
|
||||
"config.ai_openrouter_label": "OpenRouter API Key",
|
||||
"config.ai_header_desc": "Configure your API keys provider by provider. Expand a card to enter a key, then click Test to load the models.",
|
||||
"config.ai_search_placeholder": "Search a provider…",
|
||||
"config.ai_default_section": "Default configuration",
|
||||
"config.ai_providers_title": "API providers",
|
||||
"config.ai_providers_empty": "No matching provider",
|
||||
"config.ai_status_configured": "Configured",
|
||||
"config.ai_status_not_configured": "Not configured",
|
||||
"config.ai_delete_key_title": "Delete the API key",
|
||||
"config.api_keys_saved": "API keys saved",
|
||||
"config.section_sources": "🔗 Connected sources & search",
|
||||
"config.sources_desc": "Keys used by the AI assistant tools (keyed web search: Tavily, Brave, SerpAPI, Exa; connected sources: Gitea, GitHub). They are stored server-side and take precedence over environment variables.",
|
||||
|
||||
@@ -363,6 +363,14 @@
|
||||
"config.ai_keys_desc": "Configurez les clés API pour l'éditeur IA.",
|
||||
"config.ai_model": "Modèle",
|
||||
"config.ai_openrouter_label": "OpenRouter API Key",
|
||||
"config.ai_header_desc": "Configurez vos clés API fournisseur par fournisseur. Dépliez une carte pour saisir une clé, puis cliquez sur Tester pour charger les modèles.",
|
||||
"config.ai_search_placeholder": "Rechercher un fournisseur…",
|
||||
"config.ai_default_section": "Configuration par défaut",
|
||||
"config.ai_providers_title": "Fournisseurs d'API",
|
||||
"config.ai_providers_empty": "Aucun fournisseur ne correspond",
|
||||
"config.ai_status_configured": "Configuré",
|
||||
"config.ai_status_not_configured": "Non configuré",
|
||||
"config.ai_delete_key_title": "Supprimer la clé API",
|
||||
"config.api_keys_saved": "Clés API sauvegardées",
|
||||
"config.section_sources": "🔗 Sources connectées & recherche",
|
||||
"config.sources_desc": "Clés utilisées par les outils de l'Assistant IA (recherche web à clé : Tavily, Brave, SerpAPI, Exa ; sources connectées : Gitea, GitHub). Elles sont stockées sur le serveur et priment sur les variables d'environnement.",
|
||||
|
||||
+256
-3
@@ -1474,10 +1474,11 @@ select {
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
/* Full-bleed viewers (PDF, images) must use the whole width when the
|
||||
navigation sidebar is hidden instead of the centered reading column. */
|
||||
/* Full-bleed viewers (PDF, images, Excalidraw) must use the whole width when
|
||||
the navigation sidebar is hidden instead of the centered reading column. */
|
||||
.sidebar.hidden ~ .content-wrapper .content-area:has(.pdf-viewer-container),
|
||||
.sidebar.hidden ~ .content-wrapper .content-area:has(.image-viewer-container) {
|
||||
.sidebar.hidden ~ .content-wrapper .content-area:has(.image-viewer-container),
|
||||
.sidebar.hidden ~ .content-wrapper .content-area:has(iframe[src*="excalidraw-editor.html"]) {
|
||||
margin: 0;
|
||||
max-width: none;
|
||||
}
|
||||
@@ -4346,6 +4347,258 @@ body.resizing-v {
|
||||
background: var(--bg-hover);
|
||||
}
|
||||
|
||||
/* --- AI keys section: accordion redesign (#104) --- */
|
||||
.ai-keys-header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
.ai-keys-header-text {
|
||||
flex: 1 1 320px;
|
||||
min-width: 0;
|
||||
}
|
||||
.ai-keys-header-text h2 {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.ai-keys-search {
|
||||
position: relative;
|
||||
flex: 0 1 260px;
|
||||
min-width: 200px;
|
||||
}
|
||||
.ai-keys-search .icon {
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 50%;
|
||||
transform: translateY(-50%);
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
color: var(--text-muted);
|
||||
pointer-events: none;
|
||||
}
|
||||
.ai-keys-search input {
|
||||
width: 100%;
|
||||
padding: 8px 12px 8px 32px;
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-secondary);
|
||||
color: var(--text-primary);
|
||||
font-size: 0.8rem;
|
||||
outline: none;
|
||||
transition: border-color 150ms ease;
|
||||
}
|
||||
.ai-keys-search input:focus {
|
||||
border-color: var(--accent);
|
||||
}
|
||||
|
||||
.ai-card-title {
|
||||
font-size: 0.72rem;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.6px;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-secondary);
|
||||
}
|
||||
|
||||
.ai-default-card {
|
||||
background: var(--surface, #1e1e24);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
padding: 16px 18px;
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
.ai-default-card > .ai-card-title {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
.ai-default-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.ai-field {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 6px;
|
||||
min-width: 0;
|
||||
}
|
||||
.ai-field-label {
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
color: var(--text-secondary);
|
||||
letter-spacing: 0.2px;
|
||||
}
|
||||
.ai-field .config-select,
|
||||
.ai-field .config-input {
|
||||
width: 100%;
|
||||
}
|
||||
.ai-caps-badges {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 6px;
|
||||
min-height: 22px;
|
||||
}
|
||||
.ai-cap-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 3px 10px;
|
||||
border-radius: 999px;
|
||||
font-size: 0.7rem;
|
||||
font-weight: 600;
|
||||
background: var(--accent-bg);
|
||||
color: var(--accent);
|
||||
border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
|
||||
}
|
||||
|
||||
.ai-providers-header {
|
||||
margin: 0 0 10px;
|
||||
}
|
||||
.ai-providers-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
.ai-provider-card {
|
||||
background: var(--surface, #1e1e24);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
transition: border-color 150ms ease;
|
||||
}
|
||||
.ai-provider-card:hover {
|
||||
border-color: var(--border-md);
|
||||
}
|
||||
.ai-provider-card.open {
|
||||
border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
|
||||
}
|
||||
.ai-provider-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 14px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.ai-provider-head:focus-visible {
|
||||
outline: 2px solid var(--accent);
|
||||
outline-offset: -2px;
|
||||
}
|
||||
.ai-provider-logo {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
border-radius: 8px;
|
||||
background: var(--accent-bg);
|
||||
color: var(--accent);
|
||||
font-weight: 700;
|
||||
font-size: 0.85rem;
|
||||
flex: none;
|
||||
}
|
||||
.ai-provider-name {
|
||||
flex: 1;
|
||||
font-size: 0.88rem;
|
||||
font-weight: 600;
|
||||
color: var(--text-primary);
|
||||
min-width: 0;
|
||||
}
|
||||
.ai-provider-badge {
|
||||
font-size: 0.68rem;
|
||||
padding: 2px 9px;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
background: var(--muted-bg, rgba(255, 255, 255, 0.06));
|
||||
color: var(--text-muted);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
.ai-provider-badge.configured {
|
||||
background: var(--success-bg);
|
||||
color: var(--success);
|
||||
border-color: color-mix(in srgb, var(--success) 40%, transparent);
|
||||
}
|
||||
.ai-provider-delete {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
background: transparent;
|
||||
color: var(--text-muted);
|
||||
cursor: pointer;
|
||||
flex: none;
|
||||
transition: color 150ms ease, background 150ms ease;
|
||||
}
|
||||
.ai-provider-delete:hover {
|
||||
color: var(--danger);
|
||||
background: var(--danger-bg);
|
||||
}
|
||||
.ai-provider-chevron {
|
||||
flex: none;
|
||||
color: var(--text-muted);
|
||||
transition: transform 200ms ease;
|
||||
}
|
||||
.ai-provider-card.open .ai-provider-chevron {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
.ai-provider-body {
|
||||
padding: 0 14px 14px;
|
||||
}
|
||||
.ai-provider-body.hidden {
|
||||
display: none;
|
||||
}
|
||||
.ai-provider-fields {
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 2fr;
|
||||
gap: 12px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--border);
|
||||
}
|
||||
.ai-providers-empty {
|
||||
padding: 14px;
|
||||
text-align: center;
|
||||
color: var(--text-muted);
|
||||
font-size: 0.8rem;
|
||||
border: 1px dashed var(--border);
|
||||
border-radius: 10px;
|
||||
}
|
||||
.ai-keys-footer {
|
||||
position: sticky;
|
||||
bottom: 0;
|
||||
z-index: 5;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 20px;
|
||||
padding: 12px 16px;
|
||||
background: var(--surface, #1e1e24);
|
||||
border: 1px solid var(--border);
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
|
||||
}
|
||||
.ai-keys-status {
|
||||
flex: 1;
|
||||
font-size: 0.75rem;
|
||||
color: var(--text-muted);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.ai-default-grid,
|
||||
.ai-provider-fields {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.ai-keys-search {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* --- Config diagnostics panel --- */
|
||||
.config-diagnostics {
|
||||
background: var(--code-bg);
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
* cache or Cloudflare does NOT clear the Service Worker Cache Storage, which is
|
||||
* a separate store. Bumping SW_VERSION invalidates it on every release.
|
||||
*/
|
||||
const SW_VERSION = 'v20';
|
||||
const SW_VERSION = 'v21';
|
||||
const CODE_CACHE = `obsigate-code-${SW_VERSION}`;
|
||||
const RUNTIME_CACHE = `obsigate-runtime-${SW_VERSION}`;
|
||||
const API_CACHE = `obsigate-api-${SW_VERSION}`;
|
||||
|
||||
Reference in New Issue
Block a user