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) {
123
123
if ( config ) {
124
124
workspaceMonacoEditor . setValue ( config . content ) ;
125
125
monaco . editor . setModelLanguage ( workspaceMonacoEditor . getModel ( ) , config . language ) ;
126
+ console . log ( "Updated workspace editor:" , config . content ) ;
126
127
const languageSelect = document . getElementById ( 'workspace-language-select' ) ;
127
128
if ( languageSelect ) {
128
129
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">
128
128
// Global state
129
129
let isWorkspaceVisible = false ;
130
130
131
+ // Cache for actions data
132
+ let actionsCache = null ;
133
+
131
134
// Initialize on page load
132
135
document . addEventListener ( 'DOMContentLoaded' , function ( ) {
133
136
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">
143
146
// Fetch and display actions from backend API
144
147
async function loadActionsFromBackend ( ) {
145
148
try {
149
+ // Use cached data if available
150
+ if ( actionsCache ) {
151
+ renderActions ( actionsCache ) ;
152
+ return ;
153
+ }
154
+
146
155
const response = await fetch ( '/api/actions/' ) ;
147
156
if ( ! response . ok ) throw new Error ( 'Failed to fetch actions' ) ;
148
157
149
158
const data = await response . json ( ) ;
150
159
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
+
151
173
// Render agents (max 4)
152
174
const agentsContainer = document . getElementById ( 'agents-container' ) ;
153
175
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>
229
229
}
230
230
}
231
231
232
+ // Cache for sidebar actions data
233
+ let sidebarActionsCache = null ;
234
+
232
235
// Load sidebar actions from backend
233
236
async function loadSidebarActions ( ) {
234
237
try {
238
+ // Use cached data if available
239
+ if ( sidebarActionsCache ) {
240
+ renderSidebarActions ( sidebarActionsCache ) ;
241
+ return ;
242
+ }
243
+
235
244
const response = await fetch ( '/api/actions/' ) ;
236
245
if ( ! response . ok ) throw new Error ( 'Failed to fetch actions' ) ;
237
246
238
247
const data = await response . json ( ) ;
239
248
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
+
240
262
// Render MCPs
241
263
const mcpsContainer = document . getElementById ( 'sidebar-mcps-container' ) ;
242
264
if ( mcpsContainer && data . mcps ) {
You can’t perform that action at this time.
0 commit comments