import * as React from 'react';
import { Box, Button, DialogContent, DialogTitle, Dropdown, FormControl, FormLabel, IconButton, Input, ListDivider, ListItem, ListItemDecorator, Menu, MenuButton, MenuItem, Modal, ModalClose, ModalDialog, Typography } from '@mui/joy';
import CheckRoundedIcon from '@mui/icons-material/CheckRounded';
import DeleteOutlineIcon from '@mui/icons-material/DeleteOutline';
import DriveFileRenameOutlineRoundedIcon from '@mui/icons-material/DriveFileRenameOutlineRounded';
import MoreVertIcon from '@mui/icons-material/MoreVert';
import SchoolRoundedIcon from '@mui/icons-material/SchoolRounded';
import type { DLLMId } from '~/common/stores/llms/llms.types';
import type { BeamStoreApi } from '../store-beam.hooks';
import { useModuleBeamStore } from '../store-module-beam';
/// Naming Dialog ///
function DialogNamePreset(props: {
open: boolean,
onClose: () => void,
onStore: (name: string) => void,
}) {
// state
const [name, setName] = React.useState('');
const handleClose = () => {
setName('');
props.onClose();
};
return (
Save Preset
Store the Models configuration.
);
}
export function BeamScatterDropdown(props: {
beamStore: BeamStoreApi,
onExplainerShow: () => any,
}) {
// state
const [namingOpened, setNamingOpened] = React.useState(false);
// external state
const {
presets, addPreset, deletePreset,
cardAdd, toggleCardAdd,
cardScrolling, toggleCardScrolling,
scatterShowPrevMessages, toggleScatterShowPrevMessages,
scatterShowLettering, toggleScatterShowLettering,
gatherAutoStartAfterScatter, toggleGatherAutoStartAfterScatter,
gatherShowAllPrompts, toggleGatherShowAllPrompts,
} = useModuleBeamStore();
// handlers - load/save presets
const handleClosePresetNaming = React.useCallback(() => setNamingOpened(false), []);
const handlePresetSave = React.useCallback((presetName: string) => {
const { rays, currentGatherLlmId, currentFactoryId } = props.beamStore.getState();
const rayLlmIds = rays.map(ray => ray.rayLlmId).filter(Boolean) as DLLMId[];
addPreset(presetName, rayLlmIds, currentGatherLlmId, currentFactoryId);
handleClosePresetNaming();
}, [addPreset, handleClosePresetNaming, props.beamStore]);
const handlePresetLoad = React.useCallback((presetId: string) => {
const preset = useModuleBeamStore.getState().presets.find(preset => preset.id === presetId);
preset && props.beamStore.getState().loadBeamConfig(preset);
}, [props.beamStore]);
// NOTE: DEVS only - DEBUG only
const handleClearLastConfig = React.useCallback(() => {
// this is used to debug the heuristics for model selection
useModuleBeamStore.getState().deleteLastConfig();
}, []);
return <>
{/* Scatter Dropdown */}
{/* Options dialog */}
>;
}