Files
ST-Amily2-Chat-Optimisation/core/table-system/logger.js
SilenceLurker 0be6a86e94 feat: add API config system, FilePipe backend, and ConfigManager
- ConfigManager: route sensitive keys (API keys) to localStorage,
  migrate existing values out of extension_settings on startup
- ApiKeyStore: local/cloud storage modes with RSA+AES hybrid encryption
- ApiProfileManager: named connection profiles (chat/embedding/rerank)
  with per-slot type-validated assignments
- FilePipe: complete IndexedDB backend (read/write/delete/list/stat)
- Amily2Bus: inject FilePipe via forPlugin() capability token
- UI: api-config-panel with profile CRUD and slot assignment
- TableSystemService: initial service layer scaffold
- logger.js: XSS fix
2026-03-10 22:07:15 +08:00

31 lines
1.0 KiB
JavaScript

const getLogContainer = () => document.getElementById('table-log-display');
export function log(message, type = 'info', data = null) {
const container = getLogContainer();
if (!container) {
// 在容器不可用时,静默地将日志打印到控制台,不再显示警告
const logFunc = console[type] || console.log;
logFunc(`[内存储司-起居注] ${message}`, data || '');
return;
}
const iconMap = {
info: 'fa-solid fa-circle-info',
success: 'fa-solid fa-check-circle',
warn: 'fa-solid fa-triangle-exclamation',
error: 'fa-solid fa-circle-xmark',
};
const logEntry = document.createElement('p');
logEntry.className = `hly-log-entry log-${type}`;
const icon = document.createElement('i');
icon.className = iconMap[type];
logEntry.appendChild(icon);
logEntry.appendChild(document.createTextNode(` ${message}`));
container.appendChild(logEntry);
// Auto-scroll to the bottom
container.scrollTop = container.scrollHeight;
}