@labelbee/lb-components 1.18.0-dev.2 → 1.19.0-alpha.1
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/assets/annotation/LLMTool/loading.svg.js +1 -0
- package/dist/components/AnnotationView/pointCloudAnnotationView.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/modelAPIView/index.js +1 -0
- package/dist/components/LLMToolView/questionView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/components/markdownView/index.js +1 -1
- package/dist/components/pointCloudView/PointCloud2DView.js +1 -1
- package/dist/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/dist/index.css +22 -0
- package/dist/index.js +1 -1
- package/dist/store/ctx.js +1 -1
- package/dist/types/components/AnnotationView/pointCloudAnnotationView.d.ts +2 -0
- package/dist/types/components/LLMToolView/modelAPIView/index.d.ts +13 -0
- package/dist/types/components/LLMToolView/questionView/index.d.ts +6 -1
- package/dist/types/components/LLMToolView/types.d.ts +19 -0
- package/dist/types/store/ctx.d.ts +3 -0
- package/dist/views/MainView/LLMLayout/index.js +1 -1
- package/es/assets/annotation/LLMTool/loading.svg.js +1 -0
- package/es/components/AnnotationView/pointCloudAnnotationView.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/modelAPIView/index.js +1 -0
- package/es/components/LLMToolView/questionView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/components/markdownView/index.js +1 -1
- package/es/components/pointCloudView/PointCloud2DView.js +1 -1
- package/es/components/pointCloudView/hooks/usePointCloudViews.js +1 -1
- package/es/index.css +22 -0
- package/es/store/ctx.js +1 -1
- package/es/views/MainView/LLMLayout/index.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var img="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M20.1598 14.4001C21.4852 14.4001 22.5598 13.3256 22.5598 12.0001C22.5598 10.6746 21.4852 9.6001 20.1598 9.6001C18.8343 9.6001 17.7598 10.6746 17.7598 12.0001C17.7598 13.3256 18.8343 14.4001 20.1598 14.4001Z' fill='%23D0D3FF'/%3e%3cpath d='M3.83945 14.4001C5.16494 14.4001 6.23945 13.3256 6.23945 12.0001C6.23945 10.6746 5.16494 9.6001 3.83945 9.6001C2.51397 9.6001 1.43945 10.6746 1.43945 12.0001C1.43945 13.3256 2.51397 14.4001 3.83945 14.4001Z' fill='%23D0D3FF'/%3e%3cpath d='M11.9996 14.4001C13.3251 14.4001 14.3996 13.3256 14.3996 12.0001C14.3996 10.6746 13.3251 9.6001 11.9996 9.6001C10.6741 9.6001 9.59961 10.6746 9.59961 12.0001C9.59961 13.3256 10.6741 14.4001 11.9996 14.4001Z' fill='%239AA0FE'/%3e%3cpath d='M20.1598 14.4001C21.4852 14.4001 22.5598 13.3256 22.5598 12.0001C22.5598 10.6746 21.4852 9.6001 20.1598 9.6001C18.8343 9.6001 17.7598 10.6746 17.7598 12.0001C17.7598 13.3256 18.8343 14.4001 20.1598 14.4001Z' fill='%23666FFF'/%3e%3cpath d='M3.83945 14.4001C5.16494 14.4001 6.23945 13.3256 6.23945 12.0001C6.23945 10.6746 5.16494 9.6001 3.83945 9.6001C2.51397 9.6001 1.43945 10.6746 1.43945 12.0001C1.43945 13.3256 2.51397 14.4001 3.83945 14.4001Z' fill='%234750D8'/%3e%3c/svg%3e";module.exports=img;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react");function _interopDefaultLegacy(
|
|
1
|
+
"use strict";var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const PointCloudAnnotationView=n=>{const{src:l,result:o,size:i,isOrthographicCamera:u=!1,backgroundColor:f="#ccc",getInstance:c}=n;let s=React.useRef();const r=React.useRef(),b=React.useCallback(e=>{s.current=e},[]);return React.useEffect(()=>{let e={container:s.current,backgroundColor:f,isOrthographicCamera:u};u&&Object.assign(e,{orthographicParams:lbUtils.PointCloudUtils.getDefaultOrthographicParams(i)});const a=new lbAnnotation.PointCloud(e);return r.current=a,c&&r.current.on("loadPCDFileEnd",()=>{c(r.current)}),()=>{var t;(t=r.current.renderer)==null||t.forceContextLoss()}},[]),React.useEffect(()=>{var e,a,t;r.current&&((e=r.current)==null||e.init(),(a=r.current)==null||a.initOrthographicCamera(lbUtils.PointCloudUtils.getDefaultOrthographicParams(i)),(t=r.current)==null||t.render())},[i]),React.useEffect(()=>{var e;r.current&&l&&((e=r.current)==null||e.loadPCDFile(l))},[l]),React.useEffect(()=>(o&&lbUtils.PointCloudUtils.getBoxParamsFromResultList(o).forEach(a=>{var t;(t=r.current)==null||t.generateBox(a,a.id)}),()=>{var e;lbUtils.PointCloudUtils.getBoxParamsFromResultList(o).forEach(t=>{var d;(d=r.current)==null||d.removeObjectByName(t.id,"box")}),(e=r.current)==null||e.render()}),[o]),React__default.default.createElement("div",{style:i,ref:b})};module.exports=PointCloudAnnotationView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),antd=require("antd"),index$2=require("../../constant/index.js"),es=require("antd/es"),index$1=require("./questionView/index.js"),reactI18next=require("react-i18next"),index=require("../../views/MainView/annotationTips/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LLMViewCls=`${index$2.prefix}-LLMView`,LLMToolView=e=>{const{annotation:i,checkMode:
|
|
1
|
+
"use strict";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),antd=require("antd"),index$2=require("../../constant/index.js"),es=require("antd/es"),index$1=require("./questionView/index.js"),reactI18next=require("react-i18next"),index=require("../../views/MainView/annotationTips/index.js"),data=require("./utils/data.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LLMViewCls=`${index$2.prefix}-LLMView`,LLMToolView=e=>{const{annotation:i,checkMode:o=!0,tips:v,showTips:f}=e,{imgIndex:n,imgList:a}=i,{hoverKey:L,modelAPIResponse:x,setModelAPIResponse:u}=React.useContext(ctx.LLMContext),[q,m]=React.useState([]),[p,w]=React.useState(""),{t:R}=reactI18next.useTranslation();return React.useEffect(()=>{let t;if(!o)return t=setInterval(()=>{antd.message.info(R("EfficientListening"))},1e3*60),()=>{t&&clearInterval(t)}},[]),React.useEffect(()=>{var t,l;if(!a[n])return;const r=(t=a[n])==null?void 0:t.questionList,c=(l=a[n])!=null?l:{},s=data.getCurrentResultFromResultList(c==null?void 0:c.result),d=(s==null?void 0:s.length)>0?s[0]:s;w(r==null?void 0:r.question),m((r==null?void 0:r.answerList)||[]),u((d==null?void 0:d.modelAPIResponse)||[])},[n]),React__default.default.createElement(es.Layout,{className:LLMViewCls},React__default.default.createElement("div",{className:`${LLMViewCls}-question`},f===!0&&React__default.default.createElement(index,{tips:v}),React__default.default.createElement(index$1.default,{hoverKey:L,question:p,answerList:q,modelAPIResponse:x,setModelAPIResponse:u,checkMode:o,annotation:i})))},mapStateToProps=e=>({annotation:e.annotation});var LLMToolView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(LLMToolView);module.exports=LLMToolView$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var antd=require("antd"),classNames=require("classnames"),React=require("react"),loading=require("../../../assets/annotation/LLMTool/loading.svg.js"),index$4=require("../../longText/index.js"),index$3=require("../../markdownView/index.js"),index$2=require("../../../constant/index.js"),reducer=require("../../../store/annotation/reducer.js"),index=require("../../../utils/index.js"),icons=require("@ant-design/icons"),index$1=require("../questionView/index.js"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(t){return t&&typeof t=="object"&&"default"in t?t:{default:t}}var classNames__default=_interopDefaultLegacy(classNames),React__default=_interopDefaultLegacy(React),__async=(t,e,n)=>new Promise((l,u)=>{var o=a=>{try{r(n.next(a))}catch(d){u(d)}},c=a=>{try{r(n.throw(a))}catch(d){u(d)}},r=a=>a.done?l(a.value):Promise.resolve(a.value).then(o,c);r((n=n.apply(t,e)).next())});const RenderContent=({dataFormatType:t,answer:e})=>t===index$2.EDataFormatType.Markdown?React__default.default.createElement(index$3,{value:e}):React__default.default.createElement(index$4,{wordCount:1e3,text:e}),getAnswer=(t,e)=>{var n;return(n=e.find(l=>l.id===t))==null?void 0:n.answer},ModelAPIView=t=>{var e;const{annotation:n={},checkMode:l,dataFormatType:u,modelAPIResponse:o,question:c,setModelAPIResponse:r}=t,{stepList:a,step:d,toolInstance:f}=n,[v,m]=React.useState({}),{enableModelAPI:p=!1,modelAPIConfigList:i=[]}=v,g=s=>{let L=!1;const w=o.map(_=>_.id===s.id?(L=!0,s):_);L||w.push(s),r==null||r(w)};return React.useEffect(()=>{var s;if(a&&d){const L=(s=reducer.getStepConfig(a,d))==null?void 0:s.config;m(index.jsonParser(L))}},[a,d]),p?(e=i==null?void 0:i.map)==null?void 0:e.call(i,s=>React__default.default.createElement(ModelAPIContent,{dataFormatType:u,config:s,modelAPIResponse:o,key:s==null?void 0:s.id,toolInstance:f,question:c,updateModelAPIResponse:g,checkMode:l})):null},LoadingMessage=()=>React__default.default.createElement("div",{className:classNames__default.default({[`${index$1.LLMViewCls}__loading`]:!0})},lbUtils.i18n.t("AnswersAreBeingGenerated"),React__default.default.createElement("img",{src:loading})),FailedMessage=()=>React__default.default.createElement("span",{className:classNames__default.default({[`${index$1.LLMViewCls}__failed`]:!0})},lbUtils.i18n.t("AnswerGenerationFailedPleaseTryAgainLater")," ",React__default.default.createElement(icons.InfoCircleFilled,null)),ModelAPIContent=({dataFormatType:t,config:e,modelAPIResponse:n,toolInstance:l,question:u,updateModelAPIResponse:o,checkMode:c})=>{const[r,a]=React.useState(!1),[d,f]=React.useState(!1),v=getAnswer(e==null?void 0:e.id,n),m=i=>{a(i),l&&(l.loading=i)},p=()=>__async(void 0,null,function*(){m(!0),f(!1);try{const i=yield l==null?void 0:l.getAPIAnswer(e,u);o({id:e==null?void 0:e.id,answer:i})}catch(i){f(!0)}finally{m(!1)}});return React__default.default.createElement("div",{className:classNames__default.default({[`${index$1.LLMViewCls}__content`]:!0}),key:e==null?void 0:e.id},React__default.default.createElement(antd.Tag,{style:{color:"#666FFF",background:"#eeefff",height:"20px",padding:"0px 8px",border:"none"}},e==null?void 0:e.name),React__default.default.createElement("div",{className:classNames__default.default({[`${index$1.LLMViewCls}__answer`]:!0})},!r&&v&&React__default.default.createElement(RenderContent,{dataFormatType:t,answer:v}),React__default.default.createElement("div",{className:classNames__default.default({[`${index$1.LLMViewCls}__message`]:!0})},r?React__default.default.createElement(LoadingMessage,null):d&&React__default.default.createElement(FailedMessage,null)),!r&&!c&&React__default.default.createElement("div",{className:classNames__default.default({[`${index$1.LLMViewCls}__footer`]:!0})},React__default.default.createElement("span",{onClick:p},lbUtils.i18n.t("ReGenerate"),React__default.default.createElement(icons.SyncOutlined,null)))))};module.exports=ModelAPIView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),antd=require("antd"),index$2=require("../../longText/index.js"),index=require("../../../constant/index.js"),classNames=require("classnames"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$1=require("../../markdownView/index.js"),icons=require("@ant-design/icons");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e};const LLMViewCls=`${index.prefix}-LLMView`,Header=({setDataFormatType:e,dataFormatType:t})=>{const{t:a}=reactI18next.useTranslation();return React__default.default.createElement("div",{className:`${LLMViewCls}__title`,style:{display:"flex",justifyContent:"space-between"}},a("Title"),React__default.default.createElement("span",{style:{display:"flex"}},React__default.default.createElement(antd.Radio.Group,{value:t,onChange:n=>{e(n.target.value)}},React__default.default.createElement(antd.Radio.Button,{value:index.EDataFormatType.Default,style:{textAlign:"center",width:"52px"}},"</>"),React__default.default.createElement(antd.Radio.Button,{value:index.EDataFormatType.Markdown,style:{textAlign:"center",width:"52px"}},React__default.default.createElement(icons.FileTextOutlined,null))),React__default.default.createElement("span",{style:{marginLeft:"8px",width:"4px",background:"#1890ff"}})))},QuestionView=e=>{const{hoverKey:t,answerList:a,question:n,lang:o}=e,[l,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),index$2=require("../../longText/index.js"),index=require("../../../constant/index.js"),classNames=require("classnames"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$1=require("../../markdownView/index.js"),icons=require("@ant-design/icons"),index$3=require("../modelAPIView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,a)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[t]=a,__spreadValues=(e,t)=>{for(var a in t||(t={}))__hasOwnProp.call(t,a)&&__defNormalProp(e,a,t[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(t))__propIsEnum.call(t,a)&&__defNormalProp(e,a,t[a]);return e};const LLMViewCls=`${index.prefix}-LLMView`,Header=({setDataFormatType:e,dataFormatType:t})=>{const{t:a}=reactI18next.useTranslation();return React__default.default.createElement("div",{className:`${LLMViewCls}__title`,style:{display:"flex",justifyContent:"space-between"}},a("Title"),React__default.default.createElement("span",{style:{display:"flex"}},React__default.default.createElement(antd.Radio.Group,{value:t,onChange:n=>{e(n.target.value)}},React__default.default.createElement(antd.Radio.Button,{value:index.EDataFormatType.Default,style:{textAlign:"center",width:"52px"}},"</>"),React__default.default.createElement(antd.Radio.Button,{value:index.EDataFormatType.Markdown,style:{textAlign:"center",width:"52px"}},React__default.default.createElement(icons.FileTextOutlined,null))),React__default.default.createElement("span",{style:{marginLeft:"8px",width:"4px",background:"#1890ff"}})))},QuestionView=e=>{const{hoverKey:t,answerList:a,question:n,lang:o,modelAPIResponse:s,setModelAPIResponse:u,checkMode:d=!0}=e,[l,i]=React.useState(index.EDataFormatType.Default),{t:c}=reactI18next.useTranslation();return React.useEffect(()=>{var r;o&&((r=lbUtils.i18n)==null||r.changeLanguage(o))},[]),React__default.default.createElement("div",{className:LLMViewCls},React__default.default.createElement("div",{className:`${LLMViewCls}__textBox`,style:{borderBottom:"1px solid #EBEBEB"}},React__default.default.createElement(Header,{setDataFormatType:i,dataFormatType:l}),React__default.default.createElement("div",{className:`${LLMViewCls}__content`},l===index.EDataFormatType.Markdown?React__default.default.createElement(index$1,{value:n}):React__default.default.createElement(index$2,{wordCount:200,text:n}))),React__default.default.createElement("div",{className:`${LLMViewCls}__textBox`},React__default.default.createElement("div",{className:`${LLMViewCls}__title`},c("Answer")),a.map((r,f)=>React__default.default.createElement("div",{className:classNames__default.default({[`${LLMViewCls}__content`]:!0,[`${LLMViewCls}__contentActive`]:t===(r==null?void 0:r.order)}),key:f},React__default.default.createElement(antd.Tag,{style:{color:"#666FFF",background:"#eeefff",height:"20px",padding:"0px 8px",border:"none"}},r==null?void 0:r.order),l===index.EDataFormatType.Markdown?React__default.default.createElement(index$1,{value:r==null?void 0:r.answer}):React__default.default.createElement(index$2,{wordCount:1e3,text:r==null?void 0:r.answer}))),React__default.default.createElement(index$3,{dataFormatType:l,modelAPIResponse:s,question:n,setModelAPIResponse:u,checkMode:d,annotation:e.annotation})))},WrapQuestionView=e=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(QuestionView,__spreadValues({},e)));exports.LLMViewCls=LLMViewCls,exports.default=WrapQuestionView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),index$4=require("../../../constant/index.js"),antd=require("antd"),index$1=require("./components/answerSort/index.js"),reactRedux=require("react-redux"),_=require("lodash"),index$2=require("./components/answerList/index.js"),ctx=require("../../../store/ctx.js"),index=require("../../../utils/index.js"),reducer=require("../../../store/annotation/reducer.js"),annotation=require("../../../hooks/annotation.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),data=require("../utils/data.js"),empty=require("../../../assets/annotation/LLMTool/empty.svg.js"),index$3=require("./components/textInputBox/index.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,n,i)=>n in r?__defProp(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i,__spreadValues=(r,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(r,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(r,i,n[i]);return r},__spreadProps=(r,n)=>__defProps(r,__getOwnPropDescs(n));const EKeyCode=lbAnnotation.cKeyCode.default,sidebarCls=`${index$4.prefix}-sidebar`,LLMToolSidebar=r=>{var n;const{annotation:i,dispatch:x,checkMode:L}=r,{imgIndex:h,imgList:y,stepList:E,step:
|
|
1
|
+
"use strict";var React=require("react"),index$4=require("../../../constant/index.js"),antd=require("antd"),index$1=require("./components/answerSort/index.js"),reactRedux=require("react-redux"),_=require("lodash"),index$2=require("./components/answerList/index.js"),ctx=require("../../../store/ctx.js"),index=require("../../../utils/index.js"),reducer=require("../../../store/annotation/reducer.js"),annotation=require("../../../hooks/annotation.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),lbAnnotation=require("@labelbee/lb-annotation"),reactI18next=require("react-i18next"),data=require("../utils/data.js"),empty=require("../../../assets/annotation/LLMTool/empty.svg.js"),index$3=require("./components/textInputBox/index.js");function _interopDefaultLegacy(r){return r&&typeof r=="object"&&"default"in r?r:{default:r}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(r,n,i)=>n in r?__defProp(r,n,{enumerable:!0,configurable:!0,writable:!0,value:i}):r[n]=i,__spreadValues=(r,n)=>{for(var i in n||(n={}))__hasOwnProp.call(n,i)&&__defNormalProp(r,i,n[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(n))__propIsEnum.call(n,i)&&__defNormalProp(r,i,n[i]);return r},__spreadProps=(r,n)=>__defProps(r,__getOwnPropDescs(n));const EKeyCode=lbAnnotation.cKeyCode.default,sidebarCls=`${index$4.prefix}-sidebar`,LLMToolSidebar=r=>{var n;const{annotation:i,dispatch:x,checkMode:L}=r,{imgIndex:h,imgList:y,stepList:E,step:C,skipBeforePageTurning:S}=i,{modelAPIResponse:P}=React.useContext(ctx.LLMContext),{t:j}=reactI18next.useTranslation(),o=(n=y[h])!=null?n:{},I=index.jsonParser(o==null?void 0:o.result),{toolInstanceRef:q}=annotation.useCustomToolInstance({basicInfo:I}),[p,M]=React.useState({}),[v,O]=React.useState([]),[w,D]=React.useState(void 0),[b,N]=React.useState([]),[A,F]=React.useState([]);React.useEffect(()=>{var e;if(E&&C){const t=(e=reducer.getStepConfig(E,C))==null?void 0:e.config;M(index.jsonParser(t))}},[E,C]),React.useEffect(()=>{if(!o)return;const e=data.getCurrentResultFromResultList(o==null?void 0:o.result);let t=(e==null?void 0:e.answerList)?e:o==null?void 0:o.questionList;(t==null?void 0:t.answerList)&&(B(t.answerList),O(t.answerList||[])),D(e==null?void 0:e.textAttribute)},[h,o]),React.useEffect(()=>{q.current.exportData=()=>{const s=data.formatSort(b);return[[{answerList:v,sort:s,textAttribute:w,id:o==null?void 0:o.id,modelAPIResponse:P}],{}]};const e=data.formatSort(b),t={answerList:v,sort:e,textAttribute:w,id:o==null?void 0:o.id,toolName:lbAnnotation.EToolName.LLM,modelAPIResponse:P};q.current.currentPageResult=t},[v,b,w,P]),React.useEffect(()=>(window.addEventListener("keydown",R),()=>{window.removeEventListener("keydown",R)}),[]);const R=e=>{if(e.ctrlKey&&e.keyCode===EKeyCode.Enter){if(S){S(()=>x(actionCreators.PageForward()));return}x(actionCreators.PageForward())}},B=e=>{var t;let s=[],u=[];if((e==null?void 0:e.length)>0){const a=data.getCurrentResultFromResultList(o==null?void 0:o.result),d=(a==null?void 0:a.length)>0?a[0]:a;((t=d==null?void 0:d.sort)==null?void 0:t.length)>0&&(u=d.sort.reduce((l,c)=>{let f=[{title:c[0],id:c[0]}];return c.length>1&&(f=c.map(g=>({title:g,id:g}))),[...l,f]},[])),e.forEach(l=>{u.some(f=>f.length>1?f.some(g=>g.id===l.order):f[0].id===l.order)||s.push({title:l.order,id:l.order})})}N(u),F(s)},K=({order:e,value:t,key:s})=>{const u=v==null?void 0:v.map(a=>{var d;if((a==null?void 0:a.order)===e){if(_.isNumber(t))return __spreadProps(__spreadValues({},a),{score:t});if(_.isObject(t)&&s){const l={[t==null?void 0:t.key]:t.value},c=(d=a[s])!=null?d:{};return __spreadProps(__spreadValues({},a),{[s]:__spreadValues(__spreadValues({},c),l)})}}return a});O(u)};if((()=>{var e,t;const{indicatorScore:s=[],indicatorDetermine:u=[],text:a=[],enableSort:d}=p,l=((e=s==null?void 0:s.filter(m=>m.label&&m.value&&m.score))==null?void 0:e.length)>0,c=((t=u==null?void 0:u.filter(m=>m.label&&m.value))==null?void 0:t.length)>0,f=(a==null?void 0:a.length)>0;return!(l||c||f||d)})())return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`,style:{display:"flex",justifyContent:"center",alignItems:"center"}},React__default.default.createElement(antd.Empty,{description:React__default.default.createElement("span",{style:{color:"#ccc"}},j("NoScoringScale")),imageStyle:{width:200,height:200},image:React__default.default.createElement("img",{src:empty})})));const{indicatorScore:T=[],indicatorDetermine:$=[],enableSort:V}=p,W=v.length>0&&(($==null?void 0:$.length)>0||(T==null?void 0:T.length)>0);return React__default.default.createElement("div",{className:`${sidebarCls}`},React__default.default.createElement("div",{className:`${sidebarCls}__content`},V&&React__default.default.createElement(index$1,{waitSortList:A,sortList:b,setSortList:N,checkMode:L}),W&&React__default.default.createElement(index$2,{list:v,LLMConfig:p,updateValue:K,checkMode:L}),(p==null?void 0:p.text)&&React__default.default.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},React__default.default.createElement(index$3,{textAttribute:w||[],LLMConfig:p,setText:D,checkMode:L}))),React__default.default.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(y==null?void 0:y.length)-1!==h&&React__default.default.createElement(antd.Button,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(S){S(()=>x(actionCreators.PageForward()));return}x(actionCreators.PageForward())},disabled:L},j("Save"))))},mapStateToProps=r=>({annotation:r.annotation});var LLMToolSidebar$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(LLMToolSidebar);module.exports=LLMToolSidebar$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),Markdown=require("react-markdown"),remarkMath=require("remark-math"),rehypeKatex=require("rehype-katex"),SyntaxHighlighter=require("react-syntax-highlighter"),hljs=require("react-syntax-highlighter/dist/esm/styles/hljs"),remarkGfm=require("remark-gfm");require("github-markdown-css");var index_module=require("./index.module.scss.js"),index=require("../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),Markdown__default=_interopDefaultLegacy(Markdown),remarkMath__default=_interopDefaultLegacy(remarkMath),rehypeKatex__default=_interopDefaultLegacy(rehypeKatex),SyntaxHighlighter__default=_interopDefaultLegacy(SyntaxHighlighter),remarkGfm__default=_interopDefaultLegacy(remarkGfm),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,a)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,__spreadValues=(e,r)=>{for(var a in r||(r={}))__hasOwnProp.call(r,a)&&__defNormalProp(e,a,r[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(r))__propIsEnum.call(r,a)&&__defNormalProp(e,a,r[a]);return e},__spreadProps=(e,r)=>__defProps(e,__getOwnPropDescs(r)),__objRest=(e,r)=>{var a={};for(var t in e)__hasOwnProp.call(e,t)&&r.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))r.indexOf(t)<0&&__propIsEnum.call(e,t)&&(a[t]=e[t]);return a};const MarkdownView=e=>{const{value:r,transformImageUri:a,transformLinkUri:t,components:d}=e,u=f=>{var n=f,{node:m,inline:c,className:l,children:i}=n,o=__objRest(n,["node","inline","className","children"]);const s=/language-(\w+)/.exec(l||"");return!c&&s?React__default.default.createElement(SyntaxHighlighter__default.default,__spreadProps(__spreadValues({},o),{className:"markdown-code-viewer",language:s[1],style:hljs.docco,PreTag:"div"}),String(i).replace(/\n$/,"")):React__default.default.createElement("code",__spreadProps(__spreadValues({},o),{className:l}),i)};return React__default.default.createElement(Markdown__default.default,{className:index.classnames({"markdown-body":!0,[index_module.markdownView]:!0}),remarkPlugins:[remarkGfm__default.default,remarkMath__default.default],rehypePlugins:[rehypeKatex__default.default],transformImageUri:a,transformLinkUri:t,components:__spreadValues({code:u},d)},r)};module.exports=MarkdownView;
|
|
1
|
+
"use strict";var React=require("react"),Markdown=require("react-markdown"),remarkMath=require("remark-math"),rehypeKatex=require("rehype-katex"),SyntaxHighlighter=require("react-syntax-highlighter"),hljs=require("react-syntax-highlighter/dist/esm/styles/hljs"),remarkGfm=require("remark-gfm");require("github-markdown-css");var index_module=require("./index.module.scss.js"),index=require("../../utils/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),Markdown__default=_interopDefaultLegacy(Markdown),remarkMath__default=_interopDefaultLegacy(remarkMath),rehypeKatex__default=_interopDefaultLegacy(rehypeKatex),SyntaxHighlighter__default=_interopDefaultLegacy(SyntaxHighlighter),remarkGfm__default=_interopDefaultLegacy(remarkGfm),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,a)=>r in e?__defProp(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,__spreadValues=(e,r)=>{for(var a in r||(r={}))__hasOwnProp.call(r,a)&&__defNormalProp(e,a,r[a]);if(__getOwnPropSymbols)for(var a of __getOwnPropSymbols(r))__propIsEnum.call(r,a)&&__defNormalProp(e,a,r[a]);return e},__spreadProps=(e,r)=>__defProps(e,__getOwnPropDescs(r)),__objRest=(e,r)=>{var a={};for(var t in e)__hasOwnProp.call(e,t)&&r.indexOf(t)<0&&(a[t]=e[t]);if(e!=null&&__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))r.indexOf(t)<0&&__propIsEnum.call(e,t)&&(a[t]=e[t]);return a};const MarkdownView=e=>{const{value:r,transformImageUri:a,transformLinkUri:t,components:d}=e,u=f=>{var n=f,{node:m,inline:c,className:l,children:i}=n,o=__objRest(n,["node","inline","className","children"]);const s=/language-(\w+)/.exec(l||"");return!c&&s?React__default.default.createElement(SyntaxHighlighter__default.default,__spreadProps(__spreadValues({},o),{className:"markdown-code-viewer",language:s[1],style:hljs.docco,PreTag:"div"}),String(i).replace(/\n$/,"")):React__default.default.createElement("code",__spreadProps(__spreadValues({},o),{className:l}),i)};return React__default.default.createElement(Markdown__default.default,{className:index.classnames({"markdown-body":!0,[index_module.markdownView]:!0}),remarkPlugins:[remarkGfm__default.default,remarkMath__default.default],rehypePlugins:[[rehypeKatex__default.default,{output:"mathml"}]],transformImageUri:a,transformLinkUri:t,components:__spreadValues({code:u},d)},r)};module.exports=MarkdownView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,
|
|
1
|
+
"use strict";var dom=require("../../utils/dom.js"),React=require("react"),PointCloudLayout=require("./PointCloudLayout.js"),PointCloudContext=require("./PointCloudContext.js"),reactRedux=require("react-redux"),lbAnnotation=require("@labelbee/lb-annotation"),ctx=require("../../store/ctx.js"),map=require("../../store/annotation/map.js"),lbUtils=require("@labelbee/lb-utils"),PointCloud2DSingleView=require("./PointCloud2DSingleView.js"),index=require("./components/TitleButton/index.js"),icons=require("@ant-design/icons"),classNames=require("classnames"),icon_esc=require("../../assets/annotation/common/icon_esc.svg.js"),icon_left_squareOutlined=require("../../assets/annotation/common/icon_left_squareOutlined.svg.js"),icon_right_squareOutlined=require("../../assets/annotation/common/icon_right_squareOutlined.svg.js"),_=require("lodash");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,l,t)=>l in e?__defProp(e,l,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[l]=t,__spreadValues=(e,l)=>{for(var t in l||(l={}))__hasOwnProp.call(l,t)&&__defNormalProp(e,t,l[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(l))__propIsEnum.call(l,t)&&__defNormalProp(e,t,l[t]);return e},__spreadProps=(e,l)=>__defProps(e,__getOwnPropDescs(l));const EKeyCode=lbAnnotation.cKeyCode.default,ContainerTitle=({showEnlarge:e,isEnlargeTopView:l,data:t,setIsEnlarge:p,setCurIndex:f,curIndex:b=0,index:w,annotations2d:v})=>l?React__default.default.createElement(index,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?React__default.default.createElement("div",{style:{display:"flex",alignItems:"center"}},React__default.default.createElement(icons.LeftOutlined,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{p(!1),f(void 0)}}),React__default.default.createElement("span",null,t==null?void 0:t.calName),React__default.default.createElement("span",{style:{marginLeft:"8px"}},b+1,"/",v==null?void 0:v.length)):React__default.default.createElement(index,{title:t==null?void 0:t.calName,onClick:()=>{p(!0),f(w)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),PointCloud2DView=({currentData:e,config:l,thumbnailWidth:t,isEnlargeTopView:p,highlightAttribute:f,loadPCDFileLoading:b,checkMode:w})=>{var v;const[c,K]=React.useState([]),{topViewInstance:H,displayPointCloudList:L,polygonList:q,imageSizes:F,selectedIDs:O}=React.useContext(PointCloudContext.PointCloudContext),[x,M]=React.useState(""),[y,P]=React.useState(!1),[s,E]=React.useState(void 0);React.useEffect(()=>{var o;if(!b&&H&&(e==null?void 0:e.mappingImgList)&&((o=e==null?void 0:e.mappingImgList)==null?void 0:o.length)>0){const i={fill:"transparent",color:"green"};let r=[];e==null||e.mappingImgList.forEach(n=>{var m,j,N;const R=L.reduce((d,u)=>{var g,a;const C=u.id===x||f===u.attribute,{transferViewData:A,viewRangePointList:h}=(g=lbAnnotation.pointCloudLidar2image(u,n.calib,{createRange:C}))!=null?g:{};if(!A||!h)return[];const z=(a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:u.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{}))==null?void 0:a.stroke,J=U({viewDataPointList:A,pointCloudBox:u,defaultViewStyle:i,stroke:z}),T=[...d,...J];return(h==null?void 0:h.length)>0&&T.unshift({type:"polygon",annotation:__spreadProps(__spreadValues({id:x,pointList:h},i),{stroke:z,fill:"rgba(255, 255, 255, 0.6)"})}),T},[]),V=F[(m=n==null?void 0:n.path)!=null?m:""];V&&_.isNumber((j=n==null?void 0:n.calib)==null?void 0:j.groundHeight)&&q.forEach(d=>{const u=d.pointList.map(a=>{var C;return __spreadProps(__spreadValues({},a),{z:(C=n==null?void 0:n.calib)==null?void 0:C.groundHeight})}),g=lbAnnotation.pointListLidar2Img(u,n==null?void 0:n.calib,V);if(g){const a=lbUtils.toolStyleConverter.getColorFromConfig({attribute:d.attribute},__spreadProps(__spreadValues({},l),{attributeConfigurable:!0}),{});R.push({type:"polygon",annotation:__spreadProps(__spreadValues({id:d.id,pointList:g},i),{stroke:a==null?void 0:a.stroke,fill:O.includes(d.id)?a==null?void 0:a.fill:"rgba(255, 255, 255, 0.6)"})})}}),r.push({annotations:R,url:n==null?void 0:n.url,calName:(N=n==null?void 0:n.calib)==null?void 0:N.calName,calib:n==null?void 0:n.calib,path:n==null?void 0:n.path})}),K(r)}},[L,e==null?void 0:e.mappingImgList,x,f,b,q,F,O]),React.useEffect(()=>(window.addEventListener("keydown",S),()=>{window.removeEventListener("keydown",S)}),[s]);const S=o=>{const{keyCode:i}=o;switch(i){case EKeyCode.Esc:y&&P(!1);break;case EKeyCode.Left:k();break;case EKeyCode.Right:I();break}},k=()=>{s===void 0||!y||Number(s)>0&&E(s-1)},I=()=>{s===void 0||!y||Number(s)<(c==null?void 0:c.length)-1&&E(s+1)},U=({viewDataPointList:o,pointCloudBox:i,defaultViewStyle:r,stroke:n})=>o?o.map(m=>({type:m.type,annotation:__spreadProps(__spreadValues({id:i.id,pointList:m.pointList},r),{stroke:n})})):[],$=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),G=React__default.default.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},React__default.default.createElement("img",{src:icon_left_squareOutlined,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>k()}),React__default.default.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),React__default.default.createElement("img",{src:icon_right_squareOutlined,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>I()}),React__default.default.createElement("img",{src:icon_esc,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{P(!1),E(void 0)}}),React__default.default.createElement("span",null,"\u952E\u9000\u51FA"));return(c==null?void 0:c.length)>0?React__default.default.createElement(React__default.default.Fragment,null,c.map((o,i)=>{const r=y&&i===s;return React__default.default.createElement(PointCloudLayout.PointCloudContainer,{className:classNames__default.default({[dom.getClassName("point-cloud-2d-container")]:!0,[dom.getClassName("point-cloud-container","zoom")]:r}),title:React__default.default.createElement(ContainerTitle,{showEnlarge:r,isEnlargeTopView:p,data:o,setIsEnlarge:P,setCurIndex:E,curIndex:s,index:i,annotations2d:c}),titleOnSurface:!r,style:{display:$?"none":"flex",width:r?"100%":t},key:i,toolbar:G},(o==null?void 0:o.annotations)&&(o==null?void 0:o.url)&&React__default.default.createElement(PointCloud2DSingleView,{currentData:e,view2dData:o,setSelectedID:M,showEnlarge:r,checkMode:w}))})):null};var PointCloud2DView$1=reactRedux.connect(map.a2MapStateToProps,null,null,{context:ctx.LabelBeeContext})(PointCloud2DView);module.exports=PointCloud2DView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,i)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,__spreadValues=(e,t)=>{for(var i in t||(t={}))__hasOwnProp.call(t,i)&&__defNormalProp(e,i,t[i]);if(__getOwnPropSymbols)for(var i of __getOwnPropSymbols(t))__propIsEnum.call(t,i)&&__defNormalProp(e,i,t[i]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,i)=>new Promise((a,o)=>{var d=u=>{try{c(i.next(u))}catch(h){o(h)}},P=u=>{try{c(i.throw(u))}catch(h){o(h)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(d,P);c((i=i.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,i,a,o)=>{const{x:d,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,u={center:{x:d,y:P,z:c},id:e.id},h=a?__spreadValues(__spreadValues({},a),u):__spreadProps(__spreadValues({},u),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},topViewPolygon2PointCloud=(e,t,i,a,o,d)=>{let P=e.pointList.map(L=>lbUtils.PointCloudUtils.transferCanvas2World(L,t)),c=0,u=1,h={};if(i){const L=i.getSensesPointZAxisInPolygon(P,void 0,d);d&&L.fittedCoordinates.length>0&&(P=L.fittedCoordinates),c=(L.maxZ+L.minZ)/2,u=L.maxZ-L.minZ,h={count:L.zCount}}const[v,b,T]=P,V=lbAnnotation.MathUtils.getLineCenterPoint([v,T]),_=lbAnnotation.MathUtils.getLineLength(v,b),D=lbAnnotation.MathUtils.getLineLength(b,T),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);a&&(c=a.center.z,u=a.depth);const k={center:{x:V.x,y:V.y,z:c},width:d?D+INTELLIGENT_FIT_MARGIN:D,height:d?_+INTELLIGENT_FIT_MARGIN:_,depth:u,rotation:A,id:e.id},O=__spreadValues(a?__spreadValues(__spreadValues({},a),k):__spreadProps(__spreadValues({},k),{attribute:"",valid:!0}),h);o&&Object.assign(O,o);const z=P.map(L=>lbUtils.PointCloudUtils.transferWorld2Canvas(L,t));return{boxParams:O,newPointList:z}},sideViewPoint2PointCloud=(e,t,i)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x-a.x,y:i.center.y,z:i.center.z-a.y}})},sideViewPolygon2PointCloud=(e,t,i,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,k=lbAnnotation.MathUtils.getLineLength(d,P),O=lbAnnotation.MathUtils.getLineLength(u,h),z=k-O,{newBoxParams:L}=a.getNewBoxBySideUpdate(V,z,A,i);return L},backViewPoint2PointCloud=(e,t,i)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},i),{center:{x:i.center.x,y:i.center.y-a.x,z:i.center.z-a.y}})},backViewPolygon2PointCloud=(e,t,i,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,k=lbAnnotation.MathUtils.getLineLength(d,P),O=lbAnnotation.MathUtils.getLineLength(u,h),z=k-O;let{newBoxParams:L}=a.getNewBoxByBackUpdate(V,z,A,i);return L},syncSideViewByPoint=(e,t,i,a,o)=>{var d;if(!i)return;const{toolInstance:P,pointCloudInstance:c}=i;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeSideView=(e,t,i,a)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=i;d.loadPCDFileByBox(a,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxSidePolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,i,a,o)=>{var d;if(!i)return;const{toolInstance:P,pointCloudInstance:c}=i;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeBackView=(e,t,i,a)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=i;d.loadPCDFileByBox(a,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxBackPolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,i,a)=>{if(!i||!a)return;a.generateSphere(e),a.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:o,pointCloudInstance:d}=i,{point2d:P}=d.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},synchronizeTopView=(e,t,i,a)=>{var o,d;if(!i||!a)return;a.generateBox(e,t.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),h=[...P.polygonList],v=h.find(b=>b.id===t.id);v?(v.pointList=u,v.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=e.valid)!=null?d:!0}),P.setResultAndSelectedID(h,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:i,backViewInstance:a,mainViewInstance:o,addPointCloudBox:d,addPointCloudSphere:P,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:h,pointCloudSphereList:v,hideAttributes:b,setHighlight2DDataList:T,cuboidBoxIn2DView:V,imageSizes:_}=e,{addHistory:D,initHistory:A,pushHistoryUnderUpdatePolygon:k}=useHistory.useHistory(),{selectedPolygon:O}=usePolygon.usePolygon(),{getPointCloudSphereByID:z,updatePointCloudSphere:L,selectedSphere:q}=useSphere.useSphere(),{currentData:j,config:m}=ctx.useSelector(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,s).config)}}),R=ctx.useDispatch(),tt=ahooks.useLatest(V),W=n=>{if(!tt.current){const{mappingImgList:s=[]}=j,p=s.map(r=>index.getRectPointCloudBox({pointCloudBox:n,mappingData:r,imageSizes:_}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:I,updateSelectedBox:ot,updateSelectedBoxes:Z,getPointCloudByID:et}=useSingleBox.useSingleBox({generateRects:W}),{t:nt}=reactI18next.useTranslation(),X=I==null?void 0:I.info;if(!t||!i||!a)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:G}=t,it=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},st=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},rt=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const C={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const g=topViewPoint2PointCloud(n,s,G,void 0,C);c(n.id);const f=P(g);H(PointCloudView.Top,n,g,p,f,m),D({newSphereParams:g})},lt=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:C})=>{var g,f;const x={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};r===!0&&Object.assign(x,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:v})});const B=t==null?void 0:t.toolInstance,w=__spreadValues({},n);let{boxParams:y,newPointList:U}=topViewPolygon2PointCloud(w,s,G,void 0,x,C);if(y=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[y],stepConfig:m,action:"viewUpdateBox"}))[0],(m==null?void 0:m.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<m.lowerLimitPointsNumInBox){antd.message.info(nt("LowerLimitPointsNumInBox",{num:m.lowerLimitPointsNumInBox})),B.deletePolygon(y.id);return}C&&(U==null?void 0:U.length)&&(w.pointList=U);const S=b.includes(w.attribute);W(y);const N=d(y),Q=(f=e==null?void 0:e.polygonList)!=null?f:[];t==null||t.updatePolygonList(N!=null?N:[],Q),S?c([]):(c(y.id),B.selection.setSelectedIDs(w.id),E({omitView:PointCloudView.Top,polygon:w,boxParams:y,zoom:l,newPointCloudBoxList:N}),C&&synchronizeTopView(y,w,t,o)),D({newBoxParams:y})},at=n=>{const{boxID:s,imageName:p,width:r,height:l,x:C,y:g}=n,f=h.find(x=>x.id===s);if(f==null?void 0:f.rects){const{rects:x=[]}=f,B=x.find(w=>w.imageName===p);if(B){let w=x;const y=__spreadProps(__spreadValues({},B),{width:r,height:l,x:C,y:g});w=x.map(S=>S===B?y:S);const U=__spreadProps(__spreadValues({},f),{rects:w}),M=h.map(S=>S===f?U:S);return t==null||t.updatePolygonList(M!=null?M:[]),M}}},dt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const C=t==null?void 0:t.toolInstance;if(!(u.length===0||!C)){if(n||(I==null?void 0:I.info)){const g=n!=null?n:I==null?void 0:I.info;(l=C==null?void 0:C.selection)==null||l.setSelectedIDs(u[0]);const f=C.selectedPolygon;if(u.length===1&&g){E({omitView:PointCloudView.Top,polygon:f,boxParams:g,newPointCloudBoxList:s});return}}if((p||q)&&u.length===1){const g=p!=null?p:q;C.setSelectedID(u[0]);const f=C.selectedPoint;g&&H(PointCloudView.Top,f,g,void 0,r,m)}}},Y=(n,s,p)=>{if(X){let r,l;switch(p){case PointCloudView.Back:r=backViewPolygon2PointCloud;break;case PointCloudView.Side:r=sideViewPolygon2PointCloud;break;default:r=sideViewPolygon2PointCloud;break}l=r(n,s,X,i.pointCloudInstance);const g=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[l],stepConfig:m,action:"viewUpdateBox"}))[0],f=l.valid!==g.valid;if(l=g,o){const{count:B}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=__spreadProps(__spreadValues({},l),{count:B})}const x=ot(l);return l=x.find(B=>B.id===l.id),E({omitView:f?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},J=(n,s,p)=>{if(q){let r,l;switch(p){case PointCloudView.Back:r=backViewPoint2PointCloud;break;case PointCloudView.Side:r=sideViewPoint2PointCloud;break;default:r=sideViewPoint2PointCloud;break}l=r(n,s,q);const C=L(l);return H(p,n,l,void 0,C,m),C}},ct=(n,s)=>{J(n,s,PointCloudView.Side)},ut=(n,s)=>{J(n,s,PointCloudView.Back)},pt=(n,s)=>{Y(n,s,PointCloudView.Side)},Pt=(n,s)=>{Y(n,s,PointCloudView.Back)},Ct=(n,s)=>{const p=z(n.id),r=topViewPoint2PointCloud(n,s,G,p),l=L(r);H(PointCloudView.Top,n,r,void 0,l,m)},gt=(n,s)=>{if(O){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>lbUtils.PointCloudUtils.transferCanvas2World(l,s)),k(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=et(r.id),{boxParams:C}=topViewPolygon2PointCloud(r,s,t.pointCloudInstance,l);return C});if(p=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:m,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=Z(p);E({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=Z(p);r&&e.syncAllViewPointCloudColor(r)}},ht=n=>{var s,p,r,l,C;if(I){const g=Number(n.widthDefault),f=Number(n.depthDefault),x=Number(n.heightDefault),B=I==null?void 0:I.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(F=>(F==null?void 0:F.trackID)===B),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(C=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:C.height},M=y.pointList.map(F=>lbUtils.PointCloudUtils.transferCanvas2World(F,U)),S=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(M,x,g),N=S[0],Q=S[2],K=lbAnnotation.MathUtils.getLineCenterPoint([N,Q]),ft=I.info.center.z-I.info.depth/2,$=__spreadProps(__spreadValues({},I.info),{center:{x:K.x,y:K.y,z:ft+f/2},width:g,height:x,depth:f,valid:!0}),xt=Z([$]);E({omitView:PointCloudView["3D"],polygon:y,boxParams:$,newPointCloudBoxList:xt})}},H=(n,s,p,r,l,C)=>__async(void 0,null,function*(){const g=j==null?void 0:j.url,f={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,s,i,g,C)},[PointCloudView.Back]:()=>{a&&syncBackViewByPoint(p,s,a,g,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,s,t,o)}};Object.keys(f).forEach(x=>{x!==n&&f[x]()}),r&&(o==null||o.updateCameraZoom(r)),st(p)}),E=n=>__async(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:C}=n,g=j==null?void 0:j.url;C&&(yield e.syncAllViewPointCloudColor(C));const f={[PointCloudView.Side]:()=>{synchronizeSideView(r,p,i,g)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(r,p,a,g)},[PointCloudView.Top]:()=>{synchronizeTopView(r,p,t,o)}};Object.keys(f).forEach(x=>{x!==s&&f[x]()}),l&&(o==null||o.updateCameraZoom(l)),it(r)});return{topViewAddSphere:rt,topViewAddBox:lt,topViewSelectedChanged:dt,topViewUpdatePoint:Ct,sideViewUpdatePoint:ct,backViewUpdatePoint:ut,topViewUpdateBox:gt,sideViewUpdateBox:pt,backViewUpdateBox:Pt,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=lbUtils.PointCloudUtils.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>__async(void 0,[...n],function*(s=j){var p,r,l,C,g,f;if(!(s==null?void 0:s.url)||!o)return;T([]),actionCreators.SetPointCloudLoading(R,!0),actionCreators.SetLoadPCDFileLoading(R,!0),yield o.loadPCDFile(s.url,(p=m==null?void 0:m.radius)!=null?p:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],B=[],w=[],y=[];o.updateTopCamera();const U=(l=(r=index.jsonParser(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(C=e.sideViewInstance)==null||C.clearAllData(),(g=e.backViewInstance)==null||g.clearAllData(),t.updateData(s.url,s.result,{radius:(f=m==null?void 0:m.radius)!=null?f:DEFAULT_RADIUS}),s.result&&(x=lbUtils.PointCloudUtils.getBoxParamsFromResultList(s.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(s.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(s.result),y=lbUtils.PointCloudUtils.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),A({pointCloudBoxList:x,polygonList:w,lineList:B,pointCloudSphereList:y}),actionCreators.SetPointCloudLoading(R,!1),actionCreators.SetLoadPCDFileLoading(R,!1)}),updateViewsByDefaultSize:ht,generateRects:W,update2DViewRect:at}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var lbAnnotation=require("@labelbee/lb-annotation"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),PointCloudContext=require("../PointCloudContext.js"),useSingleBox=require("./useSingleBox.js"),useSphere=require("./useSphere.js"),ctx=require("../../../store/ctx.js"),StepUtils=require("../../../utils/StepUtils.js"),index=require("../../../utils/index.js"),actionCreators=require("../../../store/annotation/actionCreators.js"),antd=require("antd"),reactI18next=require("react-i18next"),useHistory=require("./useHistory.js"),usePolygon=require("./usePolygon.js"),ahooks=require("ahooks"),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t)),__async=(e,t,n)=>new Promise((a,o)=>{var d=u=>{try{c(n.next(u))}catch(h){o(h)}},P=u=>{try{c(n.throw(u))}catch(h){o(h)}},c=u=>u.done?a(u.value):Promise.resolve(u.value).then(d,P);c((n=n.apply(e,t)).next())});const DEFAULT_SCOPE=5,DEFAULT_RADIUS=90,INTELLIGENT_FIT_MARGIN=.01,PointCloudView={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},topViewPoint2PointCloud=(e,t,n,a,o)=>{const{x:d,y:P}=lbUtils.PointCloudUtils.transferCanvas2World(e,t),{defaultZ:c}=lbUtils.DEFAULT_SPHERE_PARAMS,u={center:{x:d,y:P,z:c},id:e.id},h=a?__spreadValues(__spreadValues({},a),u):__spreadProps(__spreadValues({},u),{attribute:"",valid:!0});return o&&Object.assign(h,o),h},topViewPolygon2PointCloud=(e,t,n,a,o,d)=>{let P=e.pointList.map(L=>lbUtils.PointCloudUtils.transferCanvas2World(L,t)),c=0,u=1,h={};if(n){const L=n.getSensesPointZAxisInPolygon(P,void 0,d);d&&L.fittedCoordinates.length>0&&(P=L.fittedCoordinates),c=(L.maxZ+L.minZ)/2,u=L.maxZ-L.minZ,h={count:L.zCount}}const[v,b,T]=P,V=lbAnnotation.MathUtils.getLineCenterPoint([v,T]),_=lbAnnotation.MathUtils.getLineLength(v,b),D=lbAnnotation.MathUtils.getLineLength(b,T),A=lbAnnotation.MathUtils.getRadiusFromQuadrangle(e.pointList);a&&(c=a.center.z,u=a.depth);const k={center:{x:V.x,y:V.y,z:c},width:d?D+INTELLIGENT_FIT_MARGIN:D,height:d?_+INTELLIGENT_FIT_MARGIN:_,depth:u,rotation:A,id:e.id},O=__spreadValues(a?__spreadValues(__spreadValues({},a),k):__spreadProps(__spreadValues({},k),{attribute:"",valid:!0}),h);o&&Object.assign(O,o);const z=P.map(L=>lbUtils.PointCloudUtils.transferWorld2Canvas(L,t));return{boxParams:O,newPointList:z}},sideViewPoint2PointCloud=(e,t,n)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x-a.x,y:n.center.y,z:n.center.z-a.y}})},sideViewPolygon2PointCloud=(e,t,n,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,k=lbAnnotation.MathUtils.getLineLength(d,P),O=lbAnnotation.MathUtils.getLineLength(u,h),z=k-O,{newBoxParams:L}=a.getNewBoxBySideUpdate(V,z,A,n);return L},backViewPoint2PointCloud=(e,t,n)=>{const a={x:e.x-t.x,y:e.y-t.y};return __spreadProps(__spreadValues({},n),{center:{x:n.center.x,y:n.center.y-a.x,z:n.center.z-a.y}})},backViewPolygon2PointCloud=(e,t,n,a)=>{const[o,d,P]=e.pointList,[c,u,h]=t.pointList,v=lbAnnotation.MathUtils.getLineCenterPoint([o,P]),b=lbAnnotation.MathUtils.getLineCenterPoint([c,h]),V={x:{x:v.x-b.x,y:v.y-b.y}.x,y:0,z:v.y-b.y},_=lbAnnotation.MathUtils.getLineLength(o,d),D=lbAnnotation.MathUtils.getLineLength(c,u),A=_-D,k=lbAnnotation.MathUtils.getLineLength(d,P),O=lbAnnotation.MathUtils.getLineLength(u,h),z=k-O;let{newBoxParams:L}=a.getNewBoxByBackUpdate(V,z,A,n);return L},syncSideViewByPoint=(e,t,n,a,o)=>{var d;if(!n)return;const{toolInstance:P,pointCloudInstance:c}=n;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Left);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeSideView=(e,t,n,a)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=n;d.loadPCDFileByBox(a,e,{width:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Left);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxSidePolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncBackViewByPoint=(e,t,n,a,o)=>{var d;if(!n)return;const{toolInstance:P,pointCloudInstance:c}=n;c.loadPCDFile(a,(d=o==null?void 0:o.radius)!=null?d:DEFAULT_RADIUS);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,lbUtils.EPerspectiveView.Back);c.setInitCameraPosition(u);const{point2d:h,zoom:v}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=v,c.camera.updateProjectionMatrix(),c.render(),P.initPosition(),P.zoomChangeOnCenter(v),P.setResult([__spreadProps(__spreadValues(__spreadValues({},t),h),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),P.setSelectedID(t.id)},synchronizeBackView=(e,t,n,a)=>{if(!n)return;const{pointCloud2dOperation:o,pointCloudInstance:d}=n;d.loadPCDFileByBox(a,e,{height:DEFAULT_SCOPE,depth:DEFAULT_SCOPE});const{cameraPositionVector:P}=d.updateOrthoCamera(e,lbUtils.EPerspectiveView.Back);d.setInitCameraPosition(P);const{polygon2d:c,zoom:u}=d.getBoxBackPolygon2DCoordinate(e);d.camera.zoom=u,d.camera.updateProjectionMatrix(),d.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},syncTopViewByPoint=(e,t,n,a)=>{if(!n||!a)return;a.generateSphere(e),a.updateCameraBySphere(e,lbUtils.EPerspectiveView.Top),a.render();const{toolInstance:o,pointCloudInstance:d}=n,{point2d:P}=d.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?__spreadProps(__spreadValues(__spreadValues({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},synchronizeTopView=(e,t,n,a)=>{var o,d;if(!n||!a)return;a.generateBox(e,t.id),a.render();const{pointCloud2dOperation:P,pointCloudInstance:c}=n,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),h=[...P.polygonList],v=h.find(b=>b.id===t.id);v?(v.pointList=u,v.valid=(o=e.valid)!=null?o:!0):h.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(d=e.valid)!=null?d:!0}),P.setResultAndSelectedID(h,t.id)},usePointCloudViews=()=>{const e=React.useContext(PointCloudContext.PointCloudContext),{topViewInstance:t,sideViewInstance:n,backViewInstance:a,mainViewInstance:o,addPointCloudBox:d,addPointCloudSphere:P,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:h,pointCloudSphereList:v,hideAttributes:b,setHighlight2DDataList:T,cuboidBoxIn2DView:V,imageSizes:_}=e,{addHistory:D,initHistory:A,pushHistoryUnderUpdatePolygon:k}=useHistory.useHistory(),{selectedPolygon:O}=usePolygon.usePolygon(),{getPointCloudSphereByID:z,updatePointCloudSphere:L,selectedSphere:q}=useSphere.useSphere(),{currentData:j,config:m}=ctx.useSelector(i=>{const{stepList:r,step:p,imgList:s,imgIndex:l}=i.annotation;return{currentData:s[l],config:index.jsonParser(StepUtils.getCurrentStepInfo(p,r).config)}}),R=ctx.useDispatch(),tt=ahooks.useLatest(V),W=i=>{if(!tt.current){const{mappingImgList:r=[]}=j,p=r.map(s=>index.getRectPointCloudBox({pointCloudBox:i,mappingData:s,imageSizes:_}));Object.assign(i,{rects:p.filter(s=>s!==void 0)})}},{selectedBox:I,updateSelectedBox:ot,updateSelectedBoxes:Z,getPointCloudByID:et}=useSingleBox.useSingleBox({generateRects:W}),{t:it}=reactI18next.useTranslation(),X=I==null?void 0:I.info;if(!t||!n||!a)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:G}=t,nt=i=>{o==null||o.generateBox(i),o==null||o.controls.update(),o==null||o.render()},st=i=>{o==null||o.generateSphere(i),o==null||o.controls.update(),o==null||o.render()},rt=({newPoint:i,size:r,zoom:p,trackConfigurable:s})=>{var l;const C={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};s===!0&&Object.assign(C,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:v})});const g=topViewPoint2PointCloud(i,r,G,void 0,C);c(i.id);const f=P(g);H(PointCloudView.Top,i,g,p,f,m),D({newSphereParams:g})},lt=({polygon:i,size:r,imgList:p,trackConfigurable:s,zoom:l,intelligentFit:C})=>{var g,f;const x={attribute:(g=t.toolInstance.defaultAttribute)!=null?g:""};s===!0&&Object.assign(x,{trackID:lbUtils.PointCloudUtils.getNextTrackID({imgList:[],extraBoxList:h,extraSphereList:v})});const B=t==null?void 0:t.toolInstance,w=__spreadValues({},i);let{boxParams:y,newPointList:U}=topViewPolygon2PointCloud(w,r,G,void 0,x,C);if(y=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[y],stepConfig:m,action:"viewUpdateBox"}))[0],(m==null?void 0:m.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<m.lowerLimitPointsNumInBox){antd.message.info(it("LowerLimitPointsNumInBox",{num:m.lowerLimitPointsNumInBox})),B.deletePolygon(y.id);return}C&&(U==null?void 0:U.length)&&(w.pointList=U);const S=b.includes(w.attribute);W(y);const N=d(y),Q=(f=e==null?void 0:e.polygonList)!=null?f:[];t==null||t.updatePolygonList(N!=null?N:[],Q),S?c([]):(c(y.id),B.selection.setSelectedIDs(w.id),E({omitView:PointCloudView.Top,polygon:w,boxParams:y,zoom:l,newPointCloudBoxList:N}),C&&synchronizeTopView(y,w,t,o)),D({newBoxParams:y})},at=i=>{const{boxID:r,imageName:p,width:s,height:l,x:C,y:g}=i,f=h.find(x=>x.id===r);if(f==null?void 0:f.rects){const{rects:x=[]}=f,B=x.find(w=>w.imageName===p);if(B){let w=x;const y=__spreadProps(__spreadValues({},B),{width:s,height:l,x:C,y:g});w=x.map(S=>S===B?y:S);const U=__spreadProps(__spreadValues({},f),{rects:w}),M=h.map(S=>S===f?U:S);return t==null||t.updatePolygonList(M!=null?M:[]),M}}},dt=({newSelectedBox:i,newPointCloudList:r,newSelectedSphere:p,newSphereList:s})=>{var l;const C=t==null?void 0:t.toolInstance;if(!(u.length===0||!C)){if(i||(I==null?void 0:I.info)){const g=i!=null?i:I==null?void 0:I.info;(l=C==null?void 0:C.selection)==null||l.setSelectedIDs(u[0]);const f=C.selectedPolygon;if(u.length===1&&g){E({omitView:PointCloudView.Top,polygon:f,boxParams:g,newPointCloudBoxList:r});return}}if((p||q)&&u.length===1){const g=p!=null?p:q;C.setSelectedID(u[0]);const f=C.selectedPoint;g&&H(PointCloudView.Top,f,g,void 0,s,m)}}},Y=(i,r,p)=>{if(X){let s,l;switch(p){case PointCloudView.Back:s=backViewPolygon2PointCloud;break;case PointCloudView.Side:s=sideViewPolygon2PointCloud;break;default:s=sideViewPolygon2PointCloud;break}l=s(i,r,X,n.pointCloudInstance);const g=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:[l],stepConfig:m,action:"viewUpdateBox"}))[0],f=l.valid!==g.valid;if(l=g,o){const{count:B}=o.getSensesPointZAxisInPolygon(lbAnnotation.getCuboidFromPointCloudBox(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=__spreadProps(__spreadValues({},l),{count:B})}const x=ot(l);return l=x.find(B=>B.id===l.id),E({omitView:f?void 0:p,polygon:i,boxParams:l,newPointCloudBoxList:x}),x}},J=(i,r,p)=>{if(q){let s,l;switch(p){case PointCloudView.Back:s=backViewPoint2PointCloud;break;case PointCloudView.Side:s=sideViewPoint2PointCloud;break;default:s=sideViewPoint2PointCloud;break}l=s(i,r,q);const C=L(l);return H(p,i,l,void 0,C,m),C}},ct=(i,r)=>{J(i,r,PointCloudView.Side)},ut=(i,r)=>{J(i,r,PointCloudView.Back)},pt=(i,r)=>{Y(i,r,PointCloudView.Side)},Pt=(i,r)=>{Y(i,r,PointCloudView.Back)},Ct=(i,r)=>{const p=z(i.id),s=topViewPoint2PointCloud(i,r,G,p),l=L(s);H(PointCloudView.Top,i,s,void 0,l,m)},gt=(i,r)=>{if(O){const s=__spreadValues({},i[0].newPolygon);s.pointList=s.pointList.map(l=>lbUtils.PointCloudUtils.transferCanvas2World(l,r)),k(s);return}let p=i.map(({newPolygon:s})=>{const l=et(s.id),{boxParams:C}=topViewPolygon2PointCloud(s,r,t.pointCloudInstance,l);return C});if(p=R(actionCreators.PreDataProcess({tool:lbAnnotation.EPointCloudName.PointCloud,dataList:p,stepConfig:m,action:"viewUpdateBox"})),p.length===1){const{newPolygon:s}=i[0],l=Z(p);E({polygon:s,boxParams:p[0],newPointCloudBoxList:l})}else{const s=Z(p);s&&e.syncAllViewPointCloudColor(s)}},ht=i=>{var r,p,s,l,C;if(I){const g=Number(i.widthDefault),f=Number(i.depthDefault),x=Number(i.heightDefault),B=I==null?void 0:I.info.trackID,y=((r=t==null?void 0:t.toolInstance)==null?void 0:r.polygonList).find(F=>(F==null?void 0:F.trackID)===B),U={width:(s=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:s.width,height:(C=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:C.height},M=y.pointList.map(F=>lbUtils.PointCloudUtils.transferCanvas2World(F,U)),S=lbAnnotation.MathUtils.getModifiedRectangleCoordinates(M,x,g),N=S[0],Q=S[2],K=lbAnnotation.MathUtils.getLineCenterPoint([N,Q]),ft=I.info.center.z-I.info.depth/2,$=__spreadProps(__spreadValues({},I.info),{center:{x:K.x,y:K.y,z:ft+f/2},width:g,height:x,depth:f,valid:!0}),xt=Z([$]);E({omitView:PointCloudView["3D"],polygon:y,boxParams:$,newPointCloudBoxList:xt})}},H=(i,r,p,s,l,C)=>__async(void 0,null,function*(){const g=j==null?void 0:j.url,f={[PointCloudView.Side]:()=>{syncSideViewByPoint(p,r,n,g,C)},[PointCloudView.Back]:()=>{a&&syncBackViewByPoint(p,r,a,g,C)},[PointCloudView.Top]:()=>{syncTopViewByPoint(p,r,t,o)}};Object.keys(f).forEach(x=>{x!==i&&f[x]()}),s&&(o==null||o.updateCameraZoom(s)),st(p)}),E=i=>__async(void 0,null,function*(){const{omitView:r,polygon:p,boxParams:s,zoom:l,newPointCloudBoxList:C}=i,g=j==null?void 0:j.url;C&&(yield e.syncAllViewPointCloudColor(C));const f={[PointCloudView.Side]:()=>{synchronizeSideView(s,p,n,g)},[PointCloudView.Back]:()=>{a&&synchronizeBackView(s,p,a,g)},[PointCloudView.Top]:()=>{synchronizeTopView(s,p,t,o)}};Object.keys(f).forEach(x=>{x!==r&&f[x]()}),l&&(o==null||o.updateCameraZoom(l)),nt(s)});return{topViewAddSphere:rt,topViewAddBox:lt,topViewSelectedChanged:dt,topViewUpdatePoint:Ct,sideViewUpdatePoint:ct,backViewUpdatePoint:ut,topViewUpdateBox:gt,sideViewUpdateBox:pt,backViewUpdateBox:Pt,pointCloudBoxListUpdated:i=>{t.updatePolygonList(i),o==null||o.generateBoxes(i)},initPointCloud3d:i=>{if(!o)return;const r=lbUtils.PointCloudUtils.getDefaultOrthographicParams(i);o.initOrthographicCamera(r),o.initRenderer(),o.render()},updatePointCloudData:(...i)=>__async(void 0,[...i],function*(r=j){var p,s,l,C,g,f;if(!(r==null?void 0:r.url)||!o)return;T([]),actionCreators.SetPointCloudLoading(R,!0),actionCreators.SetLoadPCDFileLoading(R,!0),yield o.loadPCDFile(r.url,(p=m==null?void 0:m.radius)!=null?p:DEFAULT_RADIUS),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],B=[],w=[],y=[];o.updateTopCamera();const U=(l=(s=index.jsonParser(r.result))==null?void 0:s.valid)!=null?l:!0;e.setPointCloudValid(U),(C=e.sideViewInstance)==null||C.clearAllData(),(g=e.backViewInstance)==null||g.clearAllData(),t.updateData(r.url,r.result,{radius:(f=m==null?void 0:m.radius)!=null?f:DEFAULT_RADIUS}),r.result&&(x=lbUtils.PointCloudUtils.getBoxParamsFromResultList(r.result),w=lbUtils.PointCloudUtils.getPolygonListFromResultList(r.result),B=lbUtils.PointCloudUtils.getLineListFromResultList(r.result),y=lbUtils.PointCloudUtils.getSphereParamsFromResultList(r.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),A({pointCloudBoxList:x,polygonList:w,lineList:B,pointCloudSphereList:y}),actionCreators.SetPointCloudLoading(R,!1),actionCreators.SetLoadPCDFileLoading(R,!1)}),updateViewsByDefaultSize:ht,generateRects:W,update2DViewRect:at}};exports.syncBackViewByPoint=syncBackViewByPoint,exports.syncSideViewByPoint=syncSideViewByPoint,exports.syncTopViewByPoint=syncTopViewByPoint,exports.synchronizeBackView=synchronizeBackView,exports.synchronizeSideView=synchronizeSideView,exports.synchronizeTopView=synchronizeTopView,exports.topViewPoint2PointCloud=topViewPoint2PointCloud,exports.topViewPolygon2PointCloud=topViewPolygon2PointCloud,exports.usePointCloudViews=usePointCloudViews;
|
package/dist/index.css
CHANGED
|
@@ -2436,6 +2436,28 @@
|
|
|
2436
2436
|
background-color: #eeefff;
|
|
2437
2437
|
border: 1px solid #666fff;
|
|
2438
2438
|
}
|
|
2439
|
+
.bee-LLMView__answer {
|
|
2440
|
+
flex: 1;
|
|
2441
|
+
}
|
|
2442
|
+
.bee-LLMView__loading {
|
|
2443
|
+
display: inline-flex;
|
|
2444
|
+
align-items: center;
|
|
2445
|
+
gap: 0 4px;
|
|
2446
|
+
}
|
|
2447
|
+
.bee-LLMView__failed {
|
|
2448
|
+
color: #f26549;
|
|
2449
|
+
}
|
|
2450
|
+
.bee-LLMView__footer {
|
|
2451
|
+
display: flex;
|
|
2452
|
+
justify-content: end;
|
|
2453
|
+
}
|
|
2454
|
+
.bee-LLMView__footer span {
|
|
2455
|
+
display: inline-flex;
|
|
2456
|
+
align-items: center;
|
|
2457
|
+
color: #666fff;
|
|
2458
|
+
gap: 0 4px;
|
|
2459
|
+
cursor: pointer;
|
|
2460
|
+
}
|
|
2439
2461
|
|
|
2440
2462
|
.bee-LLMSidebar {
|
|
2441
2463
|
overflow-y: auto;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoPlayer/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$4=require("./components/predictTracking/predictTrackingIcon/index.js"),index$3=require("./components/LLMToolView/index.js"),index$5=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$6=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,a]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;a(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$4,exports.LLMToolView=index$3,exports.SwitchCuboidBoxIn2DView=index$5,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$6.EDataFormatType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$6.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$6.ESubmitType}}),exports.componentCls=index$6.componentCls,exports.prefix=index$6.prefix,exports.default=index,exports.store=store;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var index$1=require("./components/AnnotationView/index.js"),pointCloudAnnotationView=require("./components/AnnotationView/pointCloudAnnotationView.js"),index$2=require("./components/LLMToolView/questionView/index.js"),lbUtils=require("@labelbee/lb-utils"),React=require("react"),reactI18next=require("react-i18next"),reactRedux=require("react-redux"),App=require("./App.js"),configureStore=require("./configureStore.js"),actionCreators=require("./store/annotation/actionCreators.js"),TagToolInstanceAdaptorI18nProvider=require("./components/videoPlayer/TagToolInstanceAdaptorI18nProvider.js"),PointCloudContext=require("./components/pointCloudView/PointCloudContext.js"),ctx=require("./store/ctx.js"),index$4=require("./components/predictTracking/predictTrackingIcon/index.js"),index$3=require("./components/LLMToolView/index.js"),index$5=require("./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js"),index$6=require("./constant/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const store=configureStore(),OutputApp=(e,t)=>{const[r,a]=React.useState();return React.useImperativeHandle(t,()=>({toolInstance:r,annotationEngine:store.getState().annotation.annotationEngine,pageBackwardActions:()=>store.dispatch(actionCreators.PageBackward()),pageForwardActions:()=>store.dispatch(actionCreators.PageForward()),pageJump:o=>{const n=~~o-1;store.dispatch(actionCreators.PageJump(n))},hello:()=>alert("hello labelBee!!!")}),[r]),React__default.default.createElement(reactRedux.Provider,{store,context:ctx.LabelBeeContext},React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(PointCloudContext.PointCloudProvider,null,React__default.default.createElement(App,__spreadProps(__spreadValues({},e),{setToolInstance:o=>{var n;a(o),(n=e.onLoad)==null||n.call(e,{toolInstance:o})}})))))};var index=React__default.default.forwardRef(OutputApp);exports.AnnotationView=index$1,exports.PointCloudAnnotationView=pointCloudAnnotationView,exports.QuestionView=index$2.default,Object.defineProperty(exports,"i18n",{enumerable:!0,get:function(){return lbUtils.i18n}}),exports.VideoTagTool=TagToolInstanceAdaptorI18nProvider.VideoTagTool,exports.PredictTracking=index$4,exports.LLMToolView=index$3,exports.SwitchCuboidBoxIn2DView=index$5,Object.defineProperty(exports,"EDataFormatType",{enumerable:!0,get:function(){return index$6.EDataFormatType}}),Object.defineProperty(exports,"EStepType",{enumerable:!0,get:function(){return index$6.EStepType}}),Object.defineProperty(exports,"ESubmitType",{enumerable:!0,get:function(){return index$6.ESubmitType}}),exports.componentCls=index$6.componentCls,exports.prefix=index$6.prefix,exports.default=index,exports.store=store;
|
package/dist/store/ctx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactRedux=require("react-redux");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LabelBeeContext=React__default.default.createContext(void 0),useDispatch=reactRedux.createDispatchHook(LabelBeeContext),useSelector=reactRedux.createSelectorHook(LabelBeeContext),LLMContext=React__default.default.createContext({hoverKey:-1,setHoverKey:()=>{}});exports.LLMContext=LLMContext,exports.LabelBeeContext=LabelBeeContext,exports.useDispatch=useDispatch,exports.useSelector=useSelector;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactRedux=require("react-redux");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LabelBeeContext=React__default.default.createContext(void 0),useDispatch=reactRedux.createDispatchHook(LabelBeeContext),useSelector=reactRedux.createSelectorHook(LabelBeeContext),LLMContext=React__default.default.createContext({hoverKey:-1,setHoverKey:()=>{},modelAPIResponse:[],setModelAPIResponse:()=>{}});exports.LLMContext=LLMContext,exports.LabelBeeContext=LabelBeeContext,exports.useDispatch=useDispatch,exports.useSelector=useSelector;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PointCloud } from '@labelbee/lb-annotation';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
interface IProps {
|
|
3
4
|
src: string;
|
|
@@ -8,6 +9,7 @@ interface IProps {
|
|
|
8
9
|
};
|
|
9
10
|
backgroundColor?: string;
|
|
10
11
|
isOrthographicCamera?: boolean;
|
|
12
|
+
getInstance?: (Instance: PointCloud) => void;
|
|
11
13
|
}
|
|
12
14
|
declare const PointCloudAnnotationView: (props: IProps) => React.JSX.Element;
|
|
13
15
|
export default PointCloudAnnotationView;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { EDataFormatType } from '@/constant';
|
|
3
|
+
import { IModelAPIAnswer } from '../types';
|
|
4
|
+
interface IProps {
|
|
5
|
+
dataFormatType: EDataFormatType;
|
|
6
|
+
checkMode: boolean;
|
|
7
|
+
annotation?: any;
|
|
8
|
+
modelAPIResponse: IModelAPIAnswer[];
|
|
9
|
+
question: string;
|
|
10
|
+
setModelAPIResponse?: (data: IModelAPIAnswer[]) => void;
|
|
11
|
+
}
|
|
12
|
+
declare const ModelAPIView: React.FC<IProps>;
|
|
13
|
+
export default ModelAPIView;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { IAnswerList } from '@/components/LLMToolView/types';
|
|
2
|
+
import { IAnswerList, IModelAPIAnswer } from '@/components/LLMToolView/types';
|
|
3
3
|
interface IProps {
|
|
4
4
|
hoverKey?: number;
|
|
5
5
|
question: string;
|
|
6
6
|
answerList: IAnswerList[];
|
|
7
|
+
modelAPIResponse: IModelAPIAnswer[];
|
|
8
|
+
setModelAPIResponse?: (data: IModelAPIAnswer[]) => void;
|
|
7
9
|
lang?: string;
|
|
10
|
+
checkMode?: boolean;
|
|
11
|
+
annotation?: any;
|
|
8
12
|
}
|
|
13
|
+
export declare const LLMViewCls: string;
|
|
9
14
|
declare const WrapQuestionView: (props: IProps) => React.JSX.Element;
|
|
10
15
|
export default WrapQuestionView;
|
|
@@ -19,7 +19,25 @@ export interface IAnswerList {
|
|
|
19
19
|
[key: string]: boolean;
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
+
export interface IModelAPIAnswer {
|
|
23
|
+
id: string;
|
|
24
|
+
answer: string;
|
|
25
|
+
}
|
|
26
|
+
declare interface IModelAPIConfig {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
enableAdvanced: boolean;
|
|
30
|
+
endpoint: string;
|
|
31
|
+
authorization: string;
|
|
32
|
+
key: string;
|
|
33
|
+
templateParams?: string;
|
|
34
|
+
template?: any;
|
|
35
|
+
responseSelector?: string;
|
|
36
|
+
secretKey?: string;
|
|
37
|
+
}
|
|
22
38
|
export interface ILLMToolConfig {
|
|
39
|
+
enableModelAPI?: boolean;
|
|
40
|
+
modelAPIConfigList?: IModelAPIConfig[];
|
|
23
41
|
enableSort?: boolean;
|
|
24
42
|
indicatorScore?: IndicatorScore[];
|
|
25
43
|
indicatorDetermine?: IndicatorDetermine[];
|
|
@@ -60,3 +78,4 @@ export interface ILLMBoxResult {
|
|
|
60
78
|
sort?: number[][];
|
|
61
79
|
textAttribute?: ITextList[];
|
|
62
80
|
}
|
|
81
|
+
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { IModelAPIAnswer } from '@/components/LLMToolView/types';
|
|
1
2
|
import React from 'react';
|
|
2
3
|
import { AnyAction, Dispatch } from 'redux';
|
|
3
4
|
interface ILLMContext {
|
|
4
5
|
hoverKey: number;
|
|
5
6
|
setHoverKey: (value: number) => void;
|
|
7
|
+
modelAPIResponse: IModelAPIAnswer[];
|
|
8
|
+
setModelAPIResponse: (value: IModelAPIAnswer[]) => void;
|
|
6
9
|
}
|
|
7
10
|
export declare const LabelBeeContext: any;
|
|
8
11
|
export declare const useDispatch: () => Dispatch<AnyAction | any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var index$4=require("../../../constant/index.js"),es=require("antd/es"),React=require("react"),index$3=require("../sidebar/index.js"),index$2=require("../toolFooter/index.js"),dom=require("../../../utils/dom.js"),index=require("../../../utils/index.js"),ctx=require("../../../store/ctx.js"),index$1=require("../../../components/LLMToolView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{Sider,Content}=es.Layout,layoutCls=`${index$4.prefix}-layout`,LLMLayout=e=>{var t,a;const[l,
|
|
1
|
+
"use strict";var index$4=require("../../../constant/index.js"),es=require("antd/es"),React=require("react"),index$3=require("../sidebar/index.js"),index$2=require("../toolFooter/index.js"),dom=require("../../../utils/dom.js"),index=require("../../../utils/index.js"),ctx=require("../../../store/ctx.js"),index$1=require("../../../components/LLMToolView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const{Sider,Content}=es.Layout,layoutCls=`${index$4.prefix}-layout`,LLMLayout=e=>{var t,a;const[l,n]=React.useState(-1),[r,o]=React.useState([]);return React__default.default.createElement(es.Layout,{className:dom.getClassName("layout","container")},React__default.default.createElement(ctx.LLMContext.Provider,{value:React.useMemo(()=>({hoverKey:l,setHoverKey:n,modelAPIResponse:r,setModelAPIResponse:o}),[l,r])},e==null?void 0:e.leftSider,React__default.default.createElement(Content,{className:index.classnames({[`${layoutCls}__content`]:!0,[`${index$4.prefix}-LLMLayout`]:!0})},React__default.default.createElement(index$1,{checkMode:e.checkMode,showTips:e.showTips,tips:e.tips}),React__default.default.createElement(index$2.default,{style:(t=e.style)==null?void 0:t.footer,mode:e.mode,footer:e==null?void 0:e.footer})),React__default.default.createElement(Sider,{className:`${layoutCls}__side`,width:600,style:{position:"relative"}},React__default.default.createElement(index$3.default,{sider:e==null?void 0:e.sider,checkMode:e==null?void 0:e.checkMode}),(a=e.drawLayerSlot)==null?void 0:a.call(e,{}))))};module.exports=LLMLayout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var C="data:image/svg+xml,%3csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M20.1598 14.4001C21.4852 14.4001 22.5598 13.3256 22.5598 12.0001C22.5598 10.6746 21.4852 9.6001 20.1598 9.6001C18.8343 9.6001 17.7598 10.6746 17.7598 12.0001C17.7598 13.3256 18.8343 14.4001 20.1598 14.4001Z' fill='%23D0D3FF'/%3e%3cpath d='M3.83945 14.4001C5.16494 14.4001 6.23945 13.3256 6.23945 12.0001C6.23945 10.6746 5.16494 9.6001 3.83945 9.6001C2.51397 9.6001 1.43945 10.6746 1.43945 12.0001C1.43945 13.3256 2.51397 14.4001 3.83945 14.4001Z' fill='%23D0D3FF'/%3e%3cpath d='M11.9996 14.4001C13.3251 14.4001 14.3996 13.3256 14.3996 12.0001C14.3996 10.6746 13.3251 9.6001 11.9996 9.6001C10.6741 9.6001 9.59961 10.6746 9.59961 12.0001C9.59961 13.3256 10.6741 14.4001 11.9996 14.4001Z' fill='%239AA0FE'/%3e%3cpath d='M20.1598 14.4001C21.4852 14.4001 22.5598 13.3256 22.5598 12.0001C22.5598 10.6746 21.4852 9.6001 20.1598 9.6001C18.8343 9.6001 17.7598 10.6746 17.7598 12.0001C17.7598 13.3256 18.8343 14.4001 20.1598 14.4001Z' fill='%23666FFF'/%3e%3cpath d='M3.83945 14.4001C5.16494 14.4001 6.23945 13.3256 6.23945 12.0001C6.23945 10.6746 5.16494 9.6001 3.83945 9.6001C2.51397 9.6001 1.43945 10.6746 1.43945 12.0001C1.43945 13.3256 2.51397 14.4001 3.83945 14.4001Z' fill='%234750D8'/%3e%3c/svg%3e";export{C as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{PointCloud as
|
|
1
|
+
import{PointCloud as g}from"@labelbee/lb-annotation";import{PointCloudUtils as i}from"@labelbee/lb-utils";import p,{useRef as f,useCallback as C,useEffect as l}from"react";const h=b=>{const{src:c,result:o,size:n,isOrthographicCamera:s=!1,backgroundColor:v="#ccc",getInstance:u}=b;let d=f();const e=f(),P=C(r=>{d.current=r},[]);return l(()=>{let r={container:d.current,backgroundColor:v,isOrthographicCamera:s};s&&Object.assign(r,{orthographicParams:i.getDefaultOrthographicParams(n)});const a=new g(r);return e.current=a,u&&e.current.on("loadPCDFileEnd",()=>{u(e.current)}),()=>{var t;(t=e.current.renderer)==null||t.forceContextLoss()}},[]),l(()=>{var r,a,t;e.current&&((r=e.current)==null||r.init(),(a=e.current)==null||a.initOrthographicCamera(i.getDefaultOrthographicParams(n)),(t=e.current)==null||t.render())},[n]),l(()=>{var r;e.current&&c&&((r=e.current)==null||r.loadPCDFile(c))},[c]),l(()=>(o&&i.getBoxParamsFromResultList(o).forEach(a=>{var t;(t=e.current)==null||t.generateBox(a,a.id)}),()=>{var r;i.getBoxParamsFromResultList(o).forEach(t=>{var m;(m=e.current)==null||m.removeObjectByName(t.id,"box")}),(r=e.current)==null||r.render()}),[o]),p.createElement("div",{style:n,ref:P})};export{h as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s,{useContext as E,useState as d,useEffect as f}from"react";import{connect as I}from"react-redux";import{LabelBeeContext as j,LLMContext as A}from"../../store/ctx.js";import{message as C}from"antd";import{prefix as h}from"../../constant/index.js";import{Layout as P}from"antd/es";import $ from"./questionView/index.js";import{useTranslation as b}from"react-i18next";import y from"../../views/MainView/annotationTips/index.js";import{getCurrentResultFromResultList as D}from"./utils/data.js";const L=`${h}-LLMView`,N=i=>{const{annotation:a,checkMode:l=!0,tips:v,showTips:x}=i,{imgIndex:e,imgList:r}=a,{hoverKey:w,modelAPIResponse:M,setModelAPIResponse:u}=E(A),[R,T]=d([]),[V,g]=d(""),{t:q}=b();return f(()=>{let t;if(!l)return t=setInterval(()=>{C.info(q("EfficientListening"))},1e3*60),()=>{t&&clearInterval(t)}},[]),f(()=>{var t,c;if(!r[e])return;const n=(t=r[e])==null?void 0:t.questionList,m=(c=r[e])!=null?c:{},o=D(m==null?void 0:m.result),p=(o==null?void 0:o.length)>0?o[0]:o;g(n==null?void 0:n.question),T((n==null?void 0:n.answerList)||[]),u((p==null?void 0:p.modelAPIResponse)||[])},[e]),s.createElement(P,{className:L},s.createElement("div",{className:`${L}-question`},x===!0&&s.createElement(y,{tips:v}),s.createElement($,{hoverKey:w,question:V,answerList:R,modelAPIResponse:M,setModelAPIResponse:u,checkMode:l,annotation:a})))},Q=i=>({annotation:i.annotation});var S=I(Q,null,null,{context:j})(N);export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Tag as x}from"antd";import u from"classnames";import t,{useState as _,useEffect as C}from"react";import h from"../../../assets/annotation/LLMTool/loading.svg.js";import F from"../../longText/index.js";import j from"../../markdownView/index.js";import{EDataFormatType as k}from"../../../constant/index.js";import{getStepConfig as I}from"../../../store/annotation/reducer.js";import{jsonParser as N}from"../../../utils/index.js";import{SyncOutlined as R,InfoCircleFilled as T}from"@ant-design/icons";import{LLMViewCls as f}from"../questionView/index.js";import{i18n as A}from"@labelbee/lb-utils";var b=(s,e,r)=>new Promise((a,m)=>{var c=n=>{try{l(r.next(n))}catch(i){m(i)}},p=n=>{try{l(r.throw(n))}catch(i){m(i)}},l=n=>n.done?a(n.value):Promise.resolve(n.value).then(c,p);l((r=r.apply(s,e)).next())});const $=({dataFormatType:s,answer:e})=>s===k.Markdown?t.createElement(j,{value:e}):t.createElement(F,{wordCount:1e3,text:e}),V=(s,e)=>{var r;return(r=e.find(a=>a.id===s))==null?void 0:r.answer},S=s=>{var e;const{annotation:r={},checkMode:a,dataFormatType:m,modelAPIResponse:c,question:p,setModelAPIResponse:l}=s,{stepList:n,step:i,toolInstance:v}=r,[g,w]=_({}),{enableModelAPI:L=!1,modelAPIConfigList:d=[]}=g,P=o=>{let E=!1;const M=c.map(y=>y.id===o.id?(E=!0,o):y);E||M.push(o),l==null||l(M)};return C(()=>{var o;if(n&&i){const E=(o=I(n,i))==null?void 0:o.config;w(N(E))}},[n,i]),L?(e=d==null?void 0:d.map)==null?void 0:e.call(d,o=>t.createElement(B,{dataFormatType:m,config:o,modelAPIResponse:c,key:o==null?void 0:o.id,toolInstance:v,question:p,updateModelAPIResponse:P,checkMode:a})):null},G=()=>t.createElement("div",{className:u({[`${f}__loading`]:!0})},A.t("AnswersAreBeingGenerated"),t.createElement("img",{src:h})),q=()=>t.createElement("span",{className:u({[`${f}__failed`]:!0})},A.t("AnswerGenerationFailedPleaseTryAgainLater")," ",t.createElement(T,null)),B=({dataFormatType:s,config:e,modelAPIResponse:r,toolInstance:a,question:m,updateModelAPIResponse:c,checkMode:p})=>{const[l,n]=_(!1),[i,v]=_(!1),g=V(e==null?void 0:e.id,r),w=d=>{n(d),a&&(a.loading=d)},L=()=>b(void 0,null,function*(){w(!0),v(!1);try{const d=yield a==null?void 0:a.getAPIAnswer(e,m);c({id:e==null?void 0:e.id,answer:d})}catch(d){v(!0)}finally{w(!1)}});return t.createElement("div",{className:u({[`${f}__content`]:!0}),key:e==null?void 0:e.id},t.createElement(x,{style:{color:"#666FFF",background:"#eeefff",height:"20px",padding:"0px 8px",border:"none"}},e==null?void 0:e.name),t.createElement("div",{className:u({[`${f}__answer`]:!0})},!l&&g&&t.createElement($,{dataFormatType:s,answer:g}),t.createElement("div",{className:u({[`${f}__message`]:!0})},l?t.createElement(G,null):i&&t.createElement(q,null)),!l&&!p&&t.createElement("div",{className:u({[`${f}__footer`]:!0})},t.createElement("span",{onClick:L},A.t("ReGenerate"),t.createElement(R,null)))))};export{S as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useState as
|
|
1
|
+
import e,{useState as h,useEffect as b}from"react";import{Tag as M,Radio as m}from"antd";import d from"../../longText/index.js";import{EDataFormatType as s,prefix as N}from"../../../constant/index.js";import O from"classnames";import{I18nextProvider as T,useTranslation as p}from"react-i18next";import{i18n as u}from"@labelbee/lb-utils";import f from"../../markdownView/index.js";import{FileTextOutlined as V}from"@ant-design/icons";import A from"../modelAPIView/index.js";var B=Object.defineProperty,v=Object.getOwnPropertySymbols,L=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,x=(r,t,n)=>t in r?B(r,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[t]=n,j=(r,t)=>{for(var n in t||(t={}))L.call(t,n)&&x(r,n,t[n]);if(v)for(var n of v(t))$.call(t,n)&&x(r,n,t[n]);return r};const o=`${N}-LLMView`,k=({setDataFormatType:r,dataFormatType:t})=>{const{t:n}=p();return e.createElement("div",{className:`${o}__title`,style:{display:"flex",justifyContent:"space-between"}},n("Title"),e.createElement("span",{style:{display:"flex"}},e.createElement(m.Group,{value:t,onChange:l=>{r(l.target.value)}},e.createElement(m.Button,{value:s.Default,style:{textAlign:"center",width:"52px"}},"</>"),e.createElement(m.Button,{value:s.Markdown,style:{textAlign:"center",width:"52px"}},e.createElement(V,null))),e.createElement("span",{style:{marginLeft:"8px",width:"4px",background:"#1890ff"}})))},F=r=>{const{hoverKey:t,answerList:n,question:l,lang:c,modelAPIResponse:E,setModelAPIResponse:w,checkMode:_=!0}=r,[i,y]=h(s.Default),{t:g}=p();return b(()=>{var a;c&&((a=u)==null||a.changeLanguage(c))},[]),e.createElement("div",{className:o},e.createElement("div",{className:`${o}__textBox`,style:{borderBottom:"1px solid #EBEBEB"}},e.createElement(k,{setDataFormatType:y,dataFormatType:i}),e.createElement("div",{className:`${o}__content`},i===s.Markdown?e.createElement(f,{value:l}):e.createElement(d,{wordCount:200,text:l}))),e.createElement("div",{className:`${o}__textBox`},e.createElement("div",{className:`${o}__title`},g("Answer")),n.map((a,P)=>e.createElement("div",{className:O({[`${o}__content`]:!0,[`${o}__contentActive`]:t===(a==null?void 0:a.order)}),key:P},e.createElement(M,{style:{color:"#666FFF",background:"#eeefff",height:"20px",padding:"0px 8px",border:"none"}},a==null?void 0:a.order),i===s.Markdown?e.createElement(f,{value:a==null?void 0:a.answer}):e.createElement(d,{wordCount:1e3,text:a==null?void 0:a.answer}))),e.createElement(A,{dataFormatType:i,modelAPIResponse:E,question:l,setModelAPIResponse:w,checkMode:_,annotation:r.annotation})))},I=r=>e.createElement(T,{i18n:u},e.createElement(F,j({},r)));export{o as LLMViewCls,I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s,{useState as L,useEffect as y}from"react";import{prefix as
|
|
1
|
+
import s,{useContext as et,useState as L,useEffect as y}from"react";import{prefix as ot}from"../../../constant/index.js";import{Empty as nt,Button as rt}from"antd";import it from"./components/answerSort/index.js";import{connect as st}from"react-redux";import{isNumber as lt,isObject as at}from"lodash";import ct from"./components/answerList/index.js";import{LabelBeeContext as dt,LLMContext as ut}from"../../../store/ctx.js";import{jsonParser as F}from"../../../utils/index.js";import{getStepConfig as mt}from"../../../store/annotation/reducer.js";import{useCustomToolInstance as pt}from"../../../hooks/annotation.js";import{PageForward as E}from"../../../store/annotation/actionCreators.js";import{cKeyCode as ft,EToolName as vt}from"@labelbee/lb-annotation";import{useTranslation as gt}from"react-i18next";import{getCurrentResultFromResultList as V,formatSort as W}from"../utils/data.js";import xt from"../../../assets/annotation/LLMTool/empty.svg.js";import Lt from"./components/textInputBox/index.js";var wt=Object.defineProperty,St=Object.defineProperties,_t=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,ht=Object.prototype.propertyIsEnumerable,z=(i,o,l)=>o in i?wt(i,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):i[o]=l,C=(i,o)=>{for(var l in o||(o={}))bt.call(o,l)&&z(i,l,o[l]);if(k)for(var l of k(o))ht.call(o,l)&&z(i,l,o[l]);return i},G=(i,o)=>St(i,_t(o));const yt=ft.default,j=`${ot}-sidebar`,Et=i=>{var o;const{annotation:l,dispatch:w,checkMode:S}=i,{imgIndex:P,imgList:O,stepList:T,step:D,skipBeforePageTurning:_}=l,{modelAPIResponse:N}=et(ut),{t:I}=gt(),n=(o=O[P])!=null?o:{},H=F(n==null?void 0:n.result),{toolInstanceRef:A}=pt({basicInfo:H}),[v,J]=L({}),[f,M]=L([]),[b,R]=L(void 0),[h,$]=L([]),[Q,U]=L([]);y(()=>{var t;if(T&&D){const e=(t=mt(T,D))==null?void 0:t.config;J(F(e))}},[T,D]),y(()=>{if(!n)return;const t=V(n==null?void 0:n.result);let e=(t==null?void 0:t.answerList)?t:n==null?void 0:n.questionList;(e==null?void 0:e.answerList)&&(X(e.answerList),M(e.answerList||[])),R(t==null?void 0:t.textAttribute)},[P,n]),y(()=>{A.current.exportData=()=>{const a=W(h);return[[{answerList:f,sort:a,textAttribute:b,id:n==null?void 0:n.id,modelAPIResponse:N}],{}]};const t=W(h),e={answerList:f,sort:t,textAttribute:b,id:n==null?void 0:n.id,toolName:vt.LLM,modelAPIResponse:N};A.current.currentPageResult=e},[f,h,b,N]),y(()=>(window.addEventListener("keydown",B),()=>{window.removeEventListener("keydown",B)}),[]);const B=t=>{if(t.ctrlKey&&t.keyCode===yt.Enter){if(_){_(()=>w(E()));return}w(E())}},X=t=>{var e;let a=[],d=[];if((t==null?void 0:t.length)>0){const r=V(n==null?void 0:n.result),m=(r==null?void 0:r.length)>0?r[0]:r;((e=m==null?void 0:m.sort)==null?void 0:e.length)>0&&(d=m.sort.reduce((c,u)=>{let p=[{title:u[0],id:u[0]}];return u.length>1&&(p=u.map(x=>({title:x,id:x}))),[...c,p]},[])),t.forEach(c=>{d.some(p=>p.length>1?p.some(x=>x.id===c.order):p[0].id===c.order)||a.push({title:c.order,id:c.order})})}$(d),U(a)},Y=({order:t,value:e,key:a})=>{const d=f==null?void 0:f.map(r=>{var m;if((r==null?void 0:r.order)===t){if(lt(e))return G(C({},r),{score:e});if(at(e)&&a){const c={[e==null?void 0:e.key]:e.value},u=(m=r[a])!=null?m:{};return G(C({},r),{[a]:C(C({},u),c)})}}return r});M(d)};if((()=>{var t,e;const{indicatorScore:a=[],indicatorDetermine:d=[],text:r=[],enableSort:m}=v,c=((t=a==null?void 0:a.filter(g=>g.label&&g.value&&g.score))==null?void 0:t.length)>0,u=((e=d==null?void 0:d.filter(g=>g.label&&g.value))==null?void 0:e.length)>0,p=(r==null?void 0:r.length)>0;return!(c||u||p||m)})())return s.createElement("div",{className:`${j}`},s.createElement("div",{className:`${j}__content`,style:{display:"flex",justifyContent:"center",alignItems:"center"}},s.createElement(nt,{description:s.createElement("span",{style:{color:"#ccc"}},I("NoScoringScale")),imageStyle:{width:200,height:200},image:s.createElement("img",{src:xt})})));const{indicatorScore:K=[],indicatorDetermine:q=[],enableSort:Z}=v,tt=f.length>0&&((q==null?void 0:q.length)>0||(K==null?void 0:K.length)>0);return s.createElement("div",{className:`${j}`},s.createElement("div",{className:`${j}__content`},Z&&s.createElement(it,{waitSortList:Q,sortList:h,setSortList:$,checkMode:S}),tt&&s.createElement(ct,{list:f,LLMConfig:v,updateValue:Y,checkMode:S}),(v==null?void 0:v.text)&&s.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},s.createElement(Lt,{textAttribute:b||[],LLMConfig:v,setText:R,checkMode:S}))),s.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(O==null?void 0:O.length)-1!==P&&s.createElement(rt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(_){_(()=>w(E()));return}w(E())},disabled:S},I("Save"))))},Ct=i=>({annotation:i.annotation});var jt=st(Ct,null,null,{context:dt})(Et);export{jt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n from"react";import
|
|
1
|
+
import n from"react";import y from"react-markdown";import P from"remark-math";import O from"rehype-katex";import k from"react-syntax-highlighter";import{docco as x}from"react-syntax-highlighter/dist/esm/styles/hljs";import b from"remark-gfm";import"github-markdown-css";import j from"./index.module.scss.js";import{classnames as E}from"../../utils/index.js";var N=Object.defineProperty,S=Object.defineProperties,I=Object.getOwnPropertyDescriptors,o=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,g=(r,e,t)=>e in r?N(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,m=(r,e)=>{for(var t in e||(e={}))f.call(e,t)&&g(r,t,e[t]);if(o)for(var t of o(e))d.call(e,t)&&g(r,t,e[t]);return r},h=(r,e)=>S(r,I(e)),M=(r,e)=>{var t={};for(var a in r)f.call(r,a)&&e.indexOf(a)<0&&(t[a]=r[a]);if(r!=null&&o)for(var a of o(r))e.indexOf(a)<0&&d.call(r,a)&&(t[a]=r[a]);return t};const V=r=>{const{value:e,transformImageUri:t,transformLinkUri:a,components:_}=r,u=v=>{var i=v,{node:D,inline:w,className:s,children:l}=i,c=M(i,["node","inline","className","children"]);const p=/language-(\w+)/.exec(s||"");return!w&&p?n.createElement(k,h(m({},c),{className:"markdown-code-viewer",language:p[1],style:x,PreTag:"div"}),String(l).replace(/\n$/,"")):n.createElement("code",h(m({},c),{className:s}),l)};return n.createElement(y,{className:E({"markdown-body":!0,[j.markdownView]:!0}),remarkPlugins:[b,P],rehypePlugins:[[O,{output:"mathml"}]],transformImageUri:t,transformLinkUri:a,components:m({code:u},_)},e)};export{V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getClassName as
|
|
1
|
+
import{getClassName as G}from"../../utils/dom.js";import i,{useState as L,useContext as ne,useEffect as J}from"react";import{PointCloudContainer as ie}from"./PointCloudLayout.js";import{PointCloudContext as le}from"./PointCloudContext.js";import{connect as re}from"react-redux";import{cKeyCode as se,pointCloudLidar2image as ae,pointListLidar2Img as ue}from"@labelbee/lb-annotation";import{LabelBeeContext as ce}from"../../store/ctx.js";import{a2MapStateToProps as de}from"../../store/annotation/map.js";import{toolStyleConverter as Q}from"@labelbee/lb-utils";import me from"./PointCloud2DSingleView.js";import U from"./components/TitleButton/index.js";import{LeftOutlined as pe}from"@ant-design/icons";import fe from"classnames";import ge from"../../assets/annotation/common/icon_esc.svg.js";import ve from"../../assets/annotation/common/icon_left_squareOutlined.svg.js";import be from"../../assets/annotation/common/icon_right_squareOutlined.svg.js";import{isNumber as ye}from"lodash";var Ee=Object.defineProperty,he=Object.defineProperties,we=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,_e=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,X=(e,n,t)=>n in e?Ee(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t,p=(e,n)=>{for(var t in n||(n={}))_e.call(n,t)&&X(e,t,n[t]);if(W)for(var t of W(n))Ce.call(n,t)&&X(e,t,n[t]);return e},f=(e,n)=>he(e,we(n));const I=se.default,Pe=({showEnlarge:e,isEnlargeTopView:n,data:t,setIsEnlarge:E,setCurIndex:g,curIndex:h=0,index:x,annotations2d:v})=>n?i.createElement(U,{title:t==null?void 0:t.calName,style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}):e?i.createElement("div",{style:{display:"flex",alignItems:"center"}},i.createElement(pe,{style:{cursor:"pointer",marginRight:"12px"},onClick:()=>{E(!1),g(void 0)}}),i.createElement("span",null,t==null?void 0:t.calName),i.createElement("span",{style:{marginLeft:"8px"}},h+1,"/",v==null?void 0:v.length)):i.createElement(U,{title:t==null?void 0:t.calName,onClick:()=>{E(!0),g(x)},style:{background:"rgba(0, 0, 0, 0.74)",color:"#FFFFFF"}}),Le=({currentData:e,config:n,thumbnailWidth:t,isEnlargeTopView:E,highlightAttribute:g,loadPCDFileLoading:h,checkMode:x})=>{var v;const[d,Y]=L([]),{topViewInstance:Z,displayPointCloudList:O,polygonList:j,imageSizes:S,selectedIDs:N}=ne(le),[F,B]=L(""),[w,k]=L(!1),[a,_]=L(void 0);J(()=>{var l;if(!h&&Z&&(e==null?void 0:e.mappingImgList)&&((l=e==null?void 0:e.mappingImgList)==null?void 0:l.length)>0){const r={fill:"transparent",color:"green"};let s=[];e==null||e.mappingImgList.forEach(o=>{var b,z,T;const K=O.reduce((m,c)=>{var y,u;const C=c.id===F||g===c.attribute,{transferViewData:q,viewRangePointList:P}=(y=ae(c,o.calib,{createRange:C}))!=null?y:{};if(!q||!P)return[];const H=(u=Q.getColorFromConfig({attribute:c.attribute},f(p({},n),{attributeConfigurable:!0}),{}))==null?void 0:u.stroke,oe=D({viewDataPointList:q,pointCloudBox:c,defaultViewStyle:r,stroke:H}),M=[...m,...oe];return(P==null?void 0:P.length)>0&&M.unshift({type:"polygon",annotation:f(p({id:F,pointList:P},r),{stroke:H,fill:"rgba(255, 255, 255, 0.6)"})}),M},[]),$=S[(b=o==null?void 0:o.path)!=null?b:""];$&&ye((z=o==null?void 0:o.calib)==null?void 0:z.groundHeight)&&j.forEach(m=>{const c=m.pointList.map(u=>{var C;return f(p({},u),{z:(C=o==null?void 0:o.calib)==null?void 0:C.groundHeight})}),y=ue(c,o==null?void 0:o.calib,$);if(y){const u=Q.getColorFromConfig({attribute:m.attribute},f(p({},n),{attributeConfigurable:!0}),{});K.push({type:"polygon",annotation:f(p({id:m.id,pointList:y},r),{stroke:u==null?void 0:u.stroke,fill:N.includes(m.id)?u==null?void 0:u.fill:"rgba(255, 255, 255, 0.6)"})})}}),s.push({annotations:K,url:o==null?void 0:o.url,calName:(T=o==null?void 0:o.calib)==null?void 0:T.calName,calib:o==null?void 0:o.calib,path:o==null?void 0:o.path})}),Y(s)}},[O,e==null?void 0:e.mappingImgList,F,g,h,j,S,N]),J(()=>(window.addEventListener("keydown",V),()=>{window.removeEventListener("keydown",V)}),[a]);const V=l=>{const{keyCode:r}=l;switch(r){case I.Esc:w&&k(!1);break;case I.Left:R();break;case I.Right:A();break}},R=()=>{a===void 0||!w||Number(a)>0&&_(a-1)},A=()=>{a===void 0||!w||Number(a)<(d==null?void 0:d.length)-1&&_(a+1)},D=({viewDataPointList:l,pointCloudBox:r,defaultViewStyle:s,stroke:o})=>l?l.map(b=>({type:b.type,annotation:f(p({id:r.id,pointList:b.pointList},s),{stroke:o})})):[],ee=!e||!(e==null?void 0:e.mappingImgList)||!(((v=e==null?void 0:e.mappingImgList)==null?void 0:v.length)>0),te=i.createElement("div",{style:{display:"flex",alignItems:"center",fontSize:"14px"}},i.createElement("img",{src:ve,style:{height:"24px",marginRight:"8px",cursor:"pointer"},onClick:()=>R()}),i.createElement("span",{style:{marginRight:"12px"}},"\u952E\u76D8\u5DE6\u952E\u4E0A\u4E00\u5F20"),i.createElement("span",{style:{margin:"0px 8px 0px 12px"}},"\u952E\u76D8\u53F3\u952E\u4E0A\u4E00\u5F20"),i.createElement("img",{src:be,style:{height:"24px",marginRight:"12px",cursor:"pointer"},onClick:()=>A()}),i.createElement("img",{src:ge,style:{height:"24px",margin:"0px 8px 0px 12px",cursor:"pointer"},onClick:()=>{k(!1),_(void 0)}}),i.createElement("span",null,"\u952E\u9000\u51FA"));return(d==null?void 0:d.length)>0?i.createElement(i.Fragment,null,d.map((l,r)=>{const s=w&&r===a;return i.createElement(ie,{className:fe({[G("point-cloud-2d-container")]:!0,[G("point-cloud-container","zoom")]:s}),title:i.createElement(Pe,{showEnlarge:s,isEnlargeTopView:E,data:l,setIsEnlarge:k,setCurIndex:_,curIndex:a,index:r,annotations2d:d}),titleOnSurface:!s,style:{display:ee?"none":"flex",width:s?"100%":t},key:r,toolbar:te},(l==null?void 0:l.annotations)&&(l==null?void 0:l.url)&&i.createElement(me,{currentData:e,view2dData:l,setSelectedID:B,showEnlarge:s,checkMode:x}))})):null};var xe=re(de,null,null,{context:ce})(Le);export{xe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{EPointCloudName as nt,MathUtils as w,getCuboidFromPointCloudBox as Gt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Qt}from"@labelbee/lb-utils";import{useContext as Xt}from"react";import{PointCloudContext as Yt}from"../PointCloudContext.js";import{useSingleBox as qt}from"./useSingleBox.js";import{useSphere as Jt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as ft,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{message as eo}from"antd";import{useTranslation as no}from"react-i18next";import{useHistory as io}from"./useHistory.js";import{usePolygon as so}from"./usePolygon.js";import{useLatest as ro}from"ahooks";var lo=Object.defineProperty,ao=Object.defineProperties,co=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))uo.call(t,i)&&xt(e,i,t[i]);if(mt)for(var i of mt(t))po.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ao(e,co(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,ht=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Qt,u={center:{x:a,y:g,z:c},id:e.id},P=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(B=>V.transferCanvas2World(B,t)),c=0,u=1,P={};if(i){const B=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,P={count:B.zCount}}const[h,S,F]=g,R=w.getLineCenterPoint([h,F]),z=w.getLineLength(h,S),A=w.getLineLength(S,F),N=w.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:R.x,y:R.y,z:c},width:a?A+ht:A,height:a?z+ht:z,depth:u,rotation:N,id:e.id},j=L(d?L(L({},d),T):O(L({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(B=>V.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:E}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(R,E,N,i);return B},go=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},fo=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(R,E,N,i);return B},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},wt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(S=>S.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},Co=()=>{const e=Xt(Yt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:S,setHighlight2DDataList:F,cuboidBoxIn2DView:R,imageSizes:z}=e,{addHistory:A,initHistory:N,pushHistoryUnderUpdatePolygon:T}=io(),{selectedPolygon:j}=so(),{getPointCloudSphereByID:E,updatePointCloudSphere:B,selectedSphere:X}=Jt(),{currentData:W,config:b}=Kt(n=>{const{stepList:s,step:p,imgList:r,imgIndex:l}=n.annotation;return{currentData:r[l],config:ft(to.getCurrentStepInfo(p,s).config)}}),H=$t(),Dt=ro(R),$=n=>{if(!Dt.current){const{mappingImgList:s=[]}=W,p=s.map(r=>oo({pointCloudBox:n,mappingData:r,imageSizes:z}));Object.assign(n,{rects:p.filter(r=>r!==void 0)})}},{selectedBox:_,updateSelectedBox:St,updateSelectedBoxes:tt,getPointCloudByID:_t}=qt({generateRects:$}),{t:Vt}=no(),at=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Ot=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},kt=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},At=({newPoint:n,size:s,zoom:p,trackConfigurable:r})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};r===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,s,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),A({newSphereParams:C})},Ut=({polygon:n,size:s,imgList:p,trackConfigurable:r,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};r===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,D=L({},n);let{boxParams:y,newPointList:U}=lt(D,s,ot,void 0,x,f);if(y=H(it({tool:nt.PointCloud,dataList:[y],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<b.lowerLimitPointsNumInBox){eo.info(Vt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(y.id);return}f&&(U==null?void 0:U.length)&&(D.pointList=U);const k=S.includes(D.attribute);$(y);const G=a(y),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(y.id),I.selection.setSelectedIDs(D.id),M({omitView:v.Top,polygon:D,boxParams:y,zoom:l,newPointCloudBoxList:G}),f&&dt(y,D,t,o)),A({newBoxParams:y})},Rt=n=>{const{boxID:s,imageName:p,width:r,height:l,x:f,y:C}=n,m=P.find(x=>x.id===s);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(D=>D.imageName===p);if(I){let D=x;const y=O(L({},I),{width:r,height:l,x:f,y:C});D=x.map(k=>k===I?y:k);const U=O(L({},m),{rects:D}),Z=P.map(k=>k===m?U:k);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},zt=({newSelectedBox:n,newPointCloudList:s,newSelectedSphere:p,newSphereList:r})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:s});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,r,b)}}},ct=(n,s,p)=>{if(at){let r,l;switch(p){case v.Back:r=fo;break;case v.Side:r=yt;break;default:r=yt;break}l=r(n,s,at,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Gt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:I})}const x=St(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},ut=(n,s,p)=>{if(X){let r,l;switch(p){case v.Back:r=go;break;case v.Side:r=Lt;break;default:r=Lt;break}l=r(n,s,X);const f=B(l);return Y(p,n,l,void 0,f,b),f}},Tt=(n,s)=>{ut(n,s,v.Side)},jt=(n,s)=>{ut(n,s,v.Back)},Nt=(n,s)=>{ct(n,s,v.Side)},Et=(n,s)=>{ct(n,s,v.Back)},Ht=(n,s)=>{const p=E(n.id),r=rt(n,s,ot,p),l=B(r);Y(v.Top,n,r,void 0,l,b)},Ft=(n,s)=>{if(j){const r=n[0].newPolygon;r.pointList=r.pointList.map(l=>V.transferCanvas2World(l,s)),T(n[0].newPolygon);return}let p=n.map(({newPolygon:r})=>{const l=_t(r.id),{boxParams:f}=lt(r,s,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:r}=n[0],l=tt(p);M({polygon:r,boxParams:p[0],newPointCloudBoxList:l})}else{const r=tt(p);r&&e.syncAllViewPointCloudColor(r)}},Wt=n=>{var s,p,r,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,y=((s=t==null?void 0:t.toolInstance)==null?void 0:s.polygonList).find(q=>(q==null?void 0:q.trackID)===I),U={width:(r=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:r.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=y.pointList.map(q=>V.transferCanvas2World(q,U)),k=w.getModifiedRectangleCoordinates(Z,x,C),G=k[0],et=k[2],pt=w.getLineCenterPoint([G,et]),Zt=_.info.center.z-_.info.depth/2,gt=O(L({},_.info),{center:{x:pt.x,y:pt.y,z:Zt+m/2},width:C,height:x,depth:m,valid:!0}),Mt=tt([gt]);M({omitView:v["3D"],polygon:y,boxParams:gt,newPointCloudBoxList:Mt})}},Y=(n,s,p,r,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{vt(p,s,i,C,f)},[v.Back]:()=>{d&&wt(p,s,d,C,f)},[v.Top]:()=>{It(p,s,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),r&&(o==null||o.updateCameraZoom(r)),kt(p)}),M=n=>st(void 0,null,function*(){const{omitView:s,polygon:p,boxParams:r,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{Bt(r,p,i,C)},[v.Back]:()=>{d&&bt(r,p,d,C)},[v.Top]:()=>{dt(r,p,t,o)}};Object.keys(m).forEach(x=>{x!==s&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Ot(r)});return{topViewAddSphere:At,topViewAddBox:Ut,topViewSelectedChanged:zt,topViewUpdatePoint:Ht,sideViewUpdatePoint:Tt,backViewUpdatePoint:jt,topViewUpdateBox:Ft,sideViewUpdateBox:Nt,backViewUpdateBox:Et,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const s=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(s),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(s=W){var p,r,l,f,C,m;if(!(s==null?void 0:s.url)||!o)return;F([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(s.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],D=[],y=[];o.updateTopCamera();const U=(l=(r=ft(s.result))==null?void 0:r.valid)!=null?l:!0;e.setPointCloudValid(U),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(s.url,s.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),s.result&&(x=V.getBoxParamsFromResultList(s.result),D=V.getPolygonListFromResultList(s.result),I=V.getLineListFromResultList(s.result),y=V.getSphereParamsFromResultList(s.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:D,lineList:I,pointCloudSphereList:y}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Wt,generateRects:$,update2DViewRect:Rt}};export{wt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,bt as synchronizeBackView,Bt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,Co as usePointCloudViews};
|
|
1
|
+
import{EPointCloudName as nt,MathUtils as w,getCuboidFromPointCloudBox as Gt}from"@labelbee/lb-annotation";import{EPerspectiveView as Q,PointCloudUtils as V,DEFAULT_SPHERE_PARAMS as Qt}from"@labelbee/lb-utils";import{useContext as Xt}from"react";import{PointCloudContext as Yt}from"../PointCloudContext.js";import{useSingleBox as qt}from"./useSingleBox.js";import{useSphere as Jt}from"./useSphere.js";import{useSelector as Kt,useDispatch as $t}from"../../../store/ctx.js";import to from"../../../utils/StepUtils.js";import{jsonParser as ft,getRectPointCloudBox as oo}from"../../../utils/index.js";import{PreDataProcess as it,SetPointCloudLoading as Ct,SetLoadPCDFileLoading as Pt}from"../../../store/annotation/actionCreators.js";import{message as eo}from"antd";import{useTranslation as no}from"react-i18next";import{useHistory as io}from"./useHistory.js";import{usePolygon as so}from"./usePolygon.js";import{useLatest as ro}from"ahooks";var lo=Object.defineProperty,ao=Object.defineProperties,co=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,uo=Object.prototype.hasOwnProperty,po=Object.prototype.propertyIsEnumerable,xt=(e,t,i)=>t in e?lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i,L=(e,t)=>{for(var i in t||(t={}))uo.call(t,i)&&xt(e,i,t[i]);if(mt)for(var i of mt(t))po.call(t,i)&&xt(e,i,t[i]);return e},O=(e,t)=>ao(e,co(t)),st=(e,t,i)=>new Promise((d,o)=>{var a=u=>{try{c(i.next(u))}catch(P){o(P)}},g=u=>{try{c(i.throw(u))}catch(P){o(P)}},c=u=>u.done?d(u.value):Promise.resolve(u.value).then(a,g);c((i=i.apply(e,t)).next())});const J=5,K=90,ht=.01,v={"3D":"3D",Top:"Top",Side:"Side",Back:"Back"},rt=(e,t,i,d,o)=>{const{x:a,y:g}=V.transferCanvas2World(e,t),{defaultZ:c}=Qt,u={center:{x:a,y:g,z:c},id:e.id},P=d?L(L({},d),u):O(L({},u),{attribute:"",valid:!0});return o&&Object.assign(P,o),P},lt=(e,t,i,d,o,a)=>{let g=e.pointList.map(B=>V.transferCanvas2World(B,t)),c=0,u=1,P={};if(i){const B=i.getSensesPointZAxisInPolygon(g,void 0,a);a&&B.fittedCoordinates.length>0&&(g=B.fittedCoordinates),c=(B.maxZ+B.minZ)/2,u=B.maxZ-B.minZ,P={count:B.zCount}}const[h,S,F]=g,R=w.getLineCenterPoint([h,F]),z=w.getLineLength(h,S),A=w.getLineLength(S,F),N=w.getRadiusFromQuadrangle(e.pointList);d&&(c=d.center.z,u=d.depth);const T={center:{x:R.x,y:R.y,z:c},width:a?A+ht:A,height:a?z+ht:z,depth:u,rotation:N,id:e.id},j=L(d?L(L({},d),T):O(L({},T),{attribute:"",valid:!0}),P);o&&Object.assign(j,o);const E=g.map(B=>V.transferWorld2Canvas(B,t));return{boxParams:j,newPointList:E}},Lt=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x-d.x,y:i.center.y,z:i.center.z-d.y}})},yt=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j,{newBoxParams:B}=d.getNewBoxBySideUpdate(R,E,N,i);return B},go=(e,t,i)=>{const d={x:e.x-t.x,y:e.y-t.y};return O(L({},i),{center:{x:i.center.x,y:i.center.y-d.x,z:i.center.z-d.y}})},fo=(e,t,i,d)=>{const[o,a,g]=e.pointList,[c,u,P]=t.pointList,h=w.getLineCenterPoint([o,g]),S=w.getLineCenterPoint([c,P]),R={x:{x:h.x-S.x,y:h.y-S.y}.x,y:0,z:h.y-S.y},z=w.getLineLength(o,a),A=w.getLineLength(c,u),N=z-A,T=w.getLineLength(a,g),j=w.getLineLength(u,P),E=T-j;let{newBoxParams:B}=d.getNewBoxByBackUpdate(R,E,N,i);return B},vt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Left);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereSidePoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},Bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{width:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Left);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxSidePolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},wt=(e,t,i,d,o)=>{var a;if(!i)return;const{toolInstance:g,pointCloudInstance:c}=i;c.loadPCDFile(d,(a=o==null?void 0:o.radius)!=null?a:K);const{cameraPositionVector:u}=c.updateOrthoCameraBySphere(e,Q.Back);c.setInitCameraPosition(u);const{point2d:P,zoom:h}=c.getSphereBackPoint2DCoordinate(e);c.camera.zoom=h,c.camera.updateProjectionMatrix(),c.render(),g.initPosition(),g.zoomChangeOnCenter(h),g.setResult([O(L(L({},t),P),{valid:e.valid,textAttribute:"",attribute:e.attribute})]),g.setSelectedID(t.id)},bt=(e,t,i,d)=>{if(!i)return;const{pointCloud2dOperation:o,pointCloudInstance:a}=i;a.loadPCDFileByBox(d,e,{height:J,depth:J});const{cameraPositionVector:g}=a.updateOrthoCamera(e,Q.Back);a.setInitCameraPosition(g);const{polygon2d:c,zoom:u}=a.getBoxBackPolygon2DCoordinate(e);a.camera.zoom=u,a.camera.updateProjectionMatrix(),a.render(),o.initPosition(),o.zoomChangeOnCenter(u),o.setResultAndSelectedID([{id:t.id,valid:e.valid,pointList:c,textAttribute:"",isRect:!0,attribute:e.attribute}],t.id)},It=(e,t,i,d)=>{if(!i||!d)return;d.generateSphere(e),d.updateCameraBySphere(e,Q.Top),d.render();const{toolInstance:o,pointCloudInstance:a}=i,{point2d:g}=a.getSphereTopPoint2DCoordinate(e),c=[...o.pointList].map(u=>u.id===t.id?O(L(L({},t),g),{valid:e.valid,textAttribute:"",attribute:e.attribute}):u);o.setResult(c),o.setSelectedID(t.id)},dt=(e,t,i,d)=>{var o,a;if(!i||!d)return;d.generateBox(e,t.id),d.render();const{pointCloud2dOperation:g,pointCloudInstance:c}=i,{polygon2d:u}=c.getBoxTopPolygon2DCoordinate(e),P=[...g.polygonList],h=P.find(S=>S.id===t.id);h?(h.pointList=u,h.valid=(o=e.valid)!=null?o:!0):P.push({id:t.id,pointList:u,textAttribute:"",isRect:!0,valid:(a=e.valid)!=null?a:!0}),g.setResultAndSelectedID(P,t.id)},Co=()=>{const e=Xt(Yt),{topViewInstance:t,sideViewInstance:i,backViewInstance:d,mainViewInstance:o,addPointCloudBox:a,addPointCloudSphere:g,setSelectedIDs:c,selectedIDs:u,pointCloudBoxList:P,pointCloudSphereList:h,hideAttributes:S,setHighlight2DDataList:F,cuboidBoxIn2DView:R,imageSizes:z}=e,{addHistory:A,initHistory:N,pushHistoryUnderUpdatePolygon:T}=io(),{selectedPolygon:j}=so(),{getPointCloudSphereByID:E,updatePointCloudSphere:B,selectedSphere:X}=Jt(),{currentData:W,config:b}=Kt(n=>{const{stepList:r,step:p,imgList:s,imgIndex:l}=n.annotation;return{currentData:s[l],config:ft(to.getCurrentStepInfo(p,r).config)}}),H=$t(),Dt=ro(R),$=n=>{if(!Dt.current){const{mappingImgList:r=[]}=W,p=r.map(s=>oo({pointCloudBox:n,mappingData:s,imageSizes:z}));Object.assign(n,{rects:p.filter(s=>s!==void 0)})}},{selectedBox:_,updateSelectedBox:St,updateSelectedBoxes:tt,getPointCloudByID:_t}=qt({generateRects:$}),{t:Vt}=no(),at=_==null?void 0:_.info;if(!t||!i||!d)return{topViewAddSphere:()=>{},topViewAddBox:()=>{},topViewSelectedChanged:()=>{},sideViewUpdateBox:()=>{},backViewUpdateBox:()=>{}};const{pointCloudInstance:ot}=t,Ot=n=>{o==null||o.generateBox(n),o==null||o.controls.update(),o==null||o.render()},kt=n=>{o==null||o.generateSphere(n),o==null||o.controls.update(),o==null||o.render()},At=({newPoint:n,size:r,zoom:p,trackConfigurable:s})=>{var l;const f={attribute:(l=t.toolInstance.defaultAttribute)!=null?l:""};s===!0&&Object.assign(f,{trackID:V.getNextTrackID({imgList:[],extraBoxList:[],extraSphereList:h})});const C=rt(n,r,ot,void 0,f);c(n.id);const m=g(C);Y(v.Top,n,C,p,m,b),A({newSphereParams:C})},Ut=({polygon:n,size:r,imgList:p,trackConfigurable:s,zoom:l,intelligentFit:f})=>{var C,m;const x={attribute:(C=t.toolInstance.defaultAttribute)!=null?C:""};s===!0&&Object.assign(x,{trackID:V.getNextTrackID({imgList:[],extraBoxList:P,extraSphereList:h})});const I=t==null?void 0:t.toolInstance,D=L({},n);let{boxParams:y,newPointList:U}=lt(D,r,ot,void 0,x,f);if(y=H(it({tool:nt.PointCloud,dataList:[y],stepConfig:b,action:"viewUpdateBox"}))[0],(b==null?void 0:b.lowerLimitPointsNumInBox)&&typeof y.count=="number"&&y.count<b.lowerLimitPointsNumInBox){eo.info(Vt("LowerLimitPointsNumInBox",{num:b.lowerLimitPointsNumInBox})),I.deletePolygon(y.id);return}f&&(U==null?void 0:U.length)&&(D.pointList=U);const k=S.includes(D.attribute);$(y);const G=a(y),et=(m=e==null?void 0:e.polygonList)!=null?m:[];t==null||t.updatePolygonList(G!=null?G:[],et),k?c([]):(c(y.id),I.selection.setSelectedIDs(D.id),M({omitView:v.Top,polygon:D,boxParams:y,zoom:l,newPointCloudBoxList:G}),f&&dt(y,D,t,o)),A({newBoxParams:y})},Rt=n=>{const{boxID:r,imageName:p,width:s,height:l,x:f,y:C}=n,m=P.find(x=>x.id===r);if(m==null?void 0:m.rects){const{rects:x=[]}=m,I=x.find(D=>D.imageName===p);if(I){let D=x;const y=O(L({},I),{width:s,height:l,x:f,y:C});D=x.map(k=>k===I?y:k);const U=O(L({},m),{rects:D}),Z=P.map(k=>k===m?U:k);return t==null||t.updatePolygonList(Z!=null?Z:[]),Z}}},zt=({newSelectedBox:n,newPointCloudList:r,newSelectedSphere:p,newSphereList:s})=>{var l;const f=t==null?void 0:t.toolInstance;if(!(u.length===0||!f)){if(n||(_==null?void 0:_.info)){const C=n!=null?n:_==null?void 0:_.info;(l=f==null?void 0:f.selection)==null||l.setSelectedIDs(u[0]);const m=f.selectedPolygon;if(u.length===1&&C){M({omitView:v.Top,polygon:m,boxParams:C,newPointCloudBoxList:r});return}}if((p||X)&&u.length===1){const C=p!=null?p:X;f.setSelectedID(u[0]);const m=f.selectedPoint;C&&Y(v.Top,m,C,void 0,s,b)}}},ct=(n,r,p)=>{if(at){let s,l;switch(p){case v.Back:s=fo;break;case v.Side:s=yt;break;default:s=yt;break}l=s(n,r,at,i.pointCloudInstance);const C=H(it({tool:nt.PointCloud,dataList:[l],stepConfig:b,action:"viewUpdateBox"}))[0],m=l.valid!==C.valid;if(l=C,o){const{count:I}=o.getSensesPointZAxisInPolygon(Gt(l).polygonPointList,[l.center.z-l.depth/2,l.center.z+l.depth/2]);l=O(L({},l),{count:I})}const x=St(l);return l=x.find(I=>I.id===l.id),M({omitView:m?void 0:p,polygon:n,boxParams:l,newPointCloudBoxList:x}),x}},ut=(n,r,p)=>{if(X){let s,l;switch(p){case v.Back:s=go;break;case v.Side:s=Lt;break;default:s=Lt;break}l=s(n,r,X);const f=B(l);return Y(p,n,l,void 0,f,b),f}},Tt=(n,r)=>{ut(n,r,v.Side)},jt=(n,r)=>{ut(n,r,v.Back)},Nt=(n,r)=>{ct(n,r,v.Side)},Et=(n,r)=>{ct(n,r,v.Back)},Ht=(n,r)=>{const p=E(n.id),s=rt(n,r,ot,p),l=B(s);Y(v.Top,n,s,void 0,l,b)},Ft=(n,r)=>{if(j){const s=L({},n[0].newPolygon);s.pointList=s.pointList.map(l=>V.transferCanvas2World(l,r)),T(s);return}let p=n.map(({newPolygon:s})=>{const l=_t(s.id),{boxParams:f}=lt(s,r,t.pointCloudInstance,l);return f});if(p=H(it({tool:nt.PointCloud,dataList:p,stepConfig:b,action:"viewUpdateBox"})),p.length===1){const{newPolygon:s}=n[0],l=tt(p);M({polygon:s,boxParams:p[0],newPointCloudBoxList:l})}else{const s=tt(p);s&&e.syncAllViewPointCloudColor(s)}},Wt=n=>{var r,p,s,l,f;if(_){const C=Number(n.widthDefault),m=Number(n.depthDefault),x=Number(n.heightDefault),I=_==null?void 0:_.info.trackID,y=((r=t==null?void 0:t.toolInstance)==null?void 0:r.polygonList).find(q=>(q==null?void 0:q.trackID)===I),U={width:(s=(p=t==null?void 0:t.toolInstance)==null?void 0:p.basicImgInfo)==null?void 0:s.width,height:(f=(l=t==null?void 0:t.toolInstance)==null?void 0:l.basicImgInfo)==null?void 0:f.height},Z=y.pointList.map(q=>V.transferCanvas2World(q,U)),k=w.getModifiedRectangleCoordinates(Z,x,C),G=k[0],et=k[2],pt=w.getLineCenterPoint([G,et]),Zt=_.info.center.z-_.info.depth/2,gt=O(L({},_.info),{center:{x:pt.x,y:pt.y,z:Zt+m/2},width:C,height:x,depth:m,valid:!0}),Mt=tt([gt]);M({omitView:v["3D"],polygon:y,boxParams:gt,newPointCloudBoxList:Mt})}},Y=(n,r,p,s,l,f)=>st(void 0,null,function*(){const C=W==null?void 0:W.url,m={[v.Side]:()=>{vt(p,r,i,C,f)},[v.Back]:()=>{d&&wt(p,r,d,C,f)},[v.Top]:()=>{It(p,r,t,o)}};Object.keys(m).forEach(x=>{x!==n&&m[x]()}),s&&(o==null||o.updateCameraZoom(s)),kt(p)}),M=n=>st(void 0,null,function*(){const{omitView:r,polygon:p,boxParams:s,zoom:l,newPointCloudBoxList:f}=n,C=W==null?void 0:W.url;f&&(yield e.syncAllViewPointCloudColor(f));const m={[v.Side]:()=>{Bt(s,p,i,C)},[v.Back]:()=>{d&&bt(s,p,d,C)},[v.Top]:()=>{dt(s,p,t,o)}};Object.keys(m).forEach(x=>{x!==r&&m[x]()}),l&&(o==null||o.updateCameraZoom(l)),Ot(s)});return{topViewAddSphere:At,topViewAddBox:Ut,topViewSelectedChanged:zt,topViewUpdatePoint:Ht,sideViewUpdatePoint:Tt,backViewUpdatePoint:jt,topViewUpdateBox:Ft,sideViewUpdateBox:Nt,backViewUpdateBox:Et,pointCloudBoxListUpdated:n=>{t.updatePolygonList(n),o==null||o.generateBoxes(n)},initPointCloud3d:n=>{if(!o)return;const r=V.getDefaultOrthographicParams(n);o.initOrthographicCamera(r),o.initRenderer(),o.render()},updatePointCloudData:(...n)=>st(void 0,[...n],function*(r=W){var p,s,l,f,C,m;if(!(r==null?void 0:r.url)||!o)return;F([]),Ct(H,!0),Pt(H,!0),yield o.loadPCDFile(r.url,(p=b==null?void 0:b.radius)!=null?p:K),o==null||o.clearAllBox(),o==null||o.clearAllSphere();let x=[],I=[],D=[],y=[];o.updateTopCamera();const U=(l=(s=ft(r.result))==null?void 0:s.valid)!=null?l:!0;e.setPointCloudValid(U),(f=e.sideViewInstance)==null||f.clearAllData(),(C=e.backViewInstance)==null||C.clearAllData(),t.updateData(r.url,r.result,{radius:(m=b==null?void 0:b.radius)!=null?m:K}),r.result&&(x=V.getBoxParamsFromResultList(r.result),D=V.getPolygonListFromResultList(r.result),I=V.getLineListFromResultList(r.result),y=V.getSphereParamsFromResultList(r.result),o==null||o.generateBoxes(x),o==null||o.generateSpheres(y),yield e.syncAllViewPointCloudColor(x,[])),N({pointCloudBoxList:x,polygonList:D,lineList:I,pointCloudSphereList:y}),Ct(H,!1),Pt(H,!1)}),updateViewsByDefaultSize:Wt,generateRects:$,update2DViewRect:Rt}};export{wt as syncBackViewByPoint,vt as syncSideViewByPoint,It as syncTopViewByPoint,bt as synchronizeBackView,Bt as synchronizeSideView,dt as synchronizeTopView,rt as topViewPoint2PointCloud,lt as topViewPolygon2PointCloud,Co as usePointCloudViews};
|
package/es/index.css
CHANGED
|
@@ -2436,6 +2436,28 @@
|
|
|
2436
2436
|
background-color: #eeefff;
|
|
2437
2437
|
border: 1px solid #666fff;
|
|
2438
2438
|
}
|
|
2439
|
+
.bee-LLMView__answer {
|
|
2440
|
+
flex: 1;
|
|
2441
|
+
}
|
|
2442
|
+
.bee-LLMView__loading {
|
|
2443
|
+
display: inline-flex;
|
|
2444
|
+
align-items: center;
|
|
2445
|
+
gap: 0 4px;
|
|
2446
|
+
}
|
|
2447
|
+
.bee-LLMView__failed {
|
|
2448
|
+
color: #f26549;
|
|
2449
|
+
}
|
|
2450
|
+
.bee-LLMView__footer {
|
|
2451
|
+
display: flex;
|
|
2452
|
+
justify-content: end;
|
|
2453
|
+
}
|
|
2454
|
+
.bee-LLMView__footer span {
|
|
2455
|
+
display: inline-flex;
|
|
2456
|
+
align-items: center;
|
|
2457
|
+
color: #666fff;
|
|
2458
|
+
gap: 0 4px;
|
|
2459
|
+
cursor: pointer;
|
|
2460
|
+
}
|
|
2439
2461
|
|
|
2440
2462
|
.bee-LLMSidebar {
|
|
2441
2463
|
overflow-y: auto;
|
package/es/store/ctx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"react";import{createDispatchHook as o,createSelectorHook as r}from"react-redux";const e=t.createContext(void 0),c=o(e),
|
|
1
|
+
import t from"react";import{createDispatchHook as o,createSelectorHook as r}from"react-redux";const e=t.createContext(void 0),c=o(e),s=r(e),a=t.createContext({hoverKey:-1,setHoverKey:()=>{},modelAPIResponse:[],setModelAPIResponse:()=>{}});export{a as LLMContext,e as LabelBeeContext,c as useDispatch,s as useSelector};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{prefix as r}from"../../../constant/index.js";import{Layout as a}from"antd/es";import t,{useState as s,useMemo as
|
|
1
|
+
import{prefix as r}from"../../../constant/index.js";import{Layout as a}from"antd/es";import t,{useState as s,useMemo as u}from"react";import f from"../sidebar/index.js";import L from"../toolFooter/index.js";import{getClassName as v}from"../../../utils/dom.js";import{classnames as y}from"../../../utils/index.js";import{LLMContext as M}from"../../../store/ctx.js";import x from"../../../components/LLMToolView/index.js";const{Sider:h,Content:j}=a,m=`${r}-layout`,E=e=>{var o,l;const[i,c]=s(-1),[n,d]=s([]);return t.createElement(a,{className:v("layout","container")},t.createElement(M.Provider,{value:u(()=>({hoverKey:i,setHoverKey:c,modelAPIResponse:n,setModelAPIResponse:d}),[i,n])},e==null?void 0:e.leftSider,t.createElement(j,{className:y({[`${m}__content`]:!0,[`${r}-LLMLayout`]:!0})},t.createElement(x,{checkMode:e.checkMode,showTips:e.showTips,tips:e.tips}),t.createElement(L,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer})),t.createElement(h,{className:`${m}__side`,width:600,style:{position:"relative"}},t.createElement(f,{sider:e==null?void 0:e.sider,checkMode:e==null?void 0:e.checkMode}),(l=e.drawLayerSlot)==null?void 0:l.call(e,{}))))};export{E as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0-alpha.1",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ant-design/icons": "^4.6.2",
|
|
46
|
-
"@labelbee/lb-annotation": "1.
|
|
47
|
-
"@labelbee/lb-utils": "1.
|
|
46
|
+
"@labelbee/lb-annotation": "1.22.1-alpha.1",
|
|
47
|
+
"@labelbee/lb-utils": "1.15.0-alpha.1",
|
|
48
48
|
"@labelbee/wavesurfer": "1.0.0",
|
|
49
49
|
"@types/react-dom": "^18.2.7",
|
|
50
50
|
"ahooks": "^3.4.0",
|