@@ -48,7 +48,11 @@ import {
4848import type { Mode } from "@/ui" ;
4949import { FieldRow } from "./index" ;
5050import type { SettingsDraft } from "./types" ;
51- import { deriveHost , sortedTranslationLocales } from "./aiSectionUtils" ;
51+ import {
52+ agentCliAdapters ,
53+ deriveHost ,
54+ sortedTranslationLocales ,
55+ } from "./aiSectionUtils" ;
5256
5357type AISettingsCardProps = {
5458 draft : SettingsDraft ;
@@ -83,6 +87,7 @@ export function AISettingsCard({
8387 "local" | "agent" | "backend" | "prompts" | "search"
8488 > ( "local" ) ;
8589
90+ const agentAdapters = agentCliAdapters ( settings ?. agentRuntime ?. adapters ) ;
8691 const host = deriveHost ( settings ?. llmEndpoint ) ;
8792 const defaultEndpoints : Record < string , string > = {
8893 ollama : `http://${ host } :11434` ,
@@ -171,10 +176,8 @@ export function AISettingsCard({
171176 value : "agent" as const ,
172177 label : t ( "settings.aiTabAgent" ) ,
173178 icon : < Bot /> ,
174- badge : settings ?. agentRuntime ?. adapters ?. length ? (
175- < Badge tone = "green" >
176- { settings . agentRuntime . adapters . length }
177- </ Badge >
179+ badge : agentAdapters . length ? (
180+ < Badge tone = "green" > { agentAdapters . length } </ Badge >
178181 ) : undefined ,
179182 } ,
180183 {
@@ -454,20 +457,18 @@ export function AISettingsCard({
454457 < FieldRow
455458 label = { t ( "settings.agentAvailable" ) }
456459 description = {
457- settings ?. agentRuntime ?. adapters ? .length
460+ agentAdapters . length
458461 ? undefined
459462 : t ( "settings.agentNoneDetected" )
460463 }
461464 >
462465 < div className = "flex flex-wrap items-center gap-1.5" >
463- { settings ?. agentRuntime ?. adapters
464- ?. filter ( ( a ) => a . id !== "local-llm" )
465- . map ( ( a ) => (
466- < Badge key = { a . id } tone = "green" >
467- { a . name }
468- { a . version ? ` ${ a . version } ` : "" }
469- </ Badge >
470- ) ) }
466+ { agentAdapters . map ( ( a ) => (
467+ < Badge key = { a . id } tone = "green" >
468+ { a . name }
469+ { a . version ? ` ${ a . version } ` : "" }
470+ </ Badge >
471+ ) ) }
471472 < Tooltip label = { t ( "settings.agentDetectTooltip" ) } >
472473 < IconButton
473474 size = "sm"
@@ -476,10 +477,9 @@ export function AISettingsCard({
476477 onClick = { ( ) =>
477478 detectMutation . mutate ( undefined , {
478479 onSuccess : ( data ) => {
479- const count =
480- data . settings . agentRuntime ?. adapters ?. filter (
481- ( a ) => a . id !== "local-llm" ,
482- ) . length ?? 0 ;
480+ const count = agentCliAdapters (
481+ data . settings . agentRuntime ?. adapters ,
482+ ) . length ;
483483 toast . success (
484484 t ( "settings.agentDetectDone" , { count } ) ,
485485 ) ;
0 commit comments