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
47df54bc
Commit
47df54bc
authored
Dec 24, 2024
by
alex yao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
style: agent应用数据上报
parent
7581c5e3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
31 deletions
+27
-31
AgentApplicationInfoRestImpl.java
...t_application/rest/impl/AgentApplicationInfoRestImpl.java
+4
-11
DataAnalyzeReportService.java
.../poc/data_analyze/aggregate/DataAnalyzeReportService.java
+9
-0
DataAnalyzeReportServiceImpl.java
..._analyze/aggregate/impl/DataAnalyzeReportServiceImpl.java
+9
-0
AgentApplicationApiServiceImpl.java
...expose/aggregate/impl/AgentApplicationApiServiceImpl.java
+1
-8
AgentApplicationServiceImpl.java
...oc/expose/aggregate/impl/AgentApplicationServiceImpl.java
+4
-12
No files found.
src/main/java/cn/com/poc/agent_application/rest/impl/AgentApplicationInfoRestImpl.java
View file @
47df54bc
...
@@ -266,7 +266,10 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -266,7 +266,10 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
agentSystem
,
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
topP
,
agentSystem
,
kdIds
.
toArray
(
new
Integer
[
0
]),
infoEntity
.
getCommunicationTurn
(),
topP
,
temperature
,
dto
.
getMessages
(),
tools
,
dto
.
getFileUrls
(),
true
,
httpServletResponse
);
temperature
,
dto
.
getMessages
(),
tools
,
dto
.
getFileUrls
(),
true
,
httpServletResponse
);
//数据采集
//数据采集
dataReport
(
dto
,
userBaseEntity
,
agentId
,
pointDeductionNum
);
if
(
StringUtils
.
isBlank
(
dto
.
getChannel
()))
{
dto
.
setChannel
(
DataAnalyzeChannelEnum
.
preview
.
getChannel
());
}
dataAnalyzeReportService
.
dataReport
(
dto
.
getAgentId
(),
DataAnalyzeChannelEnum
.
valueOf
(
dto
.
getChannel
()),
userBaseEntity
.
getUserId
(),
pointDeductionNum
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
httpServletResponse
.
setContentType
(
"text/event-stream"
);
httpServletResponse
.
setContentType
(
"text/event-stream"
);
PrintWriter
writer
=
httpServletResponse
.
getWriter
();
PrintWriter
writer
=
httpServletResponse
.
getWriter
();
...
@@ -479,14 +482,4 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
...
@@ -479,14 +482,4 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
Assert
.
notNull
(
agentId
);
Assert
.
notNull
(
agentId
);
LongMemory
.
clean
(
agentId
);
LongMemory
.
clean
(
agentId
);
}
}
private
void
dataReport
(
AgentApplicationPreviewDto
dto
,
UserBaseEntity
userBaseEntity
,
String
agentId
,
Long
pointDeductionNum
)
{
if
(
StringUtils
.
isBlank
(
dto
.
getChannel
()))
{
dto
.
setChannel
(
DataAnalyzeChannelEnum
.
preview
.
getChannel
());
}
BigDecimal
points
=
new
BigDecimal
(
pointDeductionNum
).
divide
(
new
BigDecimal
(
100
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
dataAnalyzeReportService
.
dataReportByDialogue
(
userBaseEntity
.
getUserId
(),
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
DataAnalyzeChannelEnum
.
valueOf
(
dto
.
getChannel
()));
dataAnalyzeReportService
.
dataReportByPoint
(
userBaseEntity
.
getUserId
(),
points
,
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
DataAnalyzeChannelEnum
.
valueOf
(
dto
.
getChannel
()));
}
}
}
\ No newline at end of file
src/main/java/cn/com/poc/data_analyze/aggregate/DataAnalyzeReportService.java
View file @
47df54bc
...
@@ -34,4 +34,13 @@ public interface DataAnalyzeReportService {
...
@@ -34,4 +34,13 @@ public interface DataAnalyzeReportService {
*/
*/
void
dataReportByDialogue
(
Long
memberId
,
DataAnalyzeTypeEnum
type
,
String
relationId
,
DataAnalyzeChannelEnum
channel
);
void
dataReportByDialogue
(
Long
memberId
,
DataAnalyzeTypeEnum
type
,
String
relationId
,
DataAnalyzeChannelEnum
channel
);
/**
* 数据上报-聚合上报【对话次数+积分使用情况】
*
* @param agentId 应用ID
* @param channel 渠道
* @param userId 用户ID
* @param pointDeductionNum 积分扣除数量-单位分
*/
boolean
dataReport
(
String
agentId
,
DataAnalyzeChannelEnum
channel
,
Long
userId
,
Long
pointDeductionNum
);
}
}
src/main/java/cn/com/poc/data_analyze/aggregate/impl/DataAnalyzeReportServiceImpl.java
View file @
47df54bc
...
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
...
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
/**
/**
* @author alex.yao
* @author alex.yao
...
@@ -59,4 +60,12 @@ public class DataAnalyzeReportServiceImpl implements DataAnalyzeReportService {
...
@@ -59,4 +60,12 @@ public class DataAnalyzeReportServiceImpl implements DataAnalyzeReportService {
logger
.
error
(
"对话次数统计情况-数据统计异常"
,
e
);
logger
.
error
(
"对话次数统计情况-数据统计异常"
,
e
);
}
}
}
}
@Override
public
boolean
dataReport
(
String
agentId
,
DataAnalyzeChannelEnum
channel
,
Long
userId
,
Long
pointDeductionNum
)
{
BigDecimal
points
=
new
BigDecimal
(
pointDeductionNum
).
divide
(
new
BigDecimal
(
100
),
2
,
RoundingMode
.
HALF_UP
);
this
.
dataReportByDialogue
(
userId
,
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
channel
);
this
.
dataReportByPoint
(
userId
,
points
,
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
channel
);
return
true
;
}
}
}
src/main/java/cn/com/poc/expose/aggregate/impl/AgentApplicationApiServiceImpl.java
View file @
47df54bc
...
@@ -154,7 +154,7 @@ public class AgentApplicationApiServiceImpl implements AgentApplicationApiServic
...
@@ -154,7 +154,7 @@ public class AgentApplicationApiServiceImpl implements AgentApplicationApiServic
memberEquityService
.
rollbackPoint
(
reduceSn
);
memberEquityService
.
rollbackPoint
(
reduceSn
);
}
}
//数据采集
//数据采集
data
Report
(
agentId
,
DataAnalyzeChannelEnum
.
api
.
getChannel
()
,
profileEntity
.
getMemberId
(),
pointDeductionNum
);
data
AnalyzeReportService
.
dataReport
(
agentId
,
DataAnalyzeChannelEnum
.
api
,
profileEntity
.
getMemberId
(),
pointDeductionNum
);
}
}
private
void
saveRecord
(
String
conversationId
,
String
query
,
String
agentId
,
BizAgentApplicationApiProfileEntity
profileEntity
,
Long
inputTimestamp
,
BizAgentApplicationPublishEntity
infoEntity
,
String
output
)
throws
Exception
{
private
void
saveRecord
(
String
conversationId
,
String
query
,
String
agentId
,
BizAgentApplicationApiProfileEntity
profileEntity
,
Long
inputTimestamp
,
BizAgentApplicationPublishEntity
infoEntity
,
String
output
)
throws
Exception
{
...
@@ -305,11 +305,4 @@ public class AgentApplicationApiServiceImpl implements AgentApplicationApiServic
...
@@ -305,11 +305,4 @@ public class AgentApplicationApiServiceImpl implements AgentApplicationApiServic
messages
.
add
(
message
);
messages
.
add
(
message
);
return
messages
;
return
messages
;
}
}
private
void
dataReport
(
String
agentId
,
String
channel
,
Long
userId
,
Long
pointDeductionNum
)
{
BigDecimal
points
=
new
BigDecimal
(
pointDeductionNum
).
divide
(
new
BigDecimal
(
100
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
dataAnalyzeReportService
.
dataReportByDialogue
(
userId
,
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
DataAnalyzeChannelEnum
.
valueOf
(
channel
));
dataAnalyzeReportService
.
dataReportByPoint
(
userId
,
points
,
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
DataAnalyzeChannelEnum
.
valueOf
(
channel
));
}
}
}
src/main/java/cn/com/poc/expose/aggregate/impl/AgentApplicationServiceImpl.java
View file @
47df54bc
...
@@ -185,7 +185,10 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
...
@@ -185,7 +185,10 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
outputRecord
.
setContent
(
output
);
outputRecord
.
setContent
(
output
);
bizAgentApplicationDialoguesRecordService
.
save
(
outputRecord
);
bizAgentApplicationDialoguesRecordService
.
save
(
outputRecord
);
//数据采集
//数据采集
dataReport
(
agentId
,
channel
,
userBaseEntity
,
pointDeductionNum
);
if
(
StringUtils
.
isBlank
(
channel
))
{
channel
=
DataAnalyzeChannelEnum
.
link_share
.
getChannel
();
}
dataAnalyzeReportService
.
dataReport
(
agentId
,
DataAnalyzeChannelEnum
.
valueOf
(
channel
),
userBaseEntity
.
getUserId
(),
pointDeductionNum
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
memberEquityService
.
rollbackPoint
(
reduceSn
);
memberEquityService
.
rollbackPoint
(
reduceSn
);
throw
new
BusinessException
(
e
.
getMessage
());
throw
new
BusinessException
(
e
.
getMessage
());
...
@@ -438,15 +441,4 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
...
@@ -438,15 +441,4 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
logger
.
info
(
"--------- Build Messages dialogsId:{},agentId:{},messages:{}--------------"
,
dialogsId
,
agentId
,
messages
);
logger
.
info
(
"--------- Build Messages dialogsId:{},agentId:{},messages:{}--------------"
,
dialogsId
,
agentId
,
messages
);
return
messages
;
return
messages
;
}
}
private
void
dataReport
(
String
agentId
,
String
channel
,
UserBaseEntity
userBaseEntity
,
Long
pointDeductionNum
)
{
if
(
StringUtils
.
isBlank
(
channel
))
{
channel
=
DataAnalyzeChannelEnum
.
link_share
.
getChannel
();
}
BigDecimal
points
=
new
BigDecimal
(
pointDeductionNum
).
divide
(
new
BigDecimal
(
100
),
2
,
BigDecimal
.
ROUND_HALF_UP
);
dataAnalyzeReportService
.
dataReportByDialogue
(
userBaseEntity
.
getUserId
(),
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
DataAnalyzeChannelEnum
.
valueOf
(
channel
));
dataAnalyzeReportService
.
dataReportByPoint
(
userBaseEntity
.
getUserId
(),
points
,
DataAnalyzeTypeEnum
.
AGENT
,
agentId
,
DataAnalyzeChannelEnum
.
valueOf
(
channel
));
}
}
}
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