@e-llm-studio/requirement-ai 0.0.298 → 0.0.300
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.
- package/dist/cjs/features/RequirementAI/components/citations/web-citation/WebCitationRenderer.js +1 -1
- package/dist/cjs/features/RequirementAI/components/citations/web-citation/WebCitationWithImageRenderer.js +1 -1
- package/dist/cjs/features/RequirementAI/hooks/useOnDemandCitation.js +1 -1
- package/dist/cjs/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
- package/dist/features/RequirementAI/components/citations/web-citation/WebCitationRenderer.js +1 -1
- package/dist/features/RequirementAI/components/citations/web-citation/WebCitationWithImageRenderer.js +1 -1
- package/dist/features/RequirementAI/hooks/useOnDemandCitation.js +1 -1
- package/dist/features/RequirementAI/hooks/useStreamContentHandler.js +1 -1
- package/dist/types/src/features/RequirementAI/components/citations/web-citation/WebCitationRenderer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/components/citations/web-citation/WebCitationWithImageRenderer.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/hooks/useOnDemandCitation.d.ts.map +1 -1
- package/dist/types/src/features/RequirementAI/hooks/useStreamContentHandler.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cjs/features/RequirementAI/components/citations/web-citation/WebCitationRenderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./WebCitationIcon.js"),i=require("./WebCitation.js"),n=require("../../../../CitationRenderer/CitationRenderer.js"),o=require("./Webcitation.module.css.js"),l=require("@mui/material");exports.default=({label:r,url:a,customStyles:s,customIcons:d,fetchOnDemandCitation:c})=>{const u=(null==d?void 0:d.webCitationIcon)||e.jsx(t.default,{});return e.jsx(n.default,{inLineCitation:!0,citationTitle:r,chevronDownComponent:u,chevronUpComponent:u,citationComponent:!a&&c?e.jsxs("div",{className:o.default.citationLoader,style:{...null==s?void 0:s.loadingCitation},children:["Loading Citation",e.jsx(l.CircularProgress,{style:{color:"#4c4c4c",width:"20px",height:"20px",...null==s?void 0:s.loadingCitationCircularProgress}})]}):e.jsxs("div",{className:"p-4 border rounded-lg bg-white mt-2",style:null==s?void 0:s.content,children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2",style:null==s?void 0:s.footerText,children:"Source Link:"}),e.jsx(i.default,{label:r,url:a||"",customStyles:s,customIcons:d})]}),additionalCallbackForPillButton:()=>{!a&&c&&(null==c||c())},styles:{pillButton:{margin:"0px",padding:"0px 4px",fontSize:"14px",color:"#2546F0",cursor:"pointer",verticalAlign:"middle",display:"inline-flex",alignItems:"center",background:"#E9ECFD",border:"1px solid #D4DBFF",borderRadius:"2px",gap:"4px",...null==s?void 0:s.pill},citationContent:{width:"100%",background:"transparent",marginTop:"10px",...null==s?void 0:s.content}}})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("./WebCitationIcon.js"),i=require("./WebCitation.js"),n=require("../../../../CitationRenderer/CitationRenderer.js"),o=require("./Webcitation.module.css.js"),l=require("@mui/material");exports.default=({label:r,url:a,customStyles:s,customIcons:d,fetchOnDemandCitation:c})=>{const u=(null==d?void 0:d.webCitationIcon)||e.jsx(t.default,{});return e.jsx(n.default,{inLineCitation:!0,citationTitle:r,chevronDownComponent:u,chevronUpComponent:u,citationComponent:!a&&c?e.jsxs("div",{className:o.default.citationLoader,style:{...null==s?void 0:s.loadingCitation},children:["Loading Citation",e.jsx(l.CircularProgress,{style:{color:"#4c4c4c",width:"20px",height:"20px",...null==s?void 0:s.loadingCitationCircularProgress}})]}):e.jsxs("div",{className:"p-4 border rounded-lg bg-white mt-2",style:null==s?void 0:s.content,children:[e.jsx("p",{className:"text-sm text-gray-600 mb-2",style:null==s?void 0:s.footerText,children:"Source Link:"}),e.jsx(i.default,{label:r,url:a||"",customStyles:s,customIcons:d})]}),additionalCallbackForPillButton:()=>{!a&&c&&(null==c||c())},styles:{pillButton:{margin:"0px",padding:"0px 4px",fontSize:"14px",color:"#2546F0",cursor:"pointer",verticalAlign:"middle",display:"inline-flex",alignItems:"center",background:"#E9ECFD",border:"1px solid #D4DBFF",borderRadius:"2px",gap:"4px",...null==s?void 0:s.pill},citationContent:{width:"100%",background:"transparent",marginTop:"10px",minHeight:"fit-content",...null==s?void 0:s.content}}})};
|
|
2
2
|
//# sourceMappingURL=WebCitationRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("./WebCitationWithImageContent.js"),i=require("./WebCitationIcon.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("./WebCitationWithImageContent.js"),i=require("./WebCitationIcon.js"),n=require("../../../../CitationRenderer/CitationRenderer.js");exports.default=({title:o,citation:a,customStyles:r,customIcons:l})=>{var s,c,u,d;const p=(null==l?void 0:l.webCitationIcon)||t.jsx(i.default,{});return t.jsx(n.default,{inLineCitation:!0,citationTitle:o,citationId:`web-citation-${a.citation_number}`,chevronDownComponent:p,chevronUpComponent:p,citationComponent:t.jsx(e.default,{gsUtilPath:(null===(s=a.customMetadata)||void 0===s?void 0:s.screenshot_url)||(null===(c=a.customMetadata)||void 0===c?void 0:c.gs_util_url)||"",relevanceScore:null===(u=a.customMetadata)||void 0===u?void 0:u.relevance_score,url:(null===(d=a.customMetadata)||void 0===d?void 0:d.link)||"",label:o,PreviewDialogCloseIcon:()=>t.jsx("span",{children:"X"}),customStyles:r,customIcons:l}),styles:{pillButton:{margin:"0px 10px",padding:"0px 4px",fontSize:"14px",color:"#2546F0",cursor:"pointer",verticalAlign:"middle",display:"inline-flex",alignItems:"center",background:"#E9ECFD",border:"1px solid #D4DBFF",borderRadius:"2px",gap:"4px",...null==r?void 0:r.pill},citationContent:{width:"100%",background:"transparent",marginTop:"10px",minHeight:"fit-content",...null==r?void 0:r.content}}})};
|
|
2
2
|
//# sourceMappingURL=WebCitationWithImageRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react");exports.useOnDemandCitation=function({baseCitations:t,requestId:n,user:o,bucketName:e,fetchOnDemandCitation:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i=require("react");exports.useOnDemandCitation=function({baseCitations:t,requestId:n,user:o,bucketName:e,fetchOnDemandCitation:a}){const l=null!=t?t:{},u=i.useRef(l),[c,d]=i.useState(l);i.useEffect(()=>{d(i=>{var n,o;return{...t,file_citations:i.file_citations&&i.file_citations.length>0?i.file_citations:null!==(n=null==t?void 0:t.file_citations)&&void 0!==n?n:[],audio_citations:i.audio_citations&&i.audio_citations.length>0?i.audio_citations:null!==(o=null==t?void 0:t.audio_citations)&&void 0!==o?o:[]}})},[t]),i.useEffect(()=>{u.current=c},[c]);const s=i.useCallback((i,t)=>{var n,o,e,a,l,u,c,d,s,r,v,_,m,f,b,g,h,p,w,C;let y=null===(c=null===(u=null===(l=null===(a=null===(e=null===(o=null===(n=null==i?void 0:i.result)||void 0===n?void 0:n.citations)||void 0===o?void 0:o[0])||void 0===e?void 0:e.citations)||void 0===a?void 0:a[0])||void 0===l?void 0:l.customMetaData)||void 0===u?void 0:u.value)||void 0===c?void 0:c[0];if("audio_citation"===t||"audio_citations"===t)y=null===(s=null===(d=null==i?void 0:i.result)||void 0===d?void 0:d.citations)||void 0===s?void 0:s[0];else if(t.includes("image_citation"))y=null===(v=null===(r=null==i?void 0:i.result)||void 0===r?void 0:r.citations)||void 0===v?void 0:v[0];else if(t.includes("web_citation")){const t=null===(h=null===(g=null===(b=null===(f=null===(m=null===(_=null==i?void 0:i.result)||void 0===_?void 0:_.citations)||void 0===m?void 0:m[0])||void 0===f?void 0:f.segments)||void 0===b?void 0:b[0])||void 0===g?void 0:g.urls)||void 0===h?void 0:h[0];y={citation_number:null===(C=null===(w=null===(p=null==i?void 0:i.result)||void 0===p?void 0:p.citations)||void 0===w?void 0:w[0])||void 0===C?void 0:C.citation_number,customMetadata:{screenshot_url:null==t?void 0:t.gcs_url,relevance_score:100,link:null==t?void 0:t.highlight_url,type:"web_citation"}}}return y},[]),r=i.useCallback((i,t,n)=>{d(o=>{const e="audio_citation"===t||"audio_citations"===t?"audio_citations":t.includes("image_citation")?"image_citations":t.includes("web_citation")?"web_citations":"file_citations",a=o[e]||[],l=a.findIndex(t=>String(t.citation_number)===i),u={...n,citation_number:i},c=l>=0?a.map((i,t)=>t===l?{...i,...u}:i):[...a,u];return{...o,[e]:c}})},[]);return{fetchOnDemandCitationHandler:i.useCallback((i,t,l,u,c)=>{const d=String(i);return new Promise((v,_)=>{(async()=>{var m,f,b,g,h,p,w,C,y,k;try{const _=null!==(m=null==o?void 0:o.accessToken)&&void 0!==m?m:"";if(!_)throw new Error("No auth token available for on-demand citation fetch");const N=Number(i);if(Number.isNaN(N))throw new Error(`Invalid citation number: ${i}`);const x=null!==(f=sessionStorage.getItem("projectId"))&&void 0!==f?f:"",I=u?[`${e}/projects/${x}/${u}`]:[],O="explanation"===c?null!==(b=null==t?void 0:t.explanation)&&void 0!==b?b:"":null!==(g=null==t?void 0:t.reason)&&void 0!==g?g:"",$=JSON.stringify({userName:null!==(h=null==o?void 0:o.name)&&void 0!==h?h:`${null!==(p=null==o?void 0:o.firstname)&&void 0!==p?p:""} ${null!==(w=null==o?void 0:o.lastname)&&void 0!==w?w:""}`.trim(),userEmailId:null!==(C=null==o?void 0:o.email)&&void 0!==C?C:""}),q=[{reason:O,title:"",description:"explanation"===c?null!==(y=null==t?void 0:t.explanation)&&void 0!==y?y:"":null!==(k=null==t?void 0:t.reason)&&void 0!==k?k:""}],D=function(i){switch(i){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";case"document_citations":return"file_citation";case"audio_citations":return"requirement_ai_audio_citation";case"web_citations":return"web_citation";case"image_citations":return"requirement_ai_image_citation";default:return i}}(l);console.log("[useOnDemandCitation] fetching citation",{key:d,citationType:l,requestCitationType:D,requestId:n,files:I});const E=await a(n,D,N,O,_,q,I,$,u),S=s(E,l);S||console.error(`Failed to resolve on-demand citation ${d}`),S&&r(d,l,S),v(S)}catch(i){console.error("[useOnDemandCitation] error for citation",d,i),_(i)}})()})},[n,o]),libraryCitationsRef:u,libraryCitations:c}};
|
|
2
2
|
//# sourceMappingURL=useOnDemandCitation.js.map
|
|
@@ -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: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)}}}};
|
|
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]})}),console.log("streaming::userstory::completed",m,_),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
|
package/dist/features/RequirementAI/components/citations/web-citation/WebCitationRenderer.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t,jsxs as o}from"react/jsx-runtime";import i from"./WebCitationIcon.js";import n from"./WebCitation.js";import e from"../../../../CitationRenderer/CitationRenderer.js";import l from"./Webcitation.module.css.js";import{CircularProgress as r}from"@mui/material";const a=({label:a,url:c,customStyles:s,customIcons:d,fetchOnDemandCitation:m})=>{const p=(null==d?void 0:d.webCitationIcon)||t(i,{});return t(e,{inLineCitation:!0,citationTitle:a,chevronDownComponent:p,chevronUpComponent:p,citationComponent:o("div",!c&&m?{className:l.citationLoader,style:{...null==s?void 0:s.loadingCitation},children:["Loading Citation",t(r,{style:{color:"#4c4c4c",width:"20px",height:"20px",...null==s?void 0:s.loadingCitationCircularProgress}})]}:{className:"p-4 border rounded-lg bg-white mt-2",style:null==s?void 0:s.content,children:[t("p",{className:"text-sm text-gray-600 mb-2",style:null==s?void 0:s.footerText,children:"Source Link:"}),t(n,{label:a,url:c||"",customStyles:s,customIcons:d})]}),additionalCallbackForPillButton:()=>{!c&&m&&(null==m||m())},styles:{pillButton:{margin:"0px",padding:"0px 4px",fontSize:"14px",color:"#2546F0",cursor:"pointer",verticalAlign:"middle",display:"inline-flex",alignItems:"center",background:"#E9ECFD",border:"1px solid #D4DBFF",borderRadius:"2px",gap:"4px",...null==s?void 0:s.pill},citationContent:{width:"100%",background:"transparent",marginTop:"10px",...null==s?void 0:s.content}}})};export{a as default};
|
|
1
|
+
import{jsx as t,jsxs as o}from"react/jsx-runtime";import i from"./WebCitationIcon.js";import n from"./WebCitation.js";import e from"../../../../CitationRenderer/CitationRenderer.js";import l from"./Webcitation.module.css.js";import{CircularProgress as r}from"@mui/material";const a=({label:a,url:c,customStyles:s,customIcons:d,fetchOnDemandCitation:m})=>{const p=(null==d?void 0:d.webCitationIcon)||t(i,{});return t(e,{inLineCitation:!0,citationTitle:a,chevronDownComponent:p,chevronUpComponent:p,citationComponent:o("div",!c&&m?{className:l.citationLoader,style:{...null==s?void 0:s.loadingCitation},children:["Loading Citation",t(r,{style:{color:"#4c4c4c",width:"20px",height:"20px",...null==s?void 0:s.loadingCitationCircularProgress}})]}:{className:"p-4 border rounded-lg bg-white mt-2",style:null==s?void 0:s.content,children:[t("p",{className:"text-sm text-gray-600 mb-2",style:null==s?void 0:s.footerText,children:"Source Link:"}),t(n,{label:a,url:c||"",customStyles:s,customIcons:d})]}),additionalCallbackForPillButton:()=>{!c&&m&&(null==m||m())},styles:{pillButton:{margin:"0px",padding:"0px 4px",fontSize:"14px",color:"#2546F0",cursor:"pointer",verticalAlign:"middle",display:"inline-flex",alignItems:"center",background:"#E9ECFD",border:"1px solid #D4DBFF",borderRadius:"2px",gap:"4px",...null==s?void 0:s.pill},citationContent:{width:"100%",background:"transparent",marginTop:"10px",minHeight:"fit-content",...null==s?void 0:s.content}}})};export{a as default};
|
|
2
2
|
//# sourceMappingURL=WebCitationRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as t}from"react/jsx-runtime";import o from"./WebCitationWithImageContent.js";import i from"./WebCitationIcon.js";import n from"../../../../CitationRenderer/CitationRenderer.js";const e=({title:e,citation:a,customStyles:r,customIcons:l})=>{var c,s,d,u;const
|
|
1
|
+
import{jsx as t}from"react/jsx-runtime";import o from"./WebCitationWithImageContent.js";import i from"./WebCitationIcon.js";import n from"../../../../CitationRenderer/CitationRenderer.js";const e=({title:e,citation:a,customStyles:r,customIcons:l})=>{var c,s,d,u;const m=(null==l?void 0:l.webCitationIcon)||t(i,{});return t(n,{inLineCitation:!0,citationTitle:e,citationId:`web-citation-${a.citation_number}`,chevronDownComponent:m,chevronUpComponent:m,citationComponent:t(o,{gsUtilPath:(null===(c=a.customMetadata)||void 0===c?void 0:c.screenshot_url)||(null===(s=a.customMetadata)||void 0===s?void 0:s.gs_util_url)||"",relevanceScore:null===(d=a.customMetadata)||void 0===d?void 0:d.relevance_score,url:(null===(u=a.customMetadata)||void 0===u?void 0:u.link)||"",label:e,PreviewDialogCloseIcon:()=>t("span",{children:"X"}),customStyles:r,customIcons:l}),styles:{pillButton:{margin:"0px 10px",padding:"0px 4px",fontSize:"14px",color:"#2546F0",cursor:"pointer",verticalAlign:"middle",display:"inline-flex",alignItems:"center",background:"#E9ECFD",border:"1px solid #D4DBFF",borderRadius:"2px",gap:"4px",...null==r?void 0:r.pill},citationContent:{width:"100%",background:"transparent",marginTop:"10px",minHeight:"fit-content",...null==r?void 0:r.content}}})};export{e as default};
|
|
2
2
|
//# sourceMappingURL=WebCitationWithImageRenderer.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useRef as i,useState as t,useEffect as n,useCallback as o}from"react";function e({baseCitations:e,requestId:l,user:a,bucketName:u,fetchOnDemandCitation:
|
|
1
|
+
import{useRef as i,useState as t,useEffect as n,useCallback as o}from"react";function e({baseCitations:e,requestId:l,user:a,bucketName:u,fetchOnDemandCitation:d}){const c=null!=e?e:{},r=i(c),[s,v]=t(c);n(()=>{v(i=>{var t,n;return{...e,file_citations:i.file_citations&&i.file_citations.length>0?i.file_citations:null!==(t=null==e?void 0:e.file_citations)&&void 0!==t?t:[],audio_citations:i.audio_citations&&i.audio_citations.length>0?i.audio_citations:null!==(n=null==e?void 0:e.audio_citations)&&void 0!==n?n:[]}})},[e]),n(()=>{r.current=s},[s]);const _=o((i,t)=>{var n,o,e,l,a,u,d,c,r,s,v,_,m,f,b,g,h,p,w,y;let C=null===(d=null===(u=null===(a=null===(l=null===(e=null===(o=null===(n=null==i?void 0:i.result)||void 0===n?void 0:n.citations)||void 0===o?void 0:o[0])||void 0===e?void 0:e.citations)||void 0===l?void 0:l[0])||void 0===a?void 0:a.customMetaData)||void 0===u?void 0:u.value)||void 0===d?void 0:d[0];if("audio_citation"===t||"audio_citations"===t)C=null===(r=null===(c=null==i?void 0:i.result)||void 0===c?void 0:c.citations)||void 0===r?void 0:r[0];else if(t.includes("image_citation"))C=null===(v=null===(s=null==i?void 0:i.result)||void 0===s?void 0:s.citations)||void 0===v?void 0:v[0];else if(t.includes("web_citation")){const t=null===(h=null===(g=null===(b=null===(f=null===(m=null===(_=null==i?void 0:i.result)||void 0===_?void 0:_.citations)||void 0===m?void 0:m[0])||void 0===f?void 0:f.segments)||void 0===b?void 0:b[0])||void 0===g?void 0:g.urls)||void 0===h?void 0:h[0];C={citation_number:null===(y=null===(w=null===(p=null==i?void 0:i.result)||void 0===p?void 0:p.citations)||void 0===w?void 0:w[0])||void 0===y?void 0:y.citation_number,customMetadata:{screenshot_url:null==t?void 0:t.gcs_url,relevance_score:100,link:null==t?void 0:t.highlight_url,type:"web_citation"}}}return C},[]),m=o((i,t,n)=>{v(o=>{const e="audio_citation"===t||"audio_citations"===t?"audio_citations":t.includes("image_citation")?"image_citations":t.includes("web_citation")?"web_citations":"file_citations",l=o[e]||[],a=l.findIndex(t=>String(t.citation_number)===i),u={...n,citation_number:i},d=a>=0?l.map((i,t)=>t===a?{...i,...u}:i):[...l,u];return{...o,[e]:d}})},[]);return{fetchOnDemandCitationHandler:o((i,t,n,o,e)=>{const c=String(i);return new Promise((r,s)=>{(async()=>{var v,f,b,g,h,p,w,y,C,N;try{const s=null!==(v=null==a?void 0:a.accessToken)&&void 0!==v?v:"";if(!s)throw new Error("No auth token available for on-demand citation fetch");const I=Number(i);if(Number.isNaN(I))throw new Error(`Invalid citation number: ${i}`);const $=null!==(f=sessionStorage.getItem("projectId"))&&void 0!==f?f:"",k=o?[`${u}/projects/${$}/${o}`]:[],x="explanation"===e?null!==(b=null==t?void 0:t.explanation)&&void 0!==b?b:"":null!==(g=null==t?void 0:t.reason)&&void 0!==g?g:"",q=JSON.stringify({userName:null!==(h=null==a?void 0:a.name)&&void 0!==h?h:`${null!==(p=null==a?void 0:a.firstname)&&void 0!==p?p:""} ${null!==(w=null==a?void 0:a.lastname)&&void 0!==w?w:""}`.trim(),userEmailId:null!==(y=null==a?void 0:a.email)&&void 0!==y?y:""}),D=[{reason:x,title:"",description:"explanation"===e?null!==(C=null==t?void 0:t.explanation)&&void 0!==C?C:"":null!==(N=null==t?void 0:t.reason)&&void 0!==N?N:""}],O=function(i){switch(i){case"artifact_chunks":case"scanned_doc_citations":return"scanned_doc_citation";case"rai_artifact_citation":return"rai_artifact_citation";case"document_citations":return"file_citation";case"audio_citations":return"requirement_ai_audio_citation";case"web_citations":return"web_citation";case"image_citations":return"requirement_ai_image_citation";default:return i}}(n);console.log("[useOnDemandCitation] fetching citation",{key:c,citationType:n,requestCitationType:O,requestId:l,files:k});const S=await d(l,O,I,x,s,D,k,q,o),E=_(S,n);E||console.error(`Failed to resolve on-demand citation ${c}`),E&&m(c,n,E),r(E)}catch(i){console.error("[useOnDemandCitation] error for citation",c,i),s(i)}})()})},[l,a]),libraryCitationsRef:r,libraryCitations:s}}export{e as useOnDemandCitation};
|
|
2
2
|
//# sourceMappingURL=useOnDemandCitation.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
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};
|
|
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]})}),console.log("streaming::userstory::completed",a,g),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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebCitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/web-citation/WebCitationRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAOrF,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CAEpC;AAED,QAAA,MAAM,mBAAmB,qEAAqE,MAAM,
|
|
1
|
+
{"version":3,"file":"WebCitationRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/web-citation/WebCitationRenderer.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAOrF,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;IAC5B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;CAEpC;AAED,QAAA,MAAM,mBAAmB,qEAAqE,MAAM,4CA0EnG,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebCitationWithImageRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/web-citation/WebCitationWithImageRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAMrF,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;CAE7B;AAED,QAAA,MAAM,4BAA4B,mDAAoD,MAAM,
|
|
1
|
+
{"version":3,"file":"WebCitationWithImageRenderer.d.ts","sourceRoot":"","sources":["../../../../../../../../src/features/RequirementAI/components/citations/web-citation/WebCitationWithImageRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAExD,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAMrF,UAAU,MAAM;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,CAAC,EAAE,kBAAkB,CAAC;IAClC,WAAW,CAAC,EAAE,cAAc,CAAA;CAE7B;AAED,QAAA,MAAM,4BAA4B,mDAAoD,MAAM,4CAgE3F,CAAC;AAEF,eAAe,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOnDemandCitation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/RequirementAI/hooks/useOnDemandCitation.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAMzD,UAAU,yBAAyB;IACjC,2FAA2F;IAC3F,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,wFAAwF;IACxF,SAAS,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE;QAC9I,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,EAAE,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAC9H;AAgCD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,SAAS,EACT,IAAI,EACJ,UAAU,EACV,qBAAqB,EACtB,EAAE,yBAAyB;+
|
|
1
|
+
{"version":3,"file":"useOnDemandCitation.d.ts","sourceRoot":"","sources":["../../../../../../src/features/RequirementAI/hooks/useOnDemandCitation.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAMzD,UAAU,yBAAyB;IACjC,2FAA2F;IAC3F,aAAa,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,wFAAwF;IACxF,SAAS,EAAE,MAAM,CAAC;IAClB,yFAAyF;IACzF,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE;QAC9I,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;KACrB,EAAE,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,CAAA;CAC9H;AAgCD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,aAAa,EACb,SAAS,EACT,IAAI,EACJ,UAAU,EACV,qBAAqB,EACtB,EAAE,yBAAyB;+CAsFV,MAAM,gBACJ,YAAY,gBACZ,MAAM,WACX,MAAM,oBACG,aAAa,GAAG,WAAW,KAC5C,QAAQ,GAAG,CAAC;;;EA0FlB"}
|
|
@@ -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;sCAkFjQ,eAAe,EAAE,kBACZ,GAAG,mBACF,MAAM,8BACK,OAAO;
|
|
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;EAuO1C"}
|