新增功能: - AI智能助手: DeepSeek多轮推理、函数调用(searchStock/createOrder等) - silent动作: AI识别无需回复的消息(好的/谢谢/再见)自动跳过回执 - ai_enabled灰度开关: 群级别控制AI启停,支持逐群放量 - 消息列表增强: storeId/groupId/groupName/userName/content/sourceType多条件筛选,时间格式化 代码优化: - processWithAI: 多轮推理循环(MAX_ROUNDS=5)、对话历史不含[#N]前缀防AI污染 - 回执记录补齐group_id/user_id/group_name/user_name上下文 - 移除未使用的target_channel字段及迁移 - bindCode文档修正: store_warehouse → store 接口文档: - system.json v0.3.18→0.3.19: 新增aiEnabled参数、消息列表响应扩充 - changes/system.json: 新增bindCode变更记录 杂项: - store_warehouse.js JSDoc补全 - wave.js waveBatchSource修复
54 lines
1.8 KiB
JavaScript
54 lines
1.8 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 为 inbox.group.* 方法创建 API 权限记录。
|
||
*
|
||
* 固定 ID(当前 max_id=494):
|
||
* 495 — inbox.group.list
|
||
* 496 — inbox.group.disable
|
||
* 497 — inbox.group.update
|
||
* 498 — inbox.group.messages
|
||
*/
|
||
module.exports = {
|
||
// eslint-disable-next-line no-unused-vars
|
||
async up(queryInterface, Sequelize) {
|
||
const methods = [
|
||
[495, 'inbox.group.list'],
|
||
[496, 'inbox.group.disable'],
|
||
[497, 'inbox.group.update'],
|
||
[498, 'inbox.group.messages'],
|
||
];
|
||
|
||
for (const [id, method] of methods) {
|
||
await queryInterface.sequelize.query(`
|
||
INSERT INTO wms_permission (id, path, component, name, redirect, meta_title, meta_icon, hidden, always_show, parent_id, type, sort, status, created_at, update_at)
|
||
VALUES (${id}, '${method}', NULL, '${method}', NULL, 'API:${method}', NULL, 0, 0, NULL, 'api', 0, 1, NOW(), NOW())
|
||
ON DUPLICATE KEY UPDATE path='${method}', meta_title='API:${method}', type='api'
|
||
`);
|
||
}
|
||
|
||
// 授权给客服组-主管及以上角色
|
||
const newIdSuffix = ', 495, 496, 497, 498';
|
||
await queryInterface.sequelize.query(`
|
||
UPDATE wms_role
|
||
SET permissions = CONCAT(LEFT(permissions, LENGTH(permissions) - 1), '${newIdSuffix}]')
|
||
WHERE id IN (8, 26, 28, 29)
|
||
AND permissions != '*'
|
||
AND permissions IS NOT NULL
|
||
AND LENGTH(permissions) > 2
|
||
`);
|
||
},
|
||
|
||
// eslint-disable-next-line no-unused-vars
|
||
async down(queryInterface, Sequelize) {
|
||
await queryInterface.sequelize.query(
|
||
'DELETE FROM wms_permission WHERE id IN (495, 496, 497, 498)'
|
||
);
|
||
await queryInterface.sequelize.query(`
|
||
UPDATE wms_role
|
||
SET permissions = REPLACE(permissions, ', 495, 496, 497, 498', '')
|
||
WHERE id IN (8, 26, 28, 29)
|
||
`);
|
||
},
|
||
};
|