zdl
|
b07cb8ab51
|
feat: 修改 bytedesk.config.js,改为使用相对路径和动态域名
|
2025-11-12 11:26:05 +08:00 |
|
zdl
|
fb4a18c8ec
|
feat: 调整环境配置
|
2025-11-12 11:03:37 +08:00 |
|
zdl
|
5c60450ba1
|
feat: 配置调整
|
2025-11-12 10:43:06 +08:00 |
|
zdl
|
a3dfa5fd06
|
fix(bytedesk): 修复组织 UUID 和 API URL 配置错误
回滚之前错误的提交,使用正确的组织 UUID(df_org_uid)和相对路径 API URL。
## 问题
1. **组织 UUID 错误**:
- 之前错误地使用 `bytedesk`(组织代码)
- 应该使用 `df_org_uid`(组织 UUID)
- Bytedesk SDK 的 `chatConfig.org` 需要组织 UUID,不是代码
2. **API URL 默认值错误**:
- 代码默认值使用 HTTP 绝对 URL: `http://43.143.189.195`
- 会导致生产环境 Mixed Content 错误
- 应该使用相对路径: `/bytedesk-api`
## 解决方案
1. 统一使用组织 UUID: `df_org_uid`
2. 修改 API URL 默认值为相对路径: `/bytedesk-api`
## 代码变更
### 1. `.env.production`
```diff
- REACT_APP_BYTEDESK_ORG=bytedesk
+ REACT_APP_BYTEDESK_ORG=df_org_uid
```
### 2. `src/bytedesk-integration/config/bytedesk.config.js`
```diff
- const BYTEDESK_API_URL = process.env.REACT_APP_BYTEDESK_API_URL || 'http://43.143.189.195';
+ const BYTEDESK_API_URL = process.env.REACT_APP_BYTEDESK_API_URL || '/bytedesk-api';
- const BYTEDESK_ORG = process.env.REACT_APP_BYTEDESK_ORG || 'bytedesk';
+ const BYTEDESK_ORG = process.env.REACT_APP_BYTEDESK_ORG || 'df_org_uid';
```
### 3. `src/bytedesk-integration/.env.bytedesk.example`
```diff
- REACT_APP_BYTEDESK_ORG=bytedesk
+ REACT_APP_BYTEDESK_ORG=df_org_uid
```
## 后台配置确认
根据 Bytedesk 管理后台:
- ✅ 组织 UUID: `df_org_uid`
- ✅ 组织代码: `bytedesk`(仅用于显示)
- ✅ 工作组 UUID: `df_wg_uid`
## 最终配置
所有环境的配置统一为:
```bash
REACT_APP_BYTEDESK_API_URL=/bytedesk-api
REACT_APP_BYTEDESK_ORG=df_org_uid
REACT_APP_BYTEDESK_SID=df_wg_uid
```
## 本地开发配置
开发者需要在 `.env.local` 中手动设置(此文件不提交到 git):
```bash
REACT_APP_BYTEDESK_API_URL=/bytedesk-api
REACT_APP_BYTEDESK_ORG=df_org_uid
REACT_APP_BYTEDESK_SID=df_wg_uid
```
## 验证
- ✅ 即使环境变量未设置,默认值也是正确的
- ✅ 不会出现 Mixed Content 错误(使用相对路径)
- ✅ 配置与后台管理界面的 UUID 一致
- ✅ 不再出现 "Failed to create thread" 错误
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-11 20:14:28 +08:00 |
|
zdl
|
2bb8cb78e6
|
feat: 客服通知代码提交
|
2025-11-11 11:31:40 +08:00 |
|
zdl
|
8e5623d723
|
feat(customer-service): 集成 Bytedesk 客服系统并优化 Dify 机器人显示
## 主要变更
### 1. Dify 机器人优化
**文件**: public/index.html
- ✅ 恢复 Dify 机器人代码
- ✅ 添加显示控制逻辑:只在 /home 页面显示
- ✅ 使用 JavaScript 监听路由变化,动态控制显示/隐藏
- ✅ 保留所有样式配置
### 2. Bytedesk 客服系统集成
**文件**: src/bytedesk-integration/config/bytedesk.config.js
- ✅ 配置开发环境使用代理路径(/bytedesk-api)
- ✅ 修复 X-Frame-Options 跨域问题
- ✅ 优化 shouldShowCustomerService 逻辑:默认所有页面显示,只在 /login 隐藏
- ✅ 保留白名单模式代码作为备用方案
**文件**: src/components/GlobalComponents.js
- ✅ 集成 BytedeskWidget 组件
- ✅ 使用 shouldShowCustomerService 控制显示
### 3. 客服显示规则
**Dify 机器人**:
- ✅ /home 页面 → 显示
- ❌ 其他页面 → 隐藏
**Bytedesk 客服**:
- ✅ 所有页面 → 显示
- ❌ /login 页面 → 隐藏
## 已知问题
- ⚠️ Bytedesk 服务器配置 enabled: false,需要后端修改为 true
- ⚠️ 配置接口: /config/bytedesk/properties
## 测试建议
1. 访问 /home 页面,检查 Dify 机器人是否显示
2. 访问其他页面,检查 Dify 是否隐藏
3. 等待后端修改 enabled 后,测试 Bytedesk 客服功能
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2025-11-10 19:58:36 +08:00 |
|
zdl
|
57b4841b4c
|
feat: 添加客服组件
|
2025-11-10 19:23:25 +08:00 |
|