(feature)(chat&common)Introduce ChatMemory module to support dynamic few-shot exemplars.#1097

This commit is contained in:
jerryjzhang
2024-06-27 10:19:59 +08:00
parent 7c711f6105
commit a655110f5f
28 changed files with 561 additions and 153 deletions

View File

@@ -172,6 +172,7 @@ public abstract class S2BaseDemo implements CommandLineRunner {
executeReq.setQueryText(queryText);
executeReq.setChatId(parseResp.getChatId());
executeReq.setUser(User.getFakeUser());
executeReq.setAgentId(agentId);
executeReq.setSaveAnswer(true);
chatService.performExecution(executeReq);
}

View File

@@ -83,6 +83,25 @@ CREATE TABLE IF NOT EXISTS `s2_chat_config` (
COMMENT ON TABLE s2_chat_config IS 'chat config information table ';
CREATE TABLE IF NOT EXISTS `s2_chat_memory` (
`id` INT NOT NULL AUTO_INCREMENT,
`question` varchar(655) ,
`agent_id` INT ,
`db_schema` TEXT ,
`s2_sql` TEXT ,
`status` char(10) ,
`llm_review` char(10) ,
`llm_comment` TEXT,
`human_review` char(10) ,
`human_comment` TEXT ,
`created_at` TIMESTAMP ,
`updated_at` TIMESTAMP ,
`created_by` varchar(100) ,
`updated_by` varchar(100) ,
PRIMARY KEY (`id`)
) ;
COMMENT ON TABLE s2_chat_memory IS 'chat memory table ';
create table IF NOT EXISTS s2_user
(
id INT AUTO_INCREMENT,

View File

@@ -136,6 +136,24 @@ CREATE TABLE `s2_chat_config` (
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='主题域扩展信息表';
CREATE TABLE IF NOT EXISTS `s2_chat_memory` (
`id` INT NOT NULL AUTO_INCREMENT,
`question` varchar(655) ,
`agent_id` INT ,
`db_schema` TEXT ,
`s2_sql` TEXT ,
`status` char(10) ,
`llm_review` char(10) ,
`llm_comment` TEXT,
`human_review` char(10) ,
`human_comment` TEXT ,
`created_at` TIMESTAMP NOT NULL ,
`updated_at` TIMESTAMP NOT NULL ,
`created_by` varchar(100) NOT NULL ,
`updated_by` varchar(100) NOT NULL ,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `s2_chat_context` (
`chat_id` bigint(20) NOT NULL COMMENT 'context chat id',
`modified_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'row modify time',

View File

@@ -82,6 +82,24 @@ CREATE TABLE IF NOT EXISTS `s2_chat_config` (
) ;
COMMENT ON TABLE s2_chat_config IS 'chat config information table ';
CREATE TABLE IF NOT EXISTS `s2_chat_memory` (
`id` INT NOT NULL AUTO_INCREMENT,
`question` varchar(655) ,
`agent_id` INT ,
`db_schema` TEXT ,
`s2_sql` TEXT ,
`status` char(10) ,
`llm_review` char(10) ,
`llm_comment` TEXT,
`human_review` char(10) ,
`human_comment` TEXT ,
`created_at` TIMESTAMP ,
`updated_at` TIMESTAMP ,
`created_by` varchar(100) ,
`updated_by` varchar(100) ,
PRIMARY KEY (`id`)
) ;
COMMENT ON TABLE s2_chat_memory IS 'chat memory table ';
create table IF NOT EXISTS s2_user
(