aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/DiagramBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/DiagramBox.tsx')
-rw-r--r--src/client/views/nodes/DiagramBox.tsx38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/client/views/nodes/DiagramBox.tsx b/src/client/views/nodes/DiagramBox.tsx
index 1b8290652..1813e6097 100644
--- a/src/client/views/nodes/DiagramBox.tsx
+++ b/src/client/views/nodes/DiagramBox.tsx
@@ -113,11 +113,43 @@ export class DiagramBox extends ViewBoxAnnotatableComponent<FieldViewProps>() im
// this.htmlCode = modelOutput;
this.generateMermaidCode();
};
- @action generateMermaidCode = async () => {
+ printTitle(){
+ let docArray: Doc[] = DocListCast(this.Document.data);
+ let mermaidCodeDoc = docArray.filter(doc => doc.type == 'rich text')
+ mermaidCodeDoc=mermaidCodeDoc.filter(doc=>(doc.text as RichTextField).Text=='mermaidCodeTitle')
+ console.log(mermaidCodeDoc[0].title)
+ if(mermaidCodeDoc[0]){
+ console.log(mermaidCodeDoc[0].title)
+ if(typeof mermaidCodeDoc[0].title=='string'){
+ console.log(mermaidCodeDoc[0].title)
+ if(mermaidCodeDoc[0].title!=""){
+ console.log("you have to see me")
+ }
+ }
+ }
+ }
+ @action async generateMermaidCode() {
console.log('Generating Mermaid Code');
this.loading = true;
-
- let res = await gptAPICall(this.inputValue, GPTCallType.MERMAID);
+ let prompt=""
+ // let docArray: Doc[] = DocListCast(this.Document.data);
+ // let mermaidCodeDoc = docArray.filter(doc => doc.type == 'rich text')
+ // mermaidCodeDoc=mermaidCodeDoc.filter(doc=>(doc.text as RichTextField).Text=='mermaidCodeTitle')
+ // if(mermaidCodeDoc[0]){
+ // console.log(mermaidCodeDoc[0].title)
+ // if(typeof mermaidCodeDoc[0].title=='string'){
+ // console.log(mermaidCodeDoc[0].title)
+ // if(mermaidCodeDoc[0].title!=""){
+ // prompt="Edit this code "+this.inputValue+": "+mermaidCodeDoc[0].title
+ // console.log("you have to see me")
+ // }
+ // }
+ // }
+ // else{
+ prompt="Write this in mermaid code and only give me the mermaid code: "+this.inputValue
+ console.log("there is no text save")
+ //}
+ let res = await gptAPICall(prompt, GPTCallType.MERMAID);
this.loading = false;
if (res == 'Error connecting with API.') {
// If GPT call failed