Compare commits
1 Commits
better-out
...
function-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
328cd4f5e6 |
@@ -9,15 +9,32 @@ import { ScenariosHeader } from "./ScenariosHeader";
|
|||||||
import { borders } from "./styles";
|
import { borders } from "./styles";
|
||||||
import { useScenarios } from "~/utils/hooks";
|
import { useScenarios } from "~/utils/hooks";
|
||||||
import ScenarioPaginator from "./ScenarioPaginator";
|
import ScenarioPaginator from "./ScenarioPaginator";
|
||||||
import { Fragment } from "react";
|
import { Fragment, useEffect, useState } from "react";
|
||||||
|
|
||||||
export default function OutputsTable({ experimentId }: { experimentId: string | undefined }) {
|
export default function OutputsTable({
|
||||||
|
experimentId,
|
||||||
|
func,
|
||||||
|
}: {
|
||||||
|
experimentId: string | undefined;
|
||||||
|
func: () => void;
|
||||||
|
}) {
|
||||||
const variants = api.promptVariants.list.useQuery(
|
const variants = api.promptVariants.list.useQuery(
|
||||||
{ experimentId: experimentId as string },
|
{ experimentId: experimentId as string },
|
||||||
{ enabled: !!experimentId },
|
{ enabled: !!experimentId },
|
||||||
);
|
);
|
||||||
|
|
||||||
const scenarios = useScenarios();
|
const scenarios = useScenarios();
|
||||||
|
const [newFunc, setNewFunc] = useState<() => void | null>();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
console.log('func', func)
|
||||||
|
if (func) {
|
||||||
|
setNewFunc(prev => {
|
||||||
|
console.log('Setting newFunc from', prev, 'to', func);
|
||||||
|
return func;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [func]);
|
||||||
|
|
||||||
if (!variants.data || !scenarios.data) return null;
|
if (!variants.data || !scenarios.data) return null;
|
||||||
|
|
||||||
@@ -46,7 +63,7 @@ export default function OutputsTable({ experimentId }: { experimentId: string |
|
|||||||
<GridItem rowSpan={variantHeaderRows}>
|
<GridItem rowSpan={variantHeaderRows}>
|
||||||
<AddVariantButton />
|
<AddVariantButton />
|
||||||
</GridItem>
|
</GridItem>
|
||||||
|
{newFunc && newFunc.toString()}
|
||||||
{variants.data.map((variant, i) => {
|
{variants.data.map((variant, i) => {
|
||||||
const sharedProps: GridItemProps = {
|
const sharedProps: GridItemProps = {
|
||||||
...borders,
|
...borders,
|
||||||
|
|||||||
@@ -61,6 +61,14 @@ export default function Experiment() {
|
|||||||
|
|
||||||
const canModify = experiment.data?.access.canModify ?? false;
|
const canModify = experiment.data?.access.canModify ?? false;
|
||||||
|
|
||||||
|
const y = "5"
|
||||||
|
const z = {abc: "123"}
|
||||||
|
|
||||||
|
const func = () => {
|
||||||
|
const u = 12;
|
||||||
|
const m = `hello ${y} ${z.abc} ${u} world`;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AppShell title={experiment.data?.label}>
|
<AppShell title={experiment.data?.label}>
|
||||||
<VStack h="full">
|
<VStack h="full">
|
||||||
@@ -106,7 +114,7 @@ export default function Experiment() {
|
|||||||
</Flex>
|
</Flex>
|
||||||
<ExperimentSettingsDrawer />
|
<ExperimentSettingsDrawer />
|
||||||
<Box w="100%" overflowX="auto" flex={1}>
|
<Box w="100%" overflowX="auto" flex={1}>
|
||||||
<OutputsTable experimentId={router.query.id as string | undefined} />
|
<OutputsTable experimentId={router.query.id as string | undefined} func={func} />
|
||||||
</Box>
|
</Box>
|
||||||
</VStack>
|
</VStack>
|
||||||
</AppShell>
|
</AppShell>
|
||||||
|
|||||||
Reference in New Issue
Block a user