@e-llm-studio/requirement-ai 0.0.292 → 0.0.295

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
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../utils/proccess-stream.utils.js");exports.useStreamContentHandler=function({setUserStory:i,setAiReasoning:n,setUserStoryCitations:o,onStreamingCompleted:r,isGraphQLCallInProgress:s,knowledgeBase:a,projectAnalyserSummary:l,dataSourceFiles:u,aiReasoning:c,setRedisValue:d,fetchCitationByBlock:p,isOnDemandCitation:_}){const[m,f]=e.useState({finalGap:"",finalRisk:"",status:"in-progress"}),g=e.useRef(new Set),b=e.useRef(new Set),v=e.useRef(null),h=e.useRef(null),k=e.useRef({gap_items_prompt:"",risk_items_prompt:""}),y=e.useRef(new Set);return e.useEffect(()=>{"complete"!==m.status||s||(r(m.finalGap,m.finalRisk),g.current.clear(),b.current.clear(),v.current=null,h.current=null,k.current={gap_items_prompt:"",risk_items_prompt:""},y.current.clear(),f({finalGap:"",finalRisk:"",status:"in-progress"}))},[m,s]),{processStreamContent:function(e,s,m,R){try{const N=JSON.stringify(e);if(h.current===N)return;h.current=N;let S=[],B=[];e=e.map(e=>{var i;const r=`${(e={...e,subBlockNumber:null!==(i=e.subBlockNumber)&&void 0!==i?i:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(y.current.has(r))return null;y.current.add(r);let{outputText:a,reasonings:l,gpt_citation:u,processedDescription:c}=t.processAIReasoningFromBlocks(e.value,e.blockNumber,e.storyNumber,e.description);o(e=>{var t;return u.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(t=e.gpt_citations)||void 0===t||t.push(...u)),{...e}}),S.push(...l),B.push([...l]);const d=l.filter(e=>e.on_demand).flatMap(e=>[...e.reason.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g),...e.gap.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g)].map(e=>{const[t,i]=e[1].split("$");return"book_citation_doc"!==t&&"book_citation_pdf"!==t&&"document_citation"!==t?null:{citation_number:i,customMetadata:{type:"document_citation"===t?"book_citation_pdf":t,file_name:"",fileType:"",gcs_upload_url:""}}}).filter(Boolean));d.length&&o(e=>{var t;return{...e,file_citations:[...null!==(t=e.file_citations)&&void 0!==t?t:[],...d]}});let m=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return _||g.current.has(m)||(!async function(e,t,i){var r,s;let a="",l="";try{const u=await p(e,i,t);n(e=>{var t;const i=[...e];return null===(t=u.response.ai_reasonings)||void 0===t||t.forEach(e=>{const t=i.findIndex(t=>t.id===e.id);-1!==t&&e.gap.length>0&&e.reason.length>0&&(i[t]={...e})}),i}),a=(null===(r=u.response)||void 0===r?void 0:r.gap_items_prompt)||"",l=(null===(s=u.response)||void 0===s?void 0:s.risk_items_prompt)||"",(a||l)&&(k.current={gap_items_prompt:a,risk_items_prompt:l}),o(e=>{var t,i,n,o,r,s,a,l,c,d,p,_,m,f;return{...e,appmod_citations:[...null!==(t=e.appmod_citations)&&void 0!==t?t:[],...null!==(i=u.response.appmod_citations)&&void 0!==i?i:[]],audio_citations:[...null!==(n=e.audio_citations)&&void 0!==n?n:[],...null!==(o=u.response.audio_citations)&&void 0!==o?o:[]],file_citations:[...null!==(r=e.file_citations)&&void 0!==r?r:[],...null!==(s=u.response.file_citations)&&void 0!==s?s:[]],image_citations:[...null!==(a=e.image_citations)&&void 0!==a?a:[],...null!==(l=u.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=u.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=u.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(f=u.response.readfile_citations)&&void 0!==f?f:[]]}})}catch(t){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,t)}finally{let t=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(b.current.add(t),b.current.size===g.current.size){const e=a||k.current.gap_items_prompt,t=l||k.current.risk_items_prompt;f({finalGap:e,finalRisk:t,status:"complete"})}}}({...e,value:a,description:c},l,s),g.current.add(m)),{...e,value:a,description:c}}).filter(Boolean),S.forEach(e=>{n(t=>(t.find(t=>t.id===e.id)||t.push(e),[...t]))}),e.length>0&&e.map(({title:e,section:t,value:n,storyNumber:o,description:r,blockNumber:s,big_enough:p,big_enough_decision_factors:_,gapValue:f,confidenceScore:g,metadata:b},h)=>{i(i=>{var k,y,R,N,S,$,C,O;const w=i.findIndex(e=>e.storyNumber===o);if("intro"===t)-1===w?i.push({artifactId:`STORY-${o}-${s}`,title:e,value:n,description:r,storyNumber:o,sub_features:[],section:t,blockNumber:s,aiReasoning:B[h],big_enough:p,big_enough_decision_factors:_,gapValue:f,confidenceScore:g,metadata:b}):(i[w].value+=n,i[w].aiReasoning=i[w].aiReasoning||[],null===(y=null===(k=i[w])||void 0===k?void 0:k.aiReasoning)||void 0===y||y.push(...B[h]),i[w].big_enough=p,i[w].big_enough_decision_factors=_,i[w].gapValue=f,i[w].confidenceScore=g,i[w].metadata=b);else{i[w].sub_features||(i[w].sub_features=[]);const r=(null===(N=null===(R=i[w])||void 0===R?void 0:R.sub_features)||void 0===N?void 0:N.findIndex(e=>e.blockNumber===s))||-1;if(-1===r)null===($=null===(S=i[w])||void 0===S?void 0:S.sub_features)||void 0===$||$.push({artifactId:`STORY-${o}-${s}`,title:e,value:n,storyNumber:o,blockNumber:s,section:t,aiReasoning:B[h],big_enough:p,big_enough_decision_factors:_,gapValue:f,confidenceScore:g,metadata:b});else{let e=null===(O=null===(C=null==i?void 0:i[w])||void 0===C?void 0:C.sub_features)||void 0===O?void 0:O[r];e.value=(e.value||"")+n,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...B[h]),e.big_enough=p,e.big_enough_decision_factors=_,e.gapValue=f,e.confidenceScore=g,e.metadata=b}}const E=JSON.stringify(i);return v.current!==E&&(d({key:`streaming-redis-key-${m}`,value:{mmvf_list:i,knowledgeBase:a,projectAnalyserSummary:l,dataSources_files:u,ai_reasonings:c}}),v.current=E),[...i]})}),R&&_&&r()}catch(e){console.error("Error in processing Stream Content",e)}}}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../utils/proccess-stream.utils.js");exports.useStreamContentHandler=function({setUserStory:i,setAiReasoning:o,setUserStoryCitations:n,onStreamingCompleted:s,isGraphQLCallInProgress:r,knowledgeBase:a,projectAnalyserSummary:l,dataSourceFiles:u,aiReasoning:c,setRedisValue:d,fetchCitationByBlock:p,isOnDemandCitation:_}){const[m,g]=e.useState({finalGap:"",finalRisk:"",status:"in-progress"}),f=e.useRef(new Set),b=e.useRef(new Set),v=e.useRef(null),h=e.useRef(null),k=e.useRef({gap_items_prompt:"",risk_items_prompt:""}),y=e.useRef(new Set);return e.useEffect(()=>{"complete"!==m.status||r||(console.log("streaming::userstory::onStreamingCompleted"),s(m.finalGap,m.finalRisk),f.current.clear(),b.current.clear(),v.current=null,h.current=null,k.current={gap_items_prompt:"",risk_items_prompt:""},y.current.clear(),g({finalGap:"",finalRisk:"",status:"in-progress"}))},[m,r]),console.log("testing::isGraphQLCallInProgress",m,r),{processStreamContent:function(e,s,r,m){try{const R=JSON.stringify(e);if(h.current===R)return;h.current=R;let N=[],S=[];e=e.map(e=>{var i;const r=`${(e={...e,subBlockNumber:null!==(i=e.subBlockNumber)&&void 0!==i?i:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(y.current.has(r))return null;y.current.add(r);let{outputText:a,reasonings:l,gpt_citation:u,processedDescription:c}=t.processAIReasoningFromBlocks(e.value,e.blockNumber,e.storyNumber,e.description);n(e=>{var t;return u.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(t=e.gpt_citations)||void 0===t||t.push(...u)),{...e}}),N.push(...l),S.push([...l]);const d=l.filter(e=>e.on_demand).flatMap(e=>[...e.reason.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g),...e.gap.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g)].map(e=>{const[t,i]=e[1].split("$");return"book_citation_doc"!==t&&"book_citation_pdf"!==t&&"document_citation"!==t?null:{citation_number:i,customMetadata:{type:"document_citation"===t?"book_citation_pdf":t,file_name:"",fileType:"",gcs_upload_url:""}}}).filter(Boolean));d.length&&n(e=>{var t;return{...e,file_citations:[...null!==(t=e.file_citations)&&void 0!==t?t:[],...d]}});let m=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return _||f.current.has(m)||(!async function(e,t,i){var s,r;let a="",l="";try{const u=await p(e,i,t);o(e=>{var t;const i=[...e];return null===(t=u.response.ai_reasonings)||void 0===t||t.forEach(e=>{const t=i.findIndex(t=>t.id===e.id);-1!==t&&e.gap.length>0&&e.reason.length>0&&(i[t]={...e})}),i}),a=(null===(s=u.response)||void 0===s?void 0:s.gap_items_prompt)||"",l=(null===(r=u.response)||void 0===r?void 0:r.risk_items_prompt)||"",(a||l)&&(k.current={gap_items_prompt:a,risk_items_prompt:l}),n(e=>{var t,i,o,n,s,r,a,l,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(t=e.appmod_citations)&&void 0!==t?t:[],...null!==(i=u.response.appmod_citations)&&void 0!==i?i:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=u.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(s=e.file_citations)&&void 0!==s?s:[],...null!==(r=u.response.file_citations)&&void 0!==r?r:[]],image_citations:[...null!==(a=e.image_citations)&&void 0!==a?a:[],...null!==(l=u.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=u.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=u.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=u.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(t){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,t)}finally{let t=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(b.current.add(t),b.current.size===f.current.size){const e=a||k.current.gap_items_prompt,t=l||k.current.risk_items_prompt;g({finalGap:e,finalRisk:t,status:"complete"})}}}({...e,value:a,description:c},l,s),f.current.add(m)),{...e,value:a,description:c}}).filter(Boolean),N.forEach(e=>{o(t=>(t.find(t=>t.id===e.id)||t.push(e),[...t]))}),e.length>0&&e.map(({title:e,section:t,value:o,storyNumber:n,description:s,blockNumber:p,big_enough:_,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b},h)=>{i(i=>{var k,y,R,N,B,C,$,O;const w=i.findIndex(e=>e.storyNumber===n);if("intro"===t)-1===w?i.push({artifactId:`STORY-${n}-${p}`,title:e,value:o,description:s,storyNumber:n,sub_features:[],section:t,blockNumber:p,aiReasoning:S[h],big_enough:_,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b}):(i[w].value+=o,i[w].aiReasoning=i[w].aiReasoning||[],null===(y=null===(k=i[w])||void 0===k?void 0:k.aiReasoning)||void 0===y||y.push(...S[h]),i[w].big_enough=_,i[w].big_enough_decision_factors=m,i[w].gapValue=g,i[w].confidenceScore=f,i[w].metadata=b);else{i[w].sub_features||(i[w].sub_features=[]);const s=(null===(N=null===(R=i[w])||void 0===R?void 0:R.sub_features)||void 0===N?void 0:N.findIndex(e=>e.blockNumber===p))||-1;if(-1===s)null===(C=null===(B=i[w])||void 0===B?void 0:B.sub_features)||void 0===C||C.push({artifactId:`STORY-${n}-${p}`,title:e,value:o,storyNumber:n,blockNumber:p,section:t,aiReasoning:S[h],big_enough:_,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b});else{let e=null===(O=null===($=null==i?void 0:i[w])||void 0===$?void 0:$.sub_features)||void 0===O?void 0:O[s];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...S[h]),e.big_enough=_,e.big_enough_decision_factors=m,e.gapValue=g,e.confidenceScore=f,e.metadata=b}}const E=JSON.stringify(i);return v.current!==E&&(d({key:`streaming-redis-key-${r}`,value:{mmvf_list:i,knowledgeBase:a,projectAnalyserSummary:l,dataSources_files:u,ai_reasonings:c}}),v.current=E),[...i]})}),m&&_&&(console.log("streaming::userstory::completed::lib"),g({finalGap:"",finalRisk:"",status:"complete"}))}catch(e){console.error("Error in processing Stream Content",e)}}}};
2
2
  //# sourceMappingURL=useStreamContentHandler.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),i=require("react"),o=require("../components/citations/web-citation/WebCitationWithImageRenderer.js"),e=require("../components/citations/web-citation/WebCitationRenderer.js"),n=require("../components/citations/stormee-citation/StormeeCitationRenderer.js"),a=require("../components/citations/audio-citation/WaveformCitationRenderer.js"),l=require("../components/citations/image-citation/ImageCitationRenderer.js"),c=require("../components/citations/file-citation/FileCitationRender.js"),s=require("../components/citations/appmod-citation/AppmodCitationRenderer.js"),d=require("../components/citations/rca-citation/RCACitationRenderer.js"),u=require("../components/citations/readfile-citation/ReadFileCitationRenderer.js"),r=require("../components/citations/audio-citation/components/AudioCitationIcon.js"),m=require("../components/RequirementAIWrapper/RequirementAIWrapper.js"),p=require("./ReqAiCitationRenderer.module.css.js");exports.default=({href:v,panelRef:_,children:f,customStyles:j,citationStyles:C,customIcons:g,aiReason:x,source:b})=>{var h,y,S,q,R,F,I,M,k,w,O,$,D,A,W,L;const{citationConfig:N,citations:E,onFetchOnDemandCitation:J}=m.useRequirementAI();let P="";try{P=JSON.parse(`"${v}"`)}catch(t){console.warn("error in parsing reasoning a tag",t),P=v}const[U,z=""]=P.split("$"),[B,G=""]=z.split("?"),H=async(t,i,o,e)=>{if(J)try{await J(t,i,o,e||"","explanation")}catch(i){console.error(`[On-Demand Fetch Error] Failed to load citation ${t}:`,i)}},K=("appmode_citation"===U||"appmode_citations"===U?(null==E?void 0:E.appmod_citations)||[]:"image_citation"===U||"image_citations"===U?(null==E?void 0:E.image_citations)||[]:"audio_citation"===U||"audio_citations"===U?(null==E?void 0:E.audio_citations)||[]:"document_citation"===U||"document_citations"===U?(null==E?void 0:E.file_citations)||[]:"rca_citation"===U||"rca_citations"===U?(null==E?void 0:E.rca_citations)||[]:"web_citation"===U||"web_citations"===U?(null==E?void 0:E.web_citations)||[]:"code_generated"===U?(null==E?void 0:E.code_generated)||[]:"readfile_citation"===U||"readfile_citations"===U?(null==E?void 0:E.readfile_citations)||[]:("gpt_citation"===U||"gpt_citations"===U)&&(null==E?void 0:E.gpt_citations)||[]).find(t=>t.citation_number===decodeURIComponent(B));return"web_citation"===(null===(h=null==K?void 0:K.customMetadata)||void 0===h?void 0:h.type)||U.includes("web_citation")?(null===(y=null==K?void 0:K.customMetadata)||void 0===y?void 0:y.screenshot_url)?t.jsx(o.default,{title:f,citation:K,customStyles:null==C?void 0:C.webCitation,customIcons:g}):t.jsx(e.default,{label:f,url:null===(S=K.customMetadata)||void 0===S?void 0:S.link,customStyles:null==C?void 0:C.webCitation,customIcons:g,fetchOnDemandCitation:()=>{H(B,x,U,b)}}):"audio_transcript"===(null===(q=null==K?void 0:K.customMetadata)||void 0===q?void 0:q.type)||U.includes("audio_citation")?"stormee"===(null===(R=null==K?void 0:K.customMetadata)||void 0===R?void 0:R.audio_citation_mode)?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(n.default,{title:`${f}`,citation:K,customStyles:null==C?void 0:C.stormeeCitation,customIcons:g})}):t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(a.default,{title:`${f}`,citation:K||{citation_number:B},customStyles:null==C?void 0:C.waveformCitation,customIcons:g,fetchOnDemandCitation:()=>{H(B,x,U)}})}):"image_citation"===(null===(F=null==K?void 0:K.customMetadata)||void 0===F?void 0:F.type)||U.includes("image_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(l.default,{title:`${f}`,citation:K||{citation_number:B,isLoading:!0},customIcons:g,customStyles:null==C?void 0:C.imageCitation,fetchOnDemandCitation:()=>{H(B,x,U,b)}})}):"book_citation_doc"===(null===(I=null==K?void 0:K.customMetadata)||void 0===I?void 0:I.type)||"book_citation_pdf"===(null===(M=null==K?void 0:K.customMetadata)||void 0===M?void 0:M.type)||U.includes("document_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(c.default,{title:`${f}`,citation:K||{citation_number:B,customMetadata:{type:"book_citation_pdf"}},customIcons:g,customStyles:null==C?void 0:C.fileCitation,fetchOnDemandCitation:()=>{H(B,x,U,b)}})}):"app_mod_rag_question"===(null===(k=null==K?void 0:K.customMetadata)||void 0===k?void 0:k.type)||U.includes("appmode_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(s.default,{title:`${f}`,citation:K,customIcons:g,customStyles:null==C?void 0:C.appModCitation,codeLinkConfig:null===(w=null==N?void 0:N.appMod)||void 0===w?void 0:w.codeLinkConfig,isLoading:null===(O=null==N?void 0:N.appMod)||void 0===O?void 0:O.isLoading,fetchOnDemandCitation:()=>{H(B,x,U,b)}})}):"rca_citation"===(null===($=null==K?void 0:K.customMetadata)||void 0===$?void 0:$.type)?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(d.default,{title:`${f}`,citation:K,customIcons:g,customStyles:null==C?void 0:C.rcaCitation})}):"readfile_citation"===(null===(D=null==K?void 0:K.customMetadata)||void 0===D?void 0:D.type)||U.includes("readfile_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(u.default,{title:`${f}`,citation:K||{citation_number:B},customIcons:g,customStyles:null==C?void 0:C.readFileCitation,fileCallback:null===(A=null==N?void 0:N.readFile)||void 0===A?void 0:A.fileCallback,editorConfig:null===(W=null==N?void 0:N.readFile)||void 0===W?void 0:W.editorConfig,customColors:null===(L=null==N?void 0:N.readFile)||void 0===L?void 0:L.customColors,fetchOnDemandCitation:()=>{H(B,x,U)}})}):t.jsxs("span",{className:p.default.container,children:[t.jsx("span",{className:p.default.text,children:f}),t.jsxs("span",{children:[" ","audio_citations"===U?t.jsx(r.default,{}):t.jsx(t.Fragment,{})]})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),i=require("react"),o=require("../components/citations/web-citation/WebCitationWithImageRenderer.js"),e=require("../components/citations/web-citation/WebCitationRenderer.js"),n=require("../components/citations/stormee-citation/StormeeCitationRenderer.js"),a=require("../components/citations/audio-citation/WaveformCitationRenderer.js"),l=require("../components/citations/image-citation/ImageCitationRenderer.js"),c=require("../components/citations/file-citation/FileCitationRender.js"),s=require("../components/citations/appmod-citation/AppmodCitationRenderer.js"),d=require("../components/citations/rca-citation/RCACitationRenderer.js"),u=require("../components/citations/readfile-citation/ReadFileCitationRenderer.js"),r=require("../components/citations/audio-citation/components/AudioCitationIcon.js"),m=require("../components/RequirementAIWrapper/RequirementAIWrapper.js"),p=require("./ReqAiCitationRenderer.module.css.js");exports.default=({href:v,panelRef:_,children:f,customStyles:j,citationStyles:C,customIcons:g,aiReason:x,source:b})=>{var h,y,S,q,R,F,I,M,k,w,O,$,D,A,W,L;const{citationConfig:N,citations:E,onFetchOnDemandCitation:J}=m.useRequirementAI();let P="";try{P=JSON.parse(`"${v}"`)}catch(t){console.warn("error in parsing reasoning a tag",t),P=v}const[U,z=""]=P.split("$"),[B,G=""]=z.split("?"),H=async(t,i,o,e)=>{if(J)try{await J(t,i,o,e||"","explanation")}catch(i){console.error(`[On-Demand Fetch Error] Failed to load citation ${t}:`,i)}},K=("appmode_citation"===U||"appmode_citations"===U?(null==E?void 0:E.appmod_citations)||[]:"image_citation"===U||"image_citations"===U?(null==E?void 0:E.image_citations)||[]:"audio_citation"===U||"audio_citations"===U?(null==E?void 0:E.audio_citations)||[]:"document_citation"===U||"document_citations"===U?(null==E?void 0:E.file_citations)||[]:"rca_citation"===U||"rca_citations"===U?(null==E?void 0:E.rca_citations)||[]:"web_citation"===U||"web_citations"===U?(null==E?void 0:E.web_citations)||[]:"code_generated"===U?(null==E?void 0:E.code_generated)||[]:"readfile_citation"===U||"readfile_citations"===U?(null==E?void 0:E.readfile_citations)||[]:("gpt_citation"===U||"gpt_citations"===U)&&(null==E?void 0:E.gpt_citations)||[]).find(t=>t.citation_number===decodeURIComponent(B));return"web_citation"===(null===(h=null==K?void 0:K.customMetadata)||void 0===h?void 0:h.type)||U.includes("web_citation")?(null===(y=null==K?void 0:K.customMetadata)||void 0===y?void 0:y.screenshot_url)?t.jsx(o.default,{title:f,citation:K,customStyles:null==C?void 0:C.webCitation,customIcons:g}):t.jsx(e.default,{label:f,url:null===(S=null==K?void 0:K.customMetadata)||void 0===S?void 0:S.link,customStyles:null==C?void 0:C.webCitation,customIcons:g,fetchOnDemandCitation:()=>{H(B,x,U,b)}}):"audio_transcript"===(null===(q=null==K?void 0:K.customMetadata)||void 0===q?void 0:q.type)||U.includes("audio_citation")?"stormee"===(null===(R=null==K?void 0:K.customMetadata)||void 0===R?void 0:R.audio_citation_mode)?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(n.default,{title:`${f}`,citation:K,customStyles:null==C?void 0:C.stormeeCitation,customIcons:g})}):t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(a.default,{title:`${f}`,citation:K||{citation_number:B},customStyles:null==C?void 0:C.waveformCitation,customIcons:g,fetchOnDemandCitation:()=>{H(B,x,U)}})}):"image_citation"===(null===(F=null==K?void 0:K.customMetadata)||void 0===F?void 0:F.type)||U.includes("image_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(l.default,{title:`${f}`,citation:K||{citation_number:B,isLoading:!0},customIcons:g,customStyles:null==C?void 0:C.imageCitation,fetchOnDemandCitation:()=>{H(B,x,U,b)}})}):"book_citation_doc"===(null===(I=null==K?void 0:K.customMetadata)||void 0===I?void 0:I.type)||"book_citation_pdf"===(null===(M=null==K?void 0:K.customMetadata)||void 0===M?void 0:M.type)||U.includes("document_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(c.default,{title:`${f}`,citation:K||{citation_number:B,customMetadata:{type:"book_citation_pdf"}},customIcons:g,customStyles:null==C?void 0:C.fileCitation,fetchOnDemandCitation:()=>{H(B,x,U,b)}})}):"app_mod_rag_question"===(null===(k=null==K?void 0:K.customMetadata)||void 0===k?void 0:k.type)||U.includes("appmode_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(s.default,{title:`${f}`,citation:K,customIcons:g,customStyles:null==C?void 0:C.appModCitation,codeLinkConfig:null===(w=null==N?void 0:N.appMod)||void 0===w?void 0:w.codeLinkConfig,isLoading:null===(O=null==N?void 0:N.appMod)||void 0===O?void 0:O.isLoading,fetchOnDemandCitation:()=>{H(B,x,U,b)}})}):"rca_citation"===(null===($=null==K?void 0:K.customMetadata)||void 0===$?void 0:$.type)?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(d.default,{title:`${f}`,citation:K,customIcons:g,customStyles:null==C?void 0:C.rcaCitation})}):"readfile_citation"===(null===(D=null==K?void 0:K.customMetadata)||void 0===D?void 0:D.type)||U.includes("readfile_citation")?t.jsx(i.Suspense,{fallback:t.jsx(t.Fragment,{}),children:t.jsx(u.default,{title:`${f}`,citation:K||{citation_number:B},customIcons:g,customStyles:null==C?void 0:C.readFileCitation,fileCallback:null===(A=null==N?void 0:N.readFile)||void 0===A?void 0:A.fileCallback,editorConfig:null===(W=null==N?void 0:N.readFile)||void 0===W?void 0:W.editorConfig,customColors:null===(L=null==N?void 0:N.readFile)||void 0===L?void 0:L.customColors,fetchOnDemandCitation:()=>{H(B,x,U)}})}):t.jsxs("span",{className:p.default.container,children:[t.jsx("span",{className:p.default.text,children:f}),t.jsxs("span",{children:[" ","audio_citations"===U?t.jsx(r.default,{}):t.jsx(t.Fragment,{})]})]})};
2
2
  //# sourceMappingURL=ReqAiCitationRenderer.js.map
@@ -1,2 +1,2 @@
1
- import{useState as e,useRef as i,useEffect as t}from"react";import{processAIReasoningFromBlocks as o}from"../utils/proccess-stream.utils.js";function n({setUserStory:n,setAiReasoning:r,setUserStoryCitations:s,onStreamingCompleted:a,isGraphQLCallInProgress:l,knowledgeBase:u,projectAnalyserSummary:c,dataSourceFiles:d,aiReasoning:p,setRedisValue:_,fetchCitationByBlock:m,isOnDemandCitation:g}){const[f,b]=e({finalGap:"",finalRisk:"",status:"in-progress"}),v=i(new Set),h=i(new Set),k=i(null),y=i(null),N=i({gap_items_prompt:"",risk_items_prompt:""}),S=i(new Set);return t(()=>{"complete"!==f.status||l||(a(f.finalGap,f.finalRisk),v.current.clear(),h.current.clear(),k.current=null,y.current=null,N.current={gap_items_prompt:"",risk_items_prompt:""},S.current.clear(),b({finalGap:"",finalRisk:"",status:"in-progress"}))},[f,l]),{processStreamContent:function(e,i,t,l){try{const f=JSON.stringify(e);if(y.current===f)return;y.current=f;let R=[],B=[];e=e.map(e=>{var t;const n=`${(e={...e,subBlockNumber:null!==(t=e.subBlockNumber)&&void 0!==t?t:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(S.current.has(n))return null;S.current.add(n);let{outputText:a,reasonings:l,gpt_citation:u,processedDescription:c}=o(e.value,e.blockNumber,e.storyNumber,e.description);s(e=>{var i;return u.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...u)),{...e}}),R.push(...l),B.push([...l]);const d=l.filter(e=>e.on_demand).flatMap(e=>[...e.reason.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g),...e.gap.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g)].map(e=>{const[i,t]=e[1].split("$");return"book_citation_doc"!==i&&"book_citation_pdf"!==i&&"document_citation"!==i?null:{citation_number:t,customMetadata:{type:"document_citation"===i?"book_citation_pdf":i,file_name:"",fileType:"",gcs_upload_url:""}}}).filter(Boolean));d.length&&s(e=>{var i;return{...e,file_citations:[...null!==(i=e.file_citations)&&void 0!==i?i:[],...d]}});let p=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return g||v.current.has(p)||(!async function(e,i,t){var o,n;let a="",l="";try{const u=await m(e,t,i);r(e=>{var i;const t=[...e];return null===(i=u.response.ai_reasonings)||void 0===i||i.forEach(e=>{const i=t.findIndex(i=>i.id===e.id);-1!==i&&e.gap.length>0&&e.reason.length>0&&(t[i]={...e})}),t}),a=(null===(o=u.response)||void 0===o?void 0:o.gap_items_prompt)||"",l=(null===(n=u.response)||void 0===n?void 0:n.risk_items_prompt)||"",(a||l)&&(N.current={gap_items_prompt:a,risk_items_prompt:l}),s(e=>{var i,t,o,n,r,s,a,l,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(i=e.appmod_citations)&&void 0!==i?i:[],...null!==(t=u.response.appmod_citations)&&void 0!==t?t:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=u.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(r=e.file_citations)&&void 0!==r?r:[],...null!==(s=u.response.file_citations)&&void 0!==s?s:[]],image_citations:[...null!==(a=e.image_citations)&&void 0!==a?a:[],...null!==(l=u.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=u.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=u.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=u.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(i){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,i)}finally{let i=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(h.current.add(i),h.current.size===v.current.size){const e=a||N.current.gap_items_prompt,i=l||N.current.risk_items_prompt;b({finalGap:e,finalRisk:i,status:"complete"})}}}({...e,value:a,description:c},l,i),v.current.add(p)),{...e,value:a,description:c}}).filter(Boolean),R.forEach(e=>{r(i=>(i.find(i=>i.id===e.id)||i.push(e),[...i]))}),e.length>0&&e.map(({title:e,section:i,value:o,storyNumber:r,description:s,blockNumber:a,big_enough:l,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b},v)=>{n(n=>{var h,y,N,S,R,$,C,O;const w=n.findIndex(e=>e.storyNumber===r);if("intro"===i)-1===w?n.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,description:s,storyNumber:r,sub_features:[],section:i,blockNumber:a,aiReasoning:B[v],big_enough:l,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b}):(n[w].value+=o,n[w].aiReasoning=n[w].aiReasoning||[],null===(y=null===(h=n[w])||void 0===h?void 0:h.aiReasoning)||void 0===y||y.push(...B[v]),n[w].big_enough=l,n[w].big_enough_decision_factors=m,n[w].gapValue=g,n[w].confidenceScore=f,n[w].metadata=b);else{n[w].sub_features||(n[w].sub_features=[]);const t=(null===(S=null===(N=n[w])||void 0===N?void 0:N.sub_features)||void 0===S?void 0:S.findIndex(e=>e.blockNumber===a))||-1;if(-1===t)null===($=null===(R=n[w])||void 0===R?void 0:R.sub_features)||void 0===$||$.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,storyNumber:r,blockNumber:a,section:i,aiReasoning:B[v],big_enough:l,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b});else{let e=null===(O=null===(C=null==n?void 0:n[w])||void 0===C?void 0:C.sub_features)||void 0===O?void 0:O[t];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...B[v]),e.big_enough=l,e.big_enough_decision_factors=m,e.gapValue=g,e.confidenceScore=f,e.metadata=b}}const E=JSON.stringify(n);return k.current!==E&&(_({key:`streaming-redis-key-${t}`,value:{mmvf_list:n,knowledgeBase:u,projectAnalyserSummary:c,dataSources_files:d,ai_reasonings:p}}),k.current=E),[...n]})}),l&&g&&a()}catch(e){console.error("Error in processing Stream Content",e)}}}}export{n as useStreamContentHandler};
1
+ import{useState as e,useRef as t,useEffect as i}from"react";import{processAIReasoningFromBlocks as o}from"../utils/proccess-stream.utils.js";function n({setUserStory:n,setAiReasoning:r,setUserStoryCitations:s,onStreamingCompleted:a,isGraphQLCallInProgress:l,knowledgeBase:u,projectAnalyserSummary:c,dataSourceFiles:d,aiReasoning:p,setRedisValue:_,fetchCitationByBlock:m,isOnDemandCitation:g}){const[f,b]=e({finalGap:"",finalRisk:"",status:"in-progress"}),v=t(new Set),h=t(new Set),k=t(null),y=t(null),N=t({gap_items_prompt:"",risk_items_prompt:""}),S=t(new Set);return i(()=>{"complete"!==f.status||l||(console.log("streaming::userstory::onStreamingCompleted"),a(f.finalGap,f.finalRisk),v.current.clear(),h.current.clear(),k.current=null,y.current=null,N.current={gap_items_prompt:"",risk_items_prompt:""},S.current.clear(),b({finalGap:"",finalRisk:"",status:"in-progress"}))},[f,l]),console.log("testing::isGraphQLCallInProgress",f,l),{processStreamContent:function(e,t,i,a){try{const l=JSON.stringify(e);if(y.current===l)return;y.current=l;let f=[],R=[];e=e.map(e=>{var i;const n=`${(e={...e,subBlockNumber:null!==(i=e.subBlockNumber)&&void 0!==i?i:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(S.current.has(n))return null;S.current.add(n);let{outputText:a,reasonings:l,gpt_citation:u,processedDescription:c}=o(e.value,e.blockNumber,e.storyNumber,e.description);s(e=>{var t;return u.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(t=e.gpt_citations)||void 0===t||t.push(...u)),{...e}}),f.push(...l),R.push([...l]);const d=l.filter(e=>e.on_demand).flatMap(e=>[...e.reason.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g),...e.gap.matchAll(/<a[^>]*href="([^"]+)\?type=on_demand"/g)].map(e=>{const[t,i]=e[1].split("$");return"book_citation_doc"!==t&&"book_citation_pdf"!==t&&"document_citation"!==t?null:{citation_number:i,customMetadata:{type:"document_citation"===t?"book_citation_pdf":t,file_name:"",fileType:"",gcs_upload_url:""}}}).filter(Boolean));d.length&&s(e=>{var t;return{...e,file_citations:[...null!==(t=e.file_citations)&&void 0!==t?t:[],...d]}});let p=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return g||v.current.has(p)||(!async function(e,t,i){var o,n;let a="",l="";try{const u=await m(e,i,t);r(e=>{var t;const i=[...e];return null===(t=u.response.ai_reasonings)||void 0===t||t.forEach(e=>{const t=i.findIndex(t=>t.id===e.id);-1!==t&&e.gap.length>0&&e.reason.length>0&&(i[t]={...e})}),i}),a=(null===(o=u.response)||void 0===o?void 0:o.gap_items_prompt)||"",l=(null===(n=u.response)||void 0===n?void 0:n.risk_items_prompt)||"",(a||l)&&(N.current={gap_items_prompt:a,risk_items_prompt:l}),s(e=>{var t,i,o,n,r,s,a,l,c,d,p,_,m,g;return{...e,appmod_citations:[...null!==(t=e.appmod_citations)&&void 0!==t?t:[],...null!==(i=u.response.appmod_citations)&&void 0!==i?i:[]],audio_citations:[...null!==(o=e.audio_citations)&&void 0!==o?o:[],...null!==(n=u.response.audio_citations)&&void 0!==n?n:[]],file_citations:[...null!==(r=e.file_citations)&&void 0!==r?r:[],...null!==(s=u.response.file_citations)&&void 0!==s?s:[]],image_citations:[...null!==(a=e.image_citations)&&void 0!==a?a:[],...null!==(l=u.response.image_citations)&&void 0!==l?l:[]],rca_citations:[...null!==(c=e.rca_citations)&&void 0!==c?c:[],...null!==(d=u.response.rca_citations)&&void 0!==d?d:[]],web_citations:[...null!==(p=e.web_citations)&&void 0!==p?p:[],...null!==(_=u.response.web_citations)&&void 0!==_?_:[]],readfile_citations:[...null!==(m=e.readfile_citations)&&void 0!==m?m:[],...null!==(g=u.response.readfile_citations)&&void 0!==g?g:[]]}})}catch(t){console.error("[liblogs] processCitationsByBlock error — story:%s block:%s",e.storyNumber,e.blockNumber,t)}finally{let t=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}`;if(h.current.add(t),h.current.size===v.current.size){const e=a||N.current.gap_items_prompt,t=l||N.current.risk_items_prompt;b({finalGap:e,finalRisk:t,status:"complete"})}}}({...e,value:a,description:c},l,t),v.current.add(p)),{...e,value:a,description:c}}).filter(Boolean),f.forEach(e=>{r(t=>(t.find(t=>t.id===e.id)||t.push(e),[...t]))}),e.length>0&&e.map(({title:e,section:t,value:o,storyNumber:r,description:s,blockNumber:a,big_enough:l,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b},v)=>{n(n=>{var h,y,N,S,B,$,C,O;const w=n.findIndex(e=>e.storyNumber===r);if("intro"===t)-1===w?n.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,description:s,storyNumber:r,sub_features:[],section:t,blockNumber:a,aiReasoning:R[v],big_enough:l,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b}):(n[w].value+=o,n[w].aiReasoning=n[w].aiReasoning||[],null===(y=null===(h=n[w])||void 0===h?void 0:h.aiReasoning)||void 0===y||y.push(...R[v]),n[w].big_enough=l,n[w].big_enough_decision_factors=m,n[w].gapValue=g,n[w].confidenceScore=f,n[w].metadata=b);else{n[w].sub_features||(n[w].sub_features=[]);const i=(null===(S=null===(N=n[w])||void 0===N?void 0:N.sub_features)||void 0===S?void 0:S.findIndex(e=>e.blockNumber===a))||-1;if(-1===i)null===($=null===(B=n[w])||void 0===B?void 0:B.sub_features)||void 0===$||$.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,storyNumber:r,blockNumber:a,section:t,aiReasoning:R[v],big_enough:l,big_enough_decision_factors:m,gapValue:g,confidenceScore:f,metadata:b});else{let e=null===(O=null===(C=null==n?void 0:n[w])||void 0===C?void 0:C.sub_features)||void 0===O?void 0:O[i];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...R[v]),e.big_enough=l,e.big_enough_decision_factors=m,e.gapValue=g,e.confidenceScore=f,e.metadata=b}}const E=JSON.stringify(n);return k.current!==E&&(_({key:`streaming-redis-key-${i}`,value:{mmvf_list:n,knowledgeBase:u,projectAnalyserSummary:c,dataSources_files:d,ai_reasonings:p}}),k.current=E),[...n]})}),a&&g&&(console.log("streaming::userstory::completed::lib"),b({finalGap:"",finalRisk:"",status:"complete"}))}catch(e){console.error("Error in processing Stream Content",e)}}}}export{n as useStreamContentHandler};
2
2
  //# sourceMappingURL=useStreamContentHandler.js.map
@@ -1,2 +1,2 @@
1
- import{jsx as i,Fragment as t,jsxs as o}from"react/jsx-runtime";import{Suspense as n}from"react";import a from"../components/citations/web-citation/WebCitationWithImageRenderer.js";import e from"../components/citations/web-citation/WebCitationRenderer.js";import c from"../components/citations/stormee-citation/StormeeCitationRenderer.js";import l from"../components/citations/audio-citation/WaveformCitationRenderer.js";import d from"../components/citations/image-citation/ImageCitationRenderer.js";import s from"../components/citations/file-citation/FileCitationRender.js";import r from"../components/citations/appmod-citation/AppmodCitationRenderer.js";import m from"../components/citations/rca-citation/RCACitationRenderer.js";import u from"../components/citations/readfile-citation/ReadFileCitationRenderer.js";import p from"../components/citations/audio-citation/components/AudioCitationIcon.js";import{useRequirementAI as v}from"../components/RequirementAIWrapper/RequirementAIWrapper.js";import _ from"./ReqAiCitationRenderer.module.css.js";const f=({href:f,panelRef:C,children:b,customStyles:g,citationStyles:h,customIcons:y,aiReason:R,source:I})=>{var k,M,j,S,w,$,F,O,D,A,W,L,q,x,N,E;const{citationConfig:J,citations:U,onFetchOnDemandCitation:z}=v();let B="";try{B=JSON.parse(`"${f}"`)}catch(i){console.warn("error in parsing reasoning a tag",i),B=f}const[G,H=""]=B.split("$"),[K,P=""]=H.split("?"),Q=async(i,t,o,n)=>{if(z)try{await z(i,t,o,n||"","explanation")}catch(t){console.error(`[On-Demand Fetch Error] Failed to load citation ${i}:`,t)}},T=("appmode_citation"===G||"appmode_citations"===G?(null==U?void 0:U.appmod_citations)||[]:"image_citation"===G||"image_citations"===G?(null==U?void 0:U.image_citations)||[]:"audio_citation"===G||"audio_citations"===G?(null==U?void 0:U.audio_citations)||[]:"document_citation"===G||"document_citations"===G?(null==U?void 0:U.file_citations)||[]:"rca_citation"===G||"rca_citations"===G?(null==U?void 0:U.rca_citations)||[]:"web_citation"===G||"web_citations"===G?(null==U?void 0:U.web_citations)||[]:"code_generated"===G?(null==U?void 0:U.code_generated)||[]:"readfile_citation"===G||"readfile_citations"===G?(null==U?void 0:U.readfile_citations)||[]:("gpt_citation"===G||"gpt_citations"===G)&&(null==U?void 0:U.gpt_citations)||[]).find(i=>i.citation_number===decodeURIComponent(K));return"web_citation"===(null===(k=null==T?void 0:T.customMetadata)||void 0===k?void 0:k.type)||G.includes("web_citation")?(null===(M=null==T?void 0:T.customMetadata)||void 0===M?void 0:M.screenshot_url)?i(a,{title:b,citation:T,customStyles:null==h?void 0:h.webCitation,customIcons:y}):i(e,{label:b,url:null===(j=T.customMetadata)||void 0===j?void 0:j.link,customStyles:null==h?void 0:h.webCitation,customIcons:y,fetchOnDemandCitation:()=>{Q(K,R,G,I)}}):"audio_transcript"===(null===(S=null==T?void 0:T.customMetadata)||void 0===S?void 0:S.type)||G.includes("audio_citation")?"stormee"===(null===(w=null==T?void 0:T.customMetadata)||void 0===w?void 0:w.audio_citation_mode)?i(n,{fallback:i(t,{}),children:i(c,{title:`${b}`,citation:T,customStyles:null==h?void 0:h.stormeeCitation,customIcons:y})}):i(n,{fallback:i(t,{}),children:i(l,{title:`${b}`,citation:T||{citation_number:K},customStyles:null==h?void 0:h.waveformCitation,customIcons:y,fetchOnDemandCitation:()=>{Q(K,R,G)}})}):"image_citation"===(null===($=null==T?void 0:T.customMetadata)||void 0===$?void 0:$.type)||G.includes("image_citation")?i(n,{fallback:i(t,{}),children:i(d,{title:`${b}`,citation:T||{citation_number:K,isLoading:!0},customIcons:y,customStyles:null==h?void 0:h.imageCitation,fetchOnDemandCitation:()=>{Q(K,R,G,I)}})}):"book_citation_doc"===(null===(F=null==T?void 0:T.customMetadata)||void 0===F?void 0:F.type)||"book_citation_pdf"===(null===(O=null==T?void 0:T.customMetadata)||void 0===O?void 0:O.type)||G.includes("document_citation")?i(n,{fallback:i(t,{}),children:i(s,{title:`${b}`,citation:T||{citation_number:K,customMetadata:{type:"book_citation_pdf"}},customIcons:y,customStyles:null==h?void 0:h.fileCitation,fetchOnDemandCitation:()=>{Q(K,R,G,I)}})}):"app_mod_rag_question"===(null===(D=null==T?void 0:T.customMetadata)||void 0===D?void 0:D.type)||G.includes("appmode_citation")?i(n,{fallback:i(t,{}),children:i(r,{title:`${b}`,citation:T,customIcons:y,customStyles:null==h?void 0:h.appModCitation,codeLinkConfig:null===(A=null==J?void 0:J.appMod)||void 0===A?void 0:A.codeLinkConfig,isLoading:null===(W=null==J?void 0:J.appMod)||void 0===W?void 0:W.isLoading,fetchOnDemandCitation:()=>{Q(K,R,G,I)}})}):"rca_citation"===(null===(L=null==T?void 0:T.customMetadata)||void 0===L?void 0:L.type)?i(n,{fallback:i(t,{}),children:i(m,{title:`${b}`,citation:T,customIcons:y,customStyles:null==h?void 0:h.rcaCitation})}):"readfile_citation"===(null===(q=null==T?void 0:T.customMetadata)||void 0===q?void 0:q.type)||G.includes("readfile_citation")?i(n,{fallback:i(t,{}),children:i(u,{title:`${b}`,citation:T||{citation_number:K},customIcons:y,customStyles:null==h?void 0:h.readFileCitation,fileCallback:null===(x=null==J?void 0:J.readFile)||void 0===x?void 0:x.fileCallback,editorConfig:null===(N=null==J?void 0:J.readFile)||void 0===N?void 0:N.editorConfig,customColors:null===(E=null==J?void 0:J.readFile)||void 0===E?void 0:E.customColors,fetchOnDemandCitation:()=>{Q(K,R,G)}})}):o("span",{className:_.container,children:[i("span",{className:_.text,children:b}),o("span",{children:[" ",i("audio_citations"===G?p:t,{})]})]})};export{f as default};
1
+ import{jsx as i,Fragment as t,jsxs as o}from"react/jsx-runtime";import{Suspense as n}from"react";import a from"../components/citations/web-citation/WebCitationWithImageRenderer.js";import e from"../components/citations/web-citation/WebCitationRenderer.js";import c from"../components/citations/stormee-citation/StormeeCitationRenderer.js";import l from"../components/citations/audio-citation/WaveformCitationRenderer.js";import d from"../components/citations/image-citation/ImageCitationRenderer.js";import s from"../components/citations/file-citation/FileCitationRender.js";import r from"../components/citations/appmod-citation/AppmodCitationRenderer.js";import m from"../components/citations/rca-citation/RCACitationRenderer.js";import u from"../components/citations/readfile-citation/ReadFileCitationRenderer.js";import p from"../components/citations/audio-citation/components/AudioCitationIcon.js";import{useRequirementAI as v}from"../components/RequirementAIWrapper/RequirementAIWrapper.js";import _ from"./ReqAiCitationRenderer.module.css.js";const f=({href:f,panelRef:C,children:b,customStyles:g,citationStyles:h,customIcons:y,aiReason:R,source:I})=>{var k,M,j,S,w,$,F,O,D,A,W,L,q,x,N,E;const{citationConfig:J,citations:U,onFetchOnDemandCitation:z}=v();let B="";try{B=JSON.parse(`"${f}"`)}catch(i){console.warn("error in parsing reasoning a tag",i),B=f}const[G,H=""]=B.split("$"),[K,P=""]=H.split("?"),Q=async(i,t,o,n)=>{if(z)try{await z(i,t,o,n||"","explanation")}catch(t){console.error(`[On-Demand Fetch Error] Failed to load citation ${i}:`,t)}},T=("appmode_citation"===G||"appmode_citations"===G?(null==U?void 0:U.appmod_citations)||[]:"image_citation"===G||"image_citations"===G?(null==U?void 0:U.image_citations)||[]:"audio_citation"===G||"audio_citations"===G?(null==U?void 0:U.audio_citations)||[]:"document_citation"===G||"document_citations"===G?(null==U?void 0:U.file_citations)||[]:"rca_citation"===G||"rca_citations"===G?(null==U?void 0:U.rca_citations)||[]:"web_citation"===G||"web_citations"===G?(null==U?void 0:U.web_citations)||[]:"code_generated"===G?(null==U?void 0:U.code_generated)||[]:"readfile_citation"===G||"readfile_citations"===G?(null==U?void 0:U.readfile_citations)||[]:("gpt_citation"===G||"gpt_citations"===G)&&(null==U?void 0:U.gpt_citations)||[]).find(i=>i.citation_number===decodeURIComponent(K));return"web_citation"===(null===(k=null==T?void 0:T.customMetadata)||void 0===k?void 0:k.type)||G.includes("web_citation")?(null===(M=null==T?void 0:T.customMetadata)||void 0===M?void 0:M.screenshot_url)?i(a,{title:b,citation:T,customStyles:null==h?void 0:h.webCitation,customIcons:y}):i(e,{label:b,url:null===(j=null==T?void 0:T.customMetadata)||void 0===j?void 0:j.link,customStyles:null==h?void 0:h.webCitation,customIcons:y,fetchOnDemandCitation:()=>{Q(K,R,G,I)}}):"audio_transcript"===(null===(S=null==T?void 0:T.customMetadata)||void 0===S?void 0:S.type)||G.includes("audio_citation")?"stormee"===(null===(w=null==T?void 0:T.customMetadata)||void 0===w?void 0:w.audio_citation_mode)?i(n,{fallback:i(t,{}),children:i(c,{title:`${b}`,citation:T,customStyles:null==h?void 0:h.stormeeCitation,customIcons:y})}):i(n,{fallback:i(t,{}),children:i(l,{title:`${b}`,citation:T||{citation_number:K},customStyles:null==h?void 0:h.waveformCitation,customIcons:y,fetchOnDemandCitation:()=>{Q(K,R,G)}})}):"image_citation"===(null===($=null==T?void 0:T.customMetadata)||void 0===$?void 0:$.type)||G.includes("image_citation")?i(n,{fallback:i(t,{}),children:i(d,{title:`${b}`,citation:T||{citation_number:K,isLoading:!0},customIcons:y,customStyles:null==h?void 0:h.imageCitation,fetchOnDemandCitation:()=>{Q(K,R,G,I)}})}):"book_citation_doc"===(null===(F=null==T?void 0:T.customMetadata)||void 0===F?void 0:F.type)||"book_citation_pdf"===(null===(O=null==T?void 0:T.customMetadata)||void 0===O?void 0:O.type)||G.includes("document_citation")?i(n,{fallback:i(t,{}),children:i(s,{title:`${b}`,citation:T||{citation_number:K,customMetadata:{type:"book_citation_pdf"}},customIcons:y,customStyles:null==h?void 0:h.fileCitation,fetchOnDemandCitation:()=>{Q(K,R,G,I)}})}):"app_mod_rag_question"===(null===(D=null==T?void 0:T.customMetadata)||void 0===D?void 0:D.type)||G.includes("appmode_citation")?i(n,{fallback:i(t,{}),children:i(r,{title:`${b}`,citation:T,customIcons:y,customStyles:null==h?void 0:h.appModCitation,codeLinkConfig:null===(A=null==J?void 0:J.appMod)||void 0===A?void 0:A.codeLinkConfig,isLoading:null===(W=null==J?void 0:J.appMod)||void 0===W?void 0:W.isLoading,fetchOnDemandCitation:()=>{Q(K,R,G,I)}})}):"rca_citation"===(null===(L=null==T?void 0:T.customMetadata)||void 0===L?void 0:L.type)?i(n,{fallback:i(t,{}),children:i(m,{title:`${b}`,citation:T,customIcons:y,customStyles:null==h?void 0:h.rcaCitation})}):"readfile_citation"===(null===(q=null==T?void 0:T.customMetadata)||void 0===q?void 0:q.type)||G.includes("readfile_citation")?i(n,{fallback:i(t,{}),children:i(u,{title:`${b}`,citation:T||{citation_number:K},customIcons:y,customStyles:null==h?void 0:h.readFileCitation,fileCallback:null===(x=null==J?void 0:J.readFile)||void 0===x?void 0:x.fileCallback,editorConfig:null===(N=null==J?void 0:J.readFile)||void 0===N?void 0:N.editorConfig,customColors:null===(E=null==J?void 0:J.readFile)||void 0===E?void 0:E.customColors,fetchOnDemandCitation:()=>{Q(K,R,G)}})}):o("span",{className:_.container,children:[i("span",{className:_.text,children:b}),o("span",{children:[" ",i("audio_citations"===G?p:t,{})]})]})};export{f as default};
2
2
  //# sourceMappingURL=ReqAiCitationRenderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStreamContentHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/features/RequirementAI/hooks/useStreamContentHandler.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGrF,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B,CAAC,EAAE,wBAAwB,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,UAAU,MAAM;IACZ,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACrE,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACjE,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrE,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAChF,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,uBAAuB,EAAE,OAAO,CAAC;IACjC,aAAa,EAAE,GAAG,CAAC;IACnB,sBAAsB,EAAE,GAAG,CAAC;IAC5B,eAAe,EAAE;QACb,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,oBAAoB,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9H,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,EAAE,MAAM;sCAgFjQ,eAAe,EAAE,kBACZ,GAAG,mBACF,MAAM,8BACK,OAAO;EAoO1C"}
1
+ {"version":3,"file":"useStreamContentHandler.d.ts","sourceRoot":"","sources":["../../../../../../src/features/RequirementAI/hooks/useStreamContentHandler.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGrF,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,GAAG,YAAY,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2BAA2B,CAAC,EAAE,wBAAwB,CAAC;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAC,OAAO,CAAC,CAAC;CACrC,CAAC;AAEF,UAAU,MAAM;IACZ,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACrE,YAAY,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IACjE,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IACrE,qBAAqB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC;IAChF,oBAAoB,EAAE,CAAC,gBAAgB,CAAC,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,uBAAuB,EAAE,OAAO,CAAC;IACjC,aAAa,EAAE,GAAG,CAAC;IACnB,sBAAsB,EAAE,GAAG,CAAC;IAC5B,eAAe,EAAE;QACb,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,KAAK,EAAE,MAAM,EAAE,CAAC;QAChB,gBAAgB,EAAE,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,WAAW,EAAE,YAAY,EAAE,CAAC;IAC5B,oBAAoB,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,GAAG,EAAE,aAAa,EAAE,YAAY,EAAE,KAAK,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC9H,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,EAAE,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,aAAa,EAAE,sBAAsB,EAAE,eAAe,EAAE,WAAW,EAAE,aAAa,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,EAAE,MAAM;sCAkFjQ,eAAe,EAAE,kBACZ,GAAG,mBACF,MAAM,8BACK,OAAO;EAqO1C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/requirement-ai",
3
- "version": "0.0.292",
3
+ "version": "0.0.295",
4
4
  "author": "Saptyadeep Bhattacharjee",
5
5
  "description": "",
6
6
  "license": "MIT",