yugbirla commited on
Commit
ec067d5
·
1 Parent(s): 6a5aa9f

Fix final UI button bindings

Browse files
app/product/final_product_ui.py CHANGED
@@ -857,6 +857,21 @@ async function sendMessage() {
857
  }
858
  }
859
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
860
  renderDocuments();
861
  </script>
862
  </body>
 
857
  }
858
  }
859
 
860
+
861
+ // Phase 40B: expose button functions globally
862
+ window.uploadDocument = uploadDocument;
863
+ window.refreshDocuments = refreshDocuments;
864
+ window.newChat = newChat;
865
+ window.reindexSelectedDocument = reindexSelectedDocument;
866
+ window.buildGraph = buildGraph;
867
+ window.openGraphViewer = openGraphViewer;
868
+ window.clearWorkspaceCache = clearWorkspaceCache;
869
+ window.deleteSelectedDocument = deleteSelectedDocument;
870
+ window.sendMessage = sendMessage;
871
+ window.handleKeyDown = handleKeyDown;
872
+ window.selectDocument = selectDocument;
873
+ window.openSource = openSource;
874
+
875
  renderDocuments();
876
  </script>
877
  </body>
scripts/phase40b_fix_ui_button_bindings.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ path = Path("app/product/final_product_ui.py")
4
+ text = path.read_text(encoding="utf-8-sig")
5
+ text = text.replace("\ufeff", "")
6
+
7
+ binding_js = r'''
8
+ // Phase 40B: expose button functions globally
9
+ window.uploadDocument = uploadDocument;
10
+ window.refreshDocuments = refreshDocuments;
11
+ window.newChat = newChat;
12
+ window.reindexSelectedDocument = reindexSelectedDocument;
13
+ window.buildGraph = buildGraph;
14
+ window.openGraphViewer = openGraphViewer;
15
+ window.clearWorkspaceCache = clearWorkspaceCache;
16
+ window.deleteSelectedDocument = deleteSelectedDocument;
17
+ window.sendMessage = sendMessage;
18
+ window.handleKeyDown = handleKeyDown;
19
+ window.selectDocument = selectDocument;
20
+ window.openSource = openSource;
21
+ '''
22
+
23
+ if "Phase 40B: expose button functions globally" not in text:
24
+ text = text.replace("renderDocuments();\n</script>", binding_js + "\nrenderDocuments();\n</script>")
25
+ print("Added global button bindings.")
26
+ else:
27
+ print("Bindings already present.")
28
+
29
+ path.write_text(text, encoding="utf-8")
30
+ print("Phase 40B complete.")