diff --git a/jcommon/rcurve/src/main/java/com/xiaomi/data/push/uds/UdsClient.java b/jcommon/rcurve/src/main/java/com/xiaomi/data/push/uds/UdsClient.java index eb3428097..33f0d6780 100644 --- a/jcommon/rcurve/src/main/java/com/xiaomi/data/push/uds/UdsClient.java +++ b/jcommon/rcurve/src/main/java/com/xiaomi/data/push/uds/UdsClient.java @@ -22,6 +22,8 @@ import com.xiaomi.data.push.uds.context.TraceContext; import com.xiaomi.data.push.uds.context.TraceEvent; import com.xiaomi.data.push.uds.context.UdsClientContext; +import com.xiaomi.data.push.uds.handler.ClientStreamCallback; +import com.xiaomi.data.push.uds.handler.MessageTypes; import com.xiaomi.data.push.uds.handler.UdsClientConnetManageHandler; import com.xiaomi.data.push.uds.handler.UdsClientHandler; import com.xiaomi.data.push.uds.po.UdsCommand; @@ -144,6 +146,18 @@ public void call(Object msg) { Send.send(this.channel, command); } + /** + * 发送OpenAI流式请求 + */ + public void stream(UdsCommand command, ClientStreamCallback callback) { + Map attachments = command.getAttachments(); + // 注册回调 + ((UdsClientHandler) channel.pipeline().last()).getStreamCallbacks() + .put(attachments.get(MessageTypes.STREAM_ID_KEY), callback); + // 发送请求 + Send.send(this.channel, command); + } + @Override public UdsCommand call(UdsCommand req) { Stopwatch sw = Stopwatch.createStarted();