Skip to content

Commit

Permalink
fix(answer): handle cases that no choices is returned from chat model. (
Browse files Browse the repository at this point in the history
#3329)

* fix(answer): handle cases that no choices is returned from chat model.

* [autofix.ci] apply automated fixes

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
wsxiaoys and autofix-ci[bot] authored Oct 28, 2024
1 parent d7b3c9b commit 97f93df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion ee/tabby-webserver/src/service/answer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ impl AnswerService {
}
};

if let Some(content) = chunk.choices[0].delta.content.as_deref() {
let content = chunk.choices.first().and_then(|x| x.delta.content.as_deref());
if let Some(content) = content {
yield Ok(ThreadRunItem::ThreadAssistantMessageContentDelta(ThreadAssistantMessageContentDelta {
delta: content.to_owned()
}));
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-webserver/src/service/user_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use tabby_schema::{
AsID, AsRowid, Result,
};

use super::{UserGroupExt, UserSecuredExt};
use super::UserGroupExt;

struct UserGroupServiceImpl {
db: DbConn,
Expand Down

0 comments on commit 97f93df

Please sign in to comment.