mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-05 16:44:22 +00:00
Auto-select first node in InstanceSettingsCard if none is selected
This commit is contained in:
@@ -35,6 +35,12 @@ const InstanceSettingsCard: React.FC<InstanceSettingsCardProps> = ({
|
|||||||
try {
|
try {
|
||||||
const fetchedNodes = await nodesApi.list()
|
const fetchedNodes = await nodesApi.list()
|
||||||
setNodes(fetchedNodes)
|
setNodes(fetchedNodes)
|
||||||
|
|
||||||
|
// Auto-select first node if none selected
|
||||||
|
const nodeNames = Object.keys(fetchedNodes)
|
||||||
|
if (nodeNames.length > 0 && (!formData.nodes || formData.nodes.length === 0)) {
|
||||||
|
onChange('nodes', [nodeNames[0]])
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to fetch nodes:', error)
|
console.error('Failed to fetch nodes:', error)
|
||||||
} finally {
|
} finally {
|
||||||
@@ -43,6 +49,7 @@ const InstanceSettingsCard: React.FC<InstanceSettingsCardProps> = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fetchNodes()
|
void fetchNodes()
|
||||||
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const nodeOptions = Object.keys(nodes).map(nodeName => ({
|
const nodeOptions = Object.keys(nodes).map(nodeName => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user