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
9082f9ec
Commit
9082f9ec
authored
Apr 10, 2025
by
yangyw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 增加片段返回
parent
282ab1ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
AppChatCompletionService.java
.../elleai/application/service/AppChatCompletionService.java
+4
-1
No files found.
src/main/java/cn/breeze/elleai/application/service/AppChatCompletionService.java
View file @
9082f9ec
...
...
@@ -592,6 +592,7 @@ public class AppChatCompletionService {
final
Boolean
[]
replyFlag
=
{
false
};
String
finalSessionId
=
sessionId
;
List
<
String
>
references
=
Lists
.
newArrayList
();
final
Boolean
[]
referenceFlag
=
{
false
};
return
webClient
.
post
().
uri
(
dsApiBase
).
accept
(
MediaType
.
TEXT_EVENT_STREAM
).
bodyValue
(
reqBody
.
toJSONString
()).
exchangeToFlux
(
r
->
r
.
bodyToFlux
(
String
.
class
))
.
mapNotNull
(
v
->
{
log
.
info
(
"ds:{}"
,
v
);
...
...
@@ -627,7 +628,8 @@ public class AppChatCompletionService {
if
(
StrUtil
.
isBlank
(
recordId
[
0
])
&&
StrUtil
.
isNotBlank
(
payload
.
getString
(
"record_id"
)))
{
recordId
[
0
]
=
payload
.
getString
(
"record_id"
);
}
if
(
CollUtil
.
isEmpty
(
references
)
&&
payload
.
containsKey
(
"knowledge"
))
{
if
(
referenceFlag
[
0
]
==
false
&&
CollUtil
.
isEmpty
(
references
)
&&
payload
.
containsKey
(
"knowledge"
))
{
referenceFlag
[
0
]
=
true
;
JSONArray
knowledge
=
payload
.
getJSONArray
(
"knowledge"
);
if
(
ObjectUtil
.
isNotNull
(
knowledge
)
&&
knowledge
.
size
()
>
0
)
{
for
(
Object
kb
:
knowledge
)
{
...
...
@@ -640,6 +642,7 @@ public class AppChatCompletionService {
if
(
CollUtil
.
isNotEmpty
(
references
))
{
try
{
List
<
String
>
docs
=
tencentCloudFacade
.
getKbSegment
(
references
);
log
.
info
(
"get kb docs:{}"
,
docs
.
size
());
result
.
setReferences
(
docs
);
}
catch
(
TencentCloudSDKException
e
)
{
log
.
error
(
"getKbSegment error,{}"
,
e
.
getMessage
());
...
...
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