File tree Expand file tree Collapse file tree 3 files changed +45
-0
lines changed
Expand file tree Collapse file tree 3 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ function updateWorkspaceEditor(tabId) {
123123 if ( config ) {
124124 workspaceMonacoEditor . setValue ( config . content ) ;
125125 monaco . editor . setModelLanguage ( workspaceMonacoEditor . getModel ( ) , config . language ) ;
126+ console . log ( "Updated workspace editor:" , config . content ) ;
126127 const languageSelect = document . getElementById ( 'workspace-language-select' ) ;
127128 if ( languageSelect ) {
128129 languageSelect . value = config . language ;
Original file line number Diff line number Diff line change @@ -128,6 +128,9 @@ <h3 class="text-sm font-black text-black mb-2 flex items-center gap-1">
128128// Global state
129129let isWorkspaceVisible = false ;
130130
131+ // Cache for actions data
132+ let actionsCache = null ;
133+
131134// Initialize on page load
132135document . addEventListener ( 'DOMContentLoaded' , function ( ) {
133136 const workspaceSection = document . querySelector ( '.workspace-container' ) ;
@@ -143,11 +146,30 @@ <h3 class="text-sm font-black text-black mb-2 flex items-center gap-1">
143146// Fetch and display actions from backend API
144147async function loadActionsFromBackend ( ) {
145148 try {
149+ // Use cached data if available
150+ if ( actionsCache ) {
151+ renderActions ( actionsCache ) ;
152+ return ;
153+ }
154+
146155 const response = await fetch ( '/api/actions/' ) ;
147156 if ( ! response . ok ) throw new Error ( 'Failed to fetch actions' ) ;
148157
149158 const data = await response . json ( ) ;
150159
160+ // Cache the data
161+ actionsCache = data ;
162+
163+ renderActions ( data ) ;
164+ } catch ( error ) {
165+ console . error ( 'Error loading actions:' , error ) ;
166+ }
167+ }
168+
169+ // Render actions from data
170+ function renderActions ( data ) {
171+ try {
172+
151173 // Render agents (max 4)
152174 const agentsContainer = document . getElementById ( 'agents-container' ) ;
153175 if ( agentsContainer && data . agents ) {
Original file line number Diff line number Diff line change @@ -229,14 +229,36 @@ <h3 class="text-lg font-black text-black mb-3">Quick Actions</h3>
229229 }
230230}
231231
232+ // Cache for sidebar actions data
233+ let sidebarActionsCache = null ;
234+
232235// Load sidebar actions from backend
233236async function loadSidebarActions ( ) {
234237 try {
238+ // Use cached data if available
239+ if ( sidebarActionsCache ) {
240+ renderSidebarActions ( sidebarActionsCache ) ;
241+ return ;
242+ }
243+
235244 const response = await fetch ( '/api/actions/' ) ;
236245 if ( ! response . ok ) throw new Error ( 'Failed to fetch actions' ) ;
237246
238247 const data = await response . json ( ) ;
239248
249+ // Cache the data
250+ sidebarActionsCache = data ;
251+
252+ renderSidebarActions ( data ) ;
253+ } catch ( error ) {
254+ console . error ( 'Error loading sidebar actions:' , error ) ;
255+ }
256+ }
257+
258+ // Render sidebar actions from data
259+ function renderSidebarActions ( data ) {
260+ try {
261+
240262 // Render MCPs
241263 const mcpsContainer = document . getElementById ( 'sidebar-mcps-container' ) ;
242264 if ( mcpsContainer && data . mcps ) {
You can’t perform that action at this time.
0 commit comments