mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-08-02 13:58:51 +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
29 lines
660 B
Dart
29 lines
660 B
Dart
import 'package:freezed_annotation/freezed_annotation.dart';
|
|
|
|
part 'error.freezed.dart';
|
|
part 'error.g.dart';
|
|
|
|
@freezed
|
|
class AIError with _$AIError {
|
|
const factory AIError({
|
|
required String message,
|
|
required AIErrorCode code,
|
|
}) = _AIError;
|
|
|
|
factory AIError.fromJson(Map<String, Object?> json) =>
|
|
_$AIErrorFromJson(json);
|
|
}
|
|
|
|
enum AIErrorCode {
|
|
@JsonValue('AIResponseLimitExceeded')
|
|
aiResponseLimitExceeded,
|
|
@JsonValue('AIImageResponseLimitExceeded')
|
|
aiImageResponseLimitExceeded,
|
|
@JsonValue('Other')
|
|
other,
|
|
}
|
|
|
|
extension AIErrorExtension on AIError {
|
|
bool get isLimitExceeded => code == AIErrorCode.aiResponseLimitExceeded;
|
|
}
|