feat(multirun): enforce maximum model selection limit and update UI hints
This commit is contained in:
@@ -31,6 +31,9 @@ import type { ModelMetadata } from '@/types';
|
|||||||
/** Max file size in bytes (10MB) */
|
/** Max file size in bytes (10MB) */
|
||||||
const MAX_FILE_SIZE = 10 * 1024 * 1024;
|
const MAX_FILE_SIZE = 10 * 1024 * 1024;
|
||||||
|
|
||||||
|
/** Max number of concurrent runs */
|
||||||
|
const MAX_MODELS = 5;
|
||||||
|
|
||||||
/** Attached file for multi-run (simplified from sessionStore's AttachedFile) */
|
/** Attached file for multi-run (simplified from sessionStore's AttachedFile) */
|
||||||
interface MultiRunAttachedFile {
|
interface MultiRunAttachedFile {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -609,6 +612,9 @@ export const MultiRunLauncher: React.FC<MultiRunLauncherProps> = ({
|
|||||||
|
|
||||||
|
|
||||||
const handleAddModel = (model: ModelSelectionWithId) => {
|
const handleAddModel = (model: ModelSelectionWithId) => {
|
||||||
|
if (selectedModels.length >= MAX_MODELS) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
setSelectedModels((prev) => [...prev, model]);
|
setSelectedModels((prev) => [...prev, model]);
|
||||||
clearError();
|
clearError();
|
||||||
};
|
};
|
||||||
@@ -942,7 +948,7 @@ export const MultiRunLauncher: React.FC<MultiRunLauncherProps> = ({
|
|||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<label className="typography-ui-label font-medium text-foreground">
|
<label className="typography-ui-label font-medium text-foreground">
|
||||||
Models <span className="text-destructive">*</span>
|
Models <span className="text-destructive">*</span>
|
||||||
<span className="ml-1 font-normal text-muted-foreground">(select at least 2)</span>
|
<span className="ml-1 font-normal text-muted-foreground">(select at least 2, maximum 5)</span>
|
||||||
</label>
|
</label>
|
||||||
<ModelMultiSelect
|
<ModelMultiSelect
|
||||||
selectedModels={selectedModels}
|
selectedModels={selectedModels}
|
||||||
|
|||||||
@@ -91,6 +91,11 @@ export const useMultiRunStore = create<MultiRunStore>()(
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (models.length > 5) {
|
||||||
|
set({ error: 'Maximum 5 models allowed' });
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
set({ isLoading: true, error: null });
|
set({ isLoading: true, error: null });
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user