Skip to content

Commit

Permalink
avoid rendering list of HelperClass
Browse files Browse the repository at this point in the history
  • Loading branch information
valkjsaaa committed May 14, 2024
1 parent e0a41a4 commit b4ca3b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactgenie-lib",
"version": "1.1.49",
"version": "1.1.50",
"description": "A Toolkit for Multimodal Applications",
"author": "valkjsaaa",
"license": "Apache-2.0",
Expand Down
25 changes: 14 additions & 11 deletions src/shared-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ export function executeGenieCode(command: string): GenieCodeResult {
return genieDispatch(async () => {
console.log(`before executing state ${JSON.stringify(sharedState)}`);
try {
const result = await GenieInterpreter.dslInterpreter.interpretSteps(
command
);
const result =
await GenieInterpreter.dslInterpreter.interpretSteps(command);
// console.log(`executed result ${result}`);
return {
success: true,
Expand All @@ -158,7 +157,7 @@ export function displayResult(
executionResult: GenieCodeResult,
transcript: string,
parsed: string,
genieInterfaces: GenieInterfaceSpec[]
genieInterfaces: GenieInterfaceSpec[],
) {
genieDispatch(() => {
let allDisplayingObjects = [];
Expand Down Expand Up @@ -204,7 +203,11 @@ export function displayResult(
let instantiatedDisplayingObject = null;
if (displayingObject != null) {
// if displayingObject is an array
if (displayingObject instanceof Array) {
if (
displayingObject instanceof Array &&
displayingObject.length >= 1 &&
displayingObject[0] instanceof DataClass
) {
// always display
onScreen = false;
instantiatedDisplayingObject = [];
Expand Down Expand Up @@ -236,8 +239,8 @@ export function displayResult(
genieInterface.className === Instance.constructor.name &&
shallowEqual(
genieInterface.key,
Instance._getConstructorParams()
)
Instance._getConstructorParams(),
),
);
if (!targetInterface) {
onScreen = false;
Expand All @@ -254,8 +257,8 @@ export function displayResult(
parsed,
stringifyResult(
// now we only display the last result
executionResult.results[executionResult.results.length - 1].result
)
executionResult.results[executionResult.results.length - 1].result,
),
)
.then((result) => {
console.log(`respond result: ${result}`);
Expand All @@ -271,14 +274,14 @@ export function displayResult(
const reactGenieState = sharedState as ReactGenieState;
reactGenieState.navState = {
objectViewClassName: AllGenieObjectInterfaces.getInterfaces(
instantiatedDisplayingObject
instantiatedDisplayingObject,
).viewClassName,
objectConstructorParams:
allDisplayingObjects.length === 1
? allDisplayingObjects[0].value._getConstructorParams()
: {
elements: allDisplayingObjects.map((displayingObject) =>
displayingObject.value._getConstructorParams()
displayingObject.value._getConstructorParams(),
),
},
};
Expand Down

0 comments on commit b4ca3b7

Please sign in to comment.