mirror of
https://github.com/carlrobertoh/ProxyAI.git
synced 2026-07-09 17:28:59 +00:00
feat: make subagent acp config options dynamic
This commit is contained in:
parent
96c1a05748
commit
e7208b5e79
3 changed files with 15 additions and 13 deletions
|
|
@ -114,11 +114,15 @@ class ExternalAcpAgentService(private val project: Project) {
|
|||
ensureSessionReady(session, preset, NO_OP_EVENTS)
|
||||
}
|
||||
|
||||
suspend fun loadConfigOptions(externalAgentId: String): List<AcpConfigOption> {
|
||||
suspend fun loadConfigOptions(
|
||||
externalAgentId: String,
|
||||
existingSelections: Map<String, String> = emptyMap()
|
||||
): List<AcpConfigOption> {
|
||||
val session = AgentSession(
|
||||
sessionId = "subagent-settings:$externalAgentId:${UUID.randomUUID()}",
|
||||
conversation = Conversation(),
|
||||
externalAgentId = externalAgentId
|
||||
externalAgentId = externalAgentId,
|
||||
externalAgentConfigSelections = existingSelections
|
||||
)
|
||||
return try {
|
||||
warmUpSession(session)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import com.intellij.openapi.components.service
|
|||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.ui.DocumentAdapter
|
||||
import com.intellij.ui.SearchTextField
|
||||
import com.intellij.ui.components.JBLabel
|
||||
import com.intellij.ui.components.JBScrollPane
|
||||
import com.intellij.ui.table.JBTable
|
||||
import com.intellij.util.ui.JBFont
|
||||
|
|
@ -29,7 +28,7 @@ class AcpAgentSettingsForm(project: Project) {
|
|||
private val presets = ExternalAcpAgents.all()
|
||||
private val root = BorderLayoutPanel()
|
||||
private val searchField = SearchTextField().apply {
|
||||
textEditor.emptyText.text = "Search ACP runtimes..."
|
||||
textEditor.emptyText.text = "Search external agents..."
|
||||
border = JBUI.Borders.compound(
|
||||
JBUI.Borders.customLine(UIUtil.getTooltipSeparatorColor(), 1),
|
||||
JBUI.Borders.empty(3, 8)
|
||||
|
|
@ -38,13 +37,6 @@ class AcpAgentSettingsForm(project: Project) {
|
|||
}
|
||||
private val tableModel = AcpAgentTableModel()
|
||||
private val rowSorter = TableRowSorter(tableModel)
|
||||
private val helperLabel = JBLabel(
|
||||
"ACP runtimes are external agents that can appear in the Agent runtime dropdown."
|
||||
).apply {
|
||||
font = JBFont.small()
|
||||
foreground = UIUtil.getContextHelpForeground()
|
||||
border = JBUI.Borders.emptyTop(6)
|
||||
}
|
||||
private val table = JBTable(tableModel).apply {
|
||||
rowSorter = this@AcpAgentSettingsForm.rowSorter
|
||||
emptyText.text = "No ACP runtimes match your search."
|
||||
|
|
@ -94,7 +86,6 @@ class AcpAgentSettingsForm(project: Project) {
|
|||
BorderLayoutPanel().apply {
|
||||
border = JBUI.Borders.emptyBottom(8)
|
||||
addToTop(searchField)
|
||||
addToCenter(helperLabel)
|
||||
}
|
||||
)
|
||||
root.addToCenter(scrollPane)
|
||||
|
|
|
|||
|
|
@ -295,8 +295,11 @@ class SubagentDetailsPanel(
|
|||
rebuildExternalOptionsPanel()
|
||||
|
||||
val requestId = ++loadSequence
|
||||
val selectionsSnapshot = current?.externalAgentOptions?.toMap().orEmpty()
|
||||
loadJob = backgroundScope.launch {
|
||||
val result = runCatching { externalAgentService.loadConfigOptions(externalAgentId) }
|
||||
val result = runCatching {
|
||||
externalAgentService.loadConfigOptions(externalAgentId, selectionsSnapshot)
|
||||
}
|
||||
|
||||
runInEdt(ModalityState.any()) {
|
||||
if (requestId != loadSequence || current?.externalAgentId != externalAgentId) {
|
||||
|
|
@ -405,6 +408,10 @@ class SubagentDetailsPanel(
|
|||
combo.addActionListener {
|
||||
val selected = combo.selectedItem as? AcpConfigOptionChoice ?: return@addActionListener
|
||||
current?.externalAgentOptions?.set(option.id, selected.value)
|
||||
if (option.category == "model") {
|
||||
current?.externalAgentId?.let { externalOptionsCache.remove(it) }
|
||||
refreshExternalOptions()
|
||||
}
|
||||
}
|
||||
|
||||
val comboPanel = JPanel(BorderLayout())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue