intermediate

This commit is contained in:
Fabian Freund
2025-01-07 00:06:31 +01:00
parent ea0880b97a
commit 4a2191b01d
84 changed files with 2655 additions and 1383 deletions
+12 -14
View File
@@ -1,9 +1,5 @@
import 'dart:convert';
import 'package:exceptions/exceptions.dart';
import 'package:http/http.dart' as http;
import 'package:lensai/core/http_error_handler.dart';
import 'package:lensai/features/settings/data/repositories/settings_repository.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
part 'chat.g.dart';
@@ -18,17 +14,19 @@ class KagiChatService extends _$KagiChatService {
}
Future<Result<String>> downloadChat(Uri url) {
final kagiSession =
ref.read(settingsRepositoryProvider).valueOrNull?.kagiSession;
throw Exception('Not implemented !');
return Result.fromAsync(
() async {
final response = await _client
.get(url.replace(queryParameters: {'token': kagiSession}));
// final kagiSession =
// ref.read(settingsRepositoryProvider).valueOrNull?.kagiSession;
return utf8.decode(response.bodyBytes);
},
exceptionHandler: handleHttpError,
);
// return Result.fromAsync(
// () async {
// final response = await _client
// .get(url.replace(queryParameters: {'token': kagiSession}));
// return utf8.decode(response.bodyBytes);
// },
// exceptionHandler: handleHttpError,
// );
}
}
@@ -6,7 +6,7 @@ part of 'chat.dart';
// RiverpodGenerator
// **************************************************************************
String _$kagiChatServiceHash() => r'fda3874c955812fa62d555afaca352a3776dd692';
String _$kagiChatServiceHash() => r'a112b70b42fe9d650c9d4dc643bf965ddce7bfa6';
/// See also [KagiChatService].
@ProviderFor(KagiChatService)