diff options
| author | sigoden <sigoden@gmail.com> | 2024-04-29 23:04:25 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-29 23:04:25 +0800 |
| commit | 4d4a100fe6fcde7ca3afcf7971ac387d355349eb (patch) | |
| tree | 2a43194cb99b4193cbf8e35162bbc8d6660d58b9 /src/client/qianwen.rs | |
| parent | ffb0af8236331c942f19ae7c4c4da38a6d0e8214 (diff) | |
| download | aichat-4d4a100fe6fcde7ca3afcf7971ac387d355349eb.tar.gz | |
refactor: sse handling (#465)
Diffstat (limited to 'src/client/qianwen.rs')
| -rw-r--r-- | src/client/qianwen.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/client/qianwen.rs b/src/client/qianwen.rs index c16aeaa..1f42fd9 100644 --- a/src/client/qianwen.rs +++ b/src/client/qianwen.rs @@ -1,6 +1,6 @@ use super::{ maybe_catch_error, message::*, sse_stream, Client, CompletionDetails, ExtraConfig, Model, - ModelConfig, PromptType, QianwenClient, SendData, SseHandler, + ModelConfig, PromptType, QianwenClient, SendData, SsMmessage, SseHandler, }; use crate::utils::{sha256sum, PromptKind}; @@ -107,8 +107,8 @@ async fn send_message_streaming( handler: &mut SseHandler, is_vl: bool, ) -> Result<()> { - let handle = |data: &str| -> Result<bool> { - let data: Value = serde_json::from_str(data)?; + let handle = |message: SsMmessage| -> Result<bool> { + let data: Value = serde_json::from_str(&message.data)?; maybe_catch_error(&data)?; if is_vl { if let Some(text) = |
