feat: LLM intent router, direct chat execution, and Memory V2 light intervention
Wire chat intent routing with direct_chat on regular sessions, skill-selected short-circuit to Agent, memory light/heavy intervention tiers, and fix direct chat UI stuck streaming after completion. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -30,6 +30,8 @@ function plazaRouteError(res, req, error) {
|
||||
* @param {Promise<unknown>} [deps.ready] Optional bootstrap gate awaited before the first request resolves auth.
|
||||
* @param {object} deps.userAuth
|
||||
* @param {object|null} deps.llmProviderService
|
||||
* @param {object|null} deps.memoryV2ConfigService
|
||||
* @param {object|null} deps.adminSystemTestService
|
||||
* @param {object|null} deps.plazaPosts
|
||||
* @param {object|null} deps.plazaOps
|
||||
* @param {object|null} deps.wechatAdmin
|
||||
@@ -40,6 +42,8 @@ export function createAdminApi({
|
||||
ready,
|
||||
userAuth,
|
||||
llmProviderService,
|
||||
memoryV2ConfigService,
|
||||
adminSystemTestService,
|
||||
plazaPosts,
|
||||
plazaOps,
|
||||
wechatAdmin,
|
||||
@@ -87,6 +91,49 @@ export function createAdminApi({
|
||||
res.json({ summary: { ...summary, llm } });
|
||||
});
|
||||
|
||||
adminApi.get('/memory-v2/config', requireAdmin, async (_req, res) => {
|
||||
if (!memoryV2ConfigService?.getAdminConfig) {
|
||||
return res.status(503).json({ message: 'Memory V2 配置服务未启用' });
|
||||
}
|
||||
const result = await memoryV2ConfigService.getAdminConfig();
|
||||
return res.json(result);
|
||||
});
|
||||
|
||||
const updateMemoryV2Config = async (req, res) => {
|
||||
if (!memoryV2ConfigService?.updateAdminConfig) {
|
||||
return res.status(503).json({ message: 'Memory V2 配置服务未启用' });
|
||||
}
|
||||
const result = await memoryV2ConfigService.updateAdminConfig(req.body ?? {}, {
|
||||
updatedBy: req.currentUser.id,
|
||||
});
|
||||
return res.json(result);
|
||||
};
|
||||
|
||||
adminApi.put('/memory-v2/config', requireAdmin, updateMemoryV2Config);
|
||||
adminApi.patch('/memory-v2/config', requireAdmin, updateMemoryV2Config);
|
||||
|
||||
adminApi.get('/memory-v2/runtime', requireAdmin, async (_req, res) => {
|
||||
if (!memoryV2ConfigService?.getRuntimeState) {
|
||||
return res.status(503).json({ message: 'Memory V2 配置服务未启用' });
|
||||
}
|
||||
const result = await memoryV2ConfigService.getRuntimeState();
|
||||
return res.json(result);
|
||||
});
|
||||
|
||||
adminApi.post('/system-tests/skill-validation', requireAdmin, async (req, res) => {
|
||||
if (!adminSystemTestService?.runSkillValidation) {
|
||||
return res.status(503).json({ message: '系统测试服务未启用' });
|
||||
}
|
||||
const username = String(req.body?.username ?? '').trim();
|
||||
const password = String(req.body?.password ?? '');
|
||||
const skillName = String(req.body?.skillName ?? 'service-integration-smoke').trim();
|
||||
if (!username || !password) {
|
||||
return res.status(400).json({ message: '请输入测试账号和密码' });
|
||||
}
|
||||
const result = await adminSystemTestService.runSkillValidation({ username, password, skillName });
|
||||
return res.json(result);
|
||||
});
|
||||
|
||||
adminApi.post('/users', requireAdmin, async (req, res) => {
|
||||
const result = await userAuth.createUser(req.body ?? {});
|
||||
if (!result.ok) return res.status(400).json({ message: result.message });
|
||||
|
||||
Reference in New Issue
Block a user