feat: add generation source handling for task creation and updates
All checks were successful
Build And Publish Production Image / Build And Publish Production Image (push) Successful in 50s
All checks were successful
Build And Publish Production Image / Build And Publish Production Image (push) Successful in 50s
This commit is contained in:
@@ -3,6 +3,8 @@ package com.condado.newsletter.model
|
||||
import jakarta.persistence.CascadeType
|
||||
import jakarta.persistence.Column
|
||||
import jakarta.persistence.Entity
|
||||
import jakarta.persistence.EnumType
|
||||
import jakarta.persistence.Enumerated
|
||||
import jakarta.persistence.FetchType
|
||||
import jakarta.persistence.GeneratedValue
|
||||
import jakarta.persistence.GenerationType
|
||||
@@ -37,6 +39,10 @@ class EntityTask(
|
||||
@Column(name = "email_lookback", nullable = false)
|
||||
val emailLookback: String,
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "generation_source", nullable = false)
|
||||
val generationSource: TaskGenerationSource = TaskGenerationSource.LLAMA,
|
||||
|
||||
@Column(nullable = false)
|
||||
val active: Boolean = true,
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.condado.newsletter.model
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator
|
||||
import com.fasterxml.jackson.annotation.JsonValue
|
||||
|
||||
enum class TaskGenerationSource(
|
||||
@get:JsonValue val value: String
|
||||
) {
|
||||
OPENAI("openai"),
|
||||
LLAMA("llama");
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
@JsonCreator
|
||||
fun from(value: String): TaskGenerationSource =
|
||||
entries.firstOrNull { it.value.equals(value, ignoreCase = true) }
|
||||
?: throw IllegalArgumentException("Invalid generationSource: $value")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user