Skip to content

Commit dae20f4

Browse files
committed
Fix: Add companion object to ModelData class for fromJson extension
1 parent 59e97f0 commit dae20f4

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

ai-module/src/main/java/com/nano/ai_module/model/ModelsData.kt

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ data class ModelData(
4848
// Prompt configuration
4949
var systemPrompt: String = "You are a helpful assistant.",
5050
var chatTemplate: String? = null
51-
)
51+
) {
52+
companion object
53+
}
5254

5355

5456
@Serializable
@@ -164,9 +166,6 @@ fun ModelData.getFormattedSize(): String? {
164166
}
165167
}
166168

167-
// Required companion object for fromJson extension
168-
fun ModelData.create() = ModelData()
169-
170169
/**
171170
* Creates ModelData from JSON string for deserialization.
172171
*/
@@ -199,8 +198,4 @@ fun ModelData.Companion.fromJson(jsonString: String): ModelData {
199198
systemPrompt = json.optString("systemPrompt", "You are a helpful assistant."),
200199
chatTemplate = json.optString("chatTemplate", null)
201200
)
202-
}
203-
204-
// Companion object for ModelData
205-
val ModelData.Companion: ModelDataCompanion get() = ModelDataCompanion
206-
object ModelDataCompanion
201+
}

0 commit comments

Comments
 (0)