Add wechat reminder LLM admin toggle
This commit is contained in:
@@ -11,6 +11,7 @@ import {
|
||||
listWechatMessages,
|
||||
listWechatWebNotifications,
|
||||
resumeWechatDigest,
|
||||
updateWechatScheduleLlmConfig,
|
||||
} from '../../api/client';
|
||||
import type {
|
||||
AdminUserRow,
|
||||
@@ -38,6 +39,7 @@ function safeSummary(summary: WechatAdminSummary | null) {
|
||||
bindPath: null,
|
||||
tokenEndpointConfigured: false,
|
||||
customerServiceEndpointConfigured: false,
|
||||
scheduleLlmEnabled: false,
|
||||
},
|
||||
counts: summary?.counts ?? {
|
||||
boundUsers: 0,
|
||||
@@ -88,6 +90,7 @@ export function WechatPage() {
|
||||
const [notifyBody, setNotifyBody] = useState('');
|
||||
const [notifyType, setNotifyType] = useState('manual');
|
||||
const [notifyChannels, setNotifyChannels] = useState<Array<'web' | 'wechat'>>(['web']);
|
||||
const [scheduleLlmEnabled, setScheduleLlmEnabled] = useState(false);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
@@ -117,6 +120,7 @@ export function WechatPage() {
|
||||
listAdminUsers({ page: 1, pageSize: 200, status: 'active' }),
|
||||
]);
|
||||
setSummary(nextSummary);
|
||||
setScheduleLlmEnabled(nextSummary.config.scheduleLlmEnabled ?? false);
|
||||
setBindings(nextBindings);
|
||||
setMessages(nextMessages);
|
||||
setDigests(nextDigests);
|
||||
@@ -224,6 +228,13 @@ export function WechatPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleSaveScheduleLlm = async () => {
|
||||
await runAction(async () => {
|
||||
await updateWechatScheduleLlmConfig({ scheduleLlmEnabled });
|
||||
setNotice(`提醒待办 LLM 已${scheduleLlmEnabled ? '开启' : '关闭'}。`);
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="admin-page">
|
||||
<div className="admin-page-head">
|
||||
@@ -280,7 +291,28 @@ export function WechatPage() {
|
||||
<dt>推送 worker</dt>
|
||||
<dd>{summary.config.reminderWorkerEnabled ? '已启用' : '未启用'}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>提醒待办 LLM</dt>
|
||||
<dd>{summary.config.scheduleLlmEnabled ? '已开启' : '已关闭'}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<div className="wechat-toolbar" style={{ marginTop: 16, justifyContent: 'space-between', alignItems: 'center' }}>
|
||||
<label>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={scheduleLlmEnabled}
|
||||
onChange={(event) => setScheduleLlmEnabled(event.target.checked)}
|
||||
disabled={busy}
|
||||
/>{' '}
|
||||
启用提醒待办 LLM 辅助识别
|
||||
</label>
|
||||
<button type="button" className="ghost-btn" onClick={() => void handleSaveScheduleLlm()} disabled={busy}>
|
||||
{busy ? '保存中…' : '保存开关'}
|
||||
</button>
|
||||
</div>
|
||||
<p className="muted" style={{ marginTop: 8 }}>
|
||||
默认关闭。开启后仅在规则未识别出提醒意图时,才调用后台已选中的 LLM 做补充解析;复杂定时提醒仍走原有会话链路。
|
||||
</p>
|
||||
</section>
|
||||
)}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user