Skip to content

Commit 34a858e

Browse files
committed
chore: show plugin version
1 parent dbe72b3 commit 34a858e

13 files changed

Lines changed: 49 additions & 183 deletions

File tree

frontend/appflowy_flutter/lib/workspace/application/settings/ai/download_offline_ai_app_bloc.dart

Lines changed: 0 additions & 41 deletions
This file was deleted.

frontend/appflowy_flutter/lib/workspace/application/settings/ai/local_ai_setting_panel_bloc.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class LocalAISettingPanelBloc
4444
) async {
4545
event.when(
4646
updateAIState: (LocalAIPB pluginState) {
47-
if (pluginState.isPluginExecutableReady) {
47+
if (pluginState.pluginDownloaded) {
4848
emit(
4949
state.copyWith(
5050
runningState: pluginState.state,

frontend/appflowy_flutter/lib/workspace/application/settings/ai/plugin_state_bloc.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,11 @@ class PluginStateBloc extends Bloc<PluginStateEvent, PluginStateState> {
9191
);
9292
break;
9393
case RunningStatePB.Running:
94-
emit(const PluginStateState(action: PluginStateAction.running()));
94+
emit(
95+
PluginStateState(
96+
action: PluginStateAction.running(aiState.pluginVersion),
97+
),
98+
);
9599
break;
96100
case RunningStatePB.Stopped:
97101
emit(
@@ -140,7 +144,7 @@ class PluginStateAction with _$PluginStateAction {
140144
const factory PluginStateAction.unknown() = _Unknown;
141145
const factory PluginStateAction.readToRun() = _ReadyToRun;
142146
const factory PluginStateAction.initializingPlugin() = _InitializingPlugin;
143-
const factory PluginStateAction.running() = _PluginRunning;
147+
const factory PluginStateAction.running(String version) = _PluginRunning;
144148
const factory PluginStateAction.restartPlugin() = _RestartPlugin;
145149
const factory PluginStateAction.lackOfResource(String desc) = _LackOfResource;
146150
}

frontend/appflowy_flutter/lib/workspace/presentation/settings/pages/setting_ai_view/plugin_state.dart

Lines changed: 9 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
1-
import 'package:appflowy/core/helpers/url_launcher.dart';
21
import 'package:appflowy/generated/flowy_svgs.g.dart';
32
import 'package:appflowy/generated/locale_keys.g.dart';
4-
import 'package:appflowy/workspace/application/settings/ai/download_offline_ai_app_bloc.dart';
53
import 'package:appflowy/workspace/application/settings/ai/plugin_state_bloc.dart';
64
import 'package:appflowy/workspace/presentation/settings/pages/setting_ai_view/init_local_ai.dart';
75
import 'package:easy_localization/easy_localization.dart';
8-
import 'package:flowy_infra/size.dart';
96
import 'package:flowy_infra_ui/style_widget/button.dart';
107
import 'package:flowy_infra_ui/style_widget/text.dart';
118
import 'package:flowy_infra_ui/widget/spacing.dart';
12-
import 'package:flutter/gestures.dart';
139
import 'package:flutter/material.dart';
1410
import 'package:flutter_bloc/flutter_bloc.dart';
1511

@@ -27,7 +23,7 @@ class PluginStateIndicator extends StatelessWidget {
2723
unknown: () => const SizedBox.shrink(),
2824
readToRun: () => const _PrepareRunning(),
2925
initializingPlugin: () => const InitLocalAIIndicator(),
30-
running: () => const _LocalAIRunning(),
26+
running: (version) => _LocalAIRunning(version: version),
3127
restartPlugin: () => const _RestartPluginButton(),
3228
lackOfResource: (desc) => _LackOfResource(desc: desc),
3329
);
@@ -88,7 +84,9 @@ class _RestartPluginButton extends StatelessWidget {
8884
}
8985

9086
class _LocalAIRunning extends StatelessWidget {
91-
const _LocalAIRunning();
87+
const _LocalAIRunning({required this.version});
88+
89+
final String version;
9290

9391
@override
9492
Widget build(BuildContext context) {
@@ -115,7 +113,11 @@ class _LocalAIRunning extends StatelessWidget {
115113
const HSpace(6),
116114
Flexible(
117115
child: FlowyText(
118-
LocaleKeys.settings_aiPage_keys_localAIRunning.tr(),
116+
LocaleKeys.settings_aiPage_keys_localAIRunning.tr(
117+
args: [
118+
version,
119+
],
120+
),
119121
fontSize: 11,
120122
color: const Color(0xFF1E4620),
121123
maxLines: 3,
@@ -131,95 +133,6 @@ class _LocalAIRunning extends StatelessWidget {
131133
}
132134
}
133135

134-
class OpenOrDownloadOfflineAIApp extends StatelessWidget {
135-
const OpenOrDownloadOfflineAIApp({required this.onRetry, super.key});
136-
137-
final VoidCallback onRetry;
138-
139-
@override
140-
Widget build(BuildContext context) {
141-
return BlocProvider(
142-
create: (context) => DownloadOfflineAIBloc(),
143-
child: BlocBuilder<DownloadOfflineAIBloc, DownloadOfflineAIState>(
144-
builder: (context, state) {
145-
return Column(
146-
crossAxisAlignment: CrossAxisAlignment.start,
147-
children: [
148-
RichText(
149-
maxLines: 3,
150-
textAlign: TextAlign.left,
151-
text: TextSpan(
152-
children: <TextSpan>[
153-
TextSpan(
154-
text:
155-
"${LocaleKeys.settings_aiPage_keys_offlineAIInstruction1.tr()} ",
156-
style: Theme.of(context)
157-
.textTheme
158-
.bodySmall!
159-
.copyWith(height: 1.5),
160-
),
161-
TextSpan(
162-
text:
163-
" ${LocaleKeys.settings_aiPage_keys_offlineAIInstruction2.tr()} ",
164-
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
165-
fontSize: FontSizes.s14,
166-
color: Theme.of(context).colorScheme.primary,
167-
height: 1.5,
168-
),
169-
recognizer: TapGestureRecognizer()
170-
..onTap = () => afLaunchUrlString(
171-
"https://docs.appflowy.io/docs/appflowy/product/appflowy-ai-offline",
172-
),
173-
),
174-
TextSpan(
175-
text:
176-
" ${LocaleKeys.settings_aiPage_keys_offlineAIInstruction3.tr()} ",
177-
style: Theme.of(context)
178-
.textTheme
179-
.bodySmall!
180-
.copyWith(height: 1.5),
181-
),
182-
TextSpan(
183-
text:
184-
"${LocaleKeys.settings_aiPage_keys_offlineAIDownload1.tr()} ",
185-
style: Theme.of(context)
186-
.textTheme
187-
.bodySmall!
188-
.copyWith(height: 1.5),
189-
),
190-
TextSpan(
191-
text:
192-
" ${LocaleKeys.settings_aiPage_keys_offlineAIDownload2.tr()} ",
193-
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
194-
fontSize: FontSizes.s14,
195-
color: Theme.of(context).colorScheme.primary,
196-
height: 1.5,
197-
),
198-
recognizer: TapGestureRecognizer()
199-
..onTap =
200-
() => context.read<DownloadOfflineAIBloc>().add(
201-
const DownloadOfflineAIEvent.started(),
202-
),
203-
),
204-
TextSpan(
205-
text:
206-
" ${LocaleKeys.settings_aiPage_keys_offlineAIDownload3.tr()} ",
207-
style: Theme.of(context)
208-
.textTheme
209-
.bodySmall!
210-
.copyWith(height: 1.5),
211-
),
212-
],
213-
),
214-
),
215-
],
216-
);
217-
},
218-
),
219-
);
220-
}
221-
}
222-
223136
class _LackOfResource extends StatelessWidget {
224137
const _LackOfResource({required this.desc});
225138

frontend/resources/translations/ar-SA.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@
857857
"localAIStart": "بدأت الدردشة المحلية بالذكاء الاصطناعي...",
858858
"localAILoading": "جاري تحميل نموذج الدردشة المحلية للذكاء الاصطناعي...",
859859
"localAIStopped": "تم إيقاف الذكاء الاصطناعي المحلي",
860-
"localAIRunning": "الذكاء الاصطناعي المحلي قيد التشغيل",
860+
"localAIRunning": "الذكاء الاصطناعي المحلي قيد التشغيل. الإصدار: {}",
861861
"localAIInitializing": "يتم تهيئة الذكاء الاصطناعي المحلي وقد يستغرق الأمر بضع دقائق، حسب جهازك",
862862
"localAINotReadyTextFieldPrompt": "لا يمكنك التحرير أثناء تحميل الذكاء الاصطناعي المحلي",
863863
"failToLoadLocalAI": "فشل في بدء تشغيل الذكاء الاصطناعي المحلي",
@@ -3217,4 +3217,4 @@
32173217
"rewrite": "إعادة كتابة",
32183218
"insertBelow": "أدخل أدناه"
32193219
}
3220-
}
3220+
}

frontend/resources/translations/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@
857857
"localAIStart": "Local AI is starting. If it’s slow, try toggling it off and on",
858858
"localAILoading": "Local AI Chat Model is loading...",
859859
"localAIStopped": "Local AI stopped",
860-
"localAIRunning": "Local AI is running",
860+
"localAIRunning": "Local AI is running. Version: {}",
861861
"localAIInitializing": "Local AI is loading and may take a few minutes, depending on your device",
862862
"localAINotReadyTextFieldPrompt": "You can not edit while Local AI is loading",
863863
"failToLoadLocalAI": "Failed to start local AI",
@@ -3202,4 +3202,4 @@
32023202
"rewrite": "Rewrite",
32033203
"insertBelow": "Insert below"
32043204
}
3205-
}
3205+
}

frontend/resources/translations/ko-KR.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@
851851
"localAIStart": "로컬 AI가 시작 중입니다. 느리다면 껐다가 다시 켜보세요",
852852
"localAILoading": "로컬 AI 채팅 모델이 로드 중입니다...",
853853
"localAIStopped": "로컬 AI가 중지되었습니다",
854-
"localAIRunning": "로컬 AI가 실행 중입니다",
854+
"localAIRunning": "로컬 AI가 실행 중입니다. 버전: {}",
855855
"localAIInitializing": "로컬 AI가 로드 중이며 장치에 따라 몇 분이 소요될 수 있습니다",
856856
"localAINotReadyTextFieldPrompt": "로컬 AI가 로드되는 동안 편집할 수 없습니다",
857857
"failToLoadLocalAI": "로컬 AI를 시작하지 못했습니다",
@@ -3185,4 +3185,4 @@
31853185
"rewrite": "다시 작성",
31863186
"insertBelow": "아래에 삽입"
31873187
}
3188-
}
3188+
}

frontend/rust-lib/Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/rust-lib/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,6 @@ collab-importer = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFl
152152
# To update the commit ID, run:
153153
# scripts/tool/update_local_ai_rev.sh new_rev_id
154154
# ⚠️⚠️⚠️️
155-
af-local-ai = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "a7d4ca96ec30cad941b67acb1e0e426d689c1270" }
156-
af-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "a7d4ca96ec30cad941b67acb1e0e426d689c1270" }
157-
af-mcp = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "a7d4ca96ec30cad941b67acb1e0e426d689c1270" }
155+
af-local-ai = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "593bc3fbedf2a2c7e00ec28b10f2268c1983be65" }
156+
af-plugin = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "593bc3fbedf2a2c7e00ec28b10f2268c1983be65" }
157+
af-mcp = { version = "0.1", git = "https://github.com/AppFlowy-IO/AppFlowy-LocalAI", rev = "593bc3fbedf2a2c7e00ec28b10f2268c1983be65" }

frontend/rust-lib/flowy-ai/src/entities.rs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -585,20 +585,17 @@ pub struct LocalAIPB {
585585
#[pb(index = 1)]
586586
pub enabled: bool,
587587

588-
#[pb(index = 2)]
589-
pub is_plugin_executable_ready: bool,
590-
591-
#[pb(index = 3, one_of)]
588+
#[pb(index = 2, one_of)]
592589
pub lack_of_resource: Option<String>,
593590

594-
#[pb(index = 4)]
591+
#[pb(index = 3)]
595592
pub state: RunningStatePB,
596-
}
597593

598-
#[derive(Default, ProtoBuf, Clone, Debug)]
599-
pub struct LocalAIAppLinkPB {
600-
#[pb(index = 1)]
601-
pub link: String,
594+
#[pb(index = 4, one_of)]
595+
pub plugin_version: Option<String>,
596+
597+
#[pb(index = 5)]
598+
pub plugin_downloaded: bool,
602599
}
603600

604601
#[derive(Default, ProtoBuf, Validate, Clone, Debug)]

0 commit comments

Comments
 (0)