diff --git a/modules/rdesign/mod.ts b/modules/rdesign/mod.ts index 42ef831..2826787 100644 --- a/modules/rdesign/mod.ts +++ b/modules/rdesign/mod.ts @@ -215,7 +215,8 @@ const RDESIGN_JS = ` var space = document.getElementById('rdesign-app').dataset.space || 'demo'; var fetchHeaders = { 'Content-Type': 'application/json' }; try { var sess = JSON.parse(localStorage.getItem('encryptid_session') || '{}'); if (sess.accessToken) fetchHeaders['Authorization'] = 'Bearer ' + sess.accessToken; } catch(e) {} - fetch('/' + space + '/rdesign/api/design-agent', { + var basePath = window.location.pathname.replace(/\\/$/, ''); + fetch(basePath + '/api/design-agent', { method: 'POST', headers: fetchHeaders, body: JSON.stringify({ brief: text, space: space }),