aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/trails/PresElementBox.tsx
diff options
context:
space:
mode:
authorSophie Zhang <sophie_zhang@brown.edu>2023-10-16 17:08:24 -0400
committerSophie Zhang <sophie_zhang@brown.edu>2023-10-16 17:08:24 -0400
commit8a0ae4e42d217a222d6a127ec640d5f1113832a0 (patch)
tree889a3d75f647297fca4ffcff3e394ed1005b5bc2 /src/client/views/nodes/trails/PresElementBox.tsx
parent675597c0716171879b527710da3bbedf928d7172 (diff)
text box
Diffstat (limited to 'src/client/views/nodes/trails/PresElementBox.tsx')
-rw-r--r--src/client/views/nodes/trails/PresElementBox.tsx35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/client/views/nodes/trails/PresElementBox.tsx b/src/client/views/nodes/trails/PresElementBox.tsx
index 82ed9e8d5..534a0f2aa 100644
--- a/src/client/views/nodes/trails/PresElementBox.tsx
+++ b/src/client/views/nodes/trails/PresElementBox.tsx
@@ -28,6 +28,7 @@ import React = require('react');
import { TreeView } from '../../collections/TreeView';
import { BranchingTrailManager } from '../../../util/BranchingTrailManager';
import { MultiToggle, Type } from 'browndash-components';
+import { gptTrailSlideCustomization } from '../../../apis/gpt/GPT';
/**
* This class models the view a document added to presentation will have in the presentation.
* It involves some functionality for its buttons and options.
@@ -434,6 +435,27 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
return width;
}
+ // GPT
+
+ @action
+ customizeWithGPT = async (input: string) => {
+ const testInput = 'change title to Customized Slide, transition for 2.3s with fade in effect';
+
+ try {
+ const res = await gptTrailSlideCustomization(testInput);
+ if (typeof res === 'string') {
+ const resObj = JSON.parse(res);
+ console.log('Result ', resObj);
+
+ for (let key in resObj) {
+ this.rootDoc[key] = resObj[key];
+ }
+ }
+ } catch (err) {
+ console.error(err);
+ }
+ };
+
@computed get presButtons() {
const presBox = this.presBox;
const presBoxColor = StrCast(presBox?._backgroundColor);
@@ -537,6 +559,19 @@ export class PresElementBox extends ViewBoxBaseComponent<FieldViewProps>() {
</div>
</Tooltip>
);
+ items.push(
+ <Tooltip key="customize" title={<div className="dash-tooltip">Customize</div>}>
+ <div
+ className={'slideButton'}
+ onClick={() => {
+ PresBox.Instance.setChatActive(true);
+ PresBox.Instance.slideToModify = this.rootDoc;
+ // this.customizeWithGPT('');
+ }}>
+ <FontAwesomeIcon icon={'message'} onPointerDown={e => e.stopPropagation()} />
+ </div>
+ </Tooltip>
+ );
return items;
}