Support assistant across all tabs: global panel (title bar button and in terminal, Docker, firewall and network tabs) that uses the active tab as context (terminal output, container/stack view, compose editor with masked .env values, firewall rules, network config); chats are stored in the vault and can be switched, started anew and deleted; stop button while answering
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+5
-3
@@ -4,8 +4,10 @@ const http = require('http');
|
||||
const https = require('https');
|
||||
|
||||
const SYSTEM_PROMPT = `You are the MrTerm support assistant, an experienced Linux system administrator.
|
||||
The user works in an SSH terminal on a Linux server (typically Ubuntu, Debian or Proxmox).
|
||||
You may receive the latest terminal output as context. Your job:
|
||||
The user manages Linux servers (typically Ubuntu, Debian or Proxmox) with MrTerm: SSH terminals, Docker containers
|
||||
and compose stacks, firewall (UFW/iptables), network configuration and SFTP.
|
||||
You may receive the content of the user's active MrTerm tab as context (terminal output, container list, compose file,
|
||||
firewall rules, …). Your job:
|
||||
- Explain errors briefly and clearly, name the most likely cause.
|
||||
- Suggest concrete, copy-pasteable shell commands in \`\`\`bash code blocks, one step at a time.
|
||||
- Warn explicitly before destructive commands (rm -rf, dd, mkfs, firewall changes that may lock out SSH, network changes).
|
||||
@@ -56,7 +58,7 @@ class AiAssistant {
|
||||
this.stop(chatId);
|
||||
const ctrl = new AbortController();
|
||||
this.running.set(chatId, ctrl);
|
||||
const sys = SYSTEM_PROMPT + (context ? `\n\nLatest terminal output:\n\`\`\`\n${context.slice(-12000)}\n\`\`\`` : '');
|
||||
const sys = SYSTEM_PROMPT + (context ? `\n\nContent of the active tab:\n\`\`\`\n${context.slice(-12000)}\n\`\`\`` : '');
|
||||
(async () => {
|
||||
try {
|
||||
const res = await request(url, 'api/chat', { method: 'POST', signal: ctrl.signal, body: { model, stream: true, messages: [{ role: 'system', content: sys }, ...messages] } });
|
||||
|
||||
Reference in New Issue
Block a user