+
-
-
+
+
+
[ AI BACKEND CONFIGURATION ]
+
+
+
+
+
-
-
+
+ const cmd = trimmed.toLowerCase();
+ switch (cmd) {
+ case 'help':
+ addLine('', '');
+ addLine('Available commands:', 'system');
+ addLine(' help - Show this help', 'system');
+ addLine(' config - Configure AI backend', 'system');
+ addLine(' status - Show connection status', 'system');
+ addLine(' clear - Clear screen', 'system');
+ addLine(' date - Show current date/time', 'system');
+ addLine('', '');
+ addLine('Any other input is sent to the AI', 'system');
+ break;
+
+ case 'config':
+ openConfig();
+ break;
+
+ case 'status':
+ addLine('', '');
+ addLine('CONNECTION STATUS:', 'system');
+ addLine(' Enabled: ' + (aiConfig.enabled ? 'YES' : 'NO'), 'system');
+ addLine(' Endpoint: ' + (aiConfig.endpoint || 'Not configured'), 'system');
+ addLine(' Model: ' + (aiConfig.model || 'Not configured'), 'system');
+ addLine(' Type: ' + (aiConfig.type || 'unknown'), 'system');
+ break;
+
+ case 'clear':
+ clearOutput();
+ break;
+
+ case 'date':
+ addLine(new Date().toString(), 'system');
+ break;
+
+ default:
+ queryAI(trimmed);
+ }
+ }
+
+ /* ============================================
+ INPUT HANDLING
+ ============================================ */
+ inputField.addEventListener('keydown', function(e) {
+ if (e.key === 'Enter' && !isProcessing) {
+ processCommand(this.value);
+ this.value = '';
+ } else if (e.key === 'ArrowUp') {
+ e.preventDefault();
+ if (historyIndex < commandHistory.length - 1) {
+ historyIndex++;
+ this.value = commandHistory[historyIndex];
+ }
+ } else if (e.key === 'ArrowDown') {
+ e.preventDefault();
+ if (historyIndex > 0) {
+ historyIndex--;
+ this.value = commandHistory[historyIndex];
+ } else {
+ historyIndex = -1;
+ this.value = '';
+ }
+ }
+ });
+
+ /* ============================================
+ INITIALIZATION
+ ============================================ */
+ updateStatus();
+ updateTime();
+ setInterval(updateTime, 1000);
+ inputField.focus();
+
+ // Click anywhere to focus input
+ document.addEventListener('click', function(e) {
+ if (!configPanel.contains(e.target)) {
+ inputField.focus();
+ }
+ });
+
-
\ No newline at end of file
+