feat: Improve model tools auto-selection and lifecycle management

This commit is contained in:
cogwheel0
2025-12-02 16:31:54 +05:30
parent e97a778f81
commit 1b22143aed
3 changed files with 17 additions and 0 deletions

View File

@@ -139,6 +139,14 @@ sealed class Model with _$Model {
}
}
// Fallback to top-level toolIds (for cached models serialized via toJson)
if (toolIds == null || toolIds.isEmpty) {
final topLevelToolIds = json['toolIds'];
if (topLevelToolIds is List) {
toolIds = topLevelToolIds.map((e) => e.toString()).toList();
}
}
final idRaw = json['id'];
final id = idRaw?.toString();
if (id == null || id.isEmpty) {