fix: 优化端口

This commit is contained in:
丹尼尔
2026-03-11 11:36:05 +08:00
parent d3c5b4c27a
commit dae013dbeb
7 changed files with 48 additions and 14 deletions

View File

@@ -127,7 +127,8 @@
</div>
<script>
const $ = (id) => document.getElementById(id);
const API_BASE = 'http://localhost:8000';
// 相对路径,由 Node 代理到后端,适配 -p/-b 任意端口
const API_BASE = '';
const KEY_STORAGE = 'wechat_key';
function getToken() {

View File

@@ -634,7 +634,8 @@
<script>
const $ = (id) => document.getElementById(id);
const API_BASE = 'http://localhost:8000';
// 相对路径,由 Node 代理到后端,适配 -p/-b 任意端口
const API_BASE = '';
const state = {
pollingScan: null,

View File

@@ -215,7 +215,8 @@
</div>
<script>
const $ = (id) => document.getElementById(id);
const API_BASE = 'http://localhost:8000';
// 相对路径,由 Node 代理到后端,适配 -p/-b 任意端口
const API_BASE = '';
const KEY_STORAGE = 'wechat_key';
function getKey() {

View File

@@ -96,7 +96,8 @@
</div>
<script>
const $ = (id) => document.getElementById(id);
const API_BASE = 'http://localhost:8000';
// 相对路径,由 Node 代理到后端
const API_BASE = '';
async function callApi(path, options = {}) {
const url = API_BASE + path;
@@ -164,7 +165,8 @@
loadModels();
(function wsStatusCheck() {
const API_BASE = 'http://localhost:8000';
// 相对路径,由 Node 代理到后端
const API_BASE = '';
let wasConnected = false;
const CHECK_MS = 8000;
const t = setInterval(async () => {

View File

@@ -112,7 +112,7 @@
var copyBaseCheck = document.getElementById('copy-base-url');
function getOpenApiUrl() {
var base = (baseUrlInput && baseUrlInput.value.trim()) || 'http://localhost:8000';
var base = (baseUrlInput && baseUrlInput.value.trim()) || '';
return base.replace(/\/$/, '') + '/openapi.json';
}
@@ -128,7 +128,7 @@
var apiUrl = applyBaseUrl();
window.xxcaibi = {
BASE_URL: (baseUrlInput && baseUrlInput.value.trim()) || 'http://localhost:8000',
BASE_URL: (baseUrlInput && baseUrlInput.value.trim()) || '',
copy: true,
KEY: ''
};
@@ -173,7 +173,7 @@
var config = window.ui.specSelectors.specJson();
if (config && config.toJS) {
var spec = config.toJS();
window.xxcaibi.BASE_URL = (baseUrlInput && baseUrlInput.value.trim()) || (spec.servers && spec.servers[0] && spec.servers[0].url) || 'http://localhost:8000';
window.xxcaibi.BASE_URL = (baseUrlInput && baseUrlInput.value.trim()) || (spec.servers && spec.servers[0] && spec.servers[0].url) || '';
}
function addCopyButtons() {
document.querySelectorAll('.opblock-summary-path').forEach(function (pathEl) {