Update AI models default and optional values

To have stronger code
This commit is contained in:
Théo Poizat
2025-12-10 07:20:47 +01:00
committed by Dat H. Pham
parent 0c787d3d98
commit aaf60cf222
4 changed files with 4 additions and 4 deletions
@@ -14,7 +14,7 @@ class AIApiResponse {
Map<String, dynamic> toJson() => _$AIApiResponseToJson(this); Map<String, dynamic> toJson() => _$AIApiResponseToJson(this);
String? get content => choices.isNotEmpty ? choices[0].message.content : null; String get content => choices.isNotEmpty ? choices[0].message.content : '';
} }
@JsonSerializable() @JsonSerializable()
@@ -9,6 +9,6 @@ class AIScribeRepositoryImpl implements AIScribeRepository {
@override @override
Future<AIResponse> generateText(String prompt) async { Future<AIResponse> generateText(String prompt) async {
return await _dataSource.request(prompt); return _dataSource.request(prompt);
} }
} }
@@ -1,5 +1,5 @@
class AIResponse { class AIResponse {
final String? result; final String result;
const AIResponse({required this.result}); const AIResponse({required this.result});
@@ -24,6 +24,6 @@ class CustomPromptAction extends AIAction {
@override @override
String getLabel(BuildContext context) { String getLabel(BuildContext context) {
return ScribeLocalizations.of(context)!.customPromptAction; return ScribeLocalizations.of(context)?.customPromptAction ?? 'Help me write';
} }
} }