diff --git a/README.md b/README.md index 80e7c99..e7aeec6 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ ai-chat/ ├── public/ # Web 根目录(Nginx 指向此目录) │ ├── index.php # 首页入口(自动路由到登录/安装页) │ ├── api.php # API 统一入口 +│ ├── router.php # PHP 内置开发服务器路由文件 │ ├── login.php # 登录页面 │ ├── chat.php # 聊天主页面 │ ├── config.php # 配置管理页面 @@ -84,21 +85,27 @@ ai-chat/ composer install ``` -3. **配置 Nginx** +3. **启动开发服务器**(本地开发) + ```bash + php -S localhost:8080 -t public/ public/router.php + ``` + 然后访问 `http://localhost:8080/` + +4. **或配置 Nginx**(生产部署) - 将网站根目录指向 `public/` 目录 - 参考 `docs/nginx.conf` 或 `docs/baota-nginx-snippet.conf` 配置 Nginx -4. **设置目录权限** +5. **设置目录权限**(生产部署) ```bash chmod -R 755 . chown -R www:www . ``` -5. **运行安装向导** +6. **运行安装向导** - 访问 `http://your-domain.com/install.php` - 按照向导步骤完成安装 -详细安装说明请查看 [INSTALL.md](INSTALL.md)。 +详细安装说明请查看 [INSTALL.md](INSTALL.md) 和 [DEPLOY.md](docs/DEPLOY.md)。 ## 页面说明 diff --git a/public/assets/js/install.js b/public/assets/js/install.js index 167a72d..8cdcd9a 100644 --- a/public/assets/js/install.js +++ b/public/assets/js/install.js @@ -75,10 +75,19 @@ const InstallWizard = { database: document.getElementById('dbName').value }) }); - const data = await response.json(); + + const text = await response.text(); + let data; + try { + data = JSON.parse(text); + } catch (parseErr) { + result.innerHTML = '
' + text.replace(/