Merge branch 'test' into prod
This commit is contained in:
commit
037fb499e5
18 files changed
+164
-27
No files matched your search
@@ -29,6 +29,8 @@ AUTH_LOCAL_JWT_ISSUER=hxops-backend
|
|||||||
AUTH_LOCAL_JWT_AUDIENCE=hxops-frontend
|
AUTH_LOCAL_JWT_AUDIENCE=hxops-frontend
|
||||||
AUTH_LOCAL_JWT_EXPIRES_HOURS=12
|
AUTH_LOCAL_JWT_EXPIRES_HOURS=12
|
||||||
|
|
||||||
|
DATABASE_URL=postgresql://postgres:@localhost:5432/hxops_db
|
||||||
|
|
||||||
# SiliconFlow API Configuration
|
# SiliconFlow API Configuration
|
||||||
GJL_API_KEY=sk-umfzicwjcvwampzblqczckkqojiscyybtaljzbsvpdwdvxlu
|
GJL_API_KEY=sk-umfzicwjcvwampzblqczckkqojiscyybtaljzbsvpdwdvxlu
|
||||||
GJL_API_BASE=https://api.siliconflow.cn/v1
|
GJL_API_BASE=https://api.siliconflow.cn/v1
|
||||||
|
|||||||
+3
-2
@@ -13,5 +13,6 @@ def make_shell_context():
|
|||||||
return {'db': db, 'User': User, 'Agent': Agent}
|
return {'db': db, 'User': User, 'Agent': Agent}
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# MacOS ControlCenter uses port 5000, so we use 5002
|
# MacOS ControlCenter uses port 5000, so we use 5052
|
||||||
app.run(host='0.0.0.0', port=5002)
|
# (原5002易被Trae IDE自动端口转发劫持)
|
||||||
|
app.run(host='0.0.0.0', port=5052)
|
||||||
@@ -17,7 +17,7 @@ username = sys.argv[1]
|
|||||||
password = sys.argv[2]
|
password = sys.argv[2]
|
||||||
|
|
||||||
# 测试登录 API
|
# 测试登录 API
|
||||||
url = "http://localhost:5002/api/user/login"
|
url = "http://localhost:5052/api/user/login"
|
||||||
headers = {"Content-Type": "application/json"}
|
headers = {"Content-Type": "application/json"}
|
||||||
data = {"username": username, "password": password}
|
data = {"username": username, "password": password}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
import requests
|
import requests
|
||||||
import json
|
import json
|
||||||
|
|
||||||
BASE_URL = "http://127.0.0.1:5002"
|
BASE_URL = "http://127.0.0.1:5052"
|
||||||
|
|
||||||
def test_auth_header_format():
|
def test_auth_header_format():
|
||||||
"""测试不同的认证头格式"""
|
"""测试不同的认证头格式"""
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import requests
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
BASE_URL = "http://127.0.0.1:5002"
|
BASE_URL = "http://127.0.0.1:5052"
|
||||||
|
|
||||||
def test_login():
|
def test_login():
|
||||||
"""测试登录 API"""
|
"""测试登录 API"""
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ services:
|
|||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
# 如果需要在宿主机调试,可暴露端口;生产环境建议只在网络内暴露
|
# 如果需要在宿主机调试,可暴露端口;生产环境建议只在网络内暴露
|
||||||
ports:
|
ports:
|
||||||
- "5002:5002"
|
- "5052:5052"
|
||||||
# 持久化运行时可写文件:
|
# 持久化运行时可写文件:
|
||||||
# - backend/.env 用于保存管理员后台修改的企业微信等配置(与数据库双写,
|
# - backend/.env 用于保存管理员后台修改的企业微信等配置(与数据库双写,
|
||||||
# 防止容器重建后从镜像基线读取丢失修改)。文件不存在时 docker 会自动
|
# 防止容器重建后从镜像基线读取丢失修改)。文件不存在时 docker 会自动
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ hxops/
|
|||||||
- 运行 Flask 应用。
|
- 运行 Flask 应用。
|
||||||
- **Worker**: `gevent` (异步模式)。
|
- **Worker**: `gevent` (异步模式)。
|
||||||
- **并发**: `workers = CPU * 2 + 1`, `worker_connections = 1000+`。
|
- **并发**: `workers = CPU * 2 + 1`, `worker_connections = 1000+`。
|
||||||
- 监听 `127.0.0.1:5002`。
|
- 监听 `127.0.0.1:5052`。
|
||||||
|
|
||||||
4. **PostgreSQL (数据层)**:
|
4. **PostgreSQL (数据层)**:
|
||||||
- 存储用户、应用配置及审计日志。
|
- 存储用户、应用配置及审计日志。
|
||||||
|
|||||||
+5
-5
@@ -129,7 +129,7 @@ python init_db.py
|
|||||||
python run.py
|
python run.py
|
||||||
```
|
```
|
||||||
|
|
||||||
后端本地开发端口:`5002`(`backend/run.py`)。
|
后端本地开发端口:`5052`(`backend/run.py`)。
|
||||||
|
|
||||||
### 5.2 前端(本地)
|
### 5.2 前端(本地)
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ npm run dev
|
|||||||
```
|
```
|
||||||
|
|
||||||
前端本地开发端口:`8881`(`frontend/vite.config.ts`)。
|
前端本地开发端口:`8881`(`frontend/vite.config.ts`)。
|
||||||
本地开发时前端 `/api` 已代理到 `http://127.0.0.1:5002`。
|
本地开发时前端 `/api` 已代理到 `http://127.0.0.1:5052`。
|
||||||
|
|
||||||
### 5.3 Docker 启动(可选)
|
### 5.3 Docker 启动(可选)
|
||||||
|
|
||||||
@@ -151,9 +151,9 @@ docker compose up -d --build
|
|||||||
当前对外端口映射(`docker-compose.yml`):
|
当前对外端口映射(`docker-compose.yml`):
|
||||||
|
|
||||||
- 前端:`8890:80`
|
- 前端:`8890:80`
|
||||||
- 后端:`5002:5002`
|
- 后端:`5052:5052`
|
||||||
|
|
||||||
注意:当前项目中后端端口存在 `5000` 与 `5002` 并存配置,若容器联调异常,优先统一端口配置。
|
注意:当前项目中后端端口存在 `5000` 与 `5052` 并存配置,若容器联调异常,优先统一端口配置。
|
||||||
|
|
||||||
## 6. 项目登录环境与账号配置
|
## 6. 项目登录环境与账号配置
|
||||||
|
|
||||||
@@ -167,7 +167,7 @@ docker compose up -d --build
|
|||||||
|
|
||||||
| 环境 | 前端地址 | 后端地址 | 登录方式 | 备注 |
|
| 环境 | 前端地址 | 后端地址 | 登录方式 | 备注 |
|
||||||
| ------- | ------------------------------ | ----------------------- | ----------------------- | ---- |
|
| ------- | ------------------------------ | ----------------------- | ----------------------- | ---- |
|
||||||
| 本地 | `http://localhost:8881` | `http://localhost:5002` | 密码/企业微信(按配置) | |
|
| 本地 | `http://localhost:8881` | `http://localhost:5052` | 密码/企业微信(按配置) | |
|
||||||
| 测试 | `待定` | `待定` | 密码/企业微信(按配置) | |
|
| 测试 | `待定` | `待定` | 密码/企业微信(按配置) | |
|
||||||
| 生产 | `http://192.168.100.230:8881/` ;域名 `http://ai.well-trust.com:8881/` | | Casdoor 密码 / 企业微信(经 Casdoor,按配置) | |
|
| 生产 | `http://192.168.100.230:8881/` ;域名 `http://ai.well-trust.com:8881/` | | Casdoor 密码 / 企业微信(经 Casdoor,按配置) | |
|
||||||
| Jenkins | `http://8.152.207.171:10240/` | | 密码 | |
|
| Jenkins | `http://8.152.207.171:10240/` | | 密码 | |
|
||||||
|
|||||||
Generated
+8
@@ -542,6 +542,7 @@
|
|||||||
"integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==",
|
"integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~7.16.0"
|
"undici-types": "~7.16.0"
|
||||||
}
|
}
|
||||||
@@ -948,6 +949,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"baseline-browser-mapping": "^2.9.0",
|
"baseline-browser-mapping": "^2.9.0",
|
||||||
"caniuse-lite": "^1.0.30001759",
|
"caniuse-lite": "^1.0.30001759",
|
||||||
@@ -2038,6 +2040,7 @@
|
|||||||
"resolved": "https://mirrors.tencent.com/npm/picomatch/-/picomatch-4.0.3.tgz",
|
"resolved": "https://mirrors.tencent.com/npm/picomatch/-/picomatch-4.0.3.tgz",
|
||||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
},
|
},
|
||||||
@@ -2082,6 +2085,7 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"nanoid": "^3.3.11",
|
"nanoid": "^3.3.11",
|
||||||
"picocolors": "^1.1.1",
|
"picocolors": "^1.1.1",
|
||||||
@@ -2440,6 +2444,7 @@
|
|||||||
"resolved": "https://mirrors.tencent.com/npm/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
"resolved": "https://mirrors.tencent.com/npm/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
||||||
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@alloc/quick-lru": "^5.2.0",
|
"@alloc/quick-lru": "^5.2.0",
|
||||||
"arg": "^5.0.2",
|
"arg": "^5.0.2",
|
||||||
@@ -2541,6 +2546,7 @@
|
|||||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
"devOptional": true,
|
"devOptional": true,
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
"peer": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
@@ -2599,6 +2605,7 @@
|
|||||||
"integrity": "sha512-RHX7IvsJlEfjyA1rS7MY0UsmF91etdLAamslHR5lfuO3W/BXRdXm2tRE64ztpSPZbKqB4wAAZ0AwtF6QzfKZLA==",
|
"integrity": "sha512-RHX7IvsJlEfjyA1rS7MY0UsmF91etdLAamslHR5lfuO3W/BXRdXm2tRE64ztpSPZbKqB4wAAZ0AwtF6QzfKZLA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@oxc-project/runtime": "0.114.0",
|
"@oxc-project/runtime": "0.114.0",
|
||||||
"lightningcss": "^1.31.1",
|
"lightningcss": "^1.31.1",
|
||||||
@@ -2684,6 +2691,7 @@
|
|||||||
"resolved": "https://mirrors.tencent.com/npm/vue/-/vue-3.5.28.tgz",
|
"resolved": "https://mirrors.tencent.com/npm/vue/-/vue-3.5.28.tgz",
|
||||||
"integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==",
|
"integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"peer": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@vue/compiler-dom": "3.5.28",
|
"@vue/compiler-dom": "3.5.28",
|
||||||
"@vue/compiler-sfc": "3.5.28",
|
"@vue/compiler-sfc": "3.5.28",
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ window.fetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Res
|
|||||||
: (input instanceof URL ? input.toString() : input.url);
|
: (input instanceof URL ? input.toString() : input.url);
|
||||||
const isApi = url.includes('/api/');
|
const isApi = url.includes('/api/');
|
||||||
const isRefreshApi = url.includes('/api/user/casdoor/refresh');
|
const isRefreshApi = url.includes('/api/user/casdoor/refresh');
|
||||||
|
const isLoginApi =
|
||||||
|
url.includes('/api/user/login') ||
|
||||||
|
url.includes('/api/user/casdoor/password-login') ||
|
||||||
|
url.includes('/api/user/casdoor/login');
|
||||||
if (res.status === 401 && isApi && !isRefreshApi) {
|
if (res.status === 401 && isApi && !isRefreshApi) {
|
||||||
// First unauthorized response: try silent refresh once.
|
// First unauthorized response: try silent refresh once.
|
||||||
const refreshed = await refreshAccessToken();
|
const refreshed = await refreshAccessToken();
|
||||||
@@ -33,7 +37,7 @@ window.fetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Res
|
|||||||
res = await runFetch(reqInit);
|
res = await runFetch(reqInit);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (res.status === 401 && isApi) {
|
if (res.status === 401 && isApi && !isLoginApi) {
|
||||||
// Still unauthorized after retry (or no refresh token): force global logout UX.
|
// Still unauthorized after retry (or no refresh token): force global logout UX.
|
||||||
window.dispatchEvent(new CustomEvent('hxops:unauthorized', { detail: { url, status: res.status } }));
|
window.dispatchEvent(new CustomEvent('hxops:unauthorized', { detail: { url, status: res.status } }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import AdminView from '../views/AdminView.vue';
|
|||||||
import ProfileView from '../views/ProfileView.vue';
|
import ProfileView from '../views/ProfileView.vue';
|
||||||
import ResetPasswordView from '../views/ResetPasswordView.vue';
|
import ResetPasswordView from '../views/ResetPasswordView.vue';
|
||||||
import { config } from '../config';
|
import { config } from '../config';
|
||||||
|
import { getStoredAuthUser } from '../utils/auth';
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
@@ -52,6 +53,17 @@ const router = createRouter({
|
|||||||
routes
|
routes
|
||||||
});
|
});
|
||||||
|
|
||||||
|
router.beforeEach((to, _from, next) => {
|
||||||
|
if (to.path === '/admin') {
|
||||||
|
const user = getStoredAuthUser();
|
||||||
|
if (!user || user.role !== 'admin') {
|
||||||
|
next('/workspace');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
router.afterEach((to) => {
|
router.afterEach((to) => {
|
||||||
const baseTitle = config.appTitle || 'AI工作台';
|
const baseTitle = config.appTitle || 'AI工作台';
|
||||||
if (to.meta.title) {
|
if (to.meta.title) {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
import { ref, onMounted, onBeforeUnmount, computed } from 'vue';
|
import { ref, onMounted, onBeforeUnmount, computed } from 'vue';
|
||||||
import { useI18n } from 'vue-i18n';
|
import { useI18n } from 'vue-i18n';
|
||||||
import { useChat } from '../composables/useChat';
|
import { useChat } from '../composables/useChat';
|
||||||
import { Send, Bot, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, Crown, ChevronDown, Sparkles, User, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink } from 'lucide-vue-next';
|
import { Send, Bot, Loader2, Plus, Copy, Edit2, RotateCw, Check, X, PanelLeftClose, PanelLeftOpen, Heart, Bell, Mail, Settings, ChevronDown, Sparkles, User, Database, Mic, LogOut, MessageSquareText, Globe, ExternalLink } from 'lucide-vue-next';
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
import { useRoute, useRouter } from 'vue-router';
|
import { useRoute, useRouter } from 'vue-router';
|
||||||
import { config } from '../config';
|
import { config } from '../config';
|
||||||
@@ -429,6 +429,63 @@ const { messages, isThinking, conversationId, sendMessage } = useChat();
|
|||||||
const input = ref('');
|
const input = ref('');
|
||||||
const currentAgent = ref<any>(null);
|
const currentAgent = ref<any>(null);
|
||||||
const showGeneralFeedbackDialog = ref(false);
|
const showGeneralFeedbackDialog = ref(false);
|
||||||
|
const showOALoginModal = ref(false);
|
||||||
|
const oaLoginForm = ref({ username: '', password: '' });
|
||||||
|
|
||||||
|
const openOALoginModal = () => {
|
||||||
|
oaLoginForm.value = {
|
||||||
|
username: currentUserEmployeeId.value || currentUser.value?.username || '',
|
||||||
|
password: ''
|
||||||
|
};
|
||||||
|
showOALoginModal.value = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
const submitOALogin = () => {
|
||||||
|
if (!oaLoginForm.value.username || !oaLoginForm.value.password) {
|
||||||
|
showMessageDialog('error', '请输入账号和密码');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 要跳转的目标 OA 页面
|
||||||
|
const targetUrl = '/workflow/request/AddRequest.jsp?workflowid=652&isagent=0&beagenter=0&f_weaver_belongto_userid=';
|
||||||
|
|
||||||
|
// 创建隐藏表单进行 POST 提交到 OA 登录接口
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.action = 'http://192.168.100.221:8888/login/VerifyLogin.jsp';
|
||||||
|
form.method = 'POST';
|
||||||
|
form.target = '_blank';
|
||||||
|
|
||||||
|
const inputLoginId = document.createElement('input');
|
||||||
|
inputLoginId.type = 'hidden';
|
||||||
|
inputLoginId.name = 'loginid';
|
||||||
|
inputLoginId.value = oaLoginForm.value.username;
|
||||||
|
form.appendChild(inputLoginId);
|
||||||
|
|
||||||
|
const inputPassword = document.createElement('input');
|
||||||
|
inputPassword.type = 'hidden';
|
||||||
|
inputPassword.name = 'userpassword';
|
||||||
|
inputPassword.value = oaLoginForm.value.password;
|
||||||
|
form.appendChild(inputPassword);
|
||||||
|
|
||||||
|
const inputGoPage = document.createElement('input');
|
||||||
|
inputGoPage.type = 'hidden';
|
||||||
|
inputGoPage.name = 'gopage';
|
||||||
|
inputGoPage.value = targetUrl;
|
||||||
|
form.appendChild(inputGoPage);
|
||||||
|
|
||||||
|
const inputLogintype = document.createElement('input');
|
||||||
|
inputLogintype.type = 'hidden';
|
||||||
|
inputLogintype.name = 'logintype';
|
||||||
|
inputLogintype.value = '1';
|
||||||
|
form.appendChild(inputLogintype);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
document.body.removeChild(form);
|
||||||
|
|
||||||
|
showOALoginModal.value = false;
|
||||||
|
};
|
||||||
|
|
||||||
const activeFeedbackMessageIndex = ref<number | null>(null);
|
const activeFeedbackMessageIndex = ref<number | null>(null);
|
||||||
const browserPanelOpen = ref(false);
|
const browserPanelOpen = ref(false);
|
||||||
const browserDraftUrl = ref('');
|
const browserDraftUrl = ref('');
|
||||||
@@ -586,7 +643,7 @@ const startLocalLeaveFlow = (content: string) => {
|
|||||||
messages.value.push({
|
messages.value.push({
|
||||||
role: 'assistant',
|
role: 'assistant',
|
||||||
type: 'leave-form',
|
type: 'leave-form',
|
||||||
content: '已为你生成请假申请表,请直接在下方填写并提交。',
|
content: '已为你生成请假申请表,请直接在下方填写并提交。或登录OA系统直接申请',
|
||||||
payload,
|
payload,
|
||||||
local_id: formId,
|
local_id: formId,
|
||||||
local_only: true,
|
local_only: true,
|
||||||
@@ -1089,7 +1146,7 @@ const showChatRating = ref(false);
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mt-auto flex flex-col p-4">
|
<div class="mt-auto flex flex-col p-4">
|
||||||
<!-- Ad Card -->
|
<!-- Upgrade card disabled for now. Keep code for future rollout.
|
||||||
<div class="mb-4 rounded-2xl border border-brand-100 bg-brand-50/70 p-4 dark:border-brand-500/20 dark:bg-brand-900/10">
|
<div class="mb-4 rounded-2xl border border-brand-100 bg-brand-50/70 p-4 dark:border-brand-500/20 dark:bg-brand-900/10">
|
||||||
<div class="mb-2 flex items-center gap-1 font-bold text-brand-700 dark:text-brand-300">
|
<div class="mb-2 flex items-center gap-1 font-bold text-brand-700 dark:text-brand-300">
|
||||||
<Crown class="h-4 w-4" /> 专业版
|
<Crown class="h-4 w-4" /> 专业版
|
||||||
@@ -1103,6 +1160,7 @@ const showChatRating = ref(false);
|
|||||||
🚀 升级说明
|
🚀 升级说明
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
-->
|
||||||
|
|
||||||
<!-- Bottom Icons -->
|
<!-- Bottom Icons -->
|
||||||
<div class="flex items-center justify-between text-slate-400 relative" ref="userMenuRef">
|
<div class="flex items-center justify-between text-slate-400 relative" ref="userMenuRef">
|
||||||
@@ -1196,7 +1254,14 @@ const showChatRating = ref(false);
|
|||||||
>{{ msg.content }}</div>
|
>{{ msg.content }}</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<div v-if="msg.type === 'leave-form'" class="space-y-4">
|
<div v-if="msg.type === 'leave-form'" class="space-y-4">
|
||||||
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">{{ msg.content }}</div>
|
<div class="text-sm font-medium text-slate-700 dark:text-slate-200">
|
||||||
|
<template v-if="msg.content.includes('或登录OA系统直接申请')">
|
||||||
|
已为你生成请假申请表,请直接在下方填写并提交。或 <a href="#" @click.prevent="openOALoginModal" class="text-brand-600 font-bold hover:underline">登录OA系统直接申请</a>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
{{ msg.content }}
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
|
<div v-if="getLeaveFormPayload(msg)" class="grid gap-4 md:grid-cols-2">
|
||||||
<label class="space-y-1.5">
|
<label class="space-y-1.5">
|
||||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">申请人</span>
|
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">申请人</span>
|
||||||
@@ -1671,6 +1736,46 @@ const showChatRating = ref(false);
|
|||||||
showGeneralFeedbackDialog = false;
|
showGeneralFeedbackDialog = false;
|
||||||
}"
|
}"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="showOALoginModal"
|
||||||
|
class="fixed inset-0 z-[100] flex items-center justify-center bg-black/40 backdrop-blur-sm p-4"
|
||||||
|
>
|
||||||
|
<div class="w-full max-w-sm rounded-2xl bg-white p-6 shadow-2xl dark:bg-slate-900">
|
||||||
|
<div class="mb-5 flex items-center justify-between">
|
||||||
|
<h3 class="text-lg font-bold text-slate-800 dark:text-slate-100">登录OA系统</h3>
|
||||||
|
<button @click="showOALoginModal = false" class="text-slate-400 hover:text-slate-600 dark:hover:text-slate-200">
|
||||||
|
<X class="h-5 w-5" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="space-y-4">
|
||||||
|
<div class="space-y-1.5">
|
||||||
|
<label class="text-sm font-semibold text-slate-600 dark:text-slate-300">账号</label>
|
||||||
|
<input
|
||||||
|
v-model="oaLoginForm.username"
|
||||||
|
type="text"
|
||||||
|
placeholder="请输入账号"
|
||||||
|
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm outline-none focus:border-brand-500 focus:ring-1 focus:ring-brand-500 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="space-y-1.5">
|
||||||
|
<label class="text-sm font-semibold text-slate-600 dark:text-slate-300">密码</label>
|
||||||
|
<input
|
||||||
|
v-model="oaLoginForm.password"
|
||||||
|
type="password"
|
||||||
|
placeholder="请输入密码"
|
||||||
|
class="w-full rounded-xl border border-slate-200 bg-slate-50 px-4 py-2.5 text-sm outline-none focus:border-brand-500 focus:ring-1 focus:ring-brand-500 dark:border-slate-700 dark:bg-slate-800 dark:text-slate-100"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
@click="submitOALogin"
|
||||||
|
class="mt-2 w-full rounded-xl bg-brand-600 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-brand-500"
|
||||||
|
>
|
||||||
|
确认登录
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
@@ -409,7 +409,10 @@ const persistLoginUser = (user: any) => {
|
|||||||
|
|
||||||
const DEFAULT_POST_LOGIN_AGENT_ID = 16;
|
const DEFAULT_POST_LOGIN_AGENT_ID = 16;
|
||||||
|
|
||||||
const handleLogin = async () => {
|
const handleLogin = async (event?: Event) => {
|
||||||
|
event?.preventDefault();
|
||||||
|
event?.stopPropagation();
|
||||||
|
|
||||||
if (!loginUsername.value.trim()) {
|
if (!loginUsername.value.trim()) {
|
||||||
showMessageDialog('warning', t('login.usernameRequired'));
|
showMessageDialog('warning', t('login.usernameRequired'));
|
||||||
return;
|
return;
|
||||||
@@ -1298,11 +1301,12 @@ onMounted(async () => {
|
|||||||
<label for="rememberMe" class="text-sm text-slate-600 cursor-pointer select-none">{{ $t('login.rememberMe') }}</label>
|
<label for="rememberMe" class="text-sm text-slate-600 cursor-pointer select-none">{{ $t('login.rememberMe') }}</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4">
|
<button type="button" @click="handleLogin" class="btn-primary w-full py-3 text-base shadow-brand-500/40 hover:shadow-brand-500/50 transform hover:-translate-y-0.5 transition-all mt-4">
|
||||||
{{ $t('login.submit') }}
|
{{ $t('login.submit') }}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
v-if="config.auth?.wecom?.enabled && (!config.auth?.wecom?.loginViaCasdoor || config.auth?.casdoor?.enabled)"
|
v-if="config.auth?.wecom?.enabled && (!config.auth?.wecom?.loginViaCasdoor || config.auth?.casdoor?.enabled)"
|
||||||
@click="handleWecomLogin"
|
@click="handleWecomLogin"
|
||||||
:disabled="isWecomLoggingIn"
|
:disabled="isWecomLoggingIn"
|
||||||
@@ -1312,7 +1316,7 @@ onMounted(async () => {
|
|||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="flex justify-between items-center pt-4 mt-2 border-t border-slate-100/50">
|
<div class="flex justify-between items-center pt-4 mt-2 border-t border-slate-100/50">
|
||||||
<button @click="showForgotPasswordModal = true" class="text-sm text-slate-500 hover:text-brand-600 transition-colors">
|
<button type="button" @click="showForgotPasswordModal = true" class="text-sm text-slate-500 hover:text-brand-600 transition-colors">
|
||||||
{{ $t('login.forgotPassword') }}
|
{{ $t('login.forgotPassword') }}
|
||||||
</button>
|
</button>
|
||||||
<!-- 点击注册 -->
|
<!-- 点击注册 -->
|
||||||
@@ -1403,6 +1407,7 @@ onMounted(async () => {
|
|||||||
<span>返回聊天</span>
|
<span>返回聊天</span>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
|
v-if="currentUser?.role === 'admin'"
|
||||||
@click="openAdminPanel"
|
@click="openAdminPanel"
|
||||||
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
|
class="flex w-full items-center gap-3 rounded-2xl px-4 py-3 text-left text-[15px] font-medium text-slate-600 transition-all hover:bg-slate-50 hover:text-slate-900"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export default defineConfig({
|
|||||||
allowedHosts: ['hx.benl.cn'],
|
allowedHosts: ['hx.benl.cn'],
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: 'http://127.0.0.1:5002',
|
target: 'http://127.0.0.1:5052',
|
||||||
changeOrigin: true
|
changeOrigin: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ RUN_DIR="${ROOT_DIR}/.run"
|
|||||||
BACKEND_DIR="${ROOT_DIR}/backend"
|
BACKEND_DIR="${ROOT_DIR}/backend"
|
||||||
FRONTEND_DIR="${ROOT_DIR}/frontend"
|
FRONTEND_DIR="${ROOT_DIR}/frontend"
|
||||||
|
|
||||||
BACKEND_PORT=5002
|
BACKEND_PORT=5052
|
||||||
FRONTEND_PORT=8881
|
FRONTEND_PORT=8881
|
||||||
DB_PORT=5432
|
DB_PORT=5432
|
||||||
DB_DATA_DIR="/opt/homebrew/var/postgresql@18"
|
DB_DATA_DIR="/opt/homebrew/var/postgresql@18"
|
||||||
|
|||||||
+2
-2
@@ -196,7 +196,7 @@ show_entry_urls() {
|
|||||||
host_ip="$(get_host_ip)"
|
host_ip="$(get_host_ip)"
|
||||||
gateway_port="$(get_mapped_port "nginx-gateway" "8881/tcp")"
|
gateway_port="$(get_mapped_port "nginx-gateway" "8881/tcp")"
|
||||||
frontend_port="$(get_mapped_port "hxops-frontend" "80/tcp")"
|
frontend_port="$(get_mapped_port "hxops-frontend" "80/tcp")"
|
||||||
backend_port="$(get_mapped_port "hxops-backend" "5002/tcp")"
|
backend_port="$(get_mapped_port "hxops-backend" "5052/tcp")"
|
||||||
|
|
||||||
echo "== 网站入口地址 =="
|
echo "== 网站入口地址 =="
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ show_entry_urls() {
|
|||||||
backend_url="http://${host_ip}:${backend_port}/api/agents"
|
backend_url="http://${host_ip}:${backend_port}/api/agents"
|
||||||
echo " 后端API示例: ${backend_url} [HTTP $(http_probe_code "${backend_url}")]"
|
echo " 后端API示例: ${backend_url} [HTTP $(http_probe_code "${backend_url}")]"
|
||||||
else
|
else
|
||||||
echo " 后端API示例: hxops-backend:5002 未映射到宿主机"
|
echo " 后端API示例: hxops-backend:5052 未映射到宿主机"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import sys
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
FRONTEND_URL = "http://localhost:8881"
|
FRONTEND_URL = "http://localhost:8881"
|
||||||
BACKEND_URL = "http://localhost:5002"
|
BACKEND_URL = "http://localhost:5052"
|
||||||
|
|
||||||
def test_backend_direct():
|
def test_backend_direct():
|
||||||
print(f"Testing Backend Direct at {BACKEND_URL}...")
|
print(f"Testing Backend Direct at {BACKEND_URL}...")
|
||||||
@@ -37,7 +37,7 @@ def test_frontend_serve():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def test_frontend_proxy():
|
def test_frontend_proxy():
|
||||||
# Vite proxy: /api -> http://127.0.0.1:5002
|
# Vite proxy: /api -> http://127.0.0.1:5052
|
||||||
url = f"{FRONTEND_URL}/api/agents"
|
url = f"{FRONTEND_URL}/api/agents"
|
||||||
print(f"Testing Frontend Proxy at {url}...")
|
print(f"Testing Frontend Proxy at {url}...")
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import json
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
# Configuration
|
# Configuration
|
||||||
BASE_URL = "http://127.0.0.1:5002/api"
|
BASE_URL = "http://127.0.0.1:5052/api"
|
||||||
|
|
||||||
class TestUserFeatures(unittest.TestCase):
|
class TestUserFeatures(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
Reference in new issue
Block a user