// utils/Global.kt package utils import io.ktor.client.* import io.ktor.client.engine.cio.* import io.ktor.client.plugins.* import io.ktor.client.plugins.contentnegotiation.* import io.ktor.serialization.kotlinx.json.* import kotlinx.serialization.json.Json import java.text.SimpleDateFormat import java.util.* import java.util.prefs.Preferences object Global { val httpClient = HttpClient(CIO) { install(ContentNegotiation) { json(Json { isLenient = true; ignoreUnknownKeys = true; prettyPrint = true }) } install(HttpTimeout) { requestTimeoutMillis = 900000 } } val jsonParser = Json { prettyPrint = true; ignoreUnknownKeys = true; encodeDefaults = true; coerceInputValues = true } val prefs: Preferences = Preferences.userNodeForPackage(Unit::class.java) const val PREF_FOLDER_PATH = "folder_path" const val PREF_API_KEY = "api_key" const val PREF_WORKSPACE_SLUG = "workspace_slug" const val PREF_RECEIPT_WORKSPACE_SLUG = "receipt_workspace_slug" const val PREF_MODEL_NAME = "model_name" } fun logMessage(logs: MutableList, message: String) { val timestamp = SimpleDateFormat("HH:mm:ss", Locale.getDefault()).format(Date()) logs.add(0, "$timestamp: $message") }