feat: IME-aware chat input, message copy button, Git path scanning

- Fix IME composition issue: Enter during Chinese/Japanese/Korean input
  method composition no longer prematurely sends messages (assistant.js)
  Uses e.isComposing + keyCode 229 guard on keydown handler
- Add one-click copy button to chat message bubbles (both chat.js and
  assistant.js), with hover-reveal animation and checkmark feedback
- Add 'copy' icon to SVG icon library (Lucide style)
- Add CSS for msg-copy-btn in chat.css and assistant.css
- Implement scan_git_paths Rust command: scans common Git installation
  locations on Windows/macOS/Linux (Program Files, Scoop, Chocolatey,
  GitHub Desktop, VS Code, MSYS2, Homebrew, Xcode CLT, etc.)
- Register scan_git_paths in lib.rs, tauri-api.js, dev-api.js
- Add scan button + results UI in settings.js Git path section
- Add i18n keys: gitScan, gitScanning, gitScanEmpty, gitScanUse
This commit is contained in:
晴天
2026-04-06 00:14:18 +08:00
parent 42aeb8b077
commit 9ff91f74d8
11 changed files with 273 additions and 8 deletions

View File

@@ -4409,6 +4409,27 @@ const handlers = {
}
},
scan_git_paths() {
const candidates = [
['/usr/bin/git', 'SYSTEM'],
['/usr/local/bin/git', 'SYSTEM'],
['/opt/homebrew/bin/git', 'BREW'],
['/Library/Developer/CommandLineTools/usr/bin/git', 'XCODE_CLT'],
['/snap/bin/git', 'SNAP'],
]
const found = []
const seen = new Set()
for (const [p, source] of candidates) {
if (!fs.existsSync(p) || seen.has(p)) continue
seen.add(p)
try {
const ver = cp.execSync(`"${p}" --version`, { timeout: 5000 }).toString().trim()
found.push({ path: p, version: ver, source })
} catch {}
}
return found
},
auto_install_git() {
// Web 模式下不自动安装系统软件,返回指引
throw new Error('Web 部署模式下请手动安装 Git\n- Ubuntu/Debian: sudo apt install git\n- CentOS/RHEL: sudo yum install git\n- macOS: xcode-select --install')