Skip to content

Commit

Permalink
refactor(webserver): when appending client side context, unnest to NU… (
Browse files Browse the repository at this point in the history
#2959)

* refactor(webserver): when appending client side context, unnest to NULL if possible

* [autofix.ci] apply automated fixes

* [autofix.ci] apply automated fixes (attempt 2/3)

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
wsxiaoys and autofix-ci[bot] authored Aug 23, 2024
1 parent 7deb7f6 commit 75f868c
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ee/tabby-webserver/src/service/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,15 @@ impl ThreadService for ThreadServiceImpl {
message: &CreateMessageInput,
) -> Result<()> {
let thread_id = thread_id.as_rowid()?;
let client_code = message
.attachments
.as_ref()
.map(|x| x.code.iter().map(Into::into).collect::<Vec<_>>());
let client_code = message.attachments.as_ref().and_then(|x| {
let code = x.code.iter().map(Into::into).collect::<Vec<_>>();
// If there are no code attachments, return None
if code.is_empty() {
None
} else {
Some(code)
}
});

self.db
.create_thread_message(
Expand Down

0 comments on commit 75f868c

Please sign in to comment.