Skip to content

Commit

Permalink
add to sidebar, and add open in playground button
Browse files Browse the repository at this point in the history
  • Loading branch information
jwlee64 committed Nov 20, 2024
1 parent db8a09c commit e1a814a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 5 deletions.
8 changes: 8 additions & 0 deletions weave-js/src/components/FancyPage/useProjectSidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,13 @@ export const useProjectSidebar = (
isShown: isWeaveOnly,
iconName: IconNames.CubeContainer,
},
{
type: 'button' as const,
name: 'Playground',
slug: 'weave/playground',
isShown: isWeaveOnly,
iconName: IconNames.RobotServiceMember,
},
{
type: 'menuPlaceholder' as const,
// name: 'More',
Expand All @@ -224,6 +231,7 @@ export const useProjectSidebar = (
// 'weave/scorers', // Hiding until we want to release
'weave/operations',
'weave/objects',
'weave/playground',
],
},
];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Box from '@mui/material/Box';
import {useViewerInfo} from '@wandb/weave/common/hooks/useViewerInfo';
import {Loading} from '@wandb/weave/components/Loading';
import {urlPrefixed} from '@wandb/weave/config';
import {useViewTraceEvent} from '@wandb/weave/integrations/analytics/useViewEvents';
import React, {FC, useCallback, useContext, useEffect, useState} from 'react';
import {useHistory} from 'react-router-dom';
Expand Down Expand Up @@ -71,6 +72,14 @@ const useCallTabs = (call: CallSchema) => {
const codeURI = call.opVersionRef;
const {entity, project, callId} = call;
const weaveRef = makeRefCall(entity, project, callId);

const handleOpenInPlayground = () => {
window.open(
urlPrefixed(`/${entity}/${project}/weave/playground/${callId}`),
'_blank'
);
};

return [
// Disabling Evaluation tab until it's better for single evaluation
...(false && isEvaluateOp(call.spanName)
Expand All @@ -97,11 +106,20 @@ const useCallTabs = (call: CallSchema) => {
{
label: 'Chat',
content: (
<ScrollableTabContent>
<Tailwind>
<CallChat call={call.traceCall!} />
</Tailwind>
</ScrollableTabContent>
<>
<Button
variant="secondary"
startIcon="sandbox-playground"
className="m-16 mb-8"
onClick={handleOpenInPlayground}>
Open chat in playground
</Button>
<ScrollableTabContent>
<Tailwind>
<CallChat call={call.traceCall!} />
</Tailwind>
</ScrollableTabContent>
</>
),
},
]
Expand Down

0 comments on commit e1a814a

Please sign in to comment.