Skip to content

Commit

Permalink
chore: optional response format (#7204)
Browse files Browse the repository at this point in the history
* chore: optional response format

* chore: bump client api

* chore: code cleanup

* chore: bump client api

---------

Co-authored-by: Nathan <[email protected]>
  • Loading branch information
richardshiue and appflowy authored Feb 6, 2025
1 parent 0d89e22 commit 62a6fb8
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 18 deletions.
42 changes: 28 additions & 14 deletions frontend/rust-lib/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/rust-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ dashmap = "6.0.1"
# Run the script.add_workspace_members:
# scripts/tool/update_client_api_rev.sh new_rev_id
# ⚠️⚠️⚠️️
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a" }
client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "4ed5b367eac5ae9ffd603812e2fea26b3ed3da7a" }
client-api = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "c80157a687397a38c7390ec3d7fee034b93db963" }
client-api-entity = { git = "https://github.com/AppFlowy-IO/AppFlowy-Cloud", rev = "c80157a687397a38c7390ec3d7fee034b93db963" }

[profile.dev]
opt-level = 0
Expand Down
4 changes: 2 additions & 2 deletions frontend/rust-lib/flowy-ai/src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ impl Chat {
// Save message to disk
save_and_notify_message(uid, &self.chat_id, &self.user_service, question.clone())?;

let format = params.format.clone().unwrap_or_default().into();
let format = params.format.clone().map(Into::into).unwrap_or_default();

self.stream_response(
params.answer_stream_port,
Expand Down Expand Up @@ -171,7 +171,7 @@ impl Chat {
.store(false, std::sync::atomic::Ordering::SeqCst);
self.stream_buffer.lock().await.clear();

let format = format.unwrap_or_default().into();
let format = format.map(Into::into).unwrap_or_default();

let answer_stream_buffer = self.stream_buffer.clone();
let uid = self.user_service.user_id()?;
Expand Down
2 changes: 2 additions & 0 deletions frontend/rust-lib/flowy-ai/src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ impl CompletionTask {
custom_prompt: None,
metadata: Some(CompletionMetadata {
object_id: self.context.object_id,
workspace_id: None,
rag_ids: Some(self.context.rag_ids),
}),
format: Default::default(),
};

info!("start completion: {:?}", params);
Expand Down

0 comments on commit 62a6fb8

Please sign in to comment.