13.08.2026 налажена работа с ИИ. Подготовка к разбивке файлов agent и db_tools
This commit is contained in:
+3
-52
@@ -15,58 +15,9 @@ document.addEventListener("DOMContentLoaded", () => {
|
||||
|
||||
if (userInputEl) {
|
||||
userInputEl.addEventListener("input", function() {
|
||||
this.style.height = "auto";
|
||||
this.style.height = Math.min(this.scrollHeight, 80) + "px";
|
||||
});
|
||||
|
||||
userInputEl.addEventListener("keydown", function(e) {
|
||||
// Отправка по Enter
|
||||
if (e.key === "Enter" && !e.shiftKey) {
|
||||
e.preventDefault();
|
||||
|
||||
const val = this.value.trim();
|
||||
if (val) {
|
||||
// Сохраняем команду в историю
|
||||
if (inputHistory.length === 0 || inputHistory[inputHistory.length - 1] !== val) {
|
||||
inputHistory.push(val);
|
||||
if (inputHistory.length > 50) inputHistory.shift();
|
||||
localStorage.setItem(STORAGE_KEY, JSON.stringify(inputHistory));
|
||||
}
|
||||
historyIndex = -1;
|
||||
}
|
||||
|
||||
if (typeof sendMessage === "function") {
|
||||
sendMessage(e);
|
||||
}
|
||||
}
|
||||
// История: стрелка ВВЕРХ
|
||||
else if (e.key === "ArrowUp") {
|
||||
if (inputHistory.length > 0 && historyIndex < inputHistory.length - 1) {
|
||||
e.preventDefault();
|
||||
if (historyIndex === -1) {
|
||||
this.dataset.draft = this.value;
|
||||
}
|
||||
historyIndex++;
|
||||
this.value = inputHistory[inputHistory.length - 1 - historyIndex];
|
||||
this.dispatchEvent(new Event("input"));
|
||||
setTimeout(() => this.setSelectionRange(this.value.length, this.value.length), 0);
|
||||
}
|
||||
}
|
||||
// История: стрелка ВНИЗ
|
||||
else if (e.key === "ArrowDown") {
|
||||
if (historyIndex !== -1) {
|
||||
e.preventDefault();
|
||||
if (historyIndex > 0) {
|
||||
historyIndex--;
|
||||
this.value = inputHistory[inputHistory.length - 1 - historyIndex];
|
||||
} else {
|
||||
historyIndex = -1;
|
||||
this.value = this.dataset.draft || "";
|
||||
}
|
||||
this.dispatchEvent(new Event("input"));
|
||||
setTimeout(() => this.setSelectionRange(this.value.length, this.value.length), 0);
|
||||
}
|
||||
}
|
||||
this.style.height = "24px";
|
||||
const newHeight = Math.min(this.scrollHeight, 120);
|
||||
this.style.height = newHeight + "px";
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user