Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libs/renderer/src/components/block-defaults/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ import { config as IconBlockConfig, IconBlockDef } from "./Icon_block";
import { config as IframeBlockConfig, IframeBlockDef } from "./iframe-block";
import { config as ImageBlockConfig, ImageBlockDef } from "./image-block";
import { config as InputBlockConfig, InputBlockDef } from "./input-block";
import { config as IterationBlockConfig, IterationBlockDef } from './iteration-block';
import {
config as IterationBlockConfig,
IterationBlockDef,
} from "./iteration-block";

import { config as LinkBlockConfig, LinkBlockDef } from "./link-block";
import { config as LogsBlockConfig, LogsBlockDef } from "./logs-block";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ export const IterationBlock: BlockComponent = observer(({ id }) => {

const [blocksToRemove, setBlocksToRemove] = useState([]);

let list
let list;
if (typeof data.source === "string") {
try {
list = JSON.parse(data.source);
} catch {
list = data.source
list = data.source;
}
}

Expand All @@ -70,10 +70,10 @@ export const IterationBlock: BlockComponent = observer(({ id }) => {
message: ActionMessages.REMOVE_BLOCK,
payload: {
id: b,
keep: false
}
})
})
keep: false,
},
});
});

list.forEach(async (j, i) => {
// Skip the first
Expand Down Expand Up @@ -118,10 +118,10 @@ export const IterationBlock: BlockComponent = observer(({ id }) => {
},
});

newIds.push(newBlockId)
newIds.push(newBlockId);
});

setBlocksToRemove(newIds)
setBlocksToRemove(newIds);
}
}
// TODO: FIx Dependency array
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { CSSProperties } from "react";
import { BlockConfig } from "../../../store";
import { ChildBlockSettings, InputSettings, QueryInputSettings, QuerySelectionSettings } from "../../block-settings";

import { IterationBlockDef, IterationBlock } from "./IterationBlock";
import { buildLayoutSection, buildListener, buildShowField } from "../block-defaults.shared";
import { FormatShapes } from "@mui/icons-material";

import { IterationBlockDef, IterationBlock } from "./IterationBlock";
import { BLOCK_TYPE_INPUT } from "../block-defaults.constants";
import { SelectInputSettings } from "../../block-settings/shared/SelectInputSettings";
import { InputModalSettings } from "../../block-settings/shared/InputModalSettings";
import { useBlock } from "@/hooks";
import { BlockConfig } from "../../../store";
import {
buildLayoutSection,
buildShowField,
} from "../block-defaults.shared";
import {
QueryInputSettings,
} from "../../block-settings";

// export the config for the block
export const config: BlockConfig<IterationBlockDef> = {
Expand All @@ -18,7 +20,7 @@ export const config: BlockConfig<IterationBlockDef> = {
style: {},
source: "",
child: null,
show: "true"
show: "true",
},
listeners: {},
slots: {
Expand All @@ -29,17 +31,19 @@ export const config: BlockConfig<IterationBlockDef> = {
contentMenu: [
{
name: "Conditional",
children: [
...buildShowField(),
],
children: [...buildShowField()],
},
{
name: "Data Source",
children: [
{
description: "Data Source",
render: ({ id }) => (
<QueryInputSettings id={id} label="Source" path="source" />
<QueryInputSettings
id={id}
label="Source"
path="source"
/>
),
},
],
Expand All @@ -56,7 +60,5 @@ export const config: BlockConfig<IterationBlockDef> = {
// ],
// },
],
styleMenu: [
buildLayoutSection(),
],
styleMenu: [buildLayoutSection()],
};
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './IterationBlock';
export * from './config';
export * from "./IterationBlock";
export * from "./config";
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ export type LLMComparisonContextType = {

watch: (str: string) => unknown;

handleSubmit: UseFormHandleSubmit<TypeLlmComparisonForm, undefined>;
handleSubmit: UseFormHandleSubmit<
TypeLlmComparisonForm,
TypeLlmComparisonForm
>;

/** All Models available for configuring variants */
allModels: TypeLlmConfig[];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
import React, { useState, useEffect } from "react";
import { Add, Edit } from "@mui/icons-material";

import { Button, IconButton, LoadingScreen, Modal, Stack, Typography } from "@semoss/ui";
import {
Button,
IconButton,
LoadingScreen,
Modal,
Stack,
Typography,
} from "@semoss/ui";
import { Env, InsightProvider, runPixel } from "@semoss/sdk";

import { BlockDef, SerializedState, STATE_VERSION, StateStore } from "../../../store";
import {
BlockDef,
SerializedState,
STATE_VERSION,
StateStore,
} from "../../../store";
import { useBlock } from "../../../hooks";
import { DefaultCells } from "../../cell-defaults";
import { DefaultBlocks } from "../../block-defaults";
Expand All @@ -17,26 +29,26 @@ interface ChildBlockSettingsProps<D extends BlockDef = BlockDef> {
const STATE = {
blocks: {
"container-5656": {
id: 'container-5656',
id: "container-5656",
widget: "container",
parent: null,
data: {
style: {
border: 'solid red'
border: "solid red",
},
show: "true",
},
listeners: {},
slots: {
children: []
children: [],
},
}
},
},
},
variables: {},
queries: {},
executionOrder: [],
version: STATE_VERSION,
}
};

export const ChildBlockSettings = (props: ChildBlockSettingsProps) => {
const { id } = props;
Expand All @@ -45,34 +57,30 @@ export const ChildBlockSettings = (props: ChildBlockSettingsProps) => {
const [state, setState] = useState<StateStore>();

useEffect(() => {
runPixel<[SerializedState]>(
`1+1`,
'new',
)
.then(async ({ pixelReturn, errors, insightId }) => {
runPixel<[SerializedState]>(`1+1`, "new").then(
async ({ pixelReturn, errors, insightId }) => {
// create a new state store
// const s = new StateStore({
// mode: 'static',
// insightId: insightId,
// state: STATE,
// cellRegistry: DefaultCells,
// });

// set it
// setState(s);

})
}, [])
},
);
}, []);

if (!state) {
return <>Loading...</>
return <>Loading...</>;
}

/**
* Initialize insight for app building
*/
Env.update({
MODULE: process.env.MODULE || '',
MODULE: process.env.MODULE || "",
});

return (
Expand Down Expand Up @@ -112,12 +120,12 @@ export const ChildBlockSettings = (props: ChildBlockSettingsProps) => {
<Modal.Content>
<>Show Preview of Block</>
{/* <InsightProvider> */}
{/* <Blocks
{/* <Blocks
state={state}
registry={DefaultBlocks}
>
</Blocks> */}
{/* <Blocks>
{/* <Blocks>
<DesignerContext.Provider>
<Workspace />
</DesignerContext.Provider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ export { IconSelectSettings } from "./IconSelectSettings";
export { QueryInputSettings } from "./QueryInputSettings";
export { OptionsSettings } from "./OptionsSettings";
export { ChipSettings } from "./ChipSettings";
export { ChildBlockSettings } from "./ChildBlockSettings"
export { ChildBlockSettings } from "./ChildBlockSettings";
5 changes: 4 additions & 1 deletion libs/renderer/src/hooks/useBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,10 @@ export const useBlock = <D extends BlockDef = BlockDef>(
// try to extract the variable

// debugger
return state.parseVariable(instance, block.widget !== 'iteration' ? block.id : null);
return state.parseVariable(
instance,
block.widget !== "iteration" ? block.id : null,
);
}

return instance;
Expand Down
2 changes: 2 additions & 0 deletions libs/renderer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export type {
VariableWithId,
CellState,
NewCellAction,
Block,
QueryStateConfig
} from "./store";

// REGISTRY AND MENUS
Expand Down
7 changes: 5 additions & 2 deletions libs/renderer/src/store/state/cell.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@ export class CellState<D extends CellDef = CellDef> {
});
});
// Currently console does not get pass STREAMING
if (status === "ProgressComplete" || status === "Streaming" || status === "Complete") {
if (
status === "ProgressComplete" ||
status === "Streaming" ||
status === "Complete"
) {
isPolling = false;
} else {
// poll
Expand Down Expand Up @@ -382,7 +386,6 @@ export class CellState<D extends CellDef = CellDef> {
});
}


// process side effects from running a pixel
this._state.processSideEffects(this.operation, this.output);
} catch (e) {
Expand Down
Loading