diff options
author | srichman333 <sarah_n_richman@brown.edu> | 2023-12-04 16:49:47 -0500 |
---|---|---|
committer | srichman333 <sarah_n_richman@brown.edu> | 2023-12-04 16:49:47 -0500 |
commit | ac51767cba1a4694980ee26272b09194ddefb0a7 (patch) | |
tree | 745816256f8d797a7484b0de0a7da9f37ee76594 /src | |
parent | 966c93e3a5b70e5e579b4b67061c859df1ac357d (diff) |
small dataviz ui tweaks
Diffstat (limited to 'src')
-rw-r--r-- | src/client/apis/gpt/GPT.ts | 33 | ||||
-rw-r--r-- | src/client/views/nodes/DataVizBox/DataVizBox.tsx | 15 | ||||
-rw-r--r-- | src/client/views/nodes/DataVizBox/SchemaCSVPopUp.tsx | 4 | ||||
-rw-r--r-- | src/client/views/nodes/DataVizBox/components/Chart.scss | 4 |
4 files changed, 12 insertions, 44 deletions
diff --git a/src/client/apis/gpt/GPT.ts b/src/client/apis/gpt/GPT.ts index d1606e7f0..6bde7989b 100644 --- a/src/client/apis/gpt/GPT.ts +++ b/src/client/apis/gpt/GPT.ts @@ -1,5 +1,3 @@ -import { config } from "dotenv"; -config(); import { Configuration, OpenAIApi } from 'openai'; enum GPTCallType { @@ -67,33 +65,4 @@ const gptImageCall = async (prompt: string, n?: number) => { } }; -const gptCSVCall = async (inputText: string, callType: GPTCallType) => { - const opts: GPTCallOpts = callTypeMap[callType]; - try { - const configuration = new Configuration({ - apiKey: process.env.OPENAI_KEY, - }); - const openai = new OpenAIApi(configuration); - // const client = OpenAIApi; - // const response = await openai.createCompletion({ - // model: opts.model, - // max_tokens: opts.maxTokens, - // temperature: opts.temp, - // prompt: `${opts.prompt}${inputText}`, - // }); - // return response.data.choices[0].text; - - const responseGpt = await openai.createChatCompletion({ - model: "gpt-3.5-turbo-16k", - messages: [{role: "user", content: inputText}], - }) - const generatedResponse = responseGpt.data.choices[0].message?.content; - console.log(generatedResponse); - return generatedResponse; - } catch (err) { - console.log(err); - return 'Error connecting with API.'; - } -}; - -export { gptAPICall, gptImageCall, gptCSVCall, GPTCallType }; +export { gptAPICall, gptImageCall, GPTCallType }; diff --git a/src/client/views/nodes/DataVizBox/DataVizBox.tsx b/src/client/views/nodes/DataVizBox/DataVizBox.tsx index cfa420473..32ed57861 100644 --- a/src/client/views/nodes/DataVizBox/DataVizBox.tsx +++ b/src/client/views/nodes/DataVizBox/DataVizBox.tsx @@ -353,9 +353,7 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { this.props.addDocument?.(newDoc); } DocUtils.MakeLink(anchor, newDoc, { link_relationship: 'GPT Data Prompt' }); - } - - + } } render() { @@ -386,15 +384,15 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { <Toggle text={'PIE CHART'} toggleType={ToggleType.BUTTON} type={Type.SEC} color={'black'} onClick={e => (this.layoutDoc._dataViz = DataVizView.PIECHART)} toggleStatus={this.layoutDoc._dataViz == -DataVizView.PIECHART} /> </div> - <CollectionFreeFormView + {/* <CollectionFreeFormView ref={this._ffref} {...this.props} setContentView={emptyFunction} - renderDepth={this.props.renderDepth + 1} + renderDepth={this.props.renderDepth - 1} fieldKey={this.annotationKey} styleProvider={this.props.styleProvider} isAnnotationOverlay={true} - annotationLayerHostsContent={true} + annotationLayerHostsContent={false} PanelWidth={this.props.PanelWidth} PanelHeight={this.props.PanelHeight} select={emptyFunction} @@ -403,11 +401,10 @@ export class DataVizBox extends ViewBoxAnnotatableComponent<FieldViewProps>() { removeDocument={this.removeDocument} moveDocument={this.moveDocument} addDocument={this.addDocument}> - {this.renderVizView} + </CollectionFreeFormView> */} - </CollectionFreeFormView> - + {this.renderVizView} <div className="dataviz-sidebar" style={{ width: `${this.sidebarWidthPercent}`, backgroundColor: `${this.sidebarColor}` }} diff --git a/src/client/views/nodes/DataVizBox/SchemaCSVPopUp.tsx b/src/client/views/nodes/DataVizBox/SchemaCSVPopUp.tsx index 309297307..a015172a4 100644 --- a/src/client/views/nodes/DataVizBox/SchemaCSVPopUp.tsx +++ b/src/client/views/nodes/DataVizBox/SchemaCSVPopUp.tsx @@ -3,12 +3,13 @@ import './SchemaCSVPopUp.scss'; import { action, observable } from 'mobx'; import { observer } from 'mobx-react'; import { Doc } from '../../../../fields/Doc'; -import { Button, Type } from 'browndash-components'; +import { Button, IconButton, Type } from 'browndash-components'; import { StrCast } from '../../../../fields/Types'; import { MarqueeView } from '../../collections/collectionFreeForm/MarqueeView'; import { Utils, emptyFunction, setupMoveUpEvents } from '../../../../Utils'; import { DragManager } from '../../../util/DragManager'; import { DocumentView } from '../DocumentView'; +import { CgClose } from 'react-icons/cg'; interface SchemaCSVPopUpProps {} @@ -69,6 +70,7 @@ export class SchemaCSVPopUp extends React.Component<SchemaCSVPopUpProps> { heading = (headingText: string) => ( <div className="summary-heading"> <label className="summary-text">{headingText}</label> + <IconButton color={StrCast(Doc.UserDoc().userVariantColor)} tooltip="close" icon={<CgClose size="16px" />} onClick={() => this.setVisible(false)} /> </div> ); diff --git a/src/client/views/nodes/DataVizBox/components/Chart.scss b/src/client/views/nodes/DataVizBox/components/Chart.scss index cc1923b98..bef3cced5 100644 --- a/src/client/views/nodes/DataVizBox/components/Chart.scss +++ b/src/client/views/nodes/DataVizBox/components/Chart.scss @@ -15,8 +15,8 @@ font-size: larger; display: flex; flex-direction: row; - margin-top: -10px; - margin-bottom: -10px; + margin-top: -20px; + margin-bottom: -20px; } .asHistogram-checkBox { // display: flex; |