fix
This commit is contained in:
@@ -211,11 +211,6 @@
|
||||
<span id="ai-reply-status-text">—</span>
|
||||
<button type="button" class="secondary" id="btn-ai-reply-status" style="margin-left:8px;padding:2px 8px;font-size:12px">检查状态</button>
|
||||
</div>
|
||||
<div class="field full" style="margin-bottom:12px">
|
||||
<span class="small-label">消息回调(7006 → 本服务):</span>
|
||||
<span id="callback-status-text">—</span>
|
||||
<button type="button" class="secondary" id="btn-callback-status" style="margin-left:8px;padding:2px 8px;font-size:12px">检查回调</button>
|
||||
</div>
|
||||
<div class="mgmt-form-grid">
|
||||
<div class="field full">
|
||||
<label>超级管理员 wxid(每行一个或逗号分隔)</label>
|
||||
@@ -302,43 +297,27 @@
|
||||
}
|
||||
|
||||
async function loadAiReplyStatus() {
|
||||
const key = $('key').value.trim();
|
||||
const key = getKey();
|
||||
const el = $('ai-reply-status-text');
|
||||
if (!el) return;
|
||||
if (!key) { el.textContent = '请先登录'; return; }
|
||||
if (!key) { el.textContent = '请先登录'; el.style.color = 'var(--muted, #94a3b8)'; return; }
|
||||
el.textContent = '检测中…';
|
||||
try {
|
||||
const data = await callApi('/api/ai-reply-status?key=' + encodeURIComponent(key));
|
||||
el.textContent = data.ok ? '正常(WS 已连接,已配置白名单/超级管理员,已选模型)' : (data.message || '异常');
|
||||
el.style.color = data.ok ? 'var(--success, #22c55e)' : 'var(--muted, #94a3b8)';
|
||||
} catch (e) {
|
||||
el.textContent = '检查失败: ' + (e.message || e);
|
||||
el.style.color = 'var(--danger, #ef4444)';
|
||||
}
|
||||
}
|
||||
|
||||
async function loadCallbackStatus() {
|
||||
const key = getKey();
|
||||
const el = $('callback-status-text');
|
||||
if (!el) return;
|
||||
if (!key) { el.textContent = '请先登录'; el.style.color = 'var(--muted)'; return; }
|
||||
el.textContent = '检测中…';
|
||||
el.style.color = 'var(--muted)';
|
||||
el.style.color = 'var(--muted, #94a3b8)';
|
||||
try {
|
||||
const data = await callApi('/api/callback-status?key=' + encodeURIComponent(key));
|
||||
if (!data.configured) {
|
||||
el.textContent = '未配置(未设置 CALLBACK_BASE_URL,使用 WS 拉取消息)';
|
||||
el.textContent = '未配置回调(AI 未接管)';
|
||||
el.style.color = 'var(--muted, #94a3b8)';
|
||||
return;
|
||||
}
|
||||
if (data.registered === true) {
|
||||
el.textContent = '已配置且已向 7006 注册成功,新消息将推送到: ' + (data.callback_url || '');
|
||||
el.textContent = '回调已配置且注册成功(AI 已接管)';
|
||||
el.style.color = 'var(--success, #22c55e)';
|
||||
} else if (data.registered === false) {
|
||||
el.textContent = '已配置但向 7006 注册失败,请检查网络或 7006 服务。回调地址: ' + (data.callback_url || '');
|
||||
el.textContent = '回调已配置但注册失败(AI 未接管)';
|
||||
el.style.color = 'var(--danger, #ef4444)';
|
||||
} else {
|
||||
el.textContent = '已配置,回调地址: ' + (data.callback_url || '');
|
||||
el.textContent = '回调已配置(AI 接管状态未知,请检查 7006)';
|
||||
el.style.color = 'var(--muted, #94a3b8)';
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -403,7 +382,7 @@
|
||||
if (!key) { alert('请先登录'); return; }
|
||||
sel.innerHTML = '<option value="">加载中…</option>';
|
||||
try {
|
||||
const data = await callApi('/api/contact-list?key=' + encodeURIComponent(key), { cache: 'no-store' });
|
||||
const data = await callApi('/api/contact-list?key=' + encodeURIComponent(key) + '&refresh=1', { cache: 'no-store' });
|
||||
const list = data.items || [];
|
||||
lastLoadedContactList = list;
|
||||
if (data.error) {
|
||||
@@ -862,7 +841,6 @@
|
||||
}
|
||||
$('btn-ai-reply-save').addEventListener('click', async () => { await saveAiReplyConfig(); loadAiReplyStatus(); });
|
||||
$('btn-ai-reply-status') && $('btn-ai-reply-status').addEventListener('click', loadAiReplyStatus);
|
||||
$('btn-callback-status') && $('btn-callback-status').addEventListener('click', loadCallbackStatus);
|
||||
$('btn-pt-add').addEventListener('click', addProductTag);
|
||||
$('btn-push-group-add').addEventListener('click', createPushGroup);
|
||||
$('btn-push-send').addEventListener('click', doPushSend);
|
||||
|
||||
Reference in New Issue
Block a user