Skip to content

Commit

Permalink
Merge branch 'enricoros:v2-dev' into v2-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
darthalex2014 authored Dec 23, 2024
2 parents 286d292 + b4a586f commit 61f1367
Show file tree
Hide file tree
Showing 24 changed files with 566 additions and 288 deletions.
333 changes: 175 additions & 158 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@
"@emotion/react": "^11.14.0",
"@emotion/server": "^11.11.0",
"@emotion/styled": "^11.14.0",
"@mui/icons-material": "^5.16.11",
"@mui/joy": "^5.0.0-beta.50",
"@mui/material": "^5.16.11",
"@next/bundle-analyzer": "^15.1.0",
"@next/third-parties": "^15.1.0",
"@mui/icons-material": "^5.16.12",
"@mui/joy": "^5.0.0-beta.51",
"@mui/material": "^5.16.12",
"@next/bundle-analyzer": "^15.1.1",
"@next/third-parties": "^15.1.1",
"@prisma/client": "^5.22.0",
"@t3-oss/env-nextjs": "^0.11.1",
"@tanstack/react-query": "^5.62.7",
"@trpc/client": "11.0.0-rc.660",
"@trpc/next": "11.0.0-rc.660",
"@trpc/react-query": "11.0.0-rc.660",
"@trpc/server": "11.0.0-rc.660",
"@tanstack/react-query": "^5.62.8",
"@trpc/client": "11.0.0-rc.666",
"@trpc/next": "11.0.0-rc.666",
"@trpc/react-query": "11.0.0-rc.666",
"@trpc/server": "11.0.0-rc.666",
"@vercel/analytics": "^1.4.1",
"@vercel/speed-insights": "^1.1.0",
"browser-fs-access": "^0.35.0",
Expand All @@ -47,7 +47,7 @@
"idb-keyval": "^6.2.1",
"mammoth": "^1.8.0",
"nanoid": "^5.0.9",
"next": "~15.1.0",
"next": "~15.1.1",
"nprogress": "^0.2.0",
"pdfjs-dist": "4.9.155",
"plantuml-encoder": "^1.4.0",
Expand All @@ -56,6 +56,7 @@
"react-beautiful-dnd": "^13.1.1",
"react-csv": "^2.2.2",
"react-dom": "^18.3.1",
"react-hook-form": "^7.54.2",
"react-katex": "^3.0.1",
"react-markdown": "^9.0.1",
"react-player": "^2.16.0",
Expand All @@ -81,16 +82,16 @@
"@types/nprogress": "^0.2.3",
"@types/plantuml-encoder": "^1.4.2",
"@types/prismjs": "^1.26.5",
"@types/react": "^18.3.16",
"@types/react": "^18.3.17",
"@types/react-beautiful-dnd": "^13.1.8",
"@types/react-csv": "^1.1.10",
"@types/react-dom": "^18.3.5",
"@types/react-katex": "^3.0.4",
"@types/react-timeago": "^4.1.7",
"@types/turndown": "^5.0.5",
"cross-env": "^7.0.3",
"eslint": "^9.16.0",
"eslint-config-next": "^15.1.0",
"eslint": "^9.17.0",
"eslint-config-next": "^15.1.1",
"prettier": "^3.4.2",
"prisma": "^5.22.0",
"typescript": "^5.7.2"
Expand All @@ -99,7 +100,7 @@
"node": "^22.0.0 || ^20.0.0 || ^18.0.0"
},
"overrides": {
"@types/react": "^18.3.16",
"@types/react": "^18.3.17",
"@types/react-dom": "^18.3.5"
}
}
2 changes: 1 addition & 1 deletion src/apps/chat/components/layout-bar/useLLMDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function LLMDropdown(props: {
{/* </ListItemButton>*/}
{/*)}*/}

<ListItemButton key='menu-llms' onClick={optimaOpenModels}>
<ListItemButton key='menu-llms' onClick={optimaOpenModels} sx={{ backgroundColor: 'background.surface' }}>
<ListItemDecorator><BuildCircleIcon color='success' /></ListItemDecorator>
<Box sx={{ flexGrow: 1, display: 'flex', justifyContent: 'space-between', gap: 1 }}>
Models
Expand Down
2 changes: 1 addition & 1 deletion src/common/app.release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Release = {

// this is here to trigger revalidation of data, e.g. models refresh
Monotonics: {
Aix: 3,
Aix: 4,
NewsVersion: 191,
},

Expand Down
44 changes: 44 additions & 0 deletions src/common/components/AppBreadcrumbs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import * as React from 'react';

import { Breadcrumbs, Typography } from '@mui/joy';
import KeyboardArrowRightIcon from '@mui/icons-material/KeyboardArrowRight';

import { Link } from '~/common/components/Link';


const _sx = { p: 0 };

export function AppBreadcrumbs(props: {
children?: React.ReactNode;
rootTitle?: string;
onRootClick?: () => void;
}) {

// prevent default href

const { rootTitle, onRootClick } = props;
const handleRootClick = React.useCallback((e: React.MouseEvent) => {
e.preventDefault();
onRootClick?.();
}, [onRootClick]);

return <Breadcrumbs size='sm' separator={<KeyboardArrowRightIcon />} aria-label='breadcrumbs' sx={_sx}>
{(props.children && !!rootTitle && !!onRootClick)
? <AppBreadcrumbs.Link color='neutral' href='#' onClick={handleRootClick}>{props.rootTitle}</AppBreadcrumbs.Link>
: <Typography>{props.rootTitle}</Typography>
}
{props.children}
{/*{nav.pnt === 'create-new' && <Link color='neutral' href='#'>Create New</Link>}*/}
{/*{['Characters', 'Futurama', 'TV Shows', 'Home'].map((item: string) => (*/}
{/* <Link key={item} color='neutral' href='#'>*/}
{/* {item}*/}
{/* </Link>*/}
{/*))}*/}
</Breadcrumbs>;
}

// Important, use this as Link
AppBreadcrumbs.Link = Link;

// Important, use this as Leaf
AppBreadcrumbs.Leaf = Typography;
36 changes: 19 additions & 17 deletions src/common/components/forms/useLLMSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,24 @@ const llmSelectSx: SxProps = {
flex: 1,
backgroundColor: 'background.popup',
// minWidth: '200',
};
} as const;

const _slotProps = {
listbox: {
sx: {
// larger list
'--ListItem-paddingLeft': '1rem',
'--ListItem-minHeight': '2.5rem',
// minWidth: '100%',
},
},
button: {
sx: {
// show the full name on the button
whiteSpace: 'inherit',
},
},
} as const;

/**
* Select the Model, synced with either Global (Chat) LLM state, or local
Expand Down Expand Up @@ -115,22 +132,7 @@ export function useLLMSelect(
disabled={disabled}
onChange={onSelectChange}
placeholder={placeholder}
slotProps={{
listbox: {
sx: {
// larger list
'--ListItem-paddingLeft': '1rem',
'--ListItem-minHeight': '2.5rem',
// minWidth: '100%',
},
},
button: {
sx: {
// show the full name on the button
whiteSpace: 'inherit',
},
},
}}
slotProps={_slotProps}
sx={llmSelectSx}
>
{componentOptions}
Expand Down
4 changes: 2 additions & 2 deletions src/common/components/modals/ConfirmationModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import { GoodModal } from '~/common/components/modals/GoodModal';
*/
export function ConfirmationModal(props: {
open?: boolean, onClose?: () => void, onPositive: () => void,
title?: string | React.JSX.Element,
title?: React.ReactNode,
noTitleBar?: boolean,
lowStakes?: boolean,
confirmationText: string | React.JSX.Element,
confirmationText: React.ReactNode,
positiveActionText: React.ReactNode,
negativeActionText?: React.ReactNode,
negativeActionStartDecorator?: React.ReactNode,
Expand Down
2 changes: 1 addition & 1 deletion src/common/layout/optima/bar/OptimaBarDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function OptimaBarDropdown<TValue extends string>(props: {
</Box>}

{/* Appender */}
{!!props.appendOption && Object.keys(props.items).length >= 1 && <ListDivider sx={{ mt: 0 }} />}
{!!props.appendOption && Object.keys(props.items).length >= 1 && <ListDivider sx={{ my: 0 }} />}
{props.appendOption}
{/*{!!props.appendOption && <Box sx={{ height: 'var(--ListDivider-gap)' }} />}*/}

Expand Down
25 changes: 25 additions & 0 deletions src/common/layout/optima/page/OptimaAppPageHeading.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import * as React from 'react';

import { Box, ListDivider, Typography } from '@mui/joy';


export function OptimaAppPageHeading(props: {
title: React.ReactNode;
tagline?: React.ReactNode;
accentedTagline?: boolean;
startDecorator?: React.ReactNode;
endDecorator?: React.ReactNode;
noDivider?: boolean;
}) {
return (
<Box mb={2.25}>
{!!props.title && <Typography level='h2' sx={{ textAlign: 'start' }} startDecorator={props.startDecorator} endDecorator={props.endDecorator}>
{props.title}
</Typography>}
{!!props.tagline && <Typography level='body-sm' sx={{ color: !props.accentedTagline ? undefined : 'text.secondary', textAlign: 'start', mt: 0.75 }}>
{props.tagline}
</Typography>}
{!props.noDivider && <ListDivider sx={{ mt: 2.25 }} />}
</Box>
);
}
4 changes: 4 additions & 0 deletions src/common/state/store-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ export const useUIPreferencesStore = create<UIPreferencesStore>()(
);


export function useUIComplexityMode(): UIComplexityMode {
return useUIPreferencesStore((state) => state.complexityMode);
}

export function useUIComplexityIsMinimal(): boolean {
return useUIPreferencesStore((state) => state.complexityMode === 'minimal');
}
Expand Down
32 changes: 28 additions & 4 deletions src/common/stores/llms/llms.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,54 @@ export interface DLLM<TLLMOptions = Record<string, any>> {
// do not change anything below! those will be persisted in data
export type DModelInterfaceV1 =
| 'oai-chat'
| 'oai-chat-fn'
| 'oai-chat-json'
| 'oai-chat-vision'
| 'oai-chat-fn'
| 'oai-chat-reasoning'
| 'oai-complete'
| 'ant-prompt-caching'
| 'oai-o1-preview'
| 'oai-prompt-caching'
| 'oai-realtime'
| 'gem-code-execution'
| 'hotfix-no-stream' // disable streaming for o1-preview (old) and o1 (20241217)
| 'hotfix-strip-images' // strip images from the input
| 'hotfix-sys0-to-usr0' // cast sys0 to usr0
;

// Model interfaces (chat, and function calls) - here as a preview, will be used more broadly in the future
// FIXME: keep this in sync with the server side on modules/llms/server/llm.server.types.ts
export const LLM_IF_OAI_Chat: DModelInterfaceV1 = 'oai-chat';
export const LLM_IF_OAI_Fn: DModelInterfaceV1 = 'oai-chat-fn';
export const LLM_IF_OAI_Json: DModelInterfaceV1 = 'oai-chat-json';
// export const LLM_IF_OAI_JsonSchema: ... future?
export const LLM_IF_OAI_Vision: DModelInterfaceV1 = 'oai-chat-vision';
export const LLM_IF_OAI_Fn: DModelInterfaceV1 = 'oai-chat-fn';
export const LLM_IF_OAI_Reasoning: DModelInterfaceV1 = 'oai-chat-reasoning';
export const LLM_IF_OAI_Complete: DModelInterfaceV1 = 'oai-complete';
export const LLM_IF_ANT_PromptCaching: DModelInterfaceV1 = 'ant-prompt-caching';
export const LLM_IF_SPECIAL_OAI_O1Preview: DModelInterfaceV1 = 'oai-o1-preview';
export const LLM_IF_OAI_PromptCaching: DModelInterfaceV1 = 'oai-prompt-caching';
export const LLM_IF_OAI_Realtime: DModelInterfaceV1 = 'oai-realtime';
export const LLM_IF_GEM_CodeExecution: DModelInterfaceV1 = 'gem-code-execution';
export const LLM_IF_HOTFIX_NoStream: DModelInterfaceV1 = 'hotfix-no-stream';
export const LLM_IF_HOTFIX_StripImages: DModelInterfaceV1 = 'hotfix-strip-images';
export const LLM_IF_HOTFIX_Sys0ToUsr0: DModelInterfaceV1 = 'hotfix-sys0-to-usr0';

// TODO: just remove this, and move to a capabilities array (I/O/...)
// FIXME: keep this in sync with the client side on llms.types.ts
export const LLMS_ALL_INTERFACES = [
LLM_IF_OAI_Chat,
LLM_IF_OAI_Fn,
LLM_IF_OAI_Json,
LLM_IF_OAI_Vision,
LLM_IF_OAI_Reasoning,
LLM_IF_OAI_Complete,
LLM_IF_ANT_PromptCaching,
LLM_IF_OAI_PromptCaching,
LLM_IF_OAI_Realtime,
LLM_IF_GEM_CodeExecution,
LLM_IF_HOTFIX_NoStream,
LLM_IF_HOTFIX_StripImages,
LLM_IF_HOTFIX_Sys0ToUsr0,
] as const;

// Future changes?
// export type DModelPartKind = 'text' | 'image' | 'audio' | 'video' | 'pdf';
Expand Down
1 change: 1 addition & 0 deletions src/common/util/dMessageUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ export function prettyShortChatModelName(model: string | undefined): string {
// TODO: fully reform this function to be using information from the DLLM, rather than this manual mapping

// [OpenAI]
if (model.endsWith('-o1')) return 'o1';
if (model.includes('o1-')) {
if (model.includes('o1-mini')) return 'o1 Mini';
if (model.includes('o1-preview')) return 'o1 Preview';
Expand Down
Loading

0 comments on commit 61f1367

Please sign in to comment.