Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
K
know-base
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
张京坤
know-base
Commits
45234c7f
提交
45234c7f
authored
1月 08, 2024
作者:
ChenShiQiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
IntelligentQa
上级
853be110
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
52 行增加
和
2 行删除
+52
-2
KnowledgeController.java
...ava/com/zzsn/knowbase/controller/KnowledgeController.java
+28
-2
IntelligentQaParam.java
src/main/java/com/zzsn/knowbase/vo/IntelligentQaParam.java
+22
-0
application.yml
src/main/resources/application.yml
+2
-0
没有找到文件。
src/main/java/com/zzsn/knowbase/controller/KnowledgeController.java
浏览文件 @
45234c7f
package
com
.
zzsn
.
knowbase
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.zzsn.knowbase.entity.AiReportScienceFile
;
import
com.zzsn.knowbase.entity.Knowledge
;
import
com.zzsn.knowbase.service.IKnowledgeService
;
import
com.zzsn.knowbase.util.DocUtil
;
import
com.zzsn.knowbase.vo.AiReportScienceFileVo
;
import
com.zzsn.knowbase.util.HttpUtil
;
import
com.zzsn.knowbase.vo.IntelligentQaParam
;
import
com.zzsn.knowbase.vo.KnowledgeParam
;
import
com.zzsn.knowbase.vo.KnowledgeVO
;
import
com.zzsn.knowbase.vo.Result
;
...
...
@@ -13,10 +15,12 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.IOException
;
import
java.util.Arrays
;
/**
* @Description: 知识
...
...
@@ -31,6 +35,9 @@ public class KnowledgeController {
@Autowired
private
IKnowledgeService
knowledgeService
;
@Value
(
"${python.IntelligentQaUrl:}"
)
private
String
IntelligentQaUrl
;
/**
* 分页列表查询
*/
...
...
@@ -89,4 +96,23 @@ public class KnowledgeController {
String
s
=
DocUtil
.
docParseHtml
(
filePath
);
return
Result
.
OK
(
s
);
}
/**
* 智能问答
*
* @param intelligentQaParam
* @return
*/
@PostMapping
(
value
=
"/IntelligentQa"
)
public
Result
<?>
intelligentQa
(
IntelligentQaParam
intelligentQaParam
)
throws
IOException
{
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"question"
,
intelligentQaParam
.
getQuestion
());
params
.
put
(
"knowledge_base_id"
,
Arrays
.
asList
(
intelligentQaParam
.
getKnowledgeProjectIds
().
split
(
","
)));
String
result
=
HttpUtil
.
doPost
(
IntelligentQaUrl
,
params
,
120000
);
if
(!
result
.
isEmpty
()){
JSONObject
jsonObject
=
JSON
.
parseObject
(
result
);
return
Result
.
OK
(
jsonObject
.
get
(
"result"
));
}
return
Result
.
error
(
"响应失败"
);
}
}
src/main/java/com/zzsn/knowbase/vo/IntelligentQaParam.java
0 → 100644
浏览文件 @
45234c7f
package
com
.
zzsn
.
knowbase
.
vo
;
import
lombok.Data
;
/**
* 智能问答入参
*
* @author ShiQiangChen
* @date 2024/1/6
*/
@Data
public
class
IntelligentQaParam
{
/**
* 问题
*/
private
String
question
;
/**
* 知识库ids
*/
private
String
knowledgeProjectIds
;
}
src/main/resources/application.yml
浏览文件 @
45234c7f
...
...
@@ -38,6 +38,8 @@ mybatis-plus:
configuration
:
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
map-underscore-to-camel-case
:
true
python
:
IntelligentQaUrl
:
http://116.63.179.212:7862/platform/chat
know
:
thirdpartyurl
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论