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_EXPIRES_HOURS=12
|
||||
|
||||
DATABASE_URL=postgresql://postgres:@localhost:5432/hxops_db
|
||||
|
||||
# SiliconFlow API Configuration
|
||||
GJL_API_KEY=sk-umfzicwjcvwampzblqczckkqojiscyybtaljzbsvpdwdvxlu
|
||||
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}
|
||||
|
||||
if __name__ == '__main__':
|
||||
# MacOS ControlCenter uses port 5000, so we use 5002
|
||||
app.run(host='0.0.0.0', port=5002)
|
||||
# MacOS ControlCenter uses port 5000, so we use 5052
|
||||
# (原5002易被Trae IDE自动端口转发劫持)
|
||||
app.run(host='0.0.0.0', port=5052)
|
||||
@@ -17,7 +17,7 @@ username = sys.argv[1]
|
||||
password = sys.argv[2]
|
||||
|
||||
# 测试登录 API
|
||||
url = "http://localhost:5002/api/user/login"
|
||||
url = "http://localhost:5052/api/user/login"
|
||||
headers = {"Content-Type": "application/json"}
|
||||
data = {"username": username, "password": password}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
BASE_URL = "http://127.0.0.1:5002"
|
||||
BASE_URL = "http://127.0.0.1:5052"
|
||||
|
||||
def test_auth_header_format():
|
||||
"""测试不同的认证头格式"""
|
||||
|
||||
@@ -7,7 +7,7 @@ import requests
|
||||
import json
|
||||
import sys
|
||||
|
||||
BASE_URL = "http://127.0.0.1:5002"
|
||||
BASE_URL = "http://127.0.0.1:5052"
|
||||
|
||||
def test_login():
|
||||
"""测试登录 API"""
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ services:
|
||||
- "host.docker.internal:host-gateway"
|
||||
# 如果需要在宿主机调试,可暴露端口;生产环境建议只在网络内暴露
|
||||
ports:
|
||||
- "5002:5002"
|
||||
- "5052:5052"
|
||||
# 持久化运行时可写文件:
|
||||
# - backend/.env 用于保存管理员后台修改的企业微信等配置(与数据库双写,
|
||||
# 防止容器重建后从镜像基线读取丢失修改)。文件不存在时 docker 会自动
|
||||
|
||||
@@ -77,7 +77,7 @@ hxops/
|
||||
- 运行 Flask 应用。
|
||||
- **Worker**: `gevent` (异步模式)。
|
||||
- **并发**: `workers = CPU * 2 + 1`, `worker_connections = 1000+`。
|
||||
- 监听 `127.0.0.1:5002`。
|
||||
- 监听 `127.0.0.1:5052`。
|
||||
|
||||
4. **PostgreSQL (数据层)**:
|
||||
- 存储用户、应用配置及审计日志。
|
||||
|
||||
+5
-5
@@ -129,7 +129,7 @@ python init_db.py
|
||||
python run.py
|
||||
```
|
||||
|
||||
后端本地开发端口:`5002`(`backend/run.py`)。
|
||||
后端本地开发端口:`5052`(`backend/run.py`)。
|
||||
|
||||
### 5.2 前端(本地)
|
||||
|
||||
@@ -140,7 +140,7 @@ npm run dev
|
||||
```
|
||||
|
||||
前端本地开发端口:`8881`(`frontend/vite.config.ts`)。
|
||||
本地开发时前端 `/api` 已代理到 `http://127.0.0.1:5002`。
|
||||
本地开发时前端 `/api` 已代理到 `http://127.0.0.1:5052`。
|
||||
|
||||
### 5.3 Docker 启动(可选)
|
||||
|
||||
@@ -151,9 +151,9 @@ docker compose up -d --build
|
||||
当前对外端口映射(`docker-compose.yml`):
|
||||
|
||||
- 前端:`8890:80`
|
||||
- 后端:`5002:5002`
|
||||
- 后端:`5052:5052`
|
||||
|
||||
注意:当前项目中后端端口存在 `5000` 与 `5002` 并存配置,若容器联调异常,优先统一端口配置。
|
||||
注意:当前项目中后端端口存在 `5000` 与 `5052` 并存配置,若容器联调异常,优先统一端口配置。
|
||||
|
||||
## 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,按配置) | |
|
||||
| Jenkins | `http://8.152.207.171:10240/` | | 密码 | |
|
||||
|
||||
Generated
+8
@@ -542,6 +542,7 @@
|
||||
"integrity": "sha512-oH72nZRfDv9lADUBSo104Aq7gPHpQZc4BTx38r9xf9pg5LfP6EzSyH2n7qFmmxRQXh7YlUXODcYsg6PuTDSxGg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~7.16.0"
|
||||
}
|
||||
@@ -948,6 +949,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"baseline-browser-mapping": "^2.9.0",
|
||||
"caniuse-lite": "^1.0.30001759",
|
||||
@@ -2038,6 +2040,7 @@
|
||||
"resolved": "https://mirrors.tencent.com/npm/picomatch/-/picomatch-4.0.3.tgz",
|
||||
"integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
@@ -2082,6 +2085,7 @@
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"nanoid": "^3.3.11",
|
||||
"picocolors": "^1.1.1",
|
||||
@@ -2440,6 +2444,7 @@
|
||||
"resolved": "https://mirrors.tencent.com/npm/tailwindcss/-/tailwindcss-3.4.17.tgz",
|
||||
"integrity": "sha512-w33E2aCvSDP0tW9RZuNXadXlkHXqFzSkQew/aIa2i/Sj8fThxwovwlXHSPXTbAHwEIhBFXAedUhP2tueAKP8Og==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
"arg": "^5.0.2",
|
||||
@@ -2541,6 +2546,7 @@
|
||||
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||
"devOptional": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
@@ -2599,6 +2605,7 @@
|
||||
"integrity": "sha512-RHX7IvsJlEfjyA1rS7MY0UsmF91etdLAamslHR5lfuO3W/BXRdXm2tRE64ztpSPZbKqB4wAAZ0AwtF6QzfKZLA==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@oxc-project/runtime": "0.114.0",
|
||||
"lightningcss": "^1.31.1",
|
||||
@@ -2684,6 +2691,7 @@
|
||||
"resolved": "https://mirrors.tencent.com/npm/vue/-/vue-3.5.28.tgz",
|
||||
"integrity": "sha512-BRdrNfeoccSoIZeIhyPBfvWSLFP4q8J3u8Ju8Ug5vu3LdD+yTM13Sg4sKtljxozbnuMu1NB1X5HBHRYUzFocKg==",
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@vue/compiler-dom": "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);
|
||||
const isApi = url.includes('/api/');
|
||||
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) {
|
||||
// First unauthorized response: try silent refresh once.
|
||||
const refreshed = await refreshAccessToken();
|
||||
@@ -33,7 +37,7 @@ window.fetch = async (input: RequestInfo | URL, init?: RequestInit): Promise<Res
|
||||
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.
|
||||
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 ResetPasswordView from '../views/ResetPasswordView.vue';
|
||||
import { config } from '../config';
|
||||
import { getStoredAuthUser } from '../utils/auth';
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@@ -52,6 +53,17 @@ const router = createRouter({
|
||||
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) => {
|
||||
const baseTitle = config.appTitle || 'AI工作台';
|
||||
if (to.meta.title) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
import { ref, onMounted, onBeforeUnmount, computed } from 'vue';
|
||||
import { useI18n } from 'vue-i18n';
|
||||
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 { useRoute, useRouter } from 'vue-router';
|
||||
import { config } from '../config';
|
||||
@@ -429,6 +429,63 @@ const { messages, isThinking, conversationId, sendMessage } = useChat();
|
||||
const input = ref('');
|
||||
const currentAgent = ref<any>(null);
|
||||
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 browserPanelOpen = ref(false);
|
||||
const browserDraftUrl = ref('');
|
||||
@@ -586,7 +643,7 @@ const startLocalLeaveFlow = (content: string) => {
|
||||
messages.value.push({
|
||||
role: 'assistant',
|
||||
type: 'leave-form',
|
||||
content: '已为你生成请假申请表,请直接在下方填写并提交。',
|
||||
content: '已为你生成请假申请表,请直接在下方填写并提交。或登录OA系统直接申请',
|
||||
payload,
|
||||
local_id: formId,
|
||||
local_only: true,
|
||||
@@ -1089,7 +1146,7 @@ const showChatRating = ref(false);
|
||||
</div>
|
||||
|
||||
<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-2 flex items-center gap-1 font-bold text-brand-700 dark:text-brand-300">
|
||||
<Crown class="h-4 w-4" /> 专业版
|
||||
@@ -1103,6 +1160,7 @@ const showChatRating = ref(false);
|
||||
🚀 升级说明
|
||||
</button>
|
||||
</div>
|
||||
-->
|
||||
|
||||
<!-- Bottom Icons -->
|
||||
<div class="flex items-center justify-between text-slate-400 relative" ref="userMenuRef">
|
||||
@@ -1196,7 +1254,14 @@ const showChatRating = ref(false);
|
||||
>{{ msg.content }}</div>
|
||||
<div v-else>
|
||||
<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">
|
||||
<label class="space-y-1.5">
|
||||
<span class="text-xs font-semibold text-slate-500 dark:text-slate-400">申请人</span>
|
||||
@@ -1671,6 +1736,46 @@ const showChatRating = ref(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>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -409,7 +409,10 @@ const persistLoginUser = (user: any) => {
|
||||
|
||||
const DEFAULT_POST_LOGIN_AGENT_ID = 16;
|
||||
|
||||
const handleLogin = async () => {
|
||||
const handleLogin = async (event?: Event) => {
|
||||
event?.preventDefault();
|
||||
event?.stopPropagation();
|
||||
|
||||
if (!loginUsername.value.trim()) {
|
||||
showMessageDialog('warning', t('login.usernameRequired'));
|
||||
return;
|
||||
@@ -1298,11 +1301,12 @@ onMounted(async () => {
|
||||
<label for="rememberMe" class="text-sm text-slate-600 cursor-pointer select-none">{{ $t('login.rememberMe') }}</label>
|
||||
</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') }}
|
||||
</button>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
v-if="config.auth?.wecom?.enabled && (!config.auth?.wecom?.loginViaCasdoor || config.auth?.casdoor?.enabled)"
|
||||
@click="handleWecomLogin"
|
||||
:disabled="isWecomLoggingIn"
|
||||
@@ -1312,7 +1316,7 @@ onMounted(async () => {
|
||||
</button>
|
||||
|
||||
<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') }}
|
||||
</button>
|
||||
<!-- 点击注册 -->
|
||||
@@ -1403,6 +1407,7 @@ onMounted(async () => {
|
||||
<span>返回聊天</span>
|
||||
</button>
|
||||
<button
|
||||
v-if="currentUser?.role === 'admin'"
|
||||
@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"
|
||||
>
|
||||
|
||||
@@ -10,7 +10,7 @@ export default defineConfig({
|
||||
allowedHosts: ['hx.benl.cn'],
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: 'http://127.0.0.1:5002',
|
||||
target: 'http://127.0.0.1:5052',
|
||||
changeOrigin: true
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ RUN_DIR="${ROOT_DIR}/.run"
|
||||
BACKEND_DIR="${ROOT_DIR}/backend"
|
||||
FRONTEND_DIR="${ROOT_DIR}/frontend"
|
||||
|
||||
BACKEND_PORT=5002
|
||||
BACKEND_PORT=5052
|
||||
FRONTEND_PORT=8881
|
||||
DB_PORT=5432
|
||||
DB_DATA_DIR="/opt/homebrew/var/postgresql@18"
|
||||
|
||||
+2
-2
@@ -196,7 +196,7 @@ show_entry_urls() {
|
||||
host_ip="$(get_host_ip)"
|
||||
gateway_port="$(get_mapped_port "nginx-gateway" "8881/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 "== 网站入口地址 =="
|
||||
|
||||
@@ -221,7 +221,7 @@ show_entry_urls() {
|
||||
backend_url="http://${host_ip}:${backend_port}/api/agents"
|
||||
echo " 后端API示例: ${backend_url} [HTTP $(http_probe_code "${backend_url}")]"
|
||||
else
|
||||
echo " 后端API示例: hxops-backend:5002 未映射到宿主机"
|
||||
echo " 后端API示例: hxops-backend:5052 未映射到宿主机"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import sys
|
||||
import time
|
||||
|
||||
FRONTEND_URL = "http://localhost:8881"
|
||||
BACKEND_URL = "http://localhost:5002"
|
||||
BACKEND_URL = "http://localhost:5052"
|
||||
|
||||
def test_backend_direct():
|
||||
print(f"Testing Backend Direct at {BACKEND_URL}...")
|
||||
@@ -37,7 +37,7 @@ def test_frontend_serve():
|
||||
return False
|
||||
|
||||
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"
|
||||
print(f"Testing Frontend Proxy at {url}...")
|
||||
try:
|
||||
|
||||
@@ -5,7 +5,7 @@ import json
|
||||
import uuid
|
||||
|
||||
# Configuration
|
||||
BASE_URL = "http://127.0.0.1:5002/api"
|
||||
BASE_URL = "http://127.0.0.1:5052/api"
|
||||
|
||||
class TestUserFeatures(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
||||
Reference in new issue
Block a user