fix: Windows support & cross-platform architecture

Major fixes for Windows portable version:

1. **Fixed critical bugs:**
   - Replace Unix /dev/null with Windows nul in all .bat files
   - Unified config path to data/.openclaw/openclaw.json
   - Fixed cross-platform node_modules compatibility issue

2. **Implemented separated core directories:**
   - app/core-mac/ for Mac dependencies
   - app/core-win/ for Windows dependencies
   - Prevents cross-platform file system conflicts
   - Shared data/ directory for configs and memory

3. **Enhanced setup.sh:**
   - Now downloads both Mac and Windows Node.js runtimes
   - Ensures U-Claw works on both platforms after setup

4. **Added diagnostic tools:**
   - Windows-Diagnose.bat for troubleshooting
   - Mac-Diagnose.command for troubleshooting
   - Auto-generates diagnostic-log.txt

5. **Improved user experience:**
   - Added Welcome.html - Simple 3-step guide in Chinese
   - All scripts updated to use platform-specific core directories
   - Better error messages and user guidance

Files modified:
- portable/Windows-Start.bat: Use core-win, fix syntax
- portable/Windows-Menu.bat: Use core-win, fix syntax
- portable/Mac-Start.command: Use core-mac
- portable/Mac-Menu.command: Use core-mac
- portable/setup.sh: Download both platforms, use core-mac

Files added:
- portable/Windows-Diagnose.bat: Diagnostic tool
- portable/Mac-Diagnose.command: Diagnostic tool
- portable/Welcome.html: User-friendly welcome page

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
hfshfg
2026-03-12 18:50:55 +08:00
parent 11220537a0
commit 25bc0076b0
8 changed files with 551 additions and 8 deletions

254
portable/Welcome.html Normal file
View File

@@ -0,0 +1,254 @@
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>U-Claw 使用指南</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
padding: 30px 20px;
}
.container {
max-width: 700px;
margin: 0 auto;
background: white;
border-radius: 16px;
padding: 40px;
box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
h1 {
text-align: center;
color: #333;
font-size: 2.5em;
margin-bottom: 10px;
}
h1 .emoji { font-size: 1.2em; }
.subtitle {
text-align: center;
color: #666;
font-size: 1.1em;
margin-bottom: 40px;
}
.section {
margin-bottom: 35px;
}
.section-title {
color: #667eea;
font-size: 1.4em;
margin-bottom: 20px;
padding-bottom: 10px;
border-bottom: 2px solid #e0e0e0;
}
.steps {
counter-reset: step;
}
.step {
position: relative;
padding: 20px;
padding-left: 70px;
margin-bottom: 20px;
background: #f8f9fa;
border-radius: 12px;
border-left: 4px solid #667eea;
}
.step::before {
content: counter(step);
counter-increment: step;
position: absolute;
left: 20px;
top: 20px;
background: #667eea;
color: white;
width: 36px;
height: 36px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 1.2em;
}
.step-title {
font-weight: 600;
color: #333;
font-size: 1.1em;
margin-bottom: 8px;
}
.step-desc {
color: #666;
line-height: 1.6;
}
.step-desc code {
background: #e3e8ff;
padding: 3px 8px;
border-radius: 4px;
color: #667eea;
font-size: 0.95em;
font-family: "Consolas", monospace;
}
.tip-box {
background: #fff3cd;
border-left: 4px solid #ffc107;
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
}
.tip-box strong {
color: #856404;
display: block;
margin-bottom: 5px;
}
.tip-box p {
color: #856404;
margin: 0;
line-height: 1.6;
}
.success-box {
background: #d4edda;
border-left: 4px solid #28a745;
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
}
.success-box p {
color: #155724;
margin: 0;
}
.model-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
margin-top: 15px;
}
.model-item {
background: #f8f9fa;
padding: 12px;
border-radius: 8px;
border: 1px solid #e0e0e0;
}
.model-item strong {
color: #667eea;
display: block;
margin-bottom: 4px;
}
.model-item span {
color: #666;
font-size: 0.9em;
}
.btn {
display: inline-block;
padding: 12px 24px;
background: #667eea;
color: white;
text-decoration: none;
border-radius: 8px;
font-weight: 600;
transition: all 0.3s;
margin-right: 10px;
margin-top: 10px;
}
.btn:hover {
background: #5568d3;
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}
.footer {
text-align: center;
margin-top: 40px;
padding-top: 20px;
border-top: 1px solid #e0e0e0;
color: #999;
}
</style>
</head>
<body>
<div class="container">
<h1><span class="emoji">🦞</span> U-Claw 使用指南</h1>
<div class="subtitle">AI助手便携U盘 · 3步开始使用</div>
<div class="section">
<div class="section-title">快速开始</div>
<div class="steps">
<div class="step">
<div class="step-title">第1步启动服务</div>
<div class="step-desc">
根据您的系统,双击对应的启动文件:<br><br>
<strong>Windows 用户:</strong>双击 <code>Windows-Start.bat</code><br>
<strong>Mac 用户:</strong>双击 <code>Mac-Start.command</code>
</div>
</div>
<div class="step">
<div class="step-title">第2步配置AI模型</div>
<div class="step-desc">
首次启动会自动打开配置页面,按照提示操作:<br>
1. 选择一个AI模型推荐 <strong>DeepSeek</strong> - 便宜好用)<br>
2. 填写API Key去模型官网注册获取<br>
3. 点击"保存配置"
</div>
</div>
<div class="step">
<div class="step-title">第3步开始对话</div>
<div class="step-desc">
配置完成后浏览器会自动打开AI对话界面<br>
地址:<code>http://127.0.0.1:18789</code><br>
现在可以和AI助手对话了
</div>
</div>
</div>
<div class="success-box">
<p>✅ 所有配置和对话记录保存在U盘的 <code>data/</code> 目录Mac和Windows自动共享</p>
</div>
</div>
<div class="section">
<div class="section-title">推荐AI模型</div>
<div class="model-grid">
<div class="model-item">
<strong>🔥 DeepSeek</strong>
<span>编程首选,极便宜</span>
</div>
<div class="model-item">
<strong>📄 Kimi</strong>
<span>长文档处理专家</span>
</div>
<div class="model-item">
<strong>🆓 通义千问</strong>
<span>免费额度大</span>
</div>
<div class="model-item">
<strong>🌟 Claude</strong>
<span>最强理解能力</span>
</div>
</div>
</div>
<div class="section">
<div class="section-title">遇到问题?</div>
<div class="tip-box">
<strong>💡 运行诊断工具</strong>
<p>
如果启动失败,双击运行诊断工具:<br>
Windows: <code>Windows-Diagnose.bat</code><br>
Mac: <code>Mac-Diagnose.command</code>
</p>
</div>
</div>
<div style="text-align: center; margin-top: 30px;">
<a href="Config.html" class="btn">打开配置页面</a>
<a href="https://u-claw.org" class="btn" target="_blank">查看文档</a>
</div>
<div class="footer">
U-Claw v1.1 · MIT License · <a href="https://github.com/dongsheng123132/u-claw" target="_blank" style="color: #667eea;">GitHub</a>
</div>
</div>
</body>
</html>