mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-04-18 20:05:05 -04:00
chore: fix ai page user profile refresh (#7317)
This commit is contained in:
parent
e9201cce72
commit
122fb89c87
4 changed files with 9 additions and 5 deletions
|
@ -109,10 +109,12 @@ class SettingsAIBloc extends Bloc<SettingsAIEvent, SettingsAIState> {
|
|||
if (!models.contains(state.selectedAIModel)) {
|
||||
// Use first model as default model if current selected model
|
||||
// is not available
|
||||
final selectedModel = models[0];
|
||||
_updateUserWorkspaceSetting(model: selectedModel);
|
||||
emit(
|
||||
state.copyWith(
|
||||
availableModels: models,
|
||||
selectedAIModel: models[0],
|
||||
selectedAIModel: selectedModel,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -141,6 +141,7 @@ class SettingsDialog extends StatelessWidget {
|
|||
case SettingsPage.ai:
|
||||
if (user.authenticator == AuthenticatorPB.AppFlowyCloud) {
|
||||
return SettingsAIView(
|
||||
key: ValueKey(user.hashCode),
|
||||
userProfile: user,
|
||||
currentWorkspaceMemberRole: currentWorkspaceMemberRole,
|
||||
workspaceId: workspaceId,
|
||||
|
|
|
@ -18,7 +18,7 @@ use client_api::entity::{
|
|||
use client_api::entity::{QueryCollab, QueryCollabParams};
|
||||
use client_api::{Client, ClientConfiguration};
|
||||
use collab_entity::{CollabObject, CollabType};
|
||||
use tracing::instrument;
|
||||
use tracing::{instrument, trace};
|
||||
|
||||
use flowy_error::{ErrorCode, FlowyError, FlowyResult};
|
||||
use flowy_user_pub::cloud::{UserCloudService, UserCollabParams, UserUpdate, UserUpdateReceiver};
|
||||
|
@ -586,6 +586,7 @@ where
|
|||
workspace_id: &str,
|
||||
workspace_settings: AFWorkspaceSettingsChange,
|
||||
) -> Result<AFWorkspaceSettings, FlowyError> {
|
||||
trace!("Sync workspace settings: {:?}", workspace_settings);
|
||||
let workspace_id = workspace_id.to_string();
|
||||
let try_get_client = self.server.try_get_client();
|
||||
let client = try_get_client?;
|
||||
|
|
|
@ -393,7 +393,7 @@ impl From<AFWorkspaceSettings> for UseAISettingPB {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(ProtoBuf, Default, Clone, Validate)]
|
||||
#[derive(ProtoBuf, Default, Clone, Validate, Debug)]
|
||||
pub struct UpdateUserWorkspaceSettingPB {
|
||||
#[pb(index = 1)]
|
||||
#[validate(custom(function = "required_not_empty_str"))]
|
||||
|
@ -410,10 +410,10 @@ impl From<UpdateUserWorkspaceSettingPB> for AFWorkspaceSettingsChange {
|
|||
fn from(value: UpdateUserWorkspaceSettingPB) -> Self {
|
||||
let mut change = AFWorkspaceSettingsChange::new();
|
||||
if let Some(disable_search_indexing) = value.disable_search_indexing {
|
||||
change = change.disable_search_indexing(disable_search_indexing);
|
||||
change.disable_search_indexing = Some(disable_search_indexing);
|
||||
}
|
||||
if let Some(ai_model) = value.ai_model {
|
||||
change = change.ai_model(ai_model);
|
||||
change.ai_model = Some(ai_model);
|
||||
}
|
||||
change
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue