diff --git a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/ChatJsonRPCService.java b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/ChatJsonRPCService.java index 4e5e18acb..fece434f8 100644 --- a/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/ChatJsonRPCService.java +++ b/core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/devui/ChatJsonRPCService.java @@ -1,10 +1,10 @@ package io.quarkiverse.langchain4j.runtime.devui; +import java.util.List; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.atomic.AtomicReference; import jakarta.enterprise.context.control.ActivateRequestContext; -import jakarta.inject.Inject; import dev.langchain4j.data.message.AiMessage; import dev.langchain4j.data.message.SystemMessage; @@ -13,17 +13,22 @@ import dev.langchain4j.memory.chat.ChatMemoryProvider; import dev.langchain4j.model.chat.ChatLanguageModel; import dev.langchain4j.model.output.Response; +import io.quarkus.arc.All; @ActivateRequestContext public class ChatJsonRPCService { - @Inject - ChatLanguageModel model; + private final ChatLanguageModel model; - @Inject - ChatMemoryProvider memoryProvider; + private final ChatMemoryProvider memoryProvider; - private AtomicReference currentMemory = new AtomicReference<>(); + public ChatJsonRPCService(@All List models, // don't use ChatLanguageModel model because it results in the default model not being configured + ChatMemoryProvider memoryProvider) { + this.model = models.get(0); + this.memoryProvider = memoryProvider; + } + + private final AtomicReference currentMemory = new AtomicReference<>(); public String reset(String systemMessage) { if (currentMemory.get() != null) { diff --git a/docs/modules/ROOT/pages/includes/attributes.adoc b/docs/modules/ROOT/pages/includes/attributes.adoc index 73b4467c1..7ee09560f 100644 --- a/docs/modules/ROOT/pages/includes/attributes.adoc +++ b/docs/modules/ROOT/pages/includes/attributes.adoc @@ -1,3 +1,3 @@ :project-version: 0.8.1 :langchain4j-version: 0.27.1 -:examples-dir: ./../examples/ +:examples-dir: ./../examples/ \ No newline at end of file