mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-06 09:04:27 +00:00
Fix backend_options cleanup to exclude empty arrays in InstanceDialog
This commit is contained in:
@@ -106,7 +106,7 @@ const InstanceDialog: React.FC<InstanceDialogProps> = ({
|
|||||||
// Clean up undefined values to avoid sending empty fields
|
// Clean up undefined values to avoid sending empty fields
|
||||||
const cleanOptions: CreateInstanceOptions = {};
|
const cleanOptions: CreateInstanceOptions = {};
|
||||||
Object.entries(formData).forEach(([key, value]) => {
|
Object.entries(formData).forEach(([key, value]) => {
|
||||||
if (key === 'backend_options' && value && typeof value === 'object') {
|
if (key === 'backend_options' && value && typeof value === 'object' && !Array.isArray(value)) {
|
||||||
// Handle backend_options specially - clean nested object
|
// Handle backend_options specially - clean nested object
|
||||||
const cleanBackendOptions: any = {};
|
const cleanBackendOptions: any = {};
|
||||||
Object.entries(value).forEach(([backendKey, backendValue]) => {
|
Object.entries(value).forEach(([backendKey, backendValue]) => {
|
||||||
@@ -118,7 +118,7 @@ const InstanceDialog: React.FC<InstanceDialogProps> = ({
|
|||||||
cleanBackendOptions[backendKey] = backendValue;
|
cleanBackendOptions[backendKey] = backendValue;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only include backend_options if it has content
|
// Only include backend_options if it has content
|
||||||
if (Object.keys(cleanBackendOptions).length > 0) {
|
if (Object.keys(cleanBackendOptions).length > 0) {
|
||||||
(cleanOptions as any)[key] = cleanBackendOptions;
|
(cleanOptions as any)[key] = cleanBackendOptions;
|
||||||
|
|||||||
Reference in New Issue
Block a user