diff --git a/package-lock.json b/package-lock.json index a9c59ae0..004840a5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -100,6 +100,7 @@ "electron": "^22.3.13", "electron-builder": "^24.13.3", "electron-devtools-installer": "^3.2.0", + "electron-reload": "^2.0.0-alpha.1", "electronmon": "^2.0.2", "eslint": "^8.42.0", "eslint-config-airbnb-base": "^15.0.0", @@ -7500,9 +7501,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001561", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz", - "integrity": "sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw==", + "version": "1.0.30001655", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001655.tgz", + "integrity": "sha512-jRGVy3iSGO5Uutn2owlb5gR6qsGngTw9ZTb4ali9f3glshcNmJ2noam4Mo9zia5P9Dk3jNNydy7vQjuE5dQmfg==", "dev": true, "funding": [ { @@ -9705,6 +9706,15 @@ "node": ">=4.0.0" } }, + "node_modules/electron-reload": { + "version": "2.0.0-alpha.1", + "resolved": "https://registry.npmjs.org/electron-reload/-/electron-reload-2.0.0-alpha.1.tgz", + "integrity": "sha512-hTde7gv0TEqxbxlB3pj2CwoyCQ9sdiQrcP8GkpzhosxyVeYM3mZbMEVKCZK3L0fED7Mz5A9IWmK7zEvi4H3P1g==", + "dev": true, + "dependencies": { + "chokidar": "^3.5.2" + } + }, "node_modules/electron-store": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/electron-store/-/electron-store-8.1.0.tgz", diff --git a/package.json b/package.json index 6708b34a..21a5feb2 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "electron": "^22.3.13", "electron-builder": "^24.13.3", "electron-devtools-installer": "^3.2.0", + "electron-reload": "^2.0.0-alpha.1", "electronmon": "^2.0.2", "eslint": "^8.42.0", "eslint-config-airbnb-base": "^15.0.0", diff --git a/src/renderer/components/AIProviderSelect.tsx b/src/renderer/components/AIProviderSelect.tsx index e081a3b8..1a819318 100644 --- a/src/renderer/components/AIProviderSelect.tsx +++ b/src/renderer/components/AIProviderSelect.tsx @@ -2,11 +2,11 @@ import { Chip, MenuItem, Typography } from '@mui/material' import { ModelProvider, ModelSettings } from '../../shared/types' import { useTranslation } from 'react-i18next' import { AIModelProviderMenuOptionList } from '../packages/models' -import * as React from 'react'; -import Button from '@mui/material/Button'; -import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; -import StyledMenu from './StyledMenu'; -import StarIcon from '@mui/icons-material/Star'; +import * as React from 'react' +import Button from '@mui/material/Button' +import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown' +import StyledMenu from './StyledMenu' +import StarIcon from '@mui/icons-material/Star' interface ModelConfigProps { settings: ModelSettings @@ -19,29 +19,25 @@ export default function AIProviderSelect(props: ModelConfigProps) { const { settings, setSettings, className, hideCustomProviderManage } = props const { t } = useTranslation() - const [menuAnchorEl, setMenuAnchorEl] = React.useState(null); - const menuState = Boolean(menuAnchorEl); + const [menuAnchorEl, setMenuAnchorEl] = React.useState(null) + const menuState = Boolean(menuAnchorEl) const openMenu = (event: React.MouseEvent) => { - setMenuAnchorEl(event.currentTarget); - }; + setMenuAnchorEl(event.currentTarget) + } const closeMenu = () => { - setMenuAnchorEl(null); - }; + setMenuAnchorEl(null) + } return ( <> - + {t('Model Provider')}: -
- - { - AIModelProviderMenuOptionList.map((provider) => ( - { - setSettings({ - ...settings, - aiProvider: provider.value as ModelProvider, - }) - closeMenu() - }} - > - - {provider.label} - {provider.featured && ( - - )} - - )) - } + {AIModelProviderMenuOptionList.map((provider) => ( + { + setSettings({ + ...settings, + aiProvider: provider.value as ModelProvider, + }) + closeMenu() + }} + > + + {provider.label} + {provider.featured && ( + + )} + + ))}
) } - diff --git a/src/renderer/components/Accordion.tsx b/src/renderer/components/Accordion.tsx index a224a87d..10a9fc23 100644 --- a/src/renderer/components/Accordion.tsx +++ b/src/renderer/components/Accordion.tsx @@ -8,8 +8,7 @@ export const Accordion = styled((props: AccordionProps) => ( ))(({ theme }) => ({ border: `1px solid ${theme.palette.divider}`, - '&:not(:last-child)': { - }, + '&:not(:last-child)': {}, '&:before': { display: 'none', }, diff --git a/src/renderer/components/FeatherlessModelSelect.tsx b/src/renderer/components/FeatherlessModelSelect.tsx new file mode 100644 index 00000000..04e3c97d --- /dev/null +++ b/src/renderer/components/FeatherlessModelSelect.tsx @@ -0,0 +1,49 @@ +import { Select, MenuItem, FormControl, InputLabel, TextField } from '@mui/material' +import { ModelSettings } from '../../shared/types' +import { useTranslation } from 'react-i18next' +import { models } from '../packages/models/featherlessai' + +export interface Props { + model: ModelSettings['featherlessModel'] + featherlessCustomModel: ModelSettings['featherlessCustomModel'] + onChange( + model: ModelSettings['featherlessModel'], + featherlessCustomModel: ModelSettings['featherlessCustomModel'] + ): void + className?: string +} + +export default function FeatherlessModelSelect(props: Props) { + const { t } = useTranslation() + return ( + + {t('model')} + + {props.model === 'custom-model' && ( + props.onChange(props.model, e.target.value.trim())} + /> + )} + + ) +} diff --git a/src/renderer/components/Header.tsx b/src/renderer/components/Header.tsx index 07c0bc86..ce3553fb 100644 --- a/src/renderer/components/Header.tsx +++ b/src/renderer/components/Header.tsx @@ -7,7 +7,7 @@ import * as sessionActions from '../stores/sessionActions' import Toolbar from './Toolbar' import { cn } from '@/lib/utils' -interface Props { } +interface Props {} export default function Header(props: Props) { const theme = useTheme() @@ -15,12 +15,9 @@ export default function Header(props: Props) { const setChatConfigDialogSession = useSetAtom(atoms.chatConfigDialogAtom) useEffect(() => { - if ( - currentSession.name === 'Untitled' - && currentSession.messages.length >= 2 - ) { + if (currentSession.name === 'Untitled' && currentSession.messages.length >= 2) { sessionActions.generateName(currentSession.id) - return + return } }, [currentSession.messages.length]) diff --git a/src/renderer/components/InputBox.tsx b/src/renderer/components/InputBox.tsx index 15a3cf1a..f24f7745 100644 --- a/src/renderer/components/InputBox.tsx +++ b/src/renderer/components/InputBox.tsx @@ -5,10 +5,7 @@ import { useTranslation } from 'react-i18next' import * as atoms from '../stores/atoms' import { useSetAtom } from 'jotai' import * as sessionActions from '../stores/sessionActions' -import { - SendHorizontal, - Settings2, -} from 'lucide-react' +import { SendHorizontal, Settings2 } from 'lucide-react' import { cn } from '@/lib/utils' import icon from '../static/icon.png' import { trackingEvent } from '@/packages/event' @@ -50,13 +47,7 @@ export default function InputBox(props: Props) { } const onKeyDown = (event: React.KeyboardEvent) => { - if ( - event.keyCode === 13 && - !event.shiftKey && - !event.ctrlKey && - !event.altKey && - !event.metaKey - ) { + if (event.keyCode === 13 && !event.shiftKey && !event.ctrlKey && !event.altKey && !event.metaKey) { event.preventDefault() handleSubmit() return @@ -71,7 +62,8 @@ export default function InputBox(props: Props) { const [easterEgg, setEasterEgg] = useState(false) return ( -
-
-
- +
+ { setEasterEgg(true) setTimeout(() => setEasterEgg(false), 1000) @@ -89,20 +83,23 @@ export default function InputBox(props: Props) { > - setChatConfigDialogSession(sessionActions.getCurrentSession())} tooltipTitle={ -
+
{t('Customize settings for the current conversation')}
} - tooltipPlacement='top' + tooltipPlacement="top" > - +
-
- + } - tooltipPlacement='top' + tooltipPlacement="top" onClick={() => handleSubmit()} > - +
-
+