mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-19 21:14:25 +08:00
[improvement][Chat] Support agent permission management (#1923)
* [improvement][Chat] Support agent permission management #1143 * [improvement][chat]Iterate LLM prompts of parsing and correction. * [improvement][headless-fe] Added null-check conditions to the data formatting function. * [improvement][headless]Clean code logic of headless translator. --------- Co-authored-by: lxwcodemonkey <jolunoluo@tencent.com> Co-authored-by: tristanliu <tristanliu@tencent.com>
This commit is contained in:
@@ -167,6 +167,8 @@ public class S2SingerDemo extends S2BaseDemo {
|
||||
Maps.newHashMap(ChatAppManager.getAllApps(AppModule.CHAT));
|
||||
chatAppConfig.values().forEach(app -> app.setChatModelId(demoChatModel.getId()));
|
||||
agent.setChatAppConfig(chatAppConfig);
|
||||
agent.setAdmins(Lists.newArrayList("alice"));
|
||||
agent.setViewers(Lists.newArrayList("tom", "jack"));
|
||||
agentService.createAgent(agent, defaultUser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,8 @@ public class S2SmallTalkDemo extends S2BaseDemo {
|
||||
chatAppConfig.get(PlainTextExecutor.APP_KEY).setEnable(true);
|
||||
chatAppConfig.get(OnePassSCSqlGenStrategy.APP_KEY).setEnable(false);
|
||||
agent.setChatAppConfig(chatAppConfig);
|
||||
agent.setAdmins(Lists.newArrayList("jack"));
|
||||
agent.setViewers(Lists.newArrayList("alice", "tom"));
|
||||
agentService.createAgent(agent, defaultUser);
|
||||
}
|
||||
|
||||
|
||||
@@ -134,7 +134,7 @@ public class S2VisitsDemo extends S2BaseDemo {
|
||||
|
||||
private void addSampleChats(Integer agentId) {
|
||||
Long chatId = chatManageService.addChat(defaultUser, "样例对话1", agentId);
|
||||
submitText(chatId.intValue(), agentId, "超音数 访问次数");
|
||||
submitText(chatId.intValue(), agentId, "访问过超音数的部门有哪些");
|
||||
submitText(chatId.intValue(), agentId, "按部门统计近7天访问次数");
|
||||
submitText(chatId.intValue(), agentId, "alice 停留时长");
|
||||
}
|
||||
@@ -162,6 +162,8 @@ public class S2VisitsDemo extends S2BaseDemo {
|
||||
Maps.newHashMap(ChatAppManager.getAllApps(AppModule.CHAT));
|
||||
chatAppConfig.values().forEach(app -> app.setChatModelId(demoChatModel.getId()));
|
||||
agent.setChatAppConfig(chatAppConfig);
|
||||
agent.setAdmins(Lists.newArrayList("tom"));
|
||||
agent.setViewers(Lists.newArrayList("alice", "jack"));
|
||||
Agent agentCreated = agentService.createAgent(agent, defaultUser);
|
||||
return agentCreated.getId();
|
||||
}
|
||||
@@ -444,7 +446,7 @@ public class S2VisitsDemo extends S2BaseDemo {
|
||||
termReq1.setDescription("用户为tom和lucy");
|
||||
termReq1.setAlias(Lists.newArrayList("VIP用户"));
|
||||
termReq1.setDomainId(s2Domain.getId());
|
||||
termService.saveOrUpdate(termReq, defaultUser);
|
||||
termService.saveOrUpdate(termReq1, defaultUser);
|
||||
}
|
||||
|
||||
private void addAuthGroup_1(ModelResp stayTimeModel) {
|
||||
|
||||
@@ -393,4 +393,8 @@ ALTER TABLE s2_agent DROP COLUMN `multi_turn_config`;
|
||||
ALTER TABLE s2_agent DROP COLUMN `enable_memory_review`;
|
||||
|
||||
--20241012
|
||||
alter table s2_agent add column `enable_feedback` tinyint DEFAULT 1;
|
||||
alter table s2_agent add column `enable_feedback` tinyint DEFAULT 1;
|
||||
|
||||
--20241116
|
||||
alter table s2_agent add column `admin` varchar(1000);
|
||||
alter table s2_agent add column `viewer` varchar(1000);
|
||||
@@ -398,6 +398,8 @@ CREATE TABLE IF NOT EXISTS s2_agent
|
||||
updated_at TIMESTAMP null,
|
||||
enable_search int null,
|
||||
enable_feedback int null,
|
||||
admin varchar(1000),
|
||||
viewer varchar(1000),
|
||||
PRIMARY KEY (`id`)
|
||||
); COMMENT ON TABLE s2_agent IS 'agent information table';
|
||||
|
||||
|
||||
@@ -50,8 +50,7 @@ public class SchemaAuthTest extends BaseTest {
|
||||
@Test
|
||||
public void test_getVisibleModelList_alice() {
|
||||
User user = DataUtils.getUserAlice();
|
||||
List<ModelResp> modelResps =
|
||||
modelService.getModelListWithAuth(user, null, AuthType.VISIBLE);
|
||||
List<ModelResp> modelResps = modelService.getModelListWithAuth(user, null, AuthType.VIEWER);
|
||||
List<String> expectedModelBizNames = Lists.newArrayList("user_department", "singer");
|
||||
Assertions.assertEquals(expectedModelBizNames,
|
||||
modelResps.stream().map(ModelResp::getBizName).collect(Collectors.toList()));
|
||||
|
||||
@@ -398,6 +398,8 @@ CREATE TABLE IF NOT EXISTS s2_agent
|
||||
updated_at TIMESTAMP null,
|
||||
enable_search int null,
|
||||
enable_feedback int null,
|
||||
admin varchar(1000),
|
||||
viewer varchar(1000),
|
||||
PRIMARY KEY (`id`)
|
||||
); COMMENT ON TABLE s2_agent IS 'agent information table';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user