@e-llm-studio/requirement-ai 0.0.287 → 0.0.288

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:o,setUserStoryCitations:n,onStreamingCompleted:r,isGraphQLCallInProgress:s,knowledgeBase:a,projectAnalyserSummary:l,dataSourceFiles:u,aiReasoning:c,setRedisValue:d,fetchCitationByBlock:p}){const[_,m]=e.useState({finalGap:"",finalRisk:"",status:"in-progress"}),f=e.useRef(new Set),g=e.useRef(new Set),b=e.useRef(null),v=e.useRef(null),h=e.useRef({gap_items_prompt:"",risk_items_prompt:""}),k=e.useRef(new Set);return e.useEffect(()=>{"complete"!==_.status||s||(r(_.finalGap,_.finalRisk),f.current.clear(),g.current.clear(),b.current=null,v.current=null,h.current={gap_items_prompt:"",risk_items_prompt:""},k.current.clear(),m({finalGap:"",finalRisk:"",status:"in-progress"}))},[_,s]),{processStreamContent:function(e,r,s){try{const _=JSON.stringify(e);if(v.current===_)return;v.current=_;let y=[],R=[];e=e.map(e=>{var i;const s=`${(e={...e,subBlockNumber:null!==(i=e.subBlockNumber)&&void 0!==i?i:"1"}).storyNumber}-${e.blockNumber}-${e.subBlockNumber}`;if(k.current.has(s))return null;k.current.add(s);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}}),y.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&&n(e=>{var t;return{...e,file_citations:[...null!==(t=e.file_citations)&&void 0!==t?t:[],...d]}});let _=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return f.current.has(_)||(!async function(e,t,i){var r,s;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===(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)&&(h.current={gap_items_prompt:a,risk_items_prompt:l}),n(e=>{var t,i,o,n,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!==(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!==(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(g.current.add(t),g.current.size===f.current.size){const e=a||h.current.gap_items_prompt,t=l||h.current.risk_items_prompt;m({finalGap:e,finalRisk:t,status:"complete"})}}}({...e,value:a,description:c},l,r),f.current.add(_)),{...e,value:a,description:c}}).filter(Boolean),y.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:r,blockNumber:p,big_enough:_,big_enough_decision_factors:m,gapValue:f,confidenceScore:g,metadata:v},h)=>{i(i=>{var k,y,N,S,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:r,storyNumber:n,sub_features:[],section:t,blockNumber:p,aiReasoning:R[h],big_enough:_,big_enough_decision_factors:m,gapValue:f,confidenceScore:g,metadata:v}):(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(...R[h]),i[w].big_enough=_,i[w].big_enough_decision_factors=m,i[w].gapValue=f,i[w].confidenceScore=g,i[w].metadata=v);else{i[w].sub_features||(i[w].sub_features=[]);const r=(null===(S=null===(N=i[w])||void 0===N?void 0:N.sub_features)||void 0===S?void 0:S.findIndex(e=>e.blockNumber===p))||-1;if(-1===r)null===($=null===(B=i[w])||void 0===B?void 0:B.sub_features)||void 0===$||$.push({artifactId:`STORY-${n}-${p}`,title:e,value:o,storyNumber:n,blockNumber:p,section:t,aiReasoning:R[h],big_enough:_,big_enough_decision_factors:m,gapValue:f,confidenceScore:g,metadata:v});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||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...R[h]),e.big_enough=_,e.big_enough_decision_factors=m,e.gapValue=f,e.confidenceScore=g,e.metadata=v}}const E=JSON.stringify(i);return b.current!==E&&(d({key:`streaming-redis-key-${s}`,value:{mmvf_list:i,knowledgeBase:a,projectAnalyserSummary:l,dataSources_files:u,ai_reasonings:c}}),b.current=E),[...i]})})}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: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 _=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return g.current.has(_)||(!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(_)),{...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)}}}};
2
2
  //# sourceMappingURL=useStreamContentHandler.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}){const[g,f]=e({finalGap:"",finalRisk:"",status:"in-progress"}),b=i(new Set),v=i(new Set),h=i(null),k=i(null),y=i({gap_items_prompt:"",risk_items_prompt:""}),N=i(new Set);return t(()=>{"complete"!==g.status||l||(a(g.finalGap,g.finalRisk),b.current.clear(),v.current.clear(),h.current=null,k.current=null,y.current={gap_items_prompt:"",risk_items_prompt:""},N.current.clear(),f({finalGap:"",finalRisk:"",status:"in-progress"}))},[g,l]),{processStreamContent:function(e,i,t){try{const a=JSON.stringify(e);if(k.current===a)return;k.current=a;let l=[],g=[];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(N.current.has(n))return null;N.current.add(n);let{outputText:a,reasonings:u,gpt_citation:c,processedDescription:d}=o(e.value,e.blockNumber,e.storyNumber,e.description);s(e=>{var i;return c.length>0&&((null==e?void 0:e.gpt_citations)||(e.gpt_citations=[]),null===(i=e.gpt_citations)||void 0===i||i.push(...c)),{...e}}),l.push(...u),g.push([...u]);const p=u.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));p.length&&s(e=>{var i;return{...e,file_citations:[...null!==(i=e.file_citations)&&void 0!==i?i:[],...p]}});let _=`<STORY_NUMBER>${e.storyNumber}<BLOCK_NUMBER>${e.blockNumber}<SUB_BLOCK>${e.subBlockNumber}`;return b.current.has(_)||(!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)&&(y.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(v.current.add(i),v.current.size===b.current.size){const e=a||y.current.gap_items_prompt,i=l||y.current.risk_items_prompt;f({finalGap:e,finalRisk:i,status:"complete"})}}}({...e,value:a,description:d},u,i),b.current.add(_)),{...e,value:a,description:d}}).filter(Boolean),l.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:f,confidenceScore:b,metadata:v},k)=>{n(n=>{var y,N,S,R,B,$,C,w;const O=n.findIndex(e=>e.storyNumber===r);if("intro"===i)-1===O?n.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,description:s,storyNumber:r,sub_features:[],section:i,blockNumber:a,aiReasoning:g[k],big_enough:l,big_enough_decision_factors:m,gapValue:f,confidenceScore:b,metadata:v}):(n[O].value+=o,n[O].aiReasoning=n[O].aiReasoning||[],null===(N=null===(y=n[O])||void 0===y?void 0:y.aiReasoning)||void 0===N||N.push(...g[k]),n[O].big_enough=l,n[O].big_enough_decision_factors=m,n[O].gapValue=f,n[O].confidenceScore=b,n[O].metadata=v);else{n[O].sub_features||(n[O].sub_features=[]);const t=(null===(R=null===(S=n[O])||void 0===S?void 0:S.sub_features)||void 0===R?void 0:R.findIndex(e=>e.blockNumber===a))||-1;if(-1===t)null===($=null===(B=n[O])||void 0===B?void 0:B.sub_features)||void 0===$||$.push({artifactId:`STORY-${r}-${a}`,title:e,value:o,storyNumber:r,blockNumber:a,section:i,aiReasoning:g[k],big_enough:l,big_enough_decision_factors:m,gapValue:f,confidenceScore:b,metadata:v});else{let e=null===(w=null===(C=null==n?void 0:n[O])||void 0===C?void 0:C.sub_features)||void 0===w?void 0:w[t];e.value=(e.value||"")+o,e.aiReasoning=e.aiReasoning||[],e.aiReasoning.push(...g[k]),e.big_enough=l,e.big_enough_decision_factors=m,e.gapValue=f,e.confidenceScore=b,e.metadata=v}}const E=JSON.stringify(n);return h.current!==E&&(_({key:`streaming-redis-key-${t}`,value:{mmvf_list:n,knowledgeBase:u,projectAnalyserSummary:c,dataSources_files:d,ai_reasonings:p}}),h.current=E),[...n]})})}catch(e){console.error("Error in processing Stream Content",e)}}}}export{n as useStreamContentHandler};
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 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};
2
2
  //# sourceMappingURL=useStreamContentHandler.js.map
@@ -33,9 +33,10 @@ interface IProps {
33
33
  };
34
34
  aiReasoning: TAIReasoning[];
35
35
  fetchCitationByBlock: (block: BlockStreamItem, metadata: any, ai_reasonings: TAIReasoning[]) => Promise<IGetCitationsByBlock>;
36
+ isOnDemandCitation?: boolean;
36
37
  }
37
- export declare function useStreamContentHandler({ setUserStory, setAiReasoning, setUserStoryCitations, onStreamingCompleted, isGraphQLCallInProgress, knowledgeBase, projectAnalyserSummary, dataSourceFiles, aiReasoning, setRedisValue, fetchCitationByBlock }: IProps): {
38
- processStreamContent: (blockList: BlockStreamItem[], customMetadata: any, storyArtifactID: string) => void;
38
+ export declare function useStreamContentHandler({ setUserStory, setAiReasoning, setUserStoryCitations, onStreamingCompleted, isGraphQLCallInProgress, knowledgeBase, projectAnalyserSummary, dataSourceFiles, aiReasoning, setRedisValue, fetchCitationByBlock, isOnDemandCitation }: IProps): {
39
+ processStreamContent: (blockList: BlockStreamItem[], customMetadata: any, storyArtifactID: string, isStoryStreamingCompleted?: boolean) => void;
39
40
  };
40
41
  export {};
41
42
  //# sourceMappingURL=useStreamContentHandler.d.ts.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;CACjI;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,EAAE,MAAM;sCAgF7O,eAAe,EAAE,kBACZ,GAAG,mBACF,MAAM;EAgO9B"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e-llm-studio/requirement-ai",
3
- "version": "0.0.287",
3
+ "version": "0.0.288",
4
4
  "author": "Saptyadeep Bhattacharjee",
5
5
  "description": "",
6
6
  "license": "MIT",