Skip to content

Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.

chore: fix local ai setting

Nathan2371d4691df4
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dart
index 751e7a6180..b836f15b03 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/local_ai_setting.dart
@@ -140,10 +140,8 @@ class LocalAISettingPanel extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const LocalAIStatusIndicator(),
- if (state.showSettings) ...[
- const VSpace(10),
- OllamaSettingPage(),
- ],
+ const VSpace(10),
+ OllamaSettingPage(),
],
);
},
diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_status_indicator.dart b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_status_indicator.dart
index fdf03bb9ca..a280cf0644 100644
--- a/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_status_indicator.dart
+++ b/frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_status_indicator.dart
@@ -288,6 +288,10 @@ class _LackOfResource extends StatelessWidget {
text: LocaleKeys.settings_aiPage_keys_modelsMissing.tr(),
style: textStyle,
),
+ TextSpan(
+ text: modelNames.join(', '),
+ style: textStyle,
+ ),
TextSpan(
text: ' ',
style: textStyle,
diff --git a/frontend/resources/translations/en.json b/frontend/resources/translations/en.json
index 855a715032..43a59974fd 100644
--- a/frontend/resources/translations/en.json
+++ b/frontend/resources/translations/en.json
@@ -885,7 +885,7 @@
"pleaseFollowThese": "Please follow these",
"instructions": "instructions",
"installOllamaLai": "to set up Ollama and AppFlowy Local AI.",
- "modelsMissing": "Cannot find the required models.",
+ "modelsMissing": "Cannot find the required models: ",
"downloadModel": "to download them."
}
},
@@ -3209,4 +3209,4 @@
"rewrite": "Rewrite",
"insertBelow": "Insert below"
}
-}
+}
\ No newline at end of file
diff --git a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs
index b384b30f4a..f90c360ec7 100644
--- a/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs
+++ b/frontend/rust-lib/flowy-ai/src/local_ai/resource.rs
@@ -195,9 +195,14 @@ impl LocalAIResourceController {
let tags: TagsResponse = resp.json().await.inspect_err(|e| {
log::error!("[LLM Resource] Failed to parse /api/tags JSON response: {e:?}")
})?;
- // Check each required model is present in the response.
+ // Check if each of our required models exists in the list of available models
+ trace!("[LLM Resource] ollama available models: {:?}", tags.models);
for required in &required_models {
- if !tags.models.iter().any(|m| m.name.contains(required)) {
+ if !tags
+ .models
+ .iter()
+ .any(|m| m.name == *required || m.name == format!("{}:latest", required))
+ {
log::trace!(
"[LLM Resource] required model '{}' not found in API response",
required