feat: add api key auth, devii agent, openai gateway, and admin service management
This commit introduces a comprehensive set of new features including API key authentication with CLI management commands (get, reset, backfill), a Devii agentic assistant with WebSocket terminal and session bootstrap, an OpenAI-compatible LLM gateway service, and an admin service management panel. It also adds Playwright browser automation for bot support, configures internal gateway URLs, refactors content editing/deletion to support JSON API responses, and updates documentation across AGENTS.md, README.md, and the developer docs site.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "./devii/devii-avatar.js";
|
||||
import "./devii/devii-terminal.js";
|
||||
|
||||
export class DeviiTerminal {
|
||||
constructor() {
|
||||
this.element = null;
|
||||
this.avatar = null;
|
||||
this.ready = this.init();
|
||||
}
|
||||
|
||||
async init() {
|
||||
try {
|
||||
await fetch("/devii/session", { credentials: "same-origin" });
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.avatar = document.createElement("devii-avatar");
|
||||
this.avatar.id = "devii";
|
||||
this.avatar.setAttribute("character", "Clippy");
|
||||
document.body.appendChild(this.avatar);
|
||||
|
||||
this.element = document.createElement("devii-terminal");
|
||||
this.element.setAttribute("avatar", "devii");
|
||||
document.body.appendChild(this.element);
|
||||
|
||||
this.bindTriggers();
|
||||
}
|
||||
|
||||
bindTriggers() {
|
||||
document.querySelectorAll("[data-devii-open]").forEach((trigger) => {
|
||||
trigger.addEventListener("click", (event) => {
|
||||
event.preventDefault();
|
||||
this.open();
|
||||
});
|
||||
});
|
||||
const stored = this.element && this.element.hasStoredState && this.element.hasStoredState();
|
||||
if (document.querySelector("[data-devii-autoopen]") && !stored) {
|
||||
this.open();
|
||||
}
|
||||
}
|
||||
|
||||
async open() {
|
||||
await this.ready;
|
||||
if (this.element) this.element.open();
|
||||
}
|
||||
|
||||
async close() {
|
||||
await this.ready;
|
||||
if (this.element) this.element.close();
|
||||
}
|
||||
|
||||
async toggle() {
|
||||
await this.ready;
|
||||
if (this.element) this.element.toggle();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user