Skip to content

Commit 3878c1a

Browse files
author
kevin
committed
feat: support real incremental output in MultiModalConversation streaming
1 parent 7250666 commit 3878c1a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main/java/com/alibaba/dashscope/aigc/multimodalconversation/MultiModalConversation.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,19 +280,24 @@ private void preprocessInput(MultiModalConversationParam param)
280280
/**
281281
* Modifies the parameters for internal streaming optimization. If incrementalOutput is false,
282282
* modifies the MultiModalConversationParam object to set incrementalOutput to true for internal
283-
* streaming optimization.
283+
* streaming optimization. If incrementalOutput is true or null, keeps the original value to
284+
* return real incremental content.
284285
*
285286
* @param param The parameter object to modify
286-
* @return true if the parameter was modified, false otherwise
287+
* @return true if the parameter was modified (needs local merge), false otherwise (real
288+
* incremental)
287289
*/
288290
private boolean modifyIncrementalOutput(MultiModalConversationParam param) {
289291
Boolean incrementalOutput = param.getIncrementalOutput();
292+
// Only modify when user explicitly sets incrementalOutput to false
293+
// If user sets true or null, respect their choice and return real incremental content
290294
if (ParamUtils.shouldModifyIncrementalOutput(param.getModel())
291295
&& Boolean.FALSE.equals(incrementalOutput)) {
292296
// Modify the MultiModalConversationParam object to enable incremental output
293297
param.setIncrementalOutput(true);
294298
return true;
295299
}
300+
// User wants real incremental content (incrementalOutput=true or null)
296301
return false;
297302
}
298303

0 commit comments

Comments
 (0)