From fd49a9b38460b7815d9ceac219fd8351936c2244 Mon Sep 17 00:00:00 2001 From: zhangping17 Date: Fri, 8 Nov 2024 16:19:29 +0800 Subject: [PATCH] chore: update UdsClient.java without any changes --- .../java/com/xiaomi/data/push/uds/UdsClient.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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();