aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DataVizBox/DataVizBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DataVizBox/DataVizBox.tsx')
-rw-r--r--src/client/views/nodes/DataVizBox/DataVizBox.tsx19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
index 808bc182a..eaf5c1758 100644
--- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx
+++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx
@@ -63,7 +63,8 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
@observable _marqueeing: number[] | undefined = undefined;
@observable _savedAnnotations = new ObservableMap<number, HTMLDivElement[]>();
@observable _specialHighlightedRow: number | undefined = undefined;
- @observable _GPTSummary: ObservableMap<string, string> | undefined = undefined;
+ @observable GPTSummary: ObservableMap<string, string> | undefined = undefined;
+ @observable fieldTypes: ObservableMap<string, string> = new ObservableMap();
@observable _GPTLoading: boolean = false;
constructor(props: FieldViewProps) {
@@ -145,6 +146,18 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
this._specialHighlightedRow = row;
}
+ @action setFieldType = (field: string, type: string) => {
+ this.fieldTypes?.set(field, type);
+ }
+
+ getFieldType = (field: string): string => {
+ return this.fieldTypes?.get(field) ?? '';
+ }
+
+ getFieldDescription = (field: string): string => {
+ return this.GPTSummary?.get(field) ?? '';
+ }
+
@action // pinned / linked anchor doc includes selected rows, graph titles, and graph colors
restoreView = (data: Doc) => {
// const changedView = data.config_dataViz && this.dataVizView !== data.config_dataViz && (this.layoutDoc._dataViz = data.config_dataViz);
@@ -516,10 +529,10 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() {
const res = await gptAPICall(prompt, GPTCallType.VIZSUM);
if (res) {
- this._GPTSummary = new ObservableMap();
+ this.GPTSummary = new ObservableMap();
const descs: {[col: string]: string} = JSON.parse(res);
for (const [key, val] of Object.entries(descs)) {
- this._GPTSummary.set(key, val);
+ this.GPTSummary.set(key, val);
}
console.log(res, descs);