diff --git a/README-Windows.txt b/README-Windows.txt new file mode 100644 index 000000000..4d30f721b --- /dev/null +++ b/README-Windows.txt @@ -0,0 +1,68 @@ +================================ + PicoClaw Windows 版使用说明 +================================ + +【快速开始】 + +第一步:配置 + 双击 setup.bat,按照提示输入: + 1. API Key(支持 OpenAI 兼容 API) + 2. API Base URL(默认:https://api.openai.com/v1) + 3. 模型名称(默认:gpt-4) + 4. 飞书 App ID + 5. 飞书 App Secret + +第二步:使用 + 配置完成后,服务会自动启动。 + 打开飞书,找到你的机器人,开始聊天! + +第三步:停止服务 + 在运行 setup.bat 的窗口按 Ctrl+C 停止服务。 + + +【常见问题】 + +Q: 如何更换配置? +A: 再次双击 setup.bat 重新配置即可。新配置会覆盖旧配置。 + +Q: 配置文件保存在哪里? +A: 配置文件保存在 C:\Users\你的用户名\.picoclaw\config.json + +Q: 如何查看日志? +A: 日志保存在 C:\Users\你的用户名\.picoclaw\logs\ + +Q: 启动时提示"PowerShell 执行策略限制"怎么办? +A: setup.bat 已经自动处理了此问题,如果仍然遇到,请以管理员身份运行 PowerShell,执行: + Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser + +Q: 防火墙拦截怎么办? +A: 首次启动时,Windows 防火墙可能会询问是否允许访问,请选择"允许"。 + +Q: 杀毒软件报警怎么办? +A: 这是正常现象(程序未签名),请添加信任或暂时禁用杀毒软件。 + + +【支持的 API】 + +PicoClaw 支持所有 OpenAI 兼容的 API,包括但不限于: + - OpenAI 官方 API (https://api.openai.com/v1) + - Azure OpenAI + - 智谱 AI (GLM-4) + - 月之暗面 (Moonshot) + - 零一万物 (Yi) + - 百川智能 (Baichuan) + - MiniMax + - 阿里云百炼 + - 豆包(火山引擎) + - 其他 OpenAI 兼容 API + + +【获取帮助】 + +GitHub: https://github.com/sipeed/picoclaw +问题反馈: https://github.com/sipeed/picoclaw/issues + + +【许可证】 + +本项目采用 MIT 许可证 diff --git a/picoclaw.exe.zip b/picoclaw.exe.zip new file mode 100644 index 000000000..656ee3a31 Binary files /dev/null and b/picoclaw.exe.zip differ diff --git a/setup-wizard.ps1 b/setup-wizard.ps1 new file mode 100644 index 000000000..8149be335 --- /dev/null +++ b/setup-wizard.ps1 @@ -0,0 +1,145 @@ +# PicoClaw Windows Setup Wizard + +[Console]::OutputEncoding = [System.Text.Encoding]::UTF8 + +Write-Host "========================================" -ForegroundColor Cyan +Write-Host " PicoClaw Windows Setup Wizard" -ForegroundColor Cyan +Write-Host "========================================" -ForegroundColor Cyan +Write-Host "" +Write-Host "This wizard will help you configure PicoClaw" -ForegroundColor Yellow +Write-Host "You need:" -ForegroundColor Yellow +Write-Host " 1. API Key (OpenAI compatible API)" -ForegroundColor White +Write-Host " 2. Feishu App ID and App Secret" -ForegroundColor White +Write-Host "" + +# Step 1: Configure LLM +Write-Host "" +Write-Host "[Step 1/2] Configure LLM (OpenAI compatible API)" -ForegroundColor Yellow +Write-Host "" + +$apiKey = "" +while ([string]::IsNullOrWhiteSpace($apiKey)) { + $apiKey = Read-Host "Enter API Key" + if ([string]::IsNullOrWhiteSpace($apiKey)) { + Write-Host "Error: API Key cannot be empty" -ForegroundColor Red + } +} + +$apiBase = Read-Host "Enter API Base URL (Press Enter for default: https://api.openai.com/v1)" +if ([string]::IsNullOrWhiteSpace($apiBase)) { + $apiBase = "https://api.openai.com/v1" + Write-Host "Using default: $apiBase" -ForegroundColor Gray +} + +$model = Read-Host "Enter model name (Press Enter for default: gpt-4)" +if ([string]::IsNullOrWhiteSpace($model)) { + $model = "gpt-4" + Write-Host "Using default: $model" -ForegroundColor Gray +} + +# Step 2: Configure Feishu +Write-Host "" +Write-Host "[Step 2/2] Configure Feishu" -ForegroundColor Yellow +Write-Host "" + +$feishuAppId = "" +while ([string]::IsNullOrWhiteSpace($feishuAppId)) { + $feishuAppId = Read-Host "Enter Feishu App ID" + if ([string]::IsNullOrWhiteSpace($feishuAppId)) { + Write-Host "Error: Feishu App ID cannot be empty" -ForegroundColor Red + } +} + +$feishuAppSecret = "" +while ([string]::IsNullOrWhiteSpace($feishuAppSecret)) { + $feishuAppSecret = Read-Host "Enter Feishu App Secret" + if ([string]::IsNullOrWhiteSpace($feishuAppSecret)) { + Write-Host "Error: Feishu App Secret cannot be empty" -ForegroundColor Red + } +} + +# Generate or update config file +Write-Host "" +Write-Host "Saving configuration..." -ForegroundColor Green + +$configDir = Join-Path $env:USERPROFILE ".picoclaw" +if (-not (Test-Path $configDir)) { + New-Item -Path $configDir -ItemType Directory -Force | Out-Null + Write-Host "Created config directory: $configDir" -ForegroundColor Gray +} + +$configPath = Join-Path $configDir "config.json" + +# Read existing config or create new one +if (Test-Path $configPath) { + Write-Host "Updating existing configuration..." -ForegroundColor Gray + $configJson = Get-Content $configPath -Raw | ConvertFrom-Json +} else { + Write-Host "Creating new configuration..." -ForegroundColor Gray + # Create minimal config structure + $configJson = @{ + agents = @{ + defaults = @{ + workspace = "~/.picoclaw/workspace" + restrict_to_workspace = $true + model_name = "user-model" + max_tokens = 8192 + temperature = 0.7 + max_tool_iterations = 20 + } + } + model_list = @() + channels = @{} + } +} + +# Update model_list +$modelEntry = @{ + model_name = "user-model" + model = $model + api_key = $apiKey + api_base = $apiBase +} + +# Remove old model entry if exists and add new one +$configJson.model_list = @($modelEntry) + +# Update agents.defaults.model_name +if (-not $configJson.agents) { + $configJson | Add-Member -MemberType NoteProperty -Name "agents" -Value @{} -Force +} +if (-not $configJson.agents.defaults) { + $configJson.agents | Add-Member -MemberType NoteProperty -Name "defaults" -Value @{} -Force +} +$configJson.agents.defaults.model_name = "user-model" + +# Update channels.feishu +if (-not $configJson.channels) { + $configJson | Add-Member -MemberType NoteProperty -Name "channels" -Value @{} -Force +} +if (-not $configJson.channels.feishu) { + $configJson.channels | Add-Member -MemberType NoteProperty -Name "feishu" -Value @{} -Force +} + +$configJson.channels.feishu | Add-Member -MemberType NoteProperty -Name "enabled" -Value $true -Force +$configJson.channels.feishu | Add-Member -MemberType NoteProperty -Name "app_id" -Value $feishuAppId -Force +$configJson.channels.feishu | Add-Member -MemberType NoteProperty -Name "app_secret" -Value $feishuAppSecret -Force + +# Save configuration +$jsonContent = $configJson | ConvertTo-Json -Depth 10 +[System.IO.File]::WriteAllText($configPath, $jsonContent, [System.Text.UTF8Encoding]::new($false)) + +Write-Host "Configuration saved to: $configPath" -ForegroundColor Green + +# Start service +Write-Host "" +Write-Host "Configuration complete! Starting PicoClaw Gateway..." -ForegroundColor Green +Write-Host "" +Write-Host "========================================" -ForegroundColor Cyan +Write-Host " Service started" -ForegroundColor Cyan +Write-Host " You can now chat via Feishu!" -ForegroundColor Cyan +Write-Host " Press Ctrl+C to stop" -ForegroundColor Cyan +Write-Host "========================================" -ForegroundColor Cyan +Write-Host "" + +& ".\picoclaw.exe" gateway diff --git a/setup.bat b/setup.bat new file mode 100644 index 000000000..4f0182d91 --- /dev/null +++ b/setup.bat @@ -0,0 +1,22 @@ +@echo off + +echo ======================================== +echo PicoClaw Windows Setup Wizard +echo ======================================== +echo. + +REM Stop any running gateway instances +echo Stopping existing gateway instances... +taskkill /F /IM picoclaw.exe >nul 2>&1 +if exist "%USERPROFILE%\.picoclaw\workspace\gateway.lock" del /F /Q "%USERPROFILE%\.picoclaw\workspace\gateway.lock" >nul 2>&1 +echo. + +echo Starting setup wizard... +echo. + +PowerShell -NoProfile -ExecutionPolicy Bypass -File "%~dp0setup-wizard.ps1" + +echo. +echo Tip: Press Ctrl+C to stop the service +echo. +pause