feat(chat): cut over to single SSE endpoint

This commit is contained in:
zhuyongxin
2026-07-22 10:01:12 +08:00
parent f8809cb7dd
commit bc36248cd8
36 changed files with 2187 additions and 945 deletions
@@ -0,0 +1,28 @@
package com.superbiz.agent.controller.sse;
import org.springframework.http.MediaType;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
import java.io.IOException;
import java.util.Objects;
final class SseEmitterChatSink implements ChatSseSink {
private final SseEmitter emitter;
SseEmitterChatSink(SseEmitter emitter) {
this.emitter = Objects.requireNonNull(emitter, "emitter must not be null");
}
@Override
public void send(String name, Object payload) throws IOException {
emitter.send(SseEmitter.event()
.name(name)
.data(payload, MediaType.APPLICATION_JSON));
}
@Override
public void complete() {
emitter.complete();
}
}