Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
poc-api
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
poc
poc-api
Commits
64582e53
Commit
64582e53
authored
Aug 21, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix[智能问数]: 修复[数据库查询异常]断连问题
parent
cf7758b9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
149 additions
and
141 deletions
+149
-141
AiBiServiceImpl.java
...java/cn/com/poc/ai_bi/aggregate/impl/AiBiServiceImpl.java
+136
-133
ChainServiceImpl.java
.../cn/com/poc/thirdparty/service/impl/ChainServiceImpl.java
+13
-8
No files found.
src/main/java/cn/com/poc/ai_bi/aggregate/impl/AiBiServiceImpl.java
View file @
64582e53
...
...
@@ -212,9 +212,10 @@ public class AiBiServiceImpl implements AiBiService {
@Override
public
void
callV2
(
String
dialoguesId
,
String
input
,
String
fileUrl
,
Integer
[]
knowledgeIds
,
Integer
[]
databaseIds
,
Long
userId
)
throws
Exception
{
public
void
callV2
(
String
dialoguesId
,
String
input
,
String
fileUrl
,
Integer
[]
knowledgeIds
,
Integer
[]
databaseIds
,
Long
userId
)
throws
IO
Exception
{
SSEUtil
sseUtil
=
new
SSEUtil
();
// 保存对话基础信息
try
{
BizAiDialoguesEntity
bizAiDialoguesEntity
=
new
BizAiDialoguesEntity
();
bizAiDialoguesEntity
.
setMemberId
(
userId
);
bizAiDialoguesEntity
.
setDialoguesId
(
dialoguesId
);
...
...
@@ -236,7 +237,7 @@ public class AiBiServiceImpl implements AiBiService {
throw
new
BusinessException
(
"仅支持单个数据库"
);
}
long
inputTime
=
System
.
currentTimeMillis
();
SSEUtil
sseUtil
=
new
SSEUtil
();
CSVChainResult
csvChainResult
=
new
CSVChainResult
();
List
<
DBChainResult
>
dbChainResults
=
new
ArrayList
<>();
String
functionRecord
=
StringUtils
.
EMPTY
;
...
...
@@ -285,14 +286,13 @@ public class AiBiServiceImpl implements AiBiService {
echartJSONObject
.
put
(
"sql_result"
,
dbChainResult
.
getSqlResult
());
echartJSONObject
.
put
(
"question"
,
input
);
AbstractFunctionResult
<
String
>
functionResult
=
eChartGenerateFunction
.
doFunction
(
echartJSONObject
.
toJSONString
(),
null
,
null
,
null
);
String
eChartOption
=
functionResult
.
getFunctionResult
();
//输出EChart
if
(
eChartOption
!=
null
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
eChartOption
);
if
(
functionResult
!=
null
&&
StringUtils
.
isNotBlank
(
functionResult
.
getFunctionResult
())
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
functionResult
.
getFunctionResult
()
);
if
(!
jsonObject
.
containsKey
(
"skip"
))
{
ToolFunction
toolFunction
=
new
ToolFunction
();
toolFunction
.
setName
(
"echart_function"
);
toolFunction
.
setResult
(
eChartOption
);
toolFunction
.
setResult
(
functionResult
.
getFunctionResult
()
);
toolFunction
.
setDisplayFormat
(
"json"
);
toolFunction
.
setArguments
(
null
);
result
=
new
LargeModelDemandResult
();
...
...
@@ -361,6 +361,9 @@ public class AiBiServiceImpl implements AiBiService {
bizAgentApplicationDialoguesRecordService
.
save
(
inputRecord
);
bizAgentApplicationDialoguesRecordService
.
save
(
assistantRecord
);
}
catch
(
Exception
e
)
{
sseUtil
.
completeByError
(
e
.
getMessage
());
}
}
...
...
src/main/java/cn/com/poc/thirdparty/service/impl/ChainServiceImpl.java
View file @
64582e53
...
...
@@ -33,6 +33,7 @@ public class ChainServiceImpl implements ChainService {
@Override
public
DBChainResult
dbChain
(
DBChainResponse
response
)
{
logger
.
info
(
"dbChain response : {}"
,
response
);
try
{
DBChainResult
dbChainResult
=
aiDialogueService
.
dbChain
(
response
);
if
(
dbChainResult
==
null
||
dbChainResult
.
getStatus
().
equals
(
"error"
))
{
logger
.
error
(
"dbChain result error : {} , response:{}"
,
dbChainResult
,
response
);
...
...
@@ -43,6 +44,10 @@ public class ChainServiceImpl implements ChainService {
return
null
;
}
return
dbChainResult
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"调用数据库失败:{}"
,
e
.
getMessage
());
return
null
;
}
}
@Override
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment