diff --git a/docker/robot-qa/Dockerfile b/docker/robot-qa/Dockerfile new file mode 100644 index 0000000..1c2e9d7 --- /dev/null +++ b/docker/robot-qa/Dockerfile @@ -0,0 +1,16 @@ +# 设置基础镜像 +FROM rasa_dev:1.0.0 + +COPY ./bert_chinese /usr/local/text2vec/bert_chinese +COPY ./app.py /usr/local/text2vec/ +#COPY ./question.json /usr/local/text2vec/ + +RUN source /root/anaconda3/etc/profile.d/conda.sh && \ + conda create --name text2vec_env python=3.9 -y && \ + conda activate text2vec_env && \ + pip install torch && \ + pip install flask && \ + pip install text2vec -i https://pypi.tuna.tsinghua.edu.cn/simple + +expose 5000 + diff --git a/docker/sqlScript/interro_robot_v1.0.0.sql b/docker/sqlScript/interro_robot_v1.0.0.sql new file mode 100644 index 0000000..d007730 --- /dev/null +++ b/docker/sqlScript/interro_robot_v1.0.0.sql @@ -0,0 +1,652 @@ +create table ir_user +( + id varchar(64) not null + constraint ir_user_pk + primary key, + user_account varchar(255) not null + constraint ir_user_pk2 + unique, + real_name varchar(255) not null, + ps varchar(255) not null, + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP, + state integer default 1, + role_type integer default 2 not null +); + +comment on table ir_user is '用户表'; + +comment on column ir_user.id is '主键'; + +comment on column ir_user.user_account is '用户账户'; + +comment on column ir_user.real_name is '真实姓名'; + +comment on column ir_user.ps is '用户密码'; + +comment on column ir_user.create_user_id is '创建人ID'; + +comment on column ir_user.create_time is '创建时间'; + +comment on column ir_user.update_user_id is '更新人ID'; + +comment on column ir_user.update_time is '更新时间'; + +comment on column ir_user.state is '状态(1启动 2禁用)'; + +comment on column ir_user.role_type is '用户角色(1管理员 2普通用户)'; + +alter table ir_user + owner to postgres; + + +create table ir_sql_param +( + id varchar(64) not null + constraint ir_sql_param_pk + primary key, + knowledge_id varchar(64), + param_name varchar(64), + param_type varchar(64), + param_require integer default 2, + param_desc varchar(255), + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP +); + +comment on table ir_sql_param is '问题模板参数'; + +comment on column ir_sql_param.knowledge_id is '知识库ID'; + +comment on column ir_sql_param.param_name is '参数名称'; + +comment on column ir_sql_param.param_type is '参数类型'; + +comment on column ir_sql_param.param_require is '是否必填(1必填,2非必填)'; + +comment on column ir_sql_param.param_desc is '参数注释'; + +alter table ir_sql_param + owner to postgres; + +create table ir_session_param +( + id varchar(64) not null + constraint ir_session_param_pk + primary key, + session_id varchar(64), + param_name varchar(255), + param_value varchar(255), + param_type varchar(64), + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP +); + +comment on table ir_session_param is '会话参数'; + +comment on column ir_session_param.id is '主键'; + +comment on column ir_session_param.session_id is '会话ID'; + +comment on column ir_session_param.param_name is '参数名称'; + +comment on column ir_session_param.param_value is '参数值'; + +comment on column ir_session_param.param_type is '参数类型'; + +alter table ir_session_param + owner to postgres; + +create table ir_session_history +( + id varchar(64) not null + constraint ir_session_history_pk + primary key, + session_id varchar(64), + user_question varchar(1024), + user_question_voice_id varchar(64), + match_knowledge_id varchar(64), + user_id varchar(64), + threshold numeric(5, 2), + score_cause integer, + answer_time timestamp default CURRENT_TIMESTAMP not null, + deal_state integer default 0 not null, + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP, + answer varchar(1024), + answer_voice_id varchar(64), + answer_file_id varchar(1024), + answer_type integer +); + +comment on table ir_session_history is '会话历史记录表'; + +comment on column ir_session_history.id is '主键'; + +comment on column ir_session_history.session_id is '所属会话ID'; + +comment on column ir_session_history.user_question is '用户问题'; + +comment on column ir_session_history.user_question_voice_id is '用户语音ID(关联语音表ID)'; + +comment on column ir_session_history.match_knowledge_id is '匹配知识库ID'; + +comment on column ir_session_history.user_id is '提问用户ID'; + +comment on column ir_session_history.threshold is '阈值'; + +comment on column ir_session_history.score_cause is '(原因 1信息错误 2答非所问 3其他),只有不满意时触发'; + +comment on column ir_session_history.answer_time is '应答时间'; + +comment on column ir_session_history.deal_state is '处理状态(0无需处理 1未处理 2已处理)'; + +comment on column ir_session_history.answer is '回答内容'; + +comment on column ir_session_history.answer_voice_id is '回答音频ID'; + +comment on column ir_session_history.answer_file_id is '回答文件ID,支持多个文件,用;分割'; + +comment on column ir_session_history.answer_type is '回答类型 1:文字 2:语音 3:文件'; + +alter table ir_session_history + owner to postgres; + +create table ir_robot_config +( + id varchar(64) not null + constraint robot_config_pk + primary key, + device_name varchar(255), + dept_name varchar(255), + device_code varchar(255), + state integer default 1 not null, + talk_speed numeric(2, 1), + icon_base64 text, + active_language varchar(255), + error_language varchar(255), + unrecognized_one varchar(255), + unrecognized_two varchar(255), + unrecognized_three varchar(255), + unrecognized_four varchar(255), + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP +); + +comment on table ir_robot_config is '机器人配置'; + +comment on column ir_robot_config.id is '主键'; + +comment on column ir_robot_config.device_name is '设备名称'; + +comment on column ir_robot_config.dept_name is '所属机构名称'; + +comment on column ir_robot_config.device_code is '设备编码'; + +comment on column ir_robot_config.state is '设备状态(1启用 2禁用)'; + +comment on column ir_robot_config.talk_speed is '语速配置'; + +comment on column ir_robot_config.icon_base64 is '机器人图表'; + +comment on column ir_robot_config.active_language is '主动话术'; + +comment on column ir_robot_config.error_language is '异常话术'; + +comment on column ir_robot_config.unrecognized_one is '未识别话术1'; + +comment on column ir_robot_config.unrecognized_two is '未识别话术2'; + +comment on column ir_robot_config.unrecognized_three is '未识别话术3'; + +comment on column ir_robot_config.unrecognized_four is '未识别话术5'; + +alter table ir_robot_config + owner to postgres; + +create table ir_session +( + id varchar(255) not null + constraint ir_session_pk + primary key, + session_name varchar(255), + session_state integer default 1 not null, + user_id varchar(64), + video_speed numeric(2, 1), + broadcast_type integer default 1, + session_score integer, + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP +); + +comment on table ir_session is '会话表'; + +comment on column ir_session.id is '主键'; + +comment on column ir_session.session_name is '会话名称'; + +comment on column ir_session.session_state is '会话状态(1进行中,2已结束)'; + +comment on column ir_session.user_id is '会话用户ID'; + +comment on column ir_session.video_speed is '播放速度(2位,小数后1位,例如:1.5)'; + +comment on column ir_session.broadcast_type is '播报方式(1语音 2文字)'; + +comment on column ir_session.session_score is '会话评分(1满意 2不满意,3未评估)'; + +alter table ir_session + owner to postgres; + + + +create table ir_voice +( + id varchar(64) not null + constraint ir_voice_pk + primary key, + voice_base64 text not null, + length integer +); + +comment on table ir_voice is '音频文件表'; + +comment on column ir_voice.id is '主键'; + +comment on column ir_voice.voice_base64 is '音频文件base64编码'; + +comment on column ir_voice.length is '长度,以秒为单位'; + +alter table ir_voice + owner to postgres; + +create table ir_file +( + id varchar(64) not null + constraint ir_file_pk + primary key, + file_name varchar(255), + file_byte bytea, + file_type varchar(255), + file_size integer +); + +comment on table ir_file is '文件表'; + +comment on column ir_file.id is '主键'; + +comment on column ir_file.file_name is '文件名称'; + +comment on column ir_file.file_byte is '文件字节编码'; + +comment on column ir_file.file_type is '文件类型 1: base64 2:原生(未经过base64编码)'; + +comment on column ir_file.file_size is '文件大小'; + +alter table ir_file + owner to postgres; +create table ir_knowledge +( + id varchar(64) not null + constraint ir_knowledge_pk + primary key, + standard_question varchar(255) not null, + state integer, + sql_template text, + result_template text, + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP, + result_type integer default 1 +); + +comment on table ir_knowledge is '知识库'; + +comment on column ir_knowledge.id is '主键'; + +comment on column ir_knowledge.standard_question is '标准问题'; + +comment on column ir_knowledge.state is '状态(1生效 2部分生效 3未部署)'; + +comment on column ir_knowledge.sql_template is 'SQL模板(使用模板工具)'; + +comment on column ir_knowledge.result_template is '回答模板格式(使用模板工具)'; + +comment on column ir_knowledge.result_type is '查询结果数据类型:1:Map 2:List> 3 : bytea'; + +alter table ir_knowledge + owner to postgres; + +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984441624252418', '本次冻结涉及多少张卡?', 1, e'select count(distinct jykh) jykh_count +from yxyc_robot_data.yxyc_djmd +where ajid = #{ajid};', '本次冻结涉及${jykh_count}张银行卡', null, '2024-03-22 09:22:49.128999', null, '2024-03-22 09:22:49.128999', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442718965762', '代理或会员的充值、提现情况', 1, null, null, null, '2024-03-22 09:22:49.240794', null, '2024-03-22 09:22:49.240794', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442979012610', '是否为团伙', 1, e'', '${result}', null, '2024-03-22 09:22:49.299090', null, '2024-03-22 09:22:49.299090', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443440386666', '我要下载案件材料', 1, null, e'<#if fileContent??> + 我们已为您准备了相关案件材料,供您随时下载查阅。 +<#else> + 暂时还没有相关案件材料可以下载查阅。 +', null, '2024-03-29 05:16:18.426524', null, '2024-03-29 05:16:18.426524', 4); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443155173377', '冻结资金的依据', 1, e'', '未查询到资金冻结的依据。', null, '2024-03-22 09:22:49.339301', null, '2024-03-22 09:22:49.339301', 3); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443096453122', '账户主要扮演哪些角色', 1, e'', e'<#if js_agg??> + 扮演的角色有:${js_agg} +<#else> + 无扮演的角色 +', null, '2024-03-22 09:22:49.327274', null, '2024-03-22 09:22:49.327274', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442920292354', '资金信息基本情况', 1, e'', e'<#macro formatMoney amount> + <#if amount < 10000> + ${amount} 元 + <#elseif amount gte 10000 && amount < 100000000 > + ${(amount / 10000) ?string[\'0.00\']} 万元 + <#else> + ${(amount / 100000000)?string[\'0.00\']} 亿元 + + +经数据清洗(补充缺失值、处理特殊字符、剔除无效数据、删除重复数据)后,本案件共调取了${dqzts}个主体的${dqzhs}个账户自${zzjyrq}到${zwjyrq}的交易记录${jyzbs}条; +其中涉及交易对手账号${sjdss}个,涉及金额交易总金额约<@formatMoney amount=jyzje/>,转出金额约<@formatMoney amount=czje/>,转入金额<@formatMoney amount=czje/>。转出笔数${czcs}笔,转入笔数${jzcs}笔。', null, '2024-03-22 09:22:49.284770', null, '2024-03-22 09:22:49.284770', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442635079681', '是否为代理或会员?', 1, e'', e'<#assign dataList = dataList?default([])> +<#assign isMember = false> +<#assign isAgent = false> +<#list dataList as item> + <#if item.js?contains("会员")> + <#assign isMember = true> + <#elseif item.js?contains("代理")> + <#assign isAgent = true> + + +<#if isMember> +是会员<#elseif isAgent>是代理<#else>不是代理或者会员', null, '2024-03-22 09:22:49.222509', null, '2024-03-22 09:22:49.222509', 2); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443201310722', '主要关联了哪些问题账户', 1, e'', e'<#if result??> + 关联问题账户有:${result} +<#else> + 没有关联问题账户。 +', null, '2024-03-22 09:22:49.352463', null, '2024-03-22 09:22:49.352463', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443385860098', '关联的出账对手情况', 1, e'', e'<#assign dataList = dataList?default([])> +关联的出账对手情况: +<#list dataList as item> +卡号:${item.jykh},关联对手数:${item.gldss},出账对手数:${item.czdsh},出账金额:${item.czje},出账笔数:${item.czbs},出账天数:${item.czts} +', null, '2024-03-22 09:22:49.395498', null, '2024-03-22 09:22:49.395498', 2); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443268419585', '为几级卡', 1, e'', e'<#assign dataList = dataList?default([])> +<#assign card_map = {}> +<#list dataList as item> + <#if item.jykh?? && item.jykh?trim?length != 0> + <#assign key = item.jykh?trim> + <#if !card_map[key]??> + <#assign card_map = card_map + {key : item}> + <#elseif item.sfbz?? && item.sfbz == "进" && item.dsfbq?? && item.dsfbq?contains("会员")> + <#assign card_map = card_map + {key : item}> + <#elseif (item.dsfbq ?? && (item.dsfbq?contains("收款账户") || item.dsfbq?contains("返款账户")) && (card_map[key].sfbz != "进"))> + <#assign card_map = card_map + {key : item}> + + + +<#list card_map?values as item> + 卡号:${item.jykh} 卡级别: + <#if item.sfbz?? && item.sfbz == "进" && item.dsfbq?? && item.dsfbq?contains("会员")> + 一级卡 + <#elseif item.sfbz?? && item.sfbz == "出" || (item.dsfbq?? && (item.dsfbq?contains("收款账户") || item.dsfbq?contains("返款账户")))> + 二级卡 + <#else> + 三级卡 + +', null, '2024-03-22 09:22:49.366105', null, '2024-03-22 09:22:49.366105', 2); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443327139841', '关联的进账对手情况', 1, e'', e'<#assign dataList = dataList?default([])> +关联的进账对手情况: +<#list dataList as item> +卡号:${item.jykh},关联对手数:${item.gldss},进账对手数:${item.jzdss},进账次数占比:${item.jzcszb},进账金额占比:${item.jzjezb},进账对手数占比:${item.jzdsszb}, 进账金额:${item.jzje},进账笔数:${item.jzbs},进账天数:${item.jzts} +', null, '2024-03-22 09:22:49.381933', null, '2024-03-22 09:22:49.381933', 2); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443440386050', '银行基本信息情况', 1, e'select t0.jykh,t0.t0_zhkhmc_agg,t1.* ,t2.联系电话 ,t3.住宅地址, t3.住宅电话 ,t4.银行账号 + from + (select jykh,khrzjhm ,string_agg(distinct zhkhmc,\'、\') t0_zhkhmc_agg + from yxyc_robot_data.yxyc_cj_zj_khxx where ajid=2 and khrzjhm = #{khrzjhm} + group by jykh,khrzjhm + ) t0 + left join + (select zjhm t1_zjhm, + string_agg(distinct email,\'、\') 联系邮箱,string_agg(distinct gzdw,\'、\') 工作单位,string_agg(distinct dwdh,\'、\') 单位电话 + from yxyc_robot_data.yxyc_cj_zj_kehxx where ajid=2 and zjhm=#{khrzjhm} + group by zjhm + ) t1 + on t0.khrzjhm=t1.t1_zjhm + left join + ( + select zzhm t2_zzhm,string_agg(distinct khmc,\'、\') 开户名称,string_agg(distinct lxdh,\'、\') 联系电话 + from yxyc_robot_data.yxyc_cj_zj_lxfsxx where ajid=2 and zzhm=#{khrzjhm} + group by zzhm + ) t2 + on t1.t1_zjhm = t2.t2_zzhm + left join + ( + select zjhm t3_zjhm,string_agg(distinct khmc,\'、\') 开户名称,string_agg(distinct zzdz,\'、\') 住宅地址, string_agg(distinct zzdh,\'、\') 住宅电话 + from yxyc_robot_data.yxyc_cj_zj_zzxx where ajid=2 and zjhm=#{khrzjhm} + group by zjhm + ) t3 + on t1.t1_zjhm = t3.t3_zjhm + left join + ( + select khrzjhm t4_khrzjhm,string_agg(distinct zhkhmc,\'、\') 开户名称,string_agg(distinct zhkhyh||\'-\'||jykh,\'、\') 银行账号 + from yxyc_robot_data.yxyc_cj_zj_khxx where ajid=2 and khrzjhm= #{khrzjhm} + group by khrzjhm + ) t4 + on t1.t1_zjhm = t4.t4_khrzjhm;', '基本情况: 交易卡号:${((jykh!'''')?length>0)?string(jykh!'''',''无'')},开户名称:${((t0_zhkhmc_agg!'''')?length>0)?string(t0_zhkhmc_agg!'''',''无'')},证照号码:${((t1_zjhm!'''')?length>0)?string(t1_zjhm!'''',''无'')},联系邮箱:${((联系邮箱!'''')?length>0)?string(联系邮箱!'''',''无'')},工作单位:${((工作单位!'''')?length>0)?string(工作单位!'''',''无'')},单位电话:${((单位电话!'''')?length>0)?string(单位电话!'''',''无'')},联系电话:${((联系电话!'''')?length>0)?string(联系电话!'''',''无'')},住宅地址:${((住宅地址!'''')?length>0)?string(住宅地址!'''',''无'')},住宅电话:${((住宅电话!'''')?length>0)?string(住宅电话!'''',''无'')},银行账号:${((银行账号!'''')?length>0)?string(银行账号!'''',''无'')}。', null, '2024-03-22 09:22:49.407176', null, '2024-03-22 09:22:49.407176', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442857377793', '是否符合立案打击标准', 1, e'', e'<#list dataList as item> + <#assign jykh = item["jykh"]> + <#assign saje = item["saje"]> +交易卡号: ${jykh}元,交易金额: ${saje}元,总交易金额: <#assign totalAmount = 0><#list dataList as item><#assign saje = item["saje"]?number> <#assign totalAmount = totalAmount + saje>${totalAmount} 元', null, '2024-03-22 09:22:49.269374', null, '2024-03-22 09:22:49.269374', 2); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442509250562', '本案调集了几轮数据,涉及多少账户', 1, e'select count(distinct djpc) as count_djpc, count(distinct jykh) as count_ykjh +from yxyc_robot_data.yxyc_djmd where ajid = #{ajid};', e'<#assign count_ykjh = count_ykjh?default(0)> +<#assign count_djpc = count_djpc?default(0)> +本案调集了${count_djpc}轮数据,涉及${count_ykjh}个账户。', null, '2024-03-22 09:22:49.186871', null, '2024-03-22 09:22:49.186871', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984443037732866', '团伙依据', 1, e'', e'<#if jyhm_agg??> +团伙人员有:${jyhm_agg} +<#else> +没有团伙成员 +', null, '2024-03-22 09:22:49.312666', null, '2024-03-22 09:22:49.312666', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442387615746', '涉及哪些银行,各银行卡数量', 1, e'SELECT STRING_AGG(result_0, \'、\') result +FROM (SELECT yhmc || \':\' || count(distinct jykh) || \'张\' as result_0 + FROM yxyc_robot_data.yxyc_djmd + where ajid = #{ajid} + GROUP BY yhmc + ) subquery;', e'<#if result?has_content> + ${result} +<#else> + 没有相关数据 +', null, '2024-03-22 09:22:49.159600', null, '2024-03-22 09:22:49.159600', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442458918914', '本次账户涉案情况', 1, e'select sum(CAST(saje AS FLOAT)) as sum_asje +from yxyc_robot_data.yxyc_djmd +where ajid = #{ajid};', '账户涉案金额是${(sum_asje!0)?c}元', null, '2024-03-22 09:22:49.172509', null, '2024-03-22 09:22:49.172509', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442811240449', '代理获取佣金情况', 1, null, null, null, '2024-03-22 09:22:49.256425', null, '2024-03-22 09:22:49.256425', 1); +INSERT INTO ir_knowledge (id, standard_question, state, sql_template, result_template, create_user_id, create_time, update_user_id, update_time, result_type) VALUES ('1770984442572165122', '是否为本次冻结打击对象?', 1, e'', '${result}本次冻结打击对象', null, '2024-03-22 09:22:49.201885', null, '2024-03-22 09:22:49.201885', 1); + + +create table ir_knowledge_similar +( + id varchar(64) not null + constraint ir_similar_question_pk + primary key, + knowledge_id varchar(64), + similar_question varchar(255), + state integer, + create_user_id varchar(64), + create_time timestamp default CURRENT_TIMESTAMP, + update_user_id varchar(64), + update_time timestamp default CURRENT_TIMESTAMP +); + +comment on table ir_knowledge_similar is '相似问法表'; + +comment on column ir_knowledge_similar.id is '主键'; + +comment on column ir_knowledge_similar.knowledge_id is '知识库ID'; + +comment on column ir_knowledge_similar.similar_question is '相似问法'; + +comment on column ir_knowledge_similar.state is '生效状态(1生效 2部分生效 3未部署)'; + +alter table ir_knowledge_similar + owner to postgres; + +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012620', '1770984443096453122', '账号主要扮演了哪些角色', 1, null, '2024-04-02 02:39:34.766612', null, '2024-04-02 02:39:34.766612'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012621', '1770984442635079681', '是否为会员或代理', 1, null, '2024-04-02 02:40:35.245391', null, '2024-04-02 02:40:35.245391'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012622', '1770984443268419585', '为几类卡', 1, null, '2024-04-02 02:42:03.044403', null, '2024-04-02 02:42:03.044403'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012623', '1770984443268419585', '卡是几级', 1, null, '2024-04-02 02:42:49.833125', null, '2024-04-02 02:42:49.833125'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012624', '1770984443268419585', '卡是几类', 1, null, '2024-04-02 02:43:28.832981', null, '2024-04-02 02:43:28.832981'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012625', '1770984443440386050', '银行基本信息情况是什么', 1, null, '2024-04-02 02:46:52.157471', null, '2024-04-02 02:46:52.157471'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012626', '1770984443201310722', '有关联的问题账号主要有哪些', 1, null, '2024-04-02 03:01:16.219558', null, '2024-04-02 03:01:16.219558'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012627', '1770984443201310722', '哪些账户与本案相关联', 1, null, '2024-04-02 03:01:52.268242', null, '2024-04-02 03:01:52.268242'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012628', '1770984443201310722', '哪些账户与本案有关系', 1, null, '2024-04-02 03:02:27.067425', null, '2024-04-02 03:02:27.067425'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012629', '1770984443201310722', '与本案有关系的主要账户有哪些', 1, null, '2024-04-02 03:03:37.523851', null, '2024-04-02 03:03:37.523851'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012630', '1770984442387615746', '涉及的银行有哪些,它们分别有多少张银行卡?', 1, null, '2024-04-02 03:10:04.519138', null, '2024-04-02 03:10:04.519138'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012631', '1770984442387615746', '可以列出涉及的银行及各自发行的银行卡数量吗?', 1, null, '2024-04-02 03:10:41.965494', null, '2024-04-02 03:10:41.965494'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012611', '1770984442979012610', '是不是团伙?', 1, null, '2024-04-01 09:00:09.759290', null, '2024-04-01 09:00:09.759290'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012612', '1770984442979012610', '是不是团伙作案?', 1, null, '2024-04-01 09:00:41.802338', null, '2024-04-01 09:00:41.802338'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012613', '1770984442857377793', '是否符合立案标准', 1, null, '2024-04-01 09:33:08.288781', null, '2024-04-01 09:33:08.288781'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012614', '1770984441624252418', '本次一共冻结多少张银行卡', 1, null, '2024-04-01 09:36:09.877843', null, '2024-04-01 09:36:09.877843'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012615', '1770984441624252418', '本案冻结涉及多少张卡', 1, null, '2024-04-01 09:36:41.845686', null, '2024-04-01 09:36:41.845686'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012616', '1770984441624252418', '本案一共冻结多少张银行卡', 1, null, '2024-04-01 09:37:59.555677', null, '2024-04-01 09:37:59.555677'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012617', '1770984442718965762', '代理或会员的充值提现情况', 1, null, '2024-04-01 09:41:08.463625', null, '2024-04-01 09:41:08.463625'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012618', '1770984442509250562', '本案涉及多少账号,调集了几轮数据', 1, null, '2024-04-02 01:17:52.878350', null, '2024-04-02 01:17:52.878350'); +INSERT INTO interro_robot.ir_knowledge_similar (id, knowledge_id, similar_question, state, create_user_id, create_time, update_user_id, update_time) VALUES ('1870984442979012619', '1770984443155173377', '冻结资金的依据是什么', 1, null, '2024-04-02 02:36:00.138586', null, '2024-04-02 02:36:00.138586'); diff --git a/docker/web/Dockerfile b/docker/web/Dockerfile index d0fcbd5..78bd3c1 100644 --- a/docker/web/Dockerfile +++ b/docker/web/Dockerfile @@ -11,7 +11,7 @@ RUN apk --no-cache add tzdata msttcorefonts-installer fontconfig \ WORKDIR /data/intro-robot/ # 复制java jar 到容器中 -COPY interro_robot-0.0.1-SNAPSHOT.jar /data/intro-robot/interro_robot-0.0.1-SNAPSHOT.jar +COPY interro_robot-0.0.1-SNAPSHOT.jar /opt/intro-robot/interro_robot-0.0.1-SNAPSHOT.jar COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh RUN chmod 777 /usr/local/bin/docker-entrypoint.sh diff --git a/docker/web/docker-entrypoint.sh b/docker/web/docker-entrypoint.sh index ab20886..17f8580 100644 --- a/docker/web/docker-entrypoint.sh +++ b/docker/web/docker-entrypoint.sh @@ -1,4 +1,4 @@ #!/bin/sh # 启动jar包 -java -jar -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 /data/intro-robot/interro_robot-0.0.1-SNAPSHOT.jar "$@" \ No newline at end of file +java -jar -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 /opt/intro-robot/interro_robot-0.0.1-SNAPSHOT.jar "$@" \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fa7e9d0..883eda2 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -1,3 +1,13 @@ +env: + datasource: + ip: 192.168.10.137:5432 + username: postgres + password: '123456' + match: + ip: 192.168.10.137:9711 + paddle-speech: + ip: 192.168.10.137:8090 + server: port: 9800 servlet: @@ -17,11 +27,12 @@ spring: max-request-size: 100MB datasource: type: com.alibaba.druid.pool.DruidDataSource + ip: 192.168.10.137:5432 druid: driver-class-name: org.postgresql.Driver - url: jdbc:postgresql://192.168.10.137:5432/postgres?useUnicode=true&characterEncoding=utf-8&useSSL=true&nullCatalogMeansCurrent=true&serverTimezone=GMT%2B8 - username: postgres - password: '123456' + url: jdbc:postgresql://${env.datasource.ip}/postgres?useUnicode=true&characterEncoding=utf-8&useSSL=true&nullCatalogMeansCurrent=true&serverTimezone=GMT%2B8 + username: ${env.datasource.username} + password: ${env.datasource.password} initial-size: 5 min-idle: 10 max-active: 20 @@ -42,12 +53,12 @@ spring: slow-sql-millis: 5000 merge-sql: false matchTool: - url: http://192.168.10.137:9711 + url: http://${env.match.ip} scoreThreshold: 0.4 paddle-speech: # https://github.com/PaddlePaddle/PaddleSpeech/wiki/PaddleSpeech-Server-RESTful-API - tts: http://192.168.10.137:8090/paddlespeech/tts - asr: http://192.168.10.137:8090/paddlespeech/asr + tts: http://${env.paddle-speech.ip}/paddlespeech/tts + asr: http://${env.paddle-speech.ip}/paddlespeech/asr mybatis-plus: mapper-locations: classpath*:mapper/**/*.xml configuration: diff --git a/部署手册.md b/部署手册.md new file mode 100644 index 0000000..677a688 --- /dev/null +++ b/部署手册.md @@ -0,0 +1,96 @@ +# interro_robot + +审讯机器人 + + +## 部署说明 + +#### 服务列表 + +| 服务名称 | 镜像文件名 | 镜像名 | 部署顺序 | +|--------|-----------------------------------|----------------------------------| --- | +| 语音转换服务 | interro-robot-paddlespeech.tar.gz | interro-robot-paddlespeech:1.0.0 | 1 | +| 语义匹配服务 | interro-robot-qa.tar.gz | interro-robot-qa:1.0.0 | 2 | +| 后端服务 | interro-robot-web.tar.gz | interro-robot-web:1.0.0 | 3 | +| 前端服务 | interro-robot-nginx.tar.gz | interro-robot-nginx:1.0.0 | 4 | + +> 注意:部署应用前需要先启动数据库interro_robot模式,并执行数据库初始化脚本。 + +#### 部署语义匹配服务 +> 进入paddlespeech目录下 + +```shell +# 加载镜像 +docker load -i interro-robot-paddlespeech.tar.gz + +# 启动容器命令: +docker run -itd --name interro-robot-paddlespeech -p {映射端口}:8089 interro-robot-paddlespeech:1.0.0 + +- 启动容器命令示例: +docker run -itd --name interro-robot-paddlespeech -p 8089:8089 interro-robot-paddlespeech:1.0.0 + +``` + +#### 部署语语义匹配服务 +> 进入interro-robot-qa目录下 + +```shell + +#加载镜像 +- 在interro-robot-qa目录下执行命令: docker load -i interro-robot-qa.tar.gz + +- 启动容器命令: +docker run -itd --name interro-robot-qa -p {映射端口}:8000 interro-robot-qa:1.0.0 + +- 启动容器命令示例: +docker run -itd --name interro-robot-qa -p 9711:8000 interro-robot-qa:1.0.0 + +``` + + +#### web端docker构建 +> 把docker文件夹放到服务器目录下,进入目录 +```shell +- 进入web目录 +# 加载镜像文件 +docker load -i interro-robot-web.tar.gz + +# 启动容器 +#参数说明: +## env.datasource.ip 数据库地址 +## env.datasource.username 数据库用户名 +## env.datasource.password 数据库密码 +## env.match.ip 语义匹配服务地址 +## env.paddle-speech.ip 语音转换服务地址 + +# 启动容器命令: +docker run --name interro-robot-web -p {映射端口}:9800 -v {案件档案存放地址}:/data/intro-robot/ -d interro-robot-web:1.0.0 \ + --env.datasource.ip={pg数据库ip:port} --env.datasource.username={pg数据库用户名}--env.datasource.password={pg数据库密码} \ + --env.match.ip={语义匹配服务ip:port} --env.paddle-speech.ip={语音转换服务ip:port} + +# 启动容器命令示例 +docker run --name interro-robot-web -p 9800:9800 -v /data/intro-robot/:/data/intro-robot/ -d interro-robot-web:1.0.0 \ + --env.datasource.ip=192.168.10.137:5432 --env.datasource.username=postgres --env.datasource.password='123456' \ + --env.match.ip=192.168.10.137:9711 --env.paddle-speech.ip=192.168.10.137:8090 + + +# 进入容器命令 +docker exec -it interro-robot-web sh +``` + +### nginx docker构建 + +```shell +# 进入nginx目录 +docker laod -i interro-robot-nginx.tar.gz + +# 启动nginx容器 +# 参数说明: +## UPSTREAM_WEB_SERVERS 配置web服务地址 + +# 启动nginx容器命令: +docker run --name interro-robot-nginx -p {映射端口}:443 -d -e UPSTREAM_WEB_SERVERS={后端服务ip:port} interro-robot-nginx:1.0.0 + +# 启动nginx容器命令示例 +docker run --name interro-robot-nginx -p 543:443 -d -e UPSTREAM_WEB_SERVERS=192.168.10.137:9800 interro-robot-nginx:1.0.0 +``` \ No newline at end of file