diff --git a/lib/models/settings_model.dart b/lib/models/settings_model.dart index c876279d..b3222bf0 100644 --- a/lib/models/settings_model.dart +++ b/lib/models/settings_model.dart @@ -1,4 +1,5 @@ import 'package:apidash_core/apidash_core.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:apidash/consts.dart'; @@ -213,7 +214,7 @@ class SettingsModel { other.workspaceFolderPath == workspaceFolderPath && other.isSSLDisabled == isSSLDisabled && other.isDashBotEnabled == isDashBotEnabled && - other.defaultAIModel == defaultAIModel; + mapEquals(other.defaultAIModel, defaultAIModel); } @override diff --git a/test/models/settings_model_test.dart b/test/models/settings_model_test.dart index 3a7827d5..0ea7746a 100644 --- a/test/models/settings_model_test.dart +++ b/test/models/settings_model_test.dart @@ -19,6 +19,7 @@ void main() { workspaceFolderPath: null, isSSLDisabled: true, isDashBotEnabled: true, + defaultAIModel: {"model": "llama"}, ); test('Testing toJson()', () { @@ -38,6 +39,7 @@ void main() { "workspaceFolderPath": null, "isSSLDisabled": true, "isDashBotEnabled": true, + "defaultAIModel": {"model": "llama"} }; expect(sm.toJson(), expectedResult); }); @@ -59,6 +61,7 @@ void main() { "workspaceFolderPath": null, "isSSLDisabled": true, "isDashBotEnabled": true, + "defaultAIModel": {"model": "llama"} }; expect(SettingsModel.fromJson(input), sm); }); @@ -77,6 +80,7 @@ void main() { historyRetentionPeriod: HistoryRetentionPeriod.oneWeek, isSSLDisabled: false, isDashBotEnabled: false, + defaultAIModel: {"model": "llama"}, ); expect( sm.copyWith( @@ -104,7 +108,10 @@ void main() { "historyRetentionPeriod": "oneWeek", "workspaceFolderPath": null, "isSSLDisabled": true, - "isDashBotEnabled": true + "isDashBotEnabled": true, + "defaultAIModel": { + "model": "llama" + } }'''; expect(sm.toString(), expectedResult); });