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: minor ai chat improvements (#6855)

Richard Shiuee0226e54a572
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/chat_page.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/chat_page.dart
index 96b4c70566..9c73d40126 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/chat_page.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/chat_page.dart
@@ -68,20 +68,24 @@ class AIChatPage extends StatelessWidget {
BlocProvider(create: (_) => ChatSidePanelBloc(chatId: view.id)),
BlocProvider(create: (_) => ChatMemberBloc()),
],
- child: DropTarget(
- onDragDone: (DropDoneDetails detail) async {
- if (context.read<AIPromptInputBloc>().state.supportChatWithFile) {
- for (final file in detail.files) {
- context
- .read<AIPromptInputBloc>()
- .add(AIPromptInputEvent.newFile(file.path, file.name));
- }
- }
+ child: Builder(
+ builder: (context) {
+ return DropTarget(
+ onDragDone: (DropDoneDetails detail) async {
+ if (context.read<AIPromptInputBloc>().state.supportChatWithFile) {
+ for (final file in detail.files) {
+ context
+ .read<AIPromptInputBloc>()
+ .add(AIPromptInputEvent.newFile(file.path, file.name));
+ }
+ }
+ },
+ child: _ChatContentPage(
+ view: view,
+ userProfile: userProfile,
+ ),
+ );
},
- child: _ChatContentPage(
- view: view,
- userProfile: userProfile,
- ),
),
);
}
@@ -116,7 +120,7 @@ class _ChatContentPage extends StatelessWidget {
.constrained(
maxWidth: 784,
)
- .padding(horizontal: 32)
+ .padding(horizontal: 60)
.animate(
const Duration(milliseconds: 200),
Curves.easeOut,
@@ -300,6 +304,7 @@ class _ChatContentPage extends StatelessWidget {
message: message,
animation: animation,
padding: const EdgeInsets.symmetric(vertical: 12.0),
+ receivedMessageScaleAnimationAlignment: Alignment.center,
child: child,
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_loading.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_loading.dart
index 052ac0d5ce..ee73e85b7d 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_loading.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/chat_loading.dart
@@ -18,53 +18,56 @@ class ChatAILoading extends StatelessWidget {
@override
Widget build(BuildContext context) {
final slice = Duration(milliseconds: duration.inMilliseconds ~/ 5);
- return SizedBox(
- height: 20,
- child: SeparatedRow(
- separatorBuilder: () => const HSpace(4),
- children: [
- Padding(
- padding: const EdgeInsetsDirectional.only(end: 4.0),
- child: BlocBuilder<ChatAIMessageBloc, ChatAIMessageState>(
- builder: (context, state) {
- return FlowyText(
- state.progress?.step ??
- LocaleKeys.chat_generatingResponse.tr(),
- color: Theme.of(context).hintColor,
- );
- },
+ return Padding(
+ padding: const EdgeInsets.only(top: 8.0),
+ child: SizedBox(
+ height: 20,
+ child: SeparatedRow(
+ separatorBuilder: () => const HSpace(4),
+ children: [
+ Padding(
+ padding: const EdgeInsetsDirectional.only(end: 4.0),
+ child: BlocBuilder<ChatAIMessageBloc, ChatAIMessageState>(
+ builder: (context, state) {
+ return FlowyText(
+ state.progress?.step ??
+ LocaleKeys.chat_generatingResponse.tr(),
+ color: Theme.of(context).hintColor,
+ );
+ },
+ ),
),
- ),
- buildDot(const Color(0xFF9327FF))
- .animate(onPlay: (controller) => controller.repeat())
- .slideY(duration: slice, begin: 0, end: -1)
- .then()
- .slideY(begin: -1, end: 1)
- .then()
- .slideY(begin: 1, end: 0)
- .then()
- .slideY(duration: slice * 2, begin: 0, end: 0),
- buildDot(const Color(0xFFFB006D))
- .animate(onPlay: (controller) => controller.repeat())
- .slideY(duration: slice, begin: 0, end: 0)
- .then()
- .slideY(begin: 0, end: -1)
- .then()
- .slideY(begin: -1, end: 1)
- .then()
- .slideY(begin: 1, end: 0)
- .then()
- .slideY(begin: 0, end: 0),
- buildDot(const Color(0xFFFFCE00))
- .animate(onPlay: (controller) => controller.repeat())
- .slideY(duration: slice * 2, begin: 0, end: 0)
- .then()
- .slideY(duration: slice, begin: 0, end: -1)
- .then()
- .slideY(begin: -1, end: 1)
- .then()
- .slideY(begin: 1, end: 0),
- ],
+ buildDot(const Color(0xFF9327FF))
+ .animate(onPlay: (controller) => controller.repeat())
+ .slideY(duration: slice, begin: 0, end: -1)
+ .then()
+ .slideY(begin: -1, end: 1)
+ .then()
+ .slideY(begin: 1, end: 0)
+ .then()
+ .slideY(duration: slice * 2, begin: 0, end: 0),
+ buildDot(const Color(0xFFFB006D))
+ .animate(onPlay: (controller) => controller.repeat())
+ .slideY(duration: slice, begin: 0, end: 0)
+ .then()
+ .slideY(begin: 0, end: -1)
+ .then()
+ .slideY(begin: -1, end: 1)
+ .then()
+ .slideY(begin: 1, end: 0)
+ .then()
+ .slideY(begin: 0, end: 0),
+ buildDot(const Color(0xFFFFCE00))
+ .animate(onPlay: (controller) => controller.repeat())
+ .slideY(duration: slice * 2, begin: 0, end: 0)
+ .then()
+ .slideY(duration: slice, begin: 0, end: -1)
+ .then()
+ .slideY(begin: -1, end: 1)
+ .then()
+ .slideY(begin: 1, end: 0),
+ ],
+ ),
),
);
}
diff --git a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart
index 29c6264b43..21d61f3ab5 100644
--- a/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart
+++ b/frontend/appflowy_flutter/lib/plugins/ai_chat/presentation/message/ai_text_message.dart
@@ -69,10 +69,7 @@ class ChatAIMessageWidget extends StatelessWidget {
return ChatAIMessageBubble(
message: message,
showActions: false,
- child: const Padding(
- padding: EdgeInsets.only(top: 8.0),
- child: ChatAILoading(),
- ),
+ child: const ChatAILoading(),
);
},
ready: () {