Skip to content

Commit

Permalink
Merge pull request #34 from guchengxi1994/master
Browse files Browse the repository at this point in the history
feat: template with ai ability
  • Loading branch information
guchengxi1994 authored May 18, 2024
2 parents f4c40a4 + 7b0da09 commit b027f5a
Show file tree
Hide file tree
Showing 47 changed files with 4,649 additions and 226 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# all_in_one

> this project is just for fun, a lot of features are not stable and not usable.
### how to run

* create an `env` file in root folder with configs like
Expand Down Expand Up @@ -34,6 +36,7 @@
| generate | optimize |
| ![image-20240511-215330](./images/20240511-215330.jpg) | ![image-20240511-215333](./images/20240511-215333.jpg) |


> **bugs-to-be-fixed**
> - [ ] sometimes, generated file is too long and `optimize_doc` return error message
* ...
7 changes: 7 additions & 0 deletions lib/app/windows.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import 'dart:io';

import 'package:all_in_one/app/common.dart';
import 'package:all_in_one/common/toast_utils.dart';
import 'package:all_in_one/layout/layout.dart';
import 'package:all_in_one/schedule/cron_listener.dart';
import 'package:all_in_one/software_monitor/notifier/monitor_item_notifier.dart';
import 'package:all_in_one/common/logger.dart';
import 'package:all_in_one/src/rust/api/llm_api.dart';
import 'package:all_in_one/styles/app_style.dart';
import 'package:appflowy_editor/appflowy_editor.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -72,6 +74,10 @@ class __WrapperState extends ConsumerState<_Wrapper> {
}
});

errorStream.listen((v) {
ToastUtils.error(context, title: v.errmsg, descryption: v.context);
});

stream.listen((event) {
// print(event);
logger.info(event);
Expand All @@ -91,6 +97,7 @@ class __WrapperState extends ConsumerState<_Wrapper> {
}

final scheduleStream = CronListener.controller.stream;
final errorStream = errorMessageStream();

final stream = Platform.isWindows
? smapi.softwareWatchingWithForegroundMessageStream()
Expand Down
6 changes: 5 additions & 1 deletion lib/isar/database.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'package:all_in_one/isar/llm_history.dart';
import 'package:all_in_one/isar/llm_template.dart';
import 'package:all_in_one/isar/recently_used.dart';
import 'package:all_in_one/isar/schedule.dart';
import 'package:all_in_one/isar/software.dart';
import 'package:all_in_one/common/logger.dart';
import 'package:all_in_one/llm/plugins/record/message_record.dart';
import 'package:isar/isar.dart';
import 'package:path_provider/path_provider.dart';

Expand All @@ -24,7 +26,9 @@ class IsarDatabase {
ScheduleItemSchema,
RecentlyUsedSchema,
LLMHistorySchema,
LLMHistoryMessageSchema
LLMHistoryMessageSchema,
MessageRecordSchema,
LlmTemplateSchema
];

Future initialDatabase() async {
Expand Down
11 changes: 11 additions & 0 deletions lib/isar/llm_template.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:isar/isar.dart';

part 'llm_template.g.dart';

@collection
class LlmTemplate {
Id id = Isar.autoIncrement;
int createAt = DateTime.now().millisecondsSinceEpoch;
late String name;
late String template;
}
Loading

0 comments on commit b027f5a

Please sign in to comment.