mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-08-04 06:50:23 +00:00

* feat: ai writer block * test: fix integration tests * chore: add continue writing to slash menu * chore: focus issues during insertion * fix: explain button position * fix: gesture detection * fix: insert below * fix: undo * chore: improve writing toolbar item * chore: pass predefined format when using quick commands * fix: continue writing in an empty document or at the beginning of a document * fix: don't allow selecting text not in content * fix: related question not following predefined format
37 lines
985 B
Dart
37 lines
985 B
Dart
import 'package:appflowy/plugins/ai_chat/chat.dart';
|
|
import 'package:appflowy/workspace/application/view/view_service.dart';
|
|
import 'package:appflowy_backend/protobuf/flowy-folder/view.pb.dart';
|
|
|
|
import '../../util.dart';
|
|
|
|
class AppFlowyChatTest {
|
|
AppFlowyChatTest({required this.unitTest});
|
|
|
|
final AppFlowyUnitTest unitTest;
|
|
|
|
static Future<AppFlowyChatTest> ensureInitialized() async {
|
|
final inner = await AppFlowyUnitTest.ensureInitialized();
|
|
return AppFlowyChatTest(unitTest: inner);
|
|
}
|
|
|
|
Future<ViewPB> createChat() async {
|
|
final app = await unitTest.createWorkspace();
|
|
final builder = AIChatPluginBuilder();
|
|
return ViewBackendService.createView(
|
|
parentViewId: app.id,
|
|
name: "Test Chat",
|
|
layoutType: builder.layoutType,
|
|
openAfterCreate: true,
|
|
).then((result) {
|
|
return result.fold(
|
|
(view) async {
|
|
return view;
|
|
},
|
|
(error) {
|
|
throw Exception();
|
|
},
|
|
);
|
|
});
|
|
}
|
|
}
|