File tree Expand file tree Collapse file tree 1 file changed +1
-3
lines changed
spring-ai-adapter/src/main/java/com/javaaidev/chatagent/springai Expand file tree Collapse file tree 1 file changed +1
-3
lines changed Original file line number Diff line number Diff line change 1616import org .springframework .ai .chat .model .ChatResponse ;
1717import org .springframework .ai .chat .model .Generation ;
1818import org .springframework .http .codec .ServerSentEvent ;
19- import org .springframework .util .StringUtils ;
2019import reactor .core .publisher .Flux ;
2120
2221/**
@@ -79,9 +78,8 @@ public static Flux<ServerSentEvent<ChatAgentResponse>> toStreamingResponse(
7978 Flux <ChatResponse > chatResponse ) {
8079 return chatResponse .concatMap (
8180 response -> Flux .fromIterable (response .getResults ()))
82- .filter (generation -> Objects .nonNull (generation .getOutput ()))
81+ .filter (generation -> Objects .nonNull (generation .getOutput (). getText () ))
8382 .map (generation -> generation .getOutput ().getText ())
84- .filter (StringUtils ::hasText )
8583 .map (text -> ServerSentEvent .<ChatAgentResponse >builder ()
8684 .data (new ChatAgentResponse (
8785 List .of (new TextContentPart (text ))))
You can’t perform that action at this time.
0 commit comments