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
0
Merge Requests
0
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
95e34fd8
Commit
95e34fd8
authored
Jun 10, 2025
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(csv): 对接CSV Chain
parent
2c822fd6
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
149 additions
and
0 deletions
+149
-0
AIDialogueService.java
...party/resource/demand/ai/aggregate/AIDialogueService.java
+7
-0
AIDialogueServiceImpl.java
...ource/demand/ai/aggregate/impl/AIDialogueServiceImpl.java
+14
-0
CSVChainResponse.java
.../resource/demand/ai/entity/csvchain/CSVChainResponse.java
+60
-0
CSVChainResult.java
...ty/resource/demand/ai/entity/csvchain/CSVChainResult.java
+43
-0
DgtoolsApiRoute.java
.../thirdparty/resource/demand/ai/route/DgtoolsApiRoute.java
+5
-0
ChainService.java
...main/java/cn/com/poc/thirdparty/service/ChainService.java
+3
-0
ChainServiceImpl.java
.../cn/com/poc/thirdparty/service/impl/ChainServiceImpl.java
+17
-0
No files found.
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/aggregate/AIDialogueService.java
View file @
95e34fd8
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
aggregate
;
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
aggregate
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.function.FunctionCallResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.function.FunctionCallResponse
;
...
@@ -40,4 +42,9 @@ public interface AIDialogueService {
...
@@ -40,4 +42,9 @@ public interface AIDialogueService {
* 调用DB_CHAIN 接口
* 调用DB_CHAIN 接口
*/
*/
DBChainResult
dbChain
(
DBChainResponse
response
);
DBChainResult
dbChain
(
DBChainResponse
response
);
/**
* 调用CSV_CHAIN 接口
*/
CSVChainResult
csvChain
(
CSVChainResponse
response
);
}
}
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/aggregate/impl/AIDialogueServiceImpl.java
View file @
95e34fd8
...
@@ -2,6 +2,8 @@ package cn.com.poc.thirdparty.resource.demand.ai.aggregate.impl;
...
@@ -2,6 +2,8 @@ package cn.com.poc.thirdparty.resource.demand.ai.aggregate.impl;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.common.utils.JsonUtils
;
import
cn.com.poc.thirdparty.resource.demand.ai.aggregate.AIDialogueService
;
import
cn.com.poc.thirdparty.resource.demand.ai.aggregate.AIDialogueService
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.function.FunctionCallResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.function.FunctionCallResponse
;
...
@@ -101,6 +103,18 @@ public class AIDialogueServiceImpl implements AIDialogueService {
...
@@ -101,6 +103,18 @@ public class AIDialogueServiceImpl implements AIDialogueService {
return
dgToolsAbstractHttpClient
.
doRequest
(
url
,
response
,
headers
);
return
dgToolsAbstractHttpClient
.
doRequest
(
url
,
response
,
headers
);
}
}
@Override
public
CSVChainResult
csvChain
(
CSVChainResponse
response
)
{
String
url
=
DgtoolsApiRoute
.
DgtoolsAI
.
CSV_CHAIN
;
response
.
setApiKey
(
API_KEY
);
List
<
Header
>
headers
=
new
ArrayList
<
Header
>()
{{
add
(
DgtoolsApiRoute
.
JSON_HEADER
);
add
(
DgtoolsApiRoute
.
AI_HEADER
);
add
(
new
BasicHeader
(
DgtoolsApiRoute
.
HEADER_X_PLATFORM_AUTHORIZATION
,
demandAuthService
.
getToken
()));
}};
return
dgToolsAbstractHttpClient
.
doRequest
(
url
,
response
,
headers
);
}
private
BufferedReader
largeModelStream
(
LargeModelDemandResponse
request
)
throws
IOException
{
private
BufferedReader
largeModelStream
(
LargeModelDemandResponse
request
)
throws
IOException
{
String
jsonBody
=
dgToolsAbstractHttpClient
.
buildJson
(
request
);
String
jsonBody
=
dgToolsAbstractHttpClient
.
buildJson
(
request
);
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
CloseableHttpClient
httpClient
=
HttpClients
.
createDefault
();
...
...
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/entity/csvchain/CSVChainResponse.java
0 → 100644
View file @
95e34fd8
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
entity
.
csvchain
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.resource.demand.dgTools.request.AbstractRequest
;
import
java.io.Serializable
;
/**
* @author alex.yao
* @date 2025/6/10
*/
public
class
CSVChainResponse
extends
AbstractRequest
<
CSVChainResult
>
implements
Serializable
{
private
String
question
;
private
String
context
;
private
String
filePath
;
private
String
apiKey
;
public
String
getQuestion
()
{
return
question
;
}
public
void
setQuestion
(
String
question
)
{
this
.
question
=
question
;
}
public
String
getContext
()
{
return
context
;
}
public
void
setContext
(
String
context
)
{
this
.
context
=
context
;
}
public
String
getFilePath
()
{
return
filePath
;
}
public
void
setFilePath
(
String
filePath
)
{
this
.
filePath
=
filePath
;
}
public
String
getApiKey
()
{
return
apiKey
;
}
public
void
setApiKey
(
String
apiKey
)
{
this
.
apiKey
=
apiKey
;
}
@Override
public
String
getMethod
()
throws
Exception
{
return
null
;
}
}
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/entity/csvchain/CSVChainResult.java
0 → 100644
View file @
95e34fd8
package
cn
.
com
.
poc
.
thirdparty
.
resource
.
demand
.
ai
.
entity
.
csvchain
;
import
cn.com.poc.thirdparty.resource.demand.dgTools.result.AbstractResult
;
import
java.io.Serializable
;
/**
* @author alex.yao
* @date 2025/6/10
*/
public
class
CSVChainResult
extends
AbstractResult
implements
Serializable
{
private
String
status
;
private
String
result
;
private
String
message
;
public
String
getStatus
()
{
return
status
;
}
public
void
setStatus
(
String
status
)
{
this
.
status
=
status
;
}
public
String
getResult
()
{
return
result
;
}
public
void
setResult
(
String
result
)
{
this
.
result
=
result
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
}
src/main/java/cn/com/poc/thirdparty/resource/demand/ai/route/DgtoolsApiRoute.java
View file @
95e34fd8
...
@@ -291,6 +291,11 @@ public interface DgtoolsApiRoute {
...
@@ -291,6 +291,11 @@ public interface DgtoolsApiRoute {
* DB_CHAIN 调用
* DB_CHAIN 调用
*/
*/
String
DATABASE_CHAIN
=
"largeModelRest/dbChain.json"
;
String
DATABASE_CHAIN
=
"largeModelRest/dbChain.json"
;
/**
* CSV_CHAIN 调用
*/
String
CSV_CHAIN
=
"largeModelRest/csvChain.json"
;
}
}
interface
ClickHouse
{
interface
ClickHouse
{
...
...
src/main/java/cn/com/poc/thirdparty/service/ChainService.java
View file @
95e34fd8
package
cn
.
com
.
poc
.
thirdparty
.
service
;
package
cn
.
com
.
poc
.
thirdparty
.
service
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
...
@@ -10,5 +12,6 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult;
...
@@ -10,5 +12,6 @@ import cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult;
public
interface
ChainService
{
public
interface
ChainService
{
DBChainResult
dbChain
(
DBChainResponse
response
);
DBChainResult
dbChain
(
DBChainResponse
response
);
CSVChainResult
csvChain
(
CSVChainResponse
response
);
}
}
src/main/java/cn/com/poc/thirdparty/service/impl/ChainServiceImpl.java
View file @
95e34fd8
...
@@ -2,6 +2,8 @@ package cn.com.poc.thirdparty.service.impl;
...
@@ -2,6 +2,8 @@ package cn.com.poc.thirdparty.service.impl;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.poc.common.utils.StringUtils
;
import
cn.com.poc.thirdparty.resource.demand.ai.aggregate.AIDialogueService
;
import
cn.com.poc.thirdparty.resource.demand.ai.aggregate.AIDialogueService
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.csvchain.CSVChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResponse
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.resource.demand.ai.entity.dbchain.DBChainResult
;
import
cn.com.poc.thirdparty.service.ChainService
;
import
cn.com.poc.thirdparty.service.ChainService
;
...
@@ -38,4 +40,19 @@ public class ChainServiceImpl implements ChainService {
...
@@ -38,4 +40,19 @@ public class ChainServiceImpl implements ChainService {
return
dbChainResult
;
return
dbChainResult
;
}
}
@Override
public
CSVChainResult
csvChain
(
CSVChainResponse
response
)
{
logger
.
info
(
"csvChain response : {}"
,
response
);
CSVChainResult
csvChainResult
=
aiDialogueService
.
csvChain
(
response
);
if
(
csvChainResult
==
null
||
csvChainResult
.
getStatus
().
equals
(
"error"
))
{
logger
.
error
(
"csvChain result error : {} , response:{}"
,
csvChainResult
,
response
);
return
null
;
}
if
(
StringUtils
.
isBlank
(
csvChainResult
.
getResult
()))
{
logger
.
warn
(
"csvChain result sqlResult is blank : {} , response:{}"
,
csvChainResult
,
response
);
return
null
;
}
return
csvChainResult
;
}
}
}
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