Skip to content

Commit 7d340c8

Browse files
songguocolakevinlin09
authored andcommitted
fix(app/multimodal-dialog): task-started callback
1 parent 6ccb42c commit 7d340c8

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/main/java/com/alibaba/dashscope/multimodal/MultiModalDialog.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public MultiModalDialog(
136136
.taskGroup(TaskGroup.AIGC.getValue())
137137
.task(Task.MULTIMODAL_GENERATION.getValue())
138138
.function(Function.GENERATION.getValue())
139+
.passTaskStarted(true)
139140
.build();
140141

141142
this.requestParam = param;
@@ -163,6 +164,7 @@ public MultiModalDialog(
163164
.taskGroup(TaskGroup.AIGC.getValue())
164165
.task(Task.MULTIMODAL_GENERATION.getValue())
165166
.function(Function.GENERATION.getValue())
167+
.passTaskStarted(true)
166168
.build();
167169
this.connectionOptions = connectionOptions;
168170
this.connectionOptions.setUseDefaultClient(false);
@@ -309,6 +311,13 @@ public void onEvent(DashScopeResult message) {
309311
default:
310312
break;
311313
}
314+
}else if (message.getEvent() != null) {
315+
if (message.getEvent().equals("task-started")){
316+
callback.onConnected();
317+
log.debug(
318+
"MultiModalDialog connected, state is {}",
319+
currentState.getValue()); // Logs connection status
320+
}
312321
}
313322
}
314323

@@ -347,10 +356,6 @@ public void onError(Exception e) { // Error event handling
347356
stopLatch.get().countDown(); // Counts down latch
348357
}
349358
}
350-
log.debug(
351-
"MultiModalDialog connected, state is {}",
352-
currentState.getValue()); // Logs connection status
353-
callback.onConnected(); // Connected successfully callback
354359
}
355360

356361
/** Starts upload speech. */

0 commit comments

Comments
 (0)