Skip to content

Commit

Permalink
chore: v2 stream message
Browse files Browse the repository at this point in the history
  • Loading branch information
appflowy committed Aug 12, 2024
1 parent 4980ae7 commit a8670d7
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions appflowy-local-ai/src/ai_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,21 @@ impl AIPluginOperation {
});
plugin.stream_request::<ChatStreamResponseParser>("handle", &params)
}
#[instrument(level = "debug", skip(self), err)]
pub async fn stream_message_v2(
&self,
chat_id: &str,
message: &str,
metadata: serde_json::Value,
) -> Result<ReceiverStream<Result<Bytes, PluginError>>, PluginError> {
let plugin = self.get_plugin()?;
let params = json!({
"chat_id": chat_id,
"method": "stream_answer_v2",
"params": { "content": message, "metadata": metadata }
});
plugin.stream_request::<ChatStreamResponseParser>("handle", &params)
}

pub async fn get_related_questions(&self, chat_id: &str) -> Result<Vec<String>, PluginError> {
self
Expand Down

0 comments on commit a8670d7

Please sign in to comment.