diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2.tsx deleted file mode 100644 index 19a6ebff1e15..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2.tsx +++ /dev/null @@ -1,193 +0,0 @@ -import {Home} from '@mui/icons-material'; -import { - AppBar, - Box, - Breadcrumbs, - IconButton, - Link as MaterialLink, - Toolbar, - Typography, -} from '@mui/material'; -import {LicenseInfo} from '@mui/x-license'; -import React, {FC} from 'react'; -import { - BrowserRouter as Router, - Link as RouterLink, - Route, - Switch, - useParams, -} from 'react-router-dom'; - -import {Browse2EntityPage} from './Browse2/Browse2EntityPage'; -import {Browse2HomePage} from './Browse2/Browse2HomePage'; -import {Browse2ObjectPage} from './Browse2/Browse2ObjectPage'; -import {Browse2ObjectTypePage} from './Browse2/Browse2ObjectTypePage'; -import {Browse2ProjectPage} from './Browse2/Browse2ProjectPage'; -import {Browse2TracePage} from './Browse2/Browse2TracePage'; -import {Browse2TracesPage} from './Browse2/Browse2TracesPage'; -LicenseInfo.setLicenseKey( - 'c3f549c76a1e054e5e314b2f1ecfca1cTz05OTY3MixFPTE3NjAxMTM3NDAwMDAsUz1wcm8sTE09c3Vic2NyaXB0aW9uLFBWPWluaXRpYWwsS1Y9Mg==' -); - -interface Browse2Params { - entity?: string; - project?: string; - rootType?: string; - objName?: string; - objVersion?: string; - refExtra?: string; -} - -const AppBarLink = (props: React.ComponentProps) => ( - theme.palette.getContrastText(theme.palette.primary.main), - '&:hover': { - color: theme => - theme.palette.getContrastText(theme.palette.primary.dark), - }, - }} - {...props} - component={RouterLink} - /> -); - -const Browse2Breadcrumbs: FC = props => { - const params = useParams(); - const refFields = params.refExtra?.split('/') ?? []; - return ( - - {params.entity && ( - {params.entity} - )} - {params.project && ( - - {params.project} - - )} - {params.rootType && ( - - {params.rootType} - - )} - {params.objName && ( - - {params.objName} - - )} - {params.objVersion && ( - - {params.objVersion} - - )} - {refFields.map((field, idx) => - field === 'index' ? ( - - theme.palette.getContrastText(theme.palette.primary.main), - }}> - row - - ) : field === 'pick' ? ( - - theme.palette.getContrastText(theme.palette.primary.main), - }}> - col - - ) : ( - - {field} - - ) - )} - - ); -}; - -export const Browse2: FC<{basename: string}> = props => { - return ( - - - - ); -}; - -const Browse2Mounted: FC = props => { - return ( - - {/* */} - theme.zIndex.drawer + 1, - // height: '30px', - // minHeight: '30px', - }}> - - - theme.palette.getContrastText(theme.palette.primary.main), - '&:hover': { - color: theme => - theme.palette.getContrastText(theme.palette.primary.dark), - }, - marginRight: theme => theme.spacing(2), - }}> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/AddRow.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/AddRow.tsx deleted file mode 100644 index 8328cf68a3c4..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/AddRow.tsx +++ /dev/null @@ -1,143 +0,0 @@ -import { - Box, - Button, - Dialog, - DialogActions, - DialogContent, - DialogTitle, - Grid, - Typography, -} from '@mui/material'; -import React, {FC, useCallback, useState} from 'react'; - -import {useWFHooks} from '../Browse3/pages/wfReactInterface/context'; -import {Link} from './CommonLib'; -import {ObjectEditor, useObjectEditorState} from './ObjectEditor'; -import {ChosenObjectNameOption, ObjectNamePicker} from './ObjectPicker'; -import {ProjectNamePicker} from './ProjectPicker'; -import {useRefPageUrl} from './url'; - -interface AddRowToPaneFormState { - projectName?: string; - datasetName?: string; - row?: {[key: string]: any}; -} - -export const AddRowToTable: FC<{ - entityName: string; - open: boolean; - handleClose: () => void; - initialFormState: AddRowToPaneFormState; -}> = ({entityName, open, handleClose, initialFormState}) => { - const [projectName, setProjectName] = useState( - initialFormState.projectName ?? null - ); - const [datasetName, setDatasetName] = useState( - initialFormState.datasetName != null - ? {name: initialFormState.datasetName} - : null - ); - - const { - value: row, - valid: rowValid, - props: objectEditorProps, - } = useObjectEditorState(initialFormState.row ?? {}); - - const formValid = rowValid && projectName && datasetName; - - const [working, setWorking] = useState< - 'idle' | 'addingRow' | 'publishing' | 'done' - >('idle'); - const [newUri, setNewUri] = useState(null); - const {useApplyMutationsToRef} = useWFHooks(); - const applyMutationsToRef = useApplyMutationsToRef(); - const addRowToDataset = useCallback(async () => { - if (projectName && datasetName) { - setWorking('addingRow'); - // Note: this is not necessarily correct when we move to the new object - // server - we may need to use a different ref type - const refUri = `wandb-artifact:///${entityName}/${projectName}/${datasetName.name}:latest/obj#atr/rows`; - const finalRootUri = await applyMutationsToRef(refUri, [ - { - type: 'append', - newValue: row, - }, - ]); - setNewUri(finalRootUri); - setWorking('done'); - } - }, [applyMutationsToRef, datasetName, entityName, projectName, row]); - - const handleSubmit = useCallback(() => { - addRowToDataset(); - }, [addRowToDataset]); - - const refPageUrl = useRefPageUrl(); - - return ( - - Add Row - {working === 'idle' ? ( - <> - - - - - - - - - {datasetName?.isNew - ? `Dataset ${datasetName.name} will be created` - : ''} - - - - - - - - - - - - - ) : ( - <> - - Adding row to dataset... - {(working === 'publishing' || working === 'done') && ( - Publishing new dataset version... - )} - {working === 'done' && Done} - {working === 'done' && ( - - - View Dataset - - - )} - - - - - - )} - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2Calls.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2Calls.tsx deleted file mode 100644 index 752266ef0ab3..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2Calls.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import {FilterList} from '@mui/icons-material'; -import {Typography} from '@mui/material'; -import React, {FC} from 'react'; - -import {CallFilter, StreamId} from './callTree'; -import {Paper} from './CommonLib'; - -export const Browse2Calls: FC<{ - streamId: StreamId; - filters: CallFilter; -}> = ({streamId, filters}) => { - return ( - - - Runs - - {filters.inputUris != null && ( -
- - Showing runs where input is one of: - {filters.inputUris.map((inputUri, i) => ( -
{inputUri}
- ))} -
- )} - Not Implemented -
- ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2CallsPage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2CallsPage.tsx deleted file mode 100644 index a8eb51974bb7..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2CallsPage.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import React, {FC} from 'react'; -import {useParams} from 'react-router-dom'; - -import {Browse2Calls} from './Browse2Calls'; -import {CallFilter, TraceSpan} from './callTree'; -import {Browse2RootObjectVersionItemParams} from './CommonLib'; -import {useQuery} from './CommonLib'; - -export const Browse2CallsPage: FC = () => { - const params = useParams(); - const filters: CallFilter = {}; - const query = useQuery(); - let selectedSpan: TraceSpan | undefined; - query.forEach((val, key) => { - if (key === 'op') { - filters.opUris = [val]; - } else if (key === 'inputUri') { - if (filters.inputUris == null) { - filters.inputUris = []; - } - filters.inputUris.push(val); - } else if (key === 'traceSpan') { - const [traceId, spanId] = val.split(',', 2); - selectedSpan = {traceId, spanId}; - } - }); - console.log('URL SEL SPAN', selectedSpan); - return ( - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2EntityPage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2EntityPage.tsx deleted file mode 100644 index 773b9c0857b8..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2EntityPage.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import {Typography} from '@mui/material'; -import React, {FC, useCallback, useMemo} from 'react'; -import {useHistory, useParams} from 'react-router-dom'; - -import {URL_BROWSE3} from '../../../../urls'; -import * as query from '../query'; -import {PageEl, PageHeader, Paper} from './CommonLib'; -import {LinkTable} from './LinkTable'; - -interface Browse2EntityParams { - entity: string; -} - -export const Browse2EntityPage: FC = props => { - const params = useParams(); - const entityProjects = query.useProjectsForEntity(params.entity); - const rows = useMemo( - () => - entityProjects.result.map((entityProject, i) => ({ - id: i, - name: entityProject, - })), - [entityProjects.result] - ); - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - const projectName = row.name; - history.push(`/${URL_BROWSE3}/${params.entity}/${projectName}`); - }, - [history, params.entity] - ); - return ( - - - - - Projects - - - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2HomePage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2HomePage.tsx deleted file mode 100644 index 374b4733164e..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2HomePage.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import {Typography} from '@mui/material'; -import {useIsAuthenticated} from '@wandb/weave/context/WeaveViewerContext'; -import React, {FC, useCallback, useMemo} from 'react'; -import {useHistory} from 'react-router-dom'; - -import {URL_BROWSE3} from '../../../../urls'; -import * as query from '../query'; -import {PageEl, PageHeader, Paper} from './CommonLib'; -import {LinkTable} from './LinkTable'; - -export const Browse2HomePage: FC = props => { - const isAuthenticated = useIsAuthenticated(); - const userEntities = query.useUserEntities(isAuthenticated); - const rows = useMemo( - () => - userEntities.result.map((entityName, i) => ({ - id: i, - name: entityName, - })), - [userEntities.result] - ); - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - const entityName = row.name; - history.push(`/${URL_BROWSE3}/${entityName}`); - }, - [history] - ); - return ( - - - - - Entities - - - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ObjectPage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ObjectPage.tsx deleted file mode 100644 index 61f13a4f6aa4..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ObjectPage.tsx +++ /dev/null @@ -1,99 +0,0 @@ -import {Typography} from '@mui/material'; -import {formatRelativeTime} from '@wandb/weave/util'; -import React, {FC, useCallback, useMemo} from 'react'; -import {useHistory, useParams} from 'react-router-dom'; - -import * as query from '../query'; -import {Paper} from './CommonLib'; -import {PageEl} from './CommonLib'; -import {PageHeader} from './CommonLib'; -import {LinkTable} from './LinkTable'; - -interface Browse2RootObjectParams { - entity: string; - project: string; - rootType: string; - objName: string; - objVersion: string; -} -export const Browse2ObjectPage: FC = props => { - const params = useParams(); - // const aliases = query.useObjectAliases( - // params.entity, - // params.project, - // params.objName - // ); - const versionNames = query.useObjectVersions( - params.entity, - params.project, - params.objName - ); - - const rows = useMemo( - () => - (versionNames.result ?? []).map((row, i) => ({ - id: i, - ...row, - })), - [versionNames.result] - ); - - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - history.push( - `/${params.entity}/${params.project}/${params.rootType}/${params.objName}/${row.digest}` - ); - }, - [history, params.entity, params.objName, params.project, params.rootType] - ); - return ( - - - {/*
- Aliases - {aliases.result.map(alias => ( -
- - {alias} - -
- ))} -
*/} -
- - - Versions - - - formatRelativeTime(linkParams?.value), - }, - ]} - /> - - {/* {versionNames.result.map(version => ( -
- - {version} - -
- ))} */} -
-
- ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ObjectTypePage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ObjectTypePage.tsx deleted file mode 100644 index 50548b00d53a..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ObjectTypePage.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import {Typography} from '@mui/material'; -import React, {FC} from 'react'; -import {useParams} from 'react-router-dom'; - -import { - Browse2RootObjectType, - Browse2RootObjectTypeParams, -} from './Browse2RootObjectType'; -import {Paper} from './CommonLib'; -import {PageEl} from './CommonLib'; -import {PageHeader} from './CommonLib'; - -export const Browse2ObjectTypePage: FC = props => { - const params = useParams(); - return ( - - - - - {params.rootType + 's'} - - - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2OpDefPage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2OpDefPage.tsx deleted file mode 100644 index f43494a5588f..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2OpDefPage.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import {Box, Button, TextField, Typography} from '@mui/material'; -import * as globals from '@wandb/weave/common/css/globals.styles'; -import React, {FC, useMemo} from 'react'; -import {useParams} from 'react-router-dom'; - -import {Browse2Calls} from './Browse2Calls'; -import {Browse2OpDefCode} from './Browse2OpDefCode'; -import {useFirstCall, useOpSignature} from './callTreeHooks'; -import {Paper} from './CommonLib'; -import {makeObjRefUri} from './CommonLib'; -import {Browse2RootObjectVersionItemParams} from './CommonLib'; -import {useQuery} from './CommonLib'; - -export const Browse2OpDefPage: FC = () => { - const params = useParams(); - return ; -}; - -export const Browse2OpDefComponent: FC<{ - params: Browse2RootObjectVersionItemParams; -}> = ({params}) => { - const uri = makeObjRefUri(params); - const query = useQuery(); - const filters = useMemo(() => { - return { - opUris: [uri], - inputUris: query.getAll('inputUri'), - }; - }, [query, uri]); - const streamId = useMemo( - () => ({ - entityName: params.entity, - projectName: params.project, - streamName: 'stream', - }), - [params.entity, params.project] - ); - - const firstCall = useFirstCall(streamId, uri); - const opSignature = useOpSignature(streamId, uri); - - return ( -
- - - - - - - Code - - - - - - - - Call Op - - - {opSignature.result != null && - Object.keys(opSignature.result.inputTypes).map(k => ( - - - - ))} - - - - - - -
- ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ProjectPage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ProjectPage.tsx deleted file mode 100644 index f35108690d15..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2ProjectPage.tsx +++ /dev/null @@ -1,138 +0,0 @@ -import {Box, Grid, Typography} from '@mui/material'; -import {useWeaveContext} from '@wandb/weave/context'; -import {constString, opGet} from '@wandb/weave/core'; -import React, {FC, useCallback, useMemo} from 'react'; -import {useHistory, useParams} from 'react-router-dom'; - -import * as query from '../query'; -import {Browse2RootObjectType} from './Browse2RootObjectType'; -import {Link, makeObjRefUri, Paper} from './CommonLib'; -import {PageEl} from './CommonLib'; -import {PageHeader} from './CommonLib'; -import {LinkTable} from './LinkTable'; - -const Browse2Boards: FC<{entity: string; project: string}> = ({ - entity, - project, -}) => { - const weave = useWeaveContext(); - const objectsInfo = query.useProjectObjectsOfType(entity, project, 'Panel'); - const rows = useMemo( - () => - (objectsInfo.result ?? []).map((row, i) => ({ - id: i, - _name: row.name, - name: row.name + ' ⮕', - })), - [objectsInfo.result] - ); - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - const boardNode = opGet({ - uri: constString( - makeObjRefUri({ - entity, - project, - objName: row._name, - objVersion: 'latest', - }) - ), - }); - return history.push( - `/?exp=${encodeURIComponent(weave.expToString(boardNode))}` - ); - }, - [entity, project, history, weave] - ); - return ( - <> - - - ); -}; - -interface Browse2ProjectParams { - entity: string; - project: string; -} - -export const Browse2ProjectPage: FC = props => { - const params = useParams(); - const rootTypeCounts = query.useProjectAssetCountGeneral( - params.entity, - params.project - ); - const rows = useMemo( - () => - (rootTypeCounts.result ?? []) - .filter( - typeInfo => - typeInfo.name !== 'stream_table' && - typeInfo.name !== 'Panel' && - typeInfo.name !== 'OpDef' && - typeInfo.name !== 'wandb-history' - ) - .map((row, i) => ({ - id: i, - - // TODO: Major hack to rename list to Table - name: row.name === 'list' ? 'Table' : row.name, - 'object count': row['object count'], - })), - [rootTypeCounts.result] - ); - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - history.push(`/${params.entity}/${params.project}/${row.name}`); - }, - [history, params.entity, params.project] - ); - return ( - - - - - - - - Object Types - - - - - - - Boards - - - - - - - - Functions - - - [See all runs] - - - - - - - -
-
-
- ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectType.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectType.tsx deleted file mode 100644 index 6dfbf7c69c77..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectType.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React, {FC, useCallback, useMemo} from 'react'; -import {useHistory} from 'react-router-dom'; - -import * as query from '../query'; -import {LinkTable} from './LinkTable'; - -export interface Browse2RootObjectTypeParams { - entity: string; - project: string; - rootType: string; -} - -export const Browse2RootObjectType: FC = ({ - entity, - project, - rootType, -}) => { - const objectsInfo = query.useProjectObjectsOfType(entity, project, rootType); - const rows = useMemo( - () => - (objectsInfo.result ?? []).map((row, i) => ({ - id: i, - ...row, - })), - [objectsInfo.result] - ); - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - history.push(`/${entity}/${project}/${rootType}/${row.name}`); - }, - [history, entity, project, rootType] - ); - return ( - <> - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersion.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersion.tsx deleted file mode 100644 index e635673943bb..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersion.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import {useNodeValue} from '@wandb/weave/react'; -import React, {FC, useCallback, useMemo} from 'react'; -import {useHistory, useParams} from 'react-router-dom'; - -import {useWeaveflowRouteContext} from '../Browse3/context'; -import {callsTableFilter, callsTableNode, callsTableOpCounts} from './callTree'; -import {Browse2RootObjectVersionItemParams} from './CommonLib'; -import {opDisplayName} from './dataModel'; -import {LinkTable} from './LinkTable'; - -export const Browse2RootObjectVersionUsers: FC<{uri: string}> = ({uri}) => { - const params = useParams(); - const {baseRouter} = useWeaveflowRouteContext(); - const calledOpCountsNode = useMemo(() => { - const streamTableRowsNode = callsTableNode({ - entityName: params.entity, - projectName: params.project, - streamName: 'stream', - }); - const filtered = callsTableFilter(streamTableRowsNode, { - inputUris: [uri], - }); - return callsTableOpCounts(filtered); - }, [params.entity, params.project, uri]); - const calledOpCountsQuery = useNodeValue(calledOpCountsNode); - - const rows = useMemo(() => { - const calledOpCounts = calledOpCountsQuery.result ?? []; - return calledOpCounts.map((row: any, i: number) => ({ - id: i, - _name: row.name, - name: opDisplayName(row.name), - count: row.count, - })); - }, [calledOpCountsQuery]); - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - history.push( - `${baseRouter.opPageUrl(row._name)}?inputUri=${encodeURIComponent(uri)}` - ); - }, - [history, baseRouter, uri] - ); - - return ; -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersionOutputOf.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersionOutputOf.tsx deleted file mode 100644 index 9ab172a5657c..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersionOutputOf.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import Typography from '@mui/material/Typography'; -import {parseRefMaybe, useNodeValue} from '@wandb/weave/react'; -import React, {FC, useMemo} from 'react'; -import {useParams} from 'react-router-dom'; - -import {callsTableFilter, callsTableNode, callsTableOpCounts} from './callTree'; -import {Browse2RootObjectVersionItemParams} from './CommonLib'; -import {SmallRef} from './SmallRef'; - -export const Browse2RootObjectVersionOutputOf: FC<{uri: string}> = ({uri}) => { - const params = useParams(); - const calledOpCountsNode = useMemo(() => { - const streamTableRowsNode = callsTableNode({ - entityName: params.entity, - projectName: params.project, - streamName: 'stream', - }); - const filtered = callsTableFilter(streamTableRowsNode, { - outputUris: [uri], - }); - return callsTableOpCounts(filtered); - }, [params.entity, params.project, uri]); - const calledOpCountsQuery = useNodeValue(calledOpCountsNode); - - const outputOfRunRef = useMemo(() => { - const runName = (calledOpCountsQuery.result ?? [])[0]?.name; - const ref = parseRefMaybe(runName); - return ref; - }, [calledOpCountsQuery]); - - return outputOfRunRef != null ? ( - - ) : ( - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersionUsers.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersionUsers.tsx deleted file mode 100644 index e635673943bb..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2RootObjectVersionUsers.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import {useNodeValue} from '@wandb/weave/react'; -import React, {FC, useCallback, useMemo} from 'react'; -import {useHistory, useParams} from 'react-router-dom'; - -import {useWeaveflowRouteContext} from '../Browse3/context'; -import {callsTableFilter, callsTableNode, callsTableOpCounts} from './callTree'; -import {Browse2RootObjectVersionItemParams} from './CommonLib'; -import {opDisplayName} from './dataModel'; -import {LinkTable} from './LinkTable'; - -export const Browse2RootObjectVersionUsers: FC<{uri: string}> = ({uri}) => { - const params = useParams(); - const {baseRouter} = useWeaveflowRouteContext(); - const calledOpCountsNode = useMemo(() => { - const streamTableRowsNode = callsTableNode({ - entityName: params.entity, - projectName: params.project, - streamName: 'stream', - }); - const filtered = callsTableFilter(streamTableRowsNode, { - inputUris: [uri], - }); - return callsTableOpCounts(filtered); - }, [params.entity, params.project, uri]); - const calledOpCountsQuery = useNodeValue(calledOpCountsNode); - - const rows = useMemo(() => { - const calledOpCounts = calledOpCountsQuery.result ?? []; - return calledOpCounts.map((row: any, i: number) => ({ - id: i, - _name: row.name, - name: opDisplayName(row.name), - count: row.count, - })); - }, [calledOpCountsQuery]); - const history = useHistory(); - const handleRowClick = useCallback( - (row: any) => { - history.push( - `${baseRouter.opPageUrl(row._name)}?inputUri=${encodeURIComponent(uri)}` - ); - }, - [history, baseRouter, uri] - ); - - return ; -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2Trace.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2Trace.tsx deleted file mode 100644 index 913eda06b414..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2Trace.tsx +++ /dev/null @@ -1,232 +0,0 @@ -import {Box, Button, Grid, Tab, Tabs, Typography} from '@mui/material'; -import * as globals from '@wandb/weave/common/css/globals.styles'; -import {useWeaveContext} from '@wandb/weave/context'; -import * as _ from 'lodash'; -import React, {FC, useMemo, useState} from 'react'; -import {v4 as uuidv4} from 'uuid'; - -import {flatToTrees} from '../../../Panel2/PanelTraceTree/util'; -import {CenteredAnimatedLoader} from '../Browse3/pages/common/Loader'; -import {AddRowToTable} from './AddRow'; -import {feedbackTableObjNode, Span, StreamId} from './callTree'; -import {useLastRunFeedback, useTraceSpans} from './callTreeHooks'; -import {Paper} from './CommonLib'; -import {mutationStreamTableLog} from './easyWeave'; -import {ObjectEditor, useObjectEditorState} from './ObjectEditor'; -import {SpanDetails} from './SpanDetails'; -import {SpanTreeNode, SpanWithChildren} from './SpanWithChildren'; - -const VerticalTraceView: FC<{ - traceSpans: Span[]; - selectedSpanId?: string; - setSelectedSpanId: (spanId: string) => void; - callStyle: 'full' | 'short'; -}> = ({traceSpans, selectedSpanId, setSelectedSpanId}) => { - const tree = useMemo( - () => flatToTrees(traceSpans), - [traceSpans] - ) as SpanWithChildren[]; - - return tree[0] == null ? ( -
No trace spans found
- ) : ( - - ); -}; - -const SpanFeedback: FC<{streamId: StreamId; spanId: string}> = ({ - streamId, - spanId, -}) => { - const lastFeedbackQuery = useLastRunFeedback( - streamId.entityName, - streamId.projectName, - spanId - ); - - return lastFeedbackQuery.loading ? ( - - ) : ( - - ); -}; - -const SpanFeedbackLoaded: FC<{ - streamId: StreamId; - spanId: string; - lastFeedback: {[key: string]: any}; -}> = ({streamId, spanId, lastFeedback}) => { - const weave = useWeaveContext(); - const { - value: feedbackValue, - valid: feedbackValid, - props: objectEditorProps, - } = useObjectEditorState(lastFeedback); - - return ( - <> - - - - - - ); -}; - -export const Browse2Trace: FC<{ - streamId: StreamId; - traceId: string; - spanId?: string; - setSelectedSpanId: (spanId: string) => void; -}> = ({streamId, traceId, spanId, setSelectedSpanId}) => { - const traceSpans = useTraceSpans(streamId, traceId); - const selectedSpanId = spanId; - const selectedSpan = useMemo(() => { - if (selectedSpanId == null) { - return undefined; - } - return traceSpans.result.filter(ts => ts.span_id === selectedSpanId)[0]; - }, [selectedSpanId, traceSpans]); - const lastFeedbackQuery = useLastRunFeedback( - streamId.entityName, - streamId.projectName, - spanId ?? '' - ); - const simpleInputOutputValue = useMemo(() => { - if (selectedSpan == null) { - return undefined; - } - const simpleInputOrder = - selectedSpan.inputs._keys ?? - Object.keys(selectedSpan.inputs).filter( - k => !k.startsWith('_') && k !== 'self' - ); - const simpleInputs = _.fromPairs( - simpleInputOrder - .map(k => [k, selectedSpan.inputs[k]]) - .filter(([k, v]) => v != null) - ); - - const res: {[key: string]: any} = { - input: simpleInputs, - }; - const output = selectedSpan.output; - if (output != null) { - const outputOrder = - output._keys ?? - Object.keys(output).filter( - k => !k.startsWith('_') && output[k] != null - ); - res.output = _.fromPairs(outputOrder.map(k => [k, output[k]])); - } - if (lastFeedbackQuery.result != null) { - res.feedback = lastFeedbackQuery.result; - } - return res; - }, [lastFeedbackQuery.result, selectedSpan]); - const [tabId, setTabId] = React.useState(0); - const handleTabChange = (event: React.SyntheticEvent, newValue: number) => { - setTabId(newValue); - }; - - const [addRowToTableOpen, setAddRowToTableOpen] = useState(false); - if (traceSpans.loading) { - return ; - } - return ( - - - - - - - - {selectedSpanId != null && ( - - - - - - - - {tabId === 0 && - (selectedSpan == null ? ( -
Span not found
- ) : ( - - ))} - {tabId === 1 && ( - - )} - {tabId === 2 && ( - <> - - Appears in datasets - - - Placeholder - - - {addRowToTableOpen && ( - setAddRowToTableOpen(false)} - initialFormState={{ - projectName: streamId.projectName, - row: simpleInputOutputValue, - }} - /> - )} - - )} -
-
- )} -
-
- ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2TracePage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2TracePage.tsx deleted file mode 100644 index 40856d4e1410..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2TracePage.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import React, {FC, useCallback} from 'react'; -import {useHistory, useParams} from 'react-router-dom'; - -import {useWeaveflowRouteContext} from '../Browse3/context'; -import {Browse2Trace} from './Browse2Trace'; - -interface Browse2TracePageParams { - entity: string; - project: string; - traceId: string; - spanId?: string; -} -export const Browse2TracePage: FC = () => { - const params = useParams(); - return ; -}; - -export const Browse2TraceComponent: FC<{params: Browse2TracePageParams}> = ({ - params, -}) => { - const history = useHistory(); - const {peekingRouter} = useWeaveflowRouteContext(); - const setSelectedSpanId = useCallback( - (spanId: string) => - history.push( - peekingRouter.callUIUrl( - params.entity, - params.project, - params.traceId, - spanId - ) - ), - [history, params.entity, params.project, params.traceId, peekingRouter] - ); - return ( - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2TracesPage.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2TracesPage.tsx deleted file mode 100644 index 69fa0203cfc9..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/Browse2TracesPage.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import React, {FC} from 'react'; -import {useParams} from 'react-router-dom'; - -import {CallFilter, StreamId, TraceSpan} from './callTree'; -import {useTraceSummaries} from './callTreeHooks'; -import {Link} from './CommonLib'; -import {PageEl} from './CommonLib'; -import {useQuery} from './CommonLib'; - -const Browse2Traces: FC<{ - streamId: StreamId; - selectedSpan?: TraceSpan; -}> = ({streamId, selectedSpan}) => { - const traces = useTraceSummaries(streamId); - return ( -
- {traces.map(trace => ( -
- - {trace.trace_id} - - : {trace.span_count} -
- ))} -
- ); -}; -interface Browse2TracesPageParams { - entity: string; - project: string; -} -export const Browse2TracesPage: FC = () => { - const params = useParams(); - const filters: CallFilter = {}; - const query = useQuery(); - let selectedSpan: TraceSpan | undefined; - query.forEach((val, key) => { - if (key === 'op') { - filters.opUris = [val]; - } else if (key === 'inputUri') { - if (filters.inputUris == null) { - filters.inputUris = []; - } - filters.inputUris.push(val); - } else if (key === 'traceSpan') { - const [traceId, spanId] = val.split(',', 2); - selectedSpan = {traceId, spanId}; - } - }); - return ( - - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/CallViewSmall.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/CallViewSmall.tsx deleted file mode 100644 index 0eefc0b5f572..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/CallViewSmall.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import {Box, Chip, Typography} from '@mui/material'; -import * as globals from '@wandb/weave/common/css/globals.styles'; -import {isWandbArtifactRef, parseRef} from '@wandb/weave/react'; -import React, {FC} from 'react'; -import styled from 'styled-components'; - -import {monthRoundedTime} from '../../../../common/util/time'; -import {Call} from './callTree'; - -const callOpName = (call: Call) => { - if (!call.name.startsWith('wandb-artifact:')) { - return call.name; - } - const ref = parseRef(call.name); - if (!isWandbArtifactRef(ref)) { - return call.name; - } - return ref.artifactName; -}; -const CallEl = styled.div` - display: flex; - white-space: nowrap; - text-overflow: ellipsis; - overflow: hidden; - align-items: center; - cursor: pointer; -`; -export const CallViewSmall: FC<{ - call: Call; - // selected: boolean; - onClick?: () => void; -}> = ({call, onClick}) => { - return ( - - - { - if (onClick) { - onClick(); - } - }}> - - - - - {monthRoundedTime(call.summary.latency_s)} - - - - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/CommonLib.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/CommonLib.tsx deleted file mode 100644 index ad8fb858b0cd..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/CommonLib.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import {Link as MaterialLink, Paper as MaterialPaper} from '@mui/material'; -import {Box, Typography} from '@mui/material'; -import * as globals from '@wandb/weave/common/css/globals.styles'; -import React, {FC} from 'react'; -import {Link as RouterLink, useLocation} from 'react-router-dom'; -import styled from 'styled-components'; - -export const Link = (props: React.ComponentProps) => ( - -); - -export const Paper = (props: React.ComponentProps) => { - return ( - theme.spacing(2), - }} - {...props}> - {props.children} - - ); -}; - -export const PageEl = styled.div``; - -export const PageHeader: FC<{ - objectType: string; - objectName?: string; - actions?: JSX.Element; -}> = ({objectType, objectName, actions}) => { - return ( - - - - {objectType} - - {objectName != null && ( - - {objectName} - - )} - - {actions} - - ); -}; -interface ObjPath { - entity: string; - project: string; - objName: string; - objVersion: string; -} - -export const makeObjRefUri = (objPath: ObjPath) => { - return `wandb-artifact:///${objPath.entity}/${objPath.project}/${objPath.objName}:${objPath.objVersion}/obj`; -}; - -export interface Browse2RootObjectVersionItemParams { - entity: string; - project: string; - rootType: string; - objName: string; - objVersion: string; - refExtra?: string; -} -export function useQuery() { - const {search} = useLocation(); - - return React.useMemo(() => new URLSearchParams(search), [search]); -} -const escapeAndRenderControlChars = (str: string) => { - const controlCharMap: {[key: string]: string | undefined} = { - '\n': '\\n', - '\t': '\\t', - '\r': '\\r', - }; - - return str.split('').map((char, index) => { - if (controlCharMap[char]) { - return ( - - {controlCharMap[char]} - {char === '\n' ? ( -
- ) : ( - - )} -
- ); - } - return char; - }); -}; -export const DisplayControlChars = ({text}: {text: string}) => { - return {escapeAndRenderControlChars(text)}; -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/LinkTable.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/LinkTable.tsx deleted file mode 100644 index be545438df9d..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/LinkTable.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import {Box} from '@mui/material'; -import {DataGridPro as DataGrid} from '@mui/x-data-grid-pro'; -import React, {useMemo} from 'react'; - -export const LinkTable = ({ - rows, - handleRowClick, - columns, -}: { - rows: RowType[]; - handleRowClick: (row: RowType) => void; - columns?: any[]; -}) => { - const autoColumns = useMemo(() => { - const row0 = rows[0]; - if (row0 == null) { - return []; - } - const cols = Object.keys(row0).filter( - k => k !== 'id' && !k.startsWith('_') - ); - return row0 == null - ? [] - : cols.map((key, i) => ({ - field: key, - headerName: key, - flex: i === 0 ? 1 : undefined, - })); - }, [rows]); - return ( - - - !columns || - !columns.map(column => column.field).includes(row.field) - ), - ...(columns || []), - ]} - autoPageSize - disableRowSelectionOnClick - onRowClick={params => handleRowClick(params.row as RowType)} - /> - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/ObjectEditor.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/ObjectEditor.tsx deleted file mode 100644 index e30272826dad..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/ObjectEditor.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import {TextField} from '@mui/material'; -import React, {FC, useCallback, useState} from 'react'; - -interface ObjectValue { - [key: string]: any; -} - -export const ObjectEditor: FC<{ - label: string; - valueS: string; - valid: boolean; - onValueSChange: (e: React.ChangeEvent) => void; -}> = ({label, valueS, valid, onValueSChange}) => { - return ( - - ); -}; - -export const useObjectEditorState = (initialValue: {[key: string]: any}) => { - const [value, setValue] = useState(initialValue); - - const [valid, setValid] = useState(true); - - const [valueS, setValueS] = useState(() => - JSON.stringify(value, undefined, 2) - ); - - const onValueSChange = useCallback( - (e: React.ChangeEvent) => { - setValueS(e.target.value); - try { - setValue(JSON.parse(e.target.value)); - setValid(true); - } catch (e) { - setValid(false); - } - }, - [] - ); - - return { - value, - valid, - props: { - valueS, - valid, - onValueSChange, - }, - }; -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/ObjectPicker.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/ObjectPicker.tsx deleted file mode 100644 index a190dfeb7157..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/ObjectPicker.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import {CircularProgress, TextField} from '@mui/material'; -import Autocomplete, {createFilterOptions} from '@mui/material/Autocomplete'; -import React, {FC, useMemo} from 'react'; - -import * as Queries from '../query'; - -export interface ChosenObjectNameOption { - name: string; - isNew?: boolean; -} - -const filterOptions = createFilterOptions(); - -// A lot of this is from the Material UI Autocomplete docs -// Requires boilerplate make it so we can have a "Create New: ..." option. - -export const ObjectNamePicker: FC<{ - entityName: string; - projectName: string | null; - rootType: string; - value: ChosenObjectNameOption | null; - setChosenObjectName: (newValue: ChosenObjectNameOption | null) => void; -}> = ({entityName, projectName, rootType, value, setChosenObjectName}) => { - const query = Queries.useProjectObjectsOfType( - entityName, - projectName ?? '', - rootType - ); - const loading = query.loading; - const options: ChosenObjectNameOption[] = useMemo( - () => (query.result.map(v => v.name) ?? []).map(name => ({name})), - [query.result] - ); - return ( - { - if (typeof newValue === 'string') { - const isNew = - options.find(option => option.name === newValue) == null; - setChosenObjectName({name: newValue, isNew}); - } else { - setChosenObjectName(newValue); - } - }} - options={options} - filterOptions={(innerOptions, params) => { - const filtered = filterOptions(innerOptions, params); - - const {inputValue} = params; - // Suggest the creation of a new value - const isExisting = innerOptions.some( - option => inputValue === option.name - ); - if (inputValue !== '' && !isExisting) { - filtered.push({ - name: inputValue, - isNew: true, - }); - } - - return filtered; - }} - renderInput={params => ( - - {loading ? ( - - ) : null} - {params.InputProps.endAdornment} - - ), - }} - /> - )} - getOptionLabel={option => { - if (typeof option === 'string') { - return option; - } else { - return option.name; - } - }} - renderOption={(props, option) => { - return ( -
  • - {option.isNew - ? `Create ${rootType}: "${option.name}"` - : option.name} -
  • - ); - }} - /> - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/ProjectPicker.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/ProjectPicker.tsx deleted file mode 100644 index ae0635b50e2f..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/ProjectPicker.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import {Autocomplete, CircularProgress, TextField} from '@mui/material'; -import React, {FC, useMemo} from 'react'; - -import * as Queries from '../query'; - -export const ProjectNamePicker: FC<{ - entityName: string; - value: string | null; - setValue: (newValue: string | null) => void; -}> = ({entityName, value, setValue}) => { - const query = Queries.useProjectsForEntity(entityName); - const loading = query.loading; - const values = useMemo(() => query.result ?? [], [query.result]); - return ( - { - setValue(newValue); - }} - options={values} - renderInput={params => ( - - {loading ? ( - - ) : null} - {params.InputProps.endAdornment} - - ), - }} - /> - )} - /> - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/SpanDetails.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/SpanDetails.tsx deleted file mode 100644 index 28f71fff4079..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/SpanDetails.tsx +++ /dev/null @@ -1,187 +0,0 @@ -import {Box, Button, Grid, Typography} from '@mui/material'; -import Paper from '@mui/material/Paper'; -import * as globals from '@wandb/weave/common/css/globals.styles'; -import * as _ from 'lodash'; -import React, {FC} from 'react'; - -import {parseRefMaybe} from '../../../../react'; -import {StatusChip} from '../Browse3/pages/common/StatusChip'; -import {Call} from './callTree'; -import {DisplayControlChars} from './CommonLib'; -import { - isOpenAIChatInput, - isOpenAIChatOutput, - OpenAIChatInputView, - OpenAIChatOutputView, -} from './openai'; -import {SmallRef} from './SmallRef'; - -const ObjectView: FC<{obj: any}> = ({obj}) => { - if (_.isPlainObject(obj)) { - return ( - - {Object.entries(obj).flatMap(([key, value]) => { - const singleRow = !_.isPlainObject(value); - return [ - - {key} - , - - - - - , - ]; - })} - - ); - } - if (typeof obj === 'string') { - const ref = parseRefMaybe(obj); - if (ref != null) { - return ; - } - return ; - } - if (_.isArray(obj)) { - return ( - - {obj.map((value, i) => ( - - - - - - ))} - - ); - } - return {JSON.stringify(obj)}; -}; - -export const SpanDetails: FC<{ - call: Call; - hackyInjectionBelowFunction?: React.ReactNode; -}> = ({call, hackyInjectionBelowFunction}) => { - const inputKeys = - call.inputs._keys ?? - Object.entries(call.inputs) - .filter(([k, c]) => c != null && !k.startsWith('_')) - .map(([k, c]) => k); - const inputs = _.fromPairs(inputKeys.map(k => [k, call.inputs[k]])); - - const callOutput = call.output ?? {}; - const outputKeys = - callOutput._keys ?? - Object.entries(call.inputs) - .filter(([k, c]) => c != null && (k === '_result' || !k.startsWith('_'))) - .map(([k, c]) => k); - const output = _.fromPairs(outputKeys.map(k => [k, callOutput[k]])); - - const attributes = _.fromPairs( - Object.entries(call.attributes ?? {}).filter(([k, a]) => !k.startsWith('_')) - ); - - return ( -
    -
    - - - - Function - - {isOpenAIChatInput(inputs) && ( - - )} - - {parseRefMaybe(call.name) != null ? ( - - ) : ( - call.name - )} - - - Status: - - - {hackyInjectionBelowFunction} - {call.exception != null && ( - - {call.exception} - - )} -
    - {Object.keys(attributes).length > 0 && ( -
    - - Attributes - - - v != null) - )} - /> - -
    - )} -
    - - Summary - - - v != null) - )} - /> - -
    -
    - - Inputs - - - {isOpenAIChatInput(inputs) ? ( - - ) : ( - - )} - -
    -
    - - Output - - - {output == null ? ( -
    null
    - ) : isOpenAIChatOutput(call.output) ? ( - - ) : ( - - (k === '_result' || !k.startsWith('_')) && v != null - ) - )} - /> - )} -
    -
    -
    - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/SpanWithChildren.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/SpanWithChildren.tsx deleted file mode 100644 index 363f2b50a58f..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/SpanWithChildren.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import {Box} from '@mui/material'; -import * as globals from '@wandb/weave/common/css/globals.styles'; -import React, {FC} from 'react'; - -import {Span} from './callTree'; -import {CallViewSmall} from './CallViewSmall'; - -export type SpanWithChildren = Span & {child_spans: SpanWithChildren[]}; -export const SpanTreeNode: FC<{ - level?: number; - call: SpanWithChildren; - selectedSpanId?: string; - setSelectedSpanId: (spanId: string) => void; -}> = ({call, selectedSpanId, setSelectedSpanId, level}) => { - const isSelected = selectedSpanId === call.span_id; - const curLevel = level ?? 0; - const childLevel = curLevel + 1; - return ( - <> - - setSelectedSpanId(call.span_id)} - /> - - {call.child_spans.map(child => ( - - ))} - - ); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/dataModel.ts b/weave-js/src/components/PagePanelComponents/Home/Browse2/dataModel.ts deleted file mode 100644 index 3d5db8b7d78b..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/dataModel.ts +++ /dev/null @@ -1,15 +0,0 @@ -import {isWandbArtifactRef, parseRef} from '@wandb/weave/react'; - -export const opDisplayName = (opName: string) => { - if (opName.startsWith('wandb-artifact:')) { - const ref = parseRef(opName); - if (isWandbArtifactRef(ref)) { - let refOpName = ref.artifactName; - if (refOpName.startsWith('op-')) { - refOpName = refOpName.slice(3); - } - return refOpName + ':' + ref.artifactVersion; - } - } - return opName; -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/easyWeave.ts b/weave-js/src/components/PagePanelComponents/Home/Browse2/easyWeave.ts deleted file mode 100644 index 721af464c2a4..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/easyWeave.ts +++ /dev/null @@ -1,179 +0,0 @@ -import {toWeaveType} from '@wandb/weave/components/Panel2/toWeaveType'; -import { - callOpVeryUnsafe, - ConstNode, - constNodeUnsafe, - constString, - isAssignableTo, - Node, - Op, - opGet, - OutputNode, - Type, - Weave, -} from '@wandb/weave/core'; - -const weaveConst = (val: any): ConstNode => { - return constNodeUnsafe(toWeaveType(val), val); -}; - -type WeaveObjectTypeSpec = string | {name: string; base: WeaveObjectTypeSpec}; - -const weaveObjectTypeSpecToType = (typeSpec: WeaveObjectTypeSpec): Type => { - let baseType: Type = {type: 'Object'}; - if (typeof typeSpec !== 'string') { - baseType = weaveObjectTypeSpecToType(typeSpec.base); - } - const name = typeof typeSpec === 'string' ? typeSpec : typeSpec.name; - return { - type: name, - _base_type: baseType, - } as Type; -}; - -// Returns a value, not a ConstNode. You can still call weaveConst on it to -// get a node. -export const weaveObject = ( - typeName: WeaveObjectTypeSpec, - attrs: {[key: string]: any} -) => { - const objectType = weaveObjectTypeSpecToType(typeName); - for (const [key, val] of Object.entries(attrs)) { - (objectType as any)[key] = toWeaveType(val); - } - return { - _type: objectType, - ...attrs, - }; -}; - -class EasyNode implements OutputNode { - type: Type; - nodeType: 'output'; - fromOp: Op; - - constructor(node: OutputNode) { - this.type = node.type; - this.nodeType = node.nodeType; - this.fromOp = node.fromOp; - } - - getAttr(attrName: string) { - return new EasyNode( - callOpVeryUnsafe('Object-__getattr__', { - obj: this as Node, - name: constString(attrName), - }) as OutputNode - ); - } - - pick(key: string) { - return new EasyNode( - callOpVeryUnsafe('pick', { - obj: this as Node, - key: constString(key), - }) as OutputNode - ); - } -} - -export const nodeToEasyNode = (node: OutputNode) => { - return new EasyNode(node); -}; - -export const weaveGet = (uri: string, defaultVal?: any) => { - if (defaultVal === undefined) { - return new EasyNode(opGet({uri: constString(uri)})); - } - return new EasyNode( - callOpVeryUnsafe('withdefault-get', { - uri: constString(uri), - default: constNodeUnsafe(toWeaveType(defaultVal), defaultVal), - }) as OutputNode - ); -}; - -// const easyOpGetAttr = (self: Node, attrName: string) => { -// return new EasyNode( -// callOpVeryUnsafe('Object-__getattr__', { -// uri: self, -// default: constString(attrName), -// }) as Node -// ); -// }; - -const mutate = async ( - weave: Weave, - mutateOpName: string, - objNode: Node, - args: any[] -) => { - const op = weave.op(mutateOpName); - const inputTypesArray = Object.entries(op.inputTypes); - if (args.length + 1 !== inputTypesArray.length) { - throw new Error( - `Expected ${inputTypesArray.length - 1} args, got ${args.length}` - ); - } - const opArgs: {[key: string]: Node} = {}; - - for (let i = 0; i < inputTypesArray.length; i++) { - const [k, paramType] = inputTypesArray[i]; - if (i === 0) { - opArgs[k] = objNode; - } else { - const arg = args[i - 1]; - const argType = toWeaveType(arg); - if (!isAssignableTo(argType, paramType)) { - throw new Error( - `Expected arg ${i} to be assignable to ${k}, got ${argType}` - ); - } - opArgs[k] = constNodeUnsafe(argType, arg); - } - } - - const calledMutation = callOpVeryUnsafe(mutateOpName, opArgs) as Node; - - return weave.client.action(calledMutation); -}; - -// Returns a local-artifact uri with the newly modified object -export const mutationSet = ( - weave: Weave, - objNode: Node, - val: any -): Promise => { - return mutate(weave, 'op-set', objNode, [weaveConst(val), {}]); -}; - -// Returns a local-artifact uri with the newly modified object -export const mutationAppend = ( - weave: Weave, - objNode: Node, - row: {[key: string]: any} -): Promise => { - return mutate(weave, 'op-append', objNode, [weaveConst(row), {}]); -}; - -export const mutationStreamTableLog = ( - weave: Weave, - streamTableNode: Node, - row: {[key: string]: any} -): Promise => { - return mutate(weave, 'stream_table-log', streamTableNode, [weaveConst(row)]); -}; - -export const mutationPublishArtifact = ( - weave: Weave, - objNode: Node, - entityName: string, - projectName: string, - artifactName: string -): Promise => { - return mutate(weave, 'op-publish_artifact', objNode, [ - weaveConst(artifactName), - weaveConst(projectName), - weaveConst(entityName), - ]); -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/openai.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse2/openai.tsx deleted file mode 100644 index 3da9b09110ad..000000000000 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/openai.tsx +++ /dev/null @@ -1,225 +0,0 @@ -import { - CallMade, - CallReceived, - Person, - Settings, - SmartToy, -} from '@mui/icons-material'; -import {Box, Chip, Typography} from '@mui/material'; -import React, {FC} from 'react'; -import {Popup} from 'semantic-ui-react'; -import styled from 'styled-components'; - -import {DisplayControlChars} from './CommonLib'; - -interface ChatMessageSystem { - role: 'system'; - content: string; -} - -interface ChatMessageUser { - role: 'user'; - content: string; -} - -interface ChatMessageFunctionCall { - name: string; - arguments: string; -} - -interface ChatMessageAssistant { - role: 'assistant'; - content?: string; - function_call?: ChatMessageFunctionCall; -} - -interface ChatMessageFunctionResponse { - role: 'function'; - name: string; - content: string; -} - -type ChatMessage = - | ChatMessageSystem - | ChatMessageUser - | ChatMessageAssistant - | ChatMessageFunctionResponse; - -interface FunctionSpec { - name: string; - description: string; - parameters: any; - returns: any; -} - -interface OpenAIChatInput { - model: string; - functions?: FunctionSpec[]; - messages: ChatMessage[]; -} - -interface OpenAIChatOutputChoice { - message: ChatMessage; - finish_reason: string; - index: number; -} - -interface OpenAIChatOutput { - model: string; - choices: OpenAIChatOutputChoice[]; -} - -export const OpenAIChatFunctionCall: FC<{ - functionCall: ChatMessageFunctionCall; -}> = ({functionCall}) => { - return ( -
    - - {functionCall.name} - {functionCall.arguments} -
    - ); -}; - -const ChatMessageEl = styled.div<{callResponse: 'call' | 'response'}>` - border-radius: 4px; - margin-bottom: 12px; - background-color: ${props => - props.callResponse === 'call' ? '#f9f9f9' : 'fff'}; -`; - -const ChatMessageContentEl = styled.div` - display: flex; - align-items: top; -`; - -export const OpenAIChatMessage: FC<{message: ChatMessage}> = ({message}) => { - return ( - - -
    - {message.role === 'assistant' ? ( - - ) : message.role === 'user' ? ( - - ) : message.role === 'function' ? ( - - ) : message.role === 'system' ? ( - - ) : ( -
    Role: {(message as any).role}
    - )} -
    -
    - {message.content != null && ( -
    - -
    - )} - {message.role === 'assistant' && message.function_call && ( - - )} -
    -
    -
    - ); -}; - -export const OpenAIChatMessages: FC<{messages: ChatMessage[]}> = ({ - messages, -}) => { - return ( -
    - {messages.map((m, i) => ( - - ))} -
    - ); -}; - -export const OpenAIFunctionSpec: FC<{functionSpec: FunctionSpec}> = ({ - functionSpec, -}) => { - return
    {functionSpec.name}
    ; -}; - -export const OpenAIFunctionSpecs: FC<{functionSpecs: FunctionSpec[]}> = ({ - functionSpecs, -}) => { - return ( -
    - {functionSpecs.map(f => ( - - ))} -
    - ); -}; - -export const OpenAIChatInputView: FC<{chatInput: OpenAIChatInput}> = ({ - chatInput, -}) => { - return ( -
    - - - Model: - - - {/*
    Model: {chatInput.model}
    */} - {chatInput.functions != null && ( - -
    - - {chatInput.functions.length} callable functions - -
    - - } - content={} - /> - )} -
    - Messages - -
    -
    - ); -}; - -export const OpenAIChatOutputView: FC<{chatOutput: OpenAIChatOutput}> = ({ - chatOutput, -}) => { - return ( -
    - - - Model: - - -
    - {chatOutput.choices?.length > 0 ? ( - - ) : ( -
    No response
    - )} -
    -
    - ); -}; - -export const isOpenAIChatInput = (obj: any): obj is OpenAIChatInput => { - return obj.model != null && obj.messages != null; -}; - -export const isOpenAIChatOutput = (obj: any): obj is OpenAIChatOutput => { - return obj != null && obj.model != null && obj.choices != null; -}; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse2/url.ts b/weave-js/src/components/PagePanelComponents/Home/Browse2/url.ts index d914803c059e..f93db06d7c20 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse2/url.ts +++ b/weave-js/src/components/PagePanelComponents/Home/Browse2/url.ts @@ -1,27 +1,4 @@ import {checkRegistryProject} from '@wandb/weave/common/util/artifacts'; -import {isWandbArtifactRef, parseRef} from '@wandb/weave/react'; - -import {useWeaveflowRouteContext} from '../Browse3/context'; - -export const useRefPageUrl = () => { - const {baseRouter} = useWeaveflowRouteContext(); - const refPageUrl = (objectType: string, refS: string) => { - const ref = parseRef(refS); - if (!isWandbArtifactRef(ref)) { - throw new Error('Not a wandb artifact ref: ' + refS); - } - - return baseRouter.refUIUrl(objectType, { - scheme: ref.scheme, - entityName: ref.entityName, - projectName: ref.projectName, - artifactName: ref.artifactName, - artifactVersion: ref.artifactVersion, - artifactPath: '', - }); - }; - return refPageUrl; -}; export type ArtifactRefURLInfo = { entityName: string; diff --git a/weave-js/src/components/PagePanelComponents/Home/Browse3.tsx b/weave-js/src/components/PagePanelComponents/Home/Browse3.tsx index 308b59bda119..3c7bd03be1a8 100644 --- a/weave-js/src/components/PagePanelComponents/Home/Browse3.tsx +++ b/weave-js/src/components/PagePanelComponents/Home/Browse3.tsx @@ -32,8 +32,6 @@ import { import {URL_BROWSE3} from '../../../urls'; import {Button} from '../../Button'; import {ErrorBoundary} from '../../ErrorBoundary'; -import {Browse2EntityPage} from './Browse2/Browse2EntityPage'; -import {Browse2HomePage} from './Browse2/Browse2HomePage'; import {ComparePage} from './Browse3/compare/ComparePage'; import { baseContext, @@ -235,19 +233,6 @@ const Browse3Mounted: FC<{ ) : ( )} - - - - - - - - - - - - - ); diff --git a/weave-js/src/entrypoint.tsx b/weave-js/src/entrypoint.tsx index 51b7872a7dfe..354c32d9e07d 100644 --- a/weave-js/src/entrypoint.tsx +++ b/weave-js/src/entrypoint.tsx @@ -15,7 +15,6 @@ import {StateInspector} from 'reinspect'; import {makeGorillaApolloClient} from './apollo'; import {onAppError} from './components/automation'; import PagePanel from './components/PagePanel'; -import {Browse2} from './components/PagePanelComponents/Home/Browse2'; import {Browse3} from './components/PagePanelComponents/Home/Browse3'; import {OptionalTraceServerClientContextProvider} from './components/PagePanelComponents/Home/Browse3/pages/wfReactInterface/traceServerClientContext'; import {PanelInteractContextProvider} from './components/Panel2/PanelInteractContext'; @@ -29,7 +28,6 @@ import { import {NotebookComputeGraphContextProvider} from './contextProviders'; import { URL_BROWSE, - URL_BROWSE2, URL_BROWSE3, URL_LOCAL, URL_RECENT, @@ -184,11 +182,6 @@ ReactDOM.render(
    - - - - -