diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/CodingActor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/CodingActor.kt index 0eb8ad33..f534151b 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/CodingActor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/CodingActor.kt @@ -1,6 +1,5 @@ package com.simiacryptus.skyenet.core.actors -import com.fasterxml.jackson.annotation.JsonIgnore import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.ApiModel.* import com.simiacryptus.jopenai.ClientUtil.toContentList @@ -50,7 +49,7 @@ open class CodingActor( } val code: String - val status: CodeResult.Status + val status: Status val result: ExecutionResult } @@ -176,17 +175,16 @@ open class CodingActor( return executionResult } - private inner class CodeResultImpl( + inner class CodeResultImpl( vararg val messages: ChatMessage, - val input: CodeRequest, - val api: OpenAIClient, - val givenCode: String? = null, + private val input: CodeRequest, + private val api: OpenAIClient, + private val givenCode: String? = null, ) : CodeResult { var _status = CodeResult.Status.Coding override val status get() = _status - @JsonIgnore override val code: String = givenCode ?: try { implement(model) } catch (ex: FailedToImplementException) { @@ -263,6 +261,7 @@ open class CodingActor( private val executionResult by lazy { execute(input.codePrefix, code) } + override val result get() = executionResult } diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedActor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedActor.kt index 279d841e..6318299f 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedActor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/ParsedActor.kt @@ -1,5 +1,6 @@ package com.simiacryptus.skyenet.core.actors +import com.fasterxml.jackson.annotation.JsonIgnore import com.simiacryptus.jopenai.API import com.simiacryptus.jopenai.ApiModel import com.simiacryptus.jopenai.ClientUtil.toContentList diff --git a/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/CodingActorInterceptor.kt b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/CodingActorInterceptor.kt index e29ac7da..0d31ceae 100644 --- a/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/CodingActorInterceptor.kt +++ b/core/src/main/kotlin/com/simiacryptus/skyenet/core/actors/record/CodingActorInterceptor.kt @@ -32,9 +32,16 @@ class CodingActorInterceptor( } - override fun answer(vararg messages: ChatMessage, input: CodeRequest, api: API) = - functionInterceptor.wrap(messages, input) - { messages, input -> inner.answer(*messages, input=input, api = api) } + override fun answer(vararg messages: ChatMessage, input: CodeRequest, api: API): CodeResult { + val codeResult = functionInterceptor.wrap(messages, input) + { messages, input -> inner.answer(*messages, input = input, api = api).code } + return inner.CodeResultImpl( + messages=messages, + input=input, + api=api as com.simiacryptus.jopenai.OpenAIClient, + givenCode = codeResult + ) + } override fun execute(prefix: String, code: String) = functionInterceptor.wrap(prefix, code)