mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-07-23 17:11:23 +00:00
fix(flutter): some ai chat bugs (#6969)
* chore: add hover effect and fix radius * chore: open ref page on mobile
This commit is contained in:
parent
62d5d66d20
commit
e8f2940024
@ -1,6 +1,8 @@
|
|||||||
|
import 'dart:async';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
|
import 'package:appflowy/mobile/application/mobile_router.dart';
|
||||||
import 'package:appflowy/plugins/ai_chat/application/chat_bloc.dart';
|
import 'package:appflowy/plugins/ai_chat/application/chat_bloc.dart';
|
||||||
import 'package:appflowy/plugins/ai_chat/application/chat_entity.dart';
|
import 'package:appflowy/plugins/ai_chat/application/chat_entity.dart';
|
||||||
import 'package:appflowy/plugins/ai_chat/application/ai_prompt_input_bloc.dart';
|
import 'package:appflowy/plugins/ai_chat/application/ai_prompt_input_bloc.dart';
|
||||||
@ -219,7 +221,8 @@ class _ChatContentPage extends StatelessWidget {
|
|||||||
chatId: view.id,
|
chatId: view.id,
|
||||||
refSourceJsonString: refSourceJsonString,
|
refSourceJsonString: refSourceJsonString,
|
||||||
isLastMessage: isLastMessage,
|
isLastMessage: isLastMessage,
|
||||||
onSelectedMetadata: _onSelectMetadata,
|
onSelectedMetadata: (metadata) =>
|
||||||
|
_onSelectMetadata(context, metadata),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -320,7 +323,10 @@ class _ChatContentPage extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _onSelectMetadata(ChatMessageRefSource metadata) async {
|
void _onSelectMetadata(
|
||||||
|
BuildContext context,
|
||||||
|
ChatMessageRefSource metadata,
|
||||||
|
) async {
|
||||||
if (isURL(metadata.name)) {
|
if (isURL(metadata.name)) {
|
||||||
late Uri uri;
|
late Uri uri;
|
||||||
try {
|
try {
|
||||||
@ -335,16 +341,22 @@ class _ChatContentPage extends StatelessWidget {
|
|||||||
Log.error("failed to open url $err");
|
Log.error("failed to open url $err");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
await ViewBackendService.getView(metadata.id).fold(
|
final sidebarView =
|
||||||
(sidebarView) {
|
await ViewBackendService.getView(metadata.id).toNullable();
|
||||||
getIt<TabsBloc>().add(
|
if (sidebarView == null) {
|
||||||
TabsEvent.openSecondaryPlugin(
|
return;
|
||||||
plugin: sidebarView.plugin(),
|
}
|
||||||
),
|
if (UniversalPlatform.isDesktop) {
|
||||||
);
|
getIt<TabsBloc>().add(
|
||||||
},
|
TabsEvent.openSecondaryPlugin(
|
||||||
(err) => Log.error("Failed to get view: $err"),
|
plugin: sidebarView.plugin(),
|
||||||
);
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
if (context.mounted) {
|
||||||
|
unawaited(context.pushView(sidebarView));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,8 @@ import 'package:appflowy/workspace/application/view_title/view_title_bar_bloc.da
|
|||||||
import 'package:appflowy/workspace/presentation/home/menu/sidebar/space/space_icon.dart';
|
import 'package:appflowy/workspace/presentation/home/menu/sidebar/space/space_icon.dart';
|
||||||
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
|
import 'package:appflowy_backend/protobuf/flowy-folder/protobuf.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
import 'package:easy_localization/easy_localization.dart' hide TextDirection;
|
||||||
import 'package:flowy_infra/theme_extension.dart';
|
|
||||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
|
import 'package:flowy_infra_ui/style_widget/hover.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:scroll_to_index/scroll_to_index.dart';
|
import 'package:scroll_to_index/scroll_to_index.dart';
|
||||||
@ -273,21 +273,18 @@ class _ChatMentionPageItem extends StatelessWidget {
|
|||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
behavior: HitTestBehavior.opaque,
|
behavior: HitTestBehavior.opaque,
|
||||||
child: Container(
|
child: FlowyHover(
|
||||||
height: _itemHeight,
|
isSelected: () => isSelected,
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
color: isSelected
|
height: _itemHeight,
|
||||||
? AFThemeExtension.of(context).lightGreyHover
|
padding: const EdgeInsets.all(4.0),
|
||||||
: Colors.transparent,
|
child: Row(
|
||||||
borderRadius: BorderRadius.circular(4.0),
|
children: [
|
||||||
),
|
MentionViewIcon(view: view),
|
||||||
padding: const EdgeInsets.all(4.0),
|
const HSpace(8.0),
|
||||||
child: Row(
|
Expanded(child: MentionViewTitleAndAncestors(view: view)),
|
||||||
children: [
|
],
|
||||||
MentionViewIcon(view: view),
|
),
|
||||||
const HSpace(8.0),
|
|
||||||
Expanded(child: MentionViewTitleAndAncestors(view: view)),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -425,9 +425,7 @@ class ChatAIMessagePopup extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: IgnorePointer(
|
child: child,
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_chat_core/flutter_chat_core.dart';
|
import 'package:flutter_chat_core/flutter_chat_core.dart';
|
||||||
|
import 'package:universal_platform/universal_platform.dart';
|
||||||
|
|
||||||
import '../layout_define.dart';
|
import '../layout_define.dart';
|
||||||
import 'ai_markdown_text.dart';
|
import 'ai_markdown_text.dart';
|
||||||
@ -82,7 +83,10 @@ class ChatAIMessageWidget extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
AIMarkdownText(markdown: state.text),
|
IgnorePointer(
|
||||||
|
ignoring: UniversalPlatform.isMobile,
|
||||||
|
child: AIMarkdownText(markdown: state.text),
|
||||||
|
),
|
||||||
if (state.sources.isNotEmpty)
|
if (state.sources.isNotEmpty)
|
||||||
AIMessageMetadata(
|
AIMessageMetadata(
|
||||||
sources: state.sources,
|
sources: state.sources,
|
||||||
|
@ -318,10 +318,10 @@ packages:
|
|||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: charcode
|
name: charcode
|
||||||
sha256: fb98c0f6d12c920a02ee2d998da788bca066ca5f148492b7085ee23372b12306
|
sha256: fb0f1107cac15a5ea6ef0a6ef71a807b9e4267c713bb93e00e92d737cc8dbd8a
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.1"
|
version: "1.4.0"
|
||||||
checked_yaml:
|
checked_yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user