@e-llm-studio/instant-learning 1.3.0-alpha.85 → 1.3.0-alpha.87

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{__assign as e}from"tslib";import{jsx as n}from"react/jsx-runtime";import{useEffect as t}from"react";import r from"./TeachMeWrapper.js";import i from"../../../plugins/ValueTypes/Default/DefaultTeachMeRenderer.js";import a from"../../../plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.js";import o from"../../../plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js";import{useTeachMeConfigStore as s,useLMSConfigStore as l}from"../../LearningManagement/store/useLMSConfigStore.js";import{useLearningTemplateStore as u}from"../../LearningManagement/store/useLearningTemplateStore.js";import{useLMSConfigQuery as g}from"../../LearningManagement/queries/useLMSConfigQuery.js";import m from"../../LearningManagement/store/useAuthStore.js";import p from"../../LearningManagement/store/useEnvStore.js";import{QueryClient as f,QueryClientProvider as c}from"@tanstack/react-query";import{fetchTiers as d}from"../../LearningManagement/apis/scopeApis.js";import{useConfigStore as S}from"../../LearningManagement/store/useConfigStore.js";var M={Default:i,"Radio Traffic Learning":a,Guidelines:o},L=new f,v=function(t){return n(c,e({client:L},{children:n(T,e({},t))}))},T=function(i){var a,o=i.app_integration_id,f=i.isOpen,c=i.onClose,L=i.pluginPayload,v=i.token,T=i.mode,h=i.config,j=s(function(e){return e.setTeachMeConfig});s(function(e){return e.clearTeachMeConfig});var R=l(function(e){return e.setLMSConfig}),C=S().setConfig;t(function(){C(h),m.getState().setUser(e(e({},m.getState().user),{accessToken:v})),p.getState().setLlmStudioUrl(null==h?void 0:h.BASE_URL),u.getState().setAppIntegrationId(null!=o?o:""),v&&(null==h?void 0:h.BASE_URL)&&((null==L?void 0:L.tiers)||d())},[o,v,null==h?void 0:h.BASE_URL]),null==L||L.teachMe;var y=g(null!=o?o:"",!1,!0);return y.isLoading,y.isError,y.refetch,y.isSuccess,t(function(){var n;if(null==L?void 0:L.teachMe){var t=L.teachMe;t.teachMe&&j(t.teachMe),t.template&&u.getState().setTemplateData(null!=o?o:"",t.template),t.learningManagement&&R(e(e({},t.learningManagement),{agents:null!==(n=t.agents)&&void 0!==n?n:{}}))}(null==L?void 0:L.tiers)&&u.getState().setTiers(L.tiers)},[L]),n(r,{app_integration_id:o,isOpen:f,onClose:c,token:v,templateRegistry:M,baseURL:null==h?void 0:h.BASE_URL,initialScope:null!==(a=null==L?void 0:L.initialScope)&&void 0!==a?a:"",ruleSet:null==L?void 0:L.ruleSet,pluginPayload:e(e({},L),{mode:T})})};export{M as TemplateRegistry,v as default};
1
+ import{__assign as e}from"tslib";import{jsx as t}from"react/jsx-runtime";import{useEffect as n}from"react";import r from"./TeachMeWrapper.js";import i from"../../../plugins/ValueTypes/Default/DefaultTeachMeRenderer.js";import a from"../../../plugins/ValueTypes/RadioTrafficLearning/RadioTrafficLearningRenderer.js";import o from"../../../plugins/ValueTypes/Guidelines/GuidelinesTeachMeRenderer.js";import{useTeachMeConfigStore as l,useLMSConfigStore as s}from"../../LearningManagement/store/useLMSConfigStore.js";import{useLearningTemplateStore as u}from"../../LearningManagement/store/useLearningTemplateStore.js";import{useLMSConfigQuery as g}from"../../LearningManagement/queries/useLMSConfigQuery.js";import m from"../../LearningManagement/store/useAuthStore.js";import p from"../../LearningManagement/store/useEnvStore.js";import{QueryClient as f,QueryClientProvider as d}from"@tanstack/react-query";import{fetchTiers as c}from"../../LearningManagement/apis/scopeApis.js";import{useConfigStore as S}from"../../LearningManagement/store/useConfigStore.js";var v={Default:i,"Radio Traffic Learning":a,Guidelines:o},M=new f,L=function(n){return t(d,e({client:M},{children:t(T,e({},n))}))},T=function(i){var a,o=i.app_integration_id,f=i.isOpen,d=i.onClose,M=i.pluginPayload,L=i.token,T=i.mode,h=i.config,R=l(function(e){return e.setTeachMeConfig});l(function(e){return e.clearTeachMeConfig});var j=s(function(e){return e.setLMSConfig}),C=S().setConfig;n(function(){var t,n;C(h),m.getState().setUser(e(e({},m.getState().user),{accessToken:L})),p.getState().setLlmStudioUrl(null==h?void 0:h.BASE_URL),u.getState().setAppIntegrationId(null!=o?o:""),u.getState().setSelectedRuleSetId(null!==(n=null===(t=null==M?void 0:M.ruleSet)||void 0===t?void 0:t.ruleSetId)&&void 0!==n?n:null),L&&(null==h?void 0:h.BASE_URL)&&((null==M?void 0:M.tiers)||c())},[o,L,null==h?void 0:h.BASE_URL]),null==M||M.teachMe;var y=g(null!=o?o:"",!1,!0);return y.isLoading,y.isError,y.refetch,y.isSuccess,n(function(){var t;if(null==M?void 0:M.teachMe){var n=M.teachMe;n.teachMe&&R(n.teachMe),n.template&&u.getState().setTemplateData(null!=o?o:"",n.template),n.learningManagement&&j(e(e({},n.learningManagement),{agents:null!==(t=n.agents)&&void 0!==t?t:{}}))}(null==M?void 0:M.tiers)&&u.getState().setTiers(M.tiers)},[M]),t(r,{app_integration_id:o,isOpen:f,onClose:d,token:L,templateRegistry:v,baseURL:null==h?void 0:h.BASE_URL,initialScope:null!==(a=null==M?void 0:M.initialScope)&&void 0!==a?a:"",ruleSet:null==M?void 0:M.ruleSet,pluginPayload:e(e({},M),{mode:T})})};export{v as TemplateRegistry,L as default};
2
2
  //# sourceMappingURL=TeachMePlugin.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as e,__awaiter as t,__generator as i}from"tslib";import{jsx as r,jsxs as n}from"react/jsx-runtime";import{useState as a,useEffect as o}from"react";import{Box as l,CircularProgress as s,Dialog as p,DialogTitle as c,Typography as d,IconButton as u,DialogContent as f}from"@mui/material";import m from"@mui/icons-material/Close";import{useLearningTemplateStore as h}from"../../LearningManagement/store/useLearningTemplateStore.js";var v=function(){var t=a(!0),i=t[0],o=t[1];return n(p,e({open:i,onClose:function(){return o(!1)},fullWidth:!0,maxWidth:"lg",PaperProps:{sx:{borderRadius:"16px",minHeight:"70vh",overflow:"hidden"}}},{children:[n(c,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",px:3,py:2}},{children:[r(d,e({variant:"h6",fontWeight:600},{children:"Teach Me"})),r(u,e({onClick:function(){return o(!1)}},{children:r(m,{})}))]})),r(f,e({dividers:!0,sx:{p:3,backgroundColor:"#fafafa"}},{children:"There is some issue with the selected template. Kindly check steps to resolve."}))]}))},g=function(n){var p=n.templateRegistry,c=void 0===p?{}:p,d=h(function(e){return e.backwardCompatibility}),u=h(function(e){return n.app_integration_id?e.templateMap[n.app_integration_id]:void 0}),f=h(function(e){return e.setTemplateData}),m=d?"Radio Traffic Learning":u,g=a(!m),_=g[0],y=g[1],b=a(!1),x=b[0],w=b[1];if(o(function(){var e,r;if(n.isOpen){if(!d&&!n.app_integration_id)return console.error("TeachMeWrapper requires an app_integration_id when backward compatibility is disabled."),w(!0),void y(!1);if(null===(r=null===(e=n.pluginPayload)||void 0===e?void 0:e.teachMe)||void 0===r?void 0:r.template)return f(n.app_integration_id,n.pluginPayload.teachMe.template),void y(!1);if(m)y(!1);else{t(void 0,void 0,void 0,function(){var e,r;return i(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,3,4]),y(!0),w(!1),[4,(o=n.app_integration_id,l=n.token,t(void 0,void 0,void 0,function(){var e,t;return i(this,function(i){switch(i.label){case 0:return[4,fetch("".concat(n.baseURL,"/instant_learning/ilotj/application/getValueType/").concat(o),{headers:{Authorization:"Bearer ".concat(l)}})];case 1:if(!(e=i.sent()).ok)throw new Error("Failed to fetch value type");return[4,e.json()];case 2:return t=i.sent(),console.log("Fetched value type data:",t),!t||Array.isArray(t.data)&&0===t.data.length?[2,null]:[2,t.data[0].value_type_name||t.valueTypeName||t.templateName]}})}))];case 1:return e=a.sent(),f(n.app_integration_id,e),[3,4];case 2:return r=a.sent(),console.error(r),w(!0),n.app_integration_id&&f(n.app_integration_id,"ERROR"),[3,4];case 3:return y(!1),[7];case 4:return[2]}var o,l})})}}},[n.isOpen,n.app_integration_id,m,n.token,f,d]),_)return r(l,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:r(s,{size:32})}));if(x||!m)return r(v,{});var k=c[m&&c[m]?m:"Default"];return k?r(k,e({},n)):(console.warn("No renderer found for template: ".concat(m)),r(v,{}))};export{g as default};
1
+ import{__assign as e,__awaiter as t,__generator as i}from"tslib";import{jsx as n,jsxs as r}from"react/jsx-runtime";import{useEffect as a,useState as o}from"react";import{Box as l,CircularProgress as d,Dialog as c,DialogTitle as p,Typography as s,IconButton as u,DialogContent as f}from"@mui/material";import m from"@mui/icons-material/Close";import{useLearningTemplateStore as v}from"../../LearningManagement/store/useLearningTemplateStore.js";var h=function(){var t=o(!0),i=t[0],a=t[1];return r(c,e({open:i,onClose:function(){return a(!1)},fullWidth:!0,maxWidth:"lg",PaperProps:{sx:{borderRadius:"16px",minHeight:"70vh",overflow:"hidden"}}},{children:[r(p,e({sx:{display:"flex",alignItems:"center",justifyContent:"space-between",borderBottom:"1px solid #e0e0e0",px:3,py:2}},{children:[n(s,e({variant:"h6",fontWeight:600},{children:"Teach Me"})),n(u,e({onClick:function(){return a(!1)}},{children:n(m,{})}))]})),n(f,e({dividers:!0,sx:{p:3,backgroundColor:"#fafafa"}},{children:"There is some issue with the selected template. Kindly check steps to resolve."}))]}))},g=function(r){var c=r.templateRegistry,p=void 0===c?{}:c,s=v(function(e){return e.backwardCompatibility}),u=v(function(e){return e.setBackwardCompatibility});a(function(){var e,t;u(null!==(t=null===(e=r.pluginPayload)||void 0===e?void 0:e.backwardCompatibility)&&void 0!==t&&t)},[]);var f=v(function(e){return r.app_integration_id?e.templateMap[r.app_integration_id]:void 0}),m=v(function(e){return e.setTemplateData}),g=s?"Radio Traffic Learning":f,y=o(!g),_=y[0],b=y[1],w=o(!1),x=w[0],k=w[1];if(a(function(){var e,n,a;if(r.isOpen){if(null===(e=r.pluginPayload)||void 0===e?void 0:e.backwardCompatibility)return m("","Radio Traffic Learning"),void b(!1);if(!s&&!r.app_integration_id)return console.error("TeachMeWrapper requires an app_integration_id when backward compatibility is disabled."),k(!0),void b(!1);if(null===(a=null===(n=r.pluginPayload)||void 0===n?void 0:n.teachMe)||void 0===a?void 0:a.template)return m(r.app_integration_id,r.pluginPayload.teachMe.template),void b(!1);if(g)b(!1);else{t(void 0,void 0,void 0,function(){var e,n;return i(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,3,4]),b(!0),k(!1),[4,(o=r.app_integration_id,l=r.token,t(void 0,void 0,void 0,function(){var e,t;return i(this,function(i){switch(i.label){case 0:return s?[2,"Radio Traffic Learning"]:[4,fetch("".concat(r.baseURL,"/instant_learning/ilotj/application/getValueType/").concat(o),{headers:{Authorization:"Bearer ".concat(l)}})];case 1:if(!(e=i.sent()).ok)throw new Error("Failed to fetch value type");return[4,e.json()];case 2:return t=i.sent(),console.log("Fetched value type data:",t),!t||Array.isArray(t.data)&&0===t.data.length?[2,null]:[2,t.data[0].value_type_name||t.valueTypeName||t.templateName]}})}))];case 1:return e=a.sent(),m(r.app_integration_id,e),[3,4];case 2:return n=a.sent(),console.error(n),k(!0),r.app_integration_id&&m(r.app_integration_id,"ERROR"),[3,4];case 3:return b(!1),[7];case 4:return[2]}var o,l})})}}},[r.isOpen,r.app_integration_id,g,r.token,m,s]),_)return n(l,e({sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"}},{children:n(d,{size:32})}));if(x||!g)return n(h,{});var C=p[g&&p[g]?g:"Default"];return C?n(C,e({},r)):(console.warn("No renderer found for template: ".concat(g)),n(h,{}))};export{g as default};
2
2
  //# sourceMappingURL=TeachMeWrapper.js.map