Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elleai
Project
Project
Details
Activity
Releases
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
ai-tech
E
ellehuis-group
backend
elleai
Commits
25f28eb2
Commit
25f28eb2
authored
Nov 06, 2024
by
陈立彬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
问答新会话bugfix
parent
6a85315d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
27 deletions
+29
-27
ExamineRecordMobileDto.java
...leai/application/dto/response/ExamineRecordMobileDto.java
+2
-2
AppChatCompletionService.java
.../elleai/application/service/AppChatCompletionService.java
+26
-24
AppExamineService.java
.../breeze/elleai/application/service/AppExamineService.java
+1
-1
No files found.
src/main/java/cn/breeze/elleai/application/dto/response/ExamineRecordMobileDto.java
View file @
25f28eb2
...
@@ -63,14 +63,14 @@ public class ExamineRecordMobileDto implements Serializable {
...
@@ -63,14 +63,14 @@ public class ExamineRecordMobileDto implements Serializable {
*/
*/
@Schema
(
description
=
"综合评分"
)
@Schema
(
description
=
"综合评分"
)
@JsonProperty
(
"overall_score"
)
@JsonProperty
(
"overall_score"
)
private
Floa
t
overallScore
;
private
in
t
overallScore
;
/**
/**
* 平均分
* 平均分
*/
*/
@Schema
(
description
=
"平均分"
)
@Schema
(
description
=
"平均分"
)
@JsonProperty
(
"avg_score"
)
@JsonProperty
(
"avg_score"
)
private
Floa
t
avgScore
;
private
in
t
avgScore
;
/**
/**
* 综合评价
* 综合评价
...
...
src/main/java/cn/breeze/elleai/application/service/AppChatCompletionService.java
View file @
25f28eb2
...
@@ -327,17 +327,8 @@ public class AppChatCompletionService {
...
@@ -327,17 +327,8 @@ public class AppChatCompletionService {
public
UserAskResultMobileDto
userAsk
(
UserPrincipal
userPrincipal
,
UserQaMobileRequestDto
request
)
{
public
UserAskResultMobileDto
userAsk
(
UserPrincipal
userPrincipal
,
UserQaMobileRequestDto
request
)
{
UserAskResultMobileDto
result
=
new
UserAskResultMobileDto
();
UserAskResultMobileDto
result
=
new
UserAskResultMobileDto
();
// 获取会话详情
// dify session id
UserQaRequestModel
requestModel
=
new
UserQaRequestModel
();
requestModel
.
setChatCompletionId
(
request
.
getChatCompletionId
());
requestModel
.
setUserId
(
userPrincipal
.
getUserId
());
UserChatCompletionResponseModel
ccModel
=
chatCompletionService
.
userQaDetail
(
requestModel
);
String
sessionId
=
""
;
String
sessionId
=
""
;
if
(
Objects
.
nonNull
(
ccModel
)
&&
StrUtil
.
isNotEmpty
(
ccModel
.
getSessionId
()))
{
sessionId
=
ccModel
.
getSessionId
();
}
// 更新会话信息
// 更新会话信息
UserChatCompletionSaveModel
saveModel
=
new
UserChatCompletionSaveModel
();
UserChatCompletionSaveModel
saveModel
=
new
UserChatCompletionSaveModel
();
saveModel
.
setUserId
(
userPrincipal
.
getUserId
());
saveModel
.
setUserId
(
userPrincipal
.
getUserId
());
...
@@ -346,10 +337,20 @@ public class AppChatCompletionService {
...
@@ -346,10 +337,20 @@ public class AppChatCompletionService {
saveModel
.
setLastQuestion
(
request
.
getContent
());
saveModel
.
setLastQuestion
(
request
.
getContent
());
saveModel
.
setShopId
(
userPrincipal
.
getShopId
());
saveModel
.
setShopId
(
userPrincipal
.
getShopId
());
saveModel
.
setShopName
(
userPrincipal
.
getShopName
());
saveModel
.
setShopName
(
userPrincipal
.
getShopName
());
// 首次提问
if
(
Objects
.
isNull
(
request
.
getChatCompletionId
())
||
(
Objects
.
nonNull
(
ccModel
)
&&
StrUtil
.
isEmpty
(
ccModel
.
getFirstQuestion
())))
{
// 新会话首次提问
if
(
Objects
.
isNull
(
request
.
getChatCompletionId
()))
{
saveModel
.
setCreateTime
(
new
Date
());
saveModel
.
setCreateTime
(
new
Date
());
saveModel
.
setFirstQuestion
(
request
.
getContent
());
saveModel
.
setFirstQuestion
(
request
.
getContent
());
}
else
{
// 获取会话详情
UserQaRequestModel
requestModel
=
new
UserQaRequestModel
();
requestModel
.
setChatCompletionId
(
request
.
getChatCompletionId
());
requestModel
.
setUserId
(
userPrincipal
.
getUserId
());
UserChatCompletionResponseModel
ccModel
=
chatCompletionService
.
userQaDetail
(
requestModel
);
if
(
Objects
.
nonNull
(
ccModel
)
&&
StrUtil
.
isNotEmpty
(
ccModel
.
getSessionId
()))
{
sessionId
=
ccModel
.
getSessionId
();
}
}
}
Integer
chatCompletionId
=
chatCompletionService
.
saveUserQaSession
(
saveModel
);
Integer
chatCompletionId
=
chatCompletionService
.
saveUserQaSession
(
saveModel
);
...
@@ -386,17 +387,8 @@ public class AppChatCompletionService {
...
@@ -386,17 +387,8 @@ public class AppChatCompletionService {
* @return
* @return
*/
*/
public
Flux
<
ServerSentEvent
<
UserAskResultMobileDto
>>
userAsk4Stream
(
UserPrincipal
userPrincipal
,
UserQaMobileRequestDto
request
)
{
public
Flux
<
ServerSentEvent
<
UserAskResultMobileDto
>>
userAsk4Stream
(
UserPrincipal
userPrincipal
,
UserQaMobileRequestDto
request
)
{
// 获取会话详情
// dify session id
UserQaRequestModel
requestModel
=
new
UserQaRequestModel
();
requestModel
.
setChatCompletionId
(
request
.
getChatCompletionId
());
requestModel
.
setUserId
(
userPrincipal
.
getUserId
());
UserChatCompletionResponseModel
ccModel
=
chatCompletionService
.
userQaDetail
(
requestModel
);
String
sessionId
=
""
;
String
sessionId
=
""
;
if
(
Objects
.
nonNull
(
ccModel
)
&&
StrUtil
.
isNotEmpty
(
ccModel
.
getSessionId
()))
{
sessionId
=
ccModel
.
getSessionId
();
}
// 更新会话信息
// 更新会话信息
UserChatCompletionSaveModel
saveModel
=
new
UserChatCompletionSaveModel
();
UserChatCompletionSaveModel
saveModel
=
new
UserChatCompletionSaveModel
();
saveModel
.
setUserId
(
userPrincipal
.
getUserId
());
saveModel
.
setUserId
(
userPrincipal
.
getUserId
());
...
@@ -405,10 +397,20 @@ public class AppChatCompletionService {
...
@@ -405,10 +397,20 @@ public class AppChatCompletionService {
saveModel
.
setLastQuestion
(
request
.
getContent
());
saveModel
.
setLastQuestion
(
request
.
getContent
());
saveModel
.
setShopId
(
userPrincipal
.
getShopId
());
saveModel
.
setShopId
(
userPrincipal
.
getShopId
());
saveModel
.
setShopName
(
userPrincipal
.
getShopName
());
saveModel
.
setShopName
(
userPrincipal
.
getShopName
());
// 首次提问
if
(
Objects
.
isNull
(
request
.
getChatCompletionId
())
||
(
Objects
.
nonNull
(
ccModel
)
&&
StrUtil
.
isEmpty
(
ccModel
.
getFirstQuestion
())))
{
// 新会话首次提问
if
(
Objects
.
isNull
(
request
.
getChatCompletionId
()))
{
saveModel
.
setCreateTime
(
new
Date
());
saveModel
.
setCreateTime
(
new
Date
());
saveModel
.
setFirstQuestion
(
request
.
getContent
());
saveModel
.
setFirstQuestion
(
request
.
getContent
());
}
else
{
// 获取会话详情
UserQaRequestModel
requestModel
=
new
UserQaRequestModel
();
requestModel
.
setChatCompletionId
(
request
.
getChatCompletionId
());
requestModel
.
setUserId
(
userPrincipal
.
getUserId
());
UserChatCompletionResponseModel
ccModel
=
chatCompletionService
.
userQaDetail
(
requestModel
);
if
(
Objects
.
nonNull
(
ccModel
)
&&
StrUtil
.
isNotEmpty
(
ccModel
.
getSessionId
()))
{
sessionId
=
ccModel
.
getSessionId
();
}
}
}
Integer
chatCompletionId
=
chatCompletionService
.
saveUserQaSession
(
saveModel
);
Integer
chatCompletionId
=
chatCompletionService
.
saveUserQaSession
(
saveModel
);
...
...
src/main/java/cn/breeze/elleai/application/service/AppExamineService.java
View file @
25f28eb2
...
@@ -590,7 +590,7 @@ public class AppExamineService {
...
@@ -590,7 +590,7 @@ public class AppExamineService {
}
}
return
detail
;
return
detail
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
result
.
setAvgScore
(
avgScore
.
floa
tValue
());
result
.
setAvgScore
(
avgScore
.
in
tValue
());
result
.
setDetails
(
details
);
result
.
setDetails
(
details
);
}
}
}
}
...
...
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