fix: set default capabilities on LlamaCpp provider to unblock router

LlamaCppInferenceProvider was created with empty capabilities, causing
NoEligibleProviderException when the router requested ModelCapability.General.
FirstAvailableRoutingStrategy requires declared capabilities to cover all
requested ones — empty set satisfied nothing.

Add a DEFAULT_LLAMA_CAPABILITIES constant with General, Coding, Reasoning,
Summarization, and ToolCalling scores, and pass it through createLlamaCppProvider()
to ModelDescriptor. Existing callers get sensible defaults automatically.

This is the root cause of the 'router not connected — epic 14' placeholder:
the server-side error (capability mismatch) sent a ProtocolError instead of a
RouterResponseMessage, so the TUI never set routerConnected=true.
This commit is contained in:
2026-05-29 20:59:16 +04:00
parent 955f1a6987
commit 1cad2bbde1
@@ -8,8 +8,10 @@ import com.correx.core.artifacts.repository.ArtifactRepository
import com.correx.core.artifactstore.ArtifactStore
import com.correx.core.events.EventDispatcher
import com.correx.core.events.stores.EventStore
import com.correx.core.inference.CapabilityScore
import com.correx.core.inference.InferenceProvider
import com.correx.core.inference.InferenceRouter
import com.correx.core.inference.ModelCapability
import com.correx.core.inference.Tokenizer
import com.correx.core.router.DefaultRouterContextBuilder
import com.correx.core.router.DefaultRouterFacade
@@ -53,6 +55,14 @@ object InfrastructureModule {
private val defaultArtifactsRoot: String =
"${System.getProperty("user.home")}/.config/correx/artifacts"
private val DEFAULT_LLAMA_CAPABILITIES: Set<CapabilityScore> = setOf(
CapabilityScore(ModelCapability.General, 1.0),
CapabilityScore(ModelCapability.Coding, 0.7),
CapabilityScore(ModelCapability.Reasoning, 0.6),
CapabilityScore(ModelCapability.Summarization, 0.8),
CapabilityScore(ModelCapability.ToolCalling, 0.5),
)
fun createEventStore(artifactStore: ArtifactStore, dbPath: String = defaultDbPath): EventStore {
val dir = java.io.File(dbPath).parentFile
if (!dir.exists()) dir.mkdirs()
@@ -76,11 +86,13 @@ object InfrastructureModule {
modelPath: String,
baseUrl: String = "http://127.0.0.1:10000",
residencyMode: ResidencyMode = ResidencyMode.PERSISTENT,
capabilities: Set<CapabilityScore> = DEFAULT_LLAMA_CAPABILITIES,
): LlamaCppInferenceProvider = LlamaCppInferenceProvider(
descriptor = ModelDescriptor(
modelId = modelId,
modelPath = modelPath,
residencyMode = residencyMode,
capabilities = capabilities,
),
baseUrl = baseUrl,
)