@labelbee/lb-components 1.23.0-alpha.121 → 1.23.0-alpha.123
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/_virtual/2DViewWorker.js +1 -1
- package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -0
- package/dist/components/LLMMultiWheelView/index.js +1 -0
- package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -0
- package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/dist/components/LLMToolView/questionView/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
- package/dist/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -0
- package/dist/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/dist/components/LLMToolView/sidebar/index.js +1 -1
- package/dist/data/enums/ToolType.js +1 -1
- package/dist/index.css +50 -0
- package/dist/index.js +1 -1
- package/dist/store/LLMMultiWheel/index.js +1 -0
- package/dist/store/annotation/reducer.js +1 -1
- package/dist/store/ctx.js +1 -1
- package/dist/types/components/LLMMultiWheelView/dialogView/index.d.ts +15 -0
- package/dist/types/components/LLMMultiWheelView/index.d.ts +20 -0
- package/dist/types/components/LLMMultiWheelView/sidebar/index.d.ts +8 -0
- package/dist/types/components/LLMMultiWheelView/types.d.ts +62 -0
- package/dist/types/components/LLMToolView/questionView/components/header/index.d.ts +15 -0
- package/dist/types/components/LLMToolView/questionView/index.d.ts +7 -0
- package/dist/types/components/LLMToolView/sidebar/components/answerSort/index.d.ts +3 -0
- package/dist/types/components/LLMToolView/sidebar/components/modelAnswerSort/index.d.ts +29 -0
- package/dist/types/components/LLMToolView/sidebar/components/textInputBox/index.d.ts +2 -2
- package/dist/types/components/LLMToolView/sidebar/index.d.ts +10 -0
- package/dist/types/components/LLMToolView/types.d.ts +5 -2
- package/dist/types/data/enums/ToolType.d.ts +2 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/store/LLMMultiWheel/index.d.ts +16 -0
- package/dist/types/store/ctx.d.ts +7 -0
- package/dist/types/views/MainView/LLMMultiWheelLayout/index.d.ts +9 -0
- package/dist/views/MainView/LLMMultiWheelLayout/index.js +1 -0
- package/dist/views/MainView/index.js +1 -1
- package/dist/views/MainView/sidebar/index.js +1 -1
- package/dist/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/components/LLMMultiWheelView/dialogView/index.js +1 -0
- package/es/components/LLMMultiWheelView/index.js +1 -0
- package/es/components/LLMMultiWheelView/sidebar/index.js +1 -0
- package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/es/components/LLMToolView/questionView/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/answerSort/index.js +1 -1
- package/es/components/LLMToolView/sidebar/components/modelAnswerSort/index.js +1 -0
- package/es/components/LLMToolView/sidebar/components/textInputBox/index.js +2 -2
- package/es/components/LLMToolView/sidebar/index.js +1 -1
- package/es/data/enums/ToolType.js +1 -1
- package/es/index.css +50 -0
- package/es/index.js +1 -1
- package/es/store/LLMMultiWheel/index.js +1 -0
- package/es/store/annotation/reducer.js +1 -1
- package/es/store/ctx.js +1 -1
- package/es/views/MainView/LLMMultiWheelLayout/index.js +1 -0
- package/es/views/MainView/index.js +1 -1
- package/es/views/MainView/sidebar/index.js +1 -1
- package/es/views/MainView/toolFooter/FooterTips/ToolHotKey/index.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getTextControlByConfig as v,RenderAnswer as N}from"../../LLMToolView/questionView/index.js";import{RenderQuestion as V}from"../../LLMToolView/questionView/components/header/index.js";import x from"../../LLMToolView/questionView/components/imgView/index.js";import y from"../../../store/LLMMultiWheel/index.js";import{classnames as I}from"../../../utils/index.js";import{Button as i}from"antd";import e from"react";const M=m=>{const{id:t,answerList:s,question:l,index:c,name:d="",answerIsImg:u,questionIsImg:E,LLMConfig:p}=m,{dataFormatType:n,selectedID:w,setSelectedID:L}=y(),a=c+1,g=d||`\u5BF9\u8BDD${a}`;return e.createElement("div",{key:t,onClick:()=>L(t),className:I({dialog:!0,selected:t===w})},e.createElement("div",{className:"header"},e.createElement("span",{className:"order"},a),e.createElement("div",{className:"name"},e.createElement("div",{className:"show-name"},g),e.createElement("div",{className:"tips"},"\uFF08\u9009\u4E2D\u6807\u6CE8\uFF09"))),e.createElement("div",{className:"dialog-question"},e.createElement(i,{type:"primary"},"\u9898\u76EE",a),e.createElement("div",null,e.createElement(V,{question:l,dataFormatType:n,isImg:E}))),e.createElement("div",{className:"dialog-answer"},s.map((o,r)=>{const f=v(o,p);return e.createElement("div",{key:r},e.createElement(i,{type:"primary"},"\u7B54\u6848",r+1),u?e.createElement(x,{answerList:s}):e.createElement(N,{i:o,isTextControl:f,dataFormatType:n}))})))};export{M as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r,{useState as g,useEffect as M}from"react";import{ELLMDataType as y}from"../../constant/index.js";import{getStepConfig as W}from"../../store/annotation/reducer.js";import{LabelBeeContext as q}from"../../store/ctx.js";import{jsonParser as N}from"../../utils/index.js";import{connect as A}from"react-redux";import x from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as j}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as F}from"../LLMToolView/questionView/components/header/index.js";import $ from"./dialogView/index.js";import k from"../messageMaskLayer/index.js";import R from"../../views/MainView/annotationTips/index.js";import{useTranslation as U}from"react-i18next";import{LLMViewCls as B}from"../LLMToolView/questionView/index.js";import{Layout as Q}from"antd";var z=Object.defineProperty,G=Object.defineProperties,H=Object.getOwnPropertyDescriptors,P=Object.getOwnPropertySymbols,J=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,I=(t,e,o)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,X=(t,e)=>{for(var o in e||(e={}))J.call(e,o)&&I(t,o,e[o]);if(P)for(var o of P(e))K.call(e,o)&&I(t,o,e[o]);return t},Y=(t,e)=>G(t,H(e));const T=t=>{const{questionIsImg:e,answerIsImg:o,LLMConfig:u,dialogList:m}=t,{dataFormatType:f,setDataFormatType:c}=x();return r.createElement("div",{className:`${j}`},r.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},r.createElement(F,{dataFormatType:f,setDataFormatType:c})),r.createElement("div",{className:`${j}-container`},m==null?void 0:m.map((a,s)=>r.createElement($,Y(X({},a),{key:s,index:s,questionIsImg:e,answerIsImg:o,LLMConfig:u})))))},Z=t=>{var e,o;const{annotation:u,tips:m,showTips:f,drawLayerSlot:c}=t,{imgIndex:a,imgList:s,stepList:L,step:v,toolInstance:i}=u,[l,V]=g(),{setSelectedID:E}=x(),[h,O]=g([]),S=((e=l==null?void 0:l.dataType)==null?void 0:e.prompt)===y.Picture,C=((o=l==null?void 0:l.dataType)==null?void 0:o.response)===y.Picture,{t:D}=U(),[,b]=g(0);return M(()=>{var n,p,w;if(!s[a])return;const _=(n=s[a])!=null?n:{},d=(w=(p=_==null?void 0:_.questionList)==null?void 0:p.textList)!=null?w:[];O(d),(d==null?void 0:d.length)&&E(d[0].id)},[a]),M(()=>{var n;if(L&&v){const p=(n=W(L,v))==null?void 0:n.config;V(N(p))}},[L,v]),M(()=>{if(i)return i.on("validUpdated",()=>{b(n=>n+1)}),()=>{i.unbindAll("validUpdated")}},[i]),r.createElement(Q,{className:B},!(i==null?void 0:i.valid)&&r.createElement(k,{message:D("InvalidQuestionAndSkip")}),c==null?void 0:c({}),f===!0&&r.createElement(R,{tips:m}),r.createElement(T,{questionIsImg:S,answerIsImg:C,LLMConfig:l,dialogList:h}))},ee=t=>({annotation:t.annotation});var te=A(ee,null,null,{context:q})(Z);export{T as LLMMultiWheelSourceView,te as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r,{useState as S,useRef as lt,useMemo as k,useEffect as O}from"react";import{LabelBeeContext as Rt}from"../../../store/ctx.js";import{connect as Pt}from"react-redux";import{prefix as Dt}from"../../../constant/index.js";import{getStepConfig as It}from"../../../store/annotation/reducer.js";import{jsonParser as it}from"../../../utils/index.js";import Ot,{getSorts as st}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Vt}from"react-i18next";import{useCustomToolInstance as Nt}from"../../../hooks/annotation.js";import{isBoolean as Bt,isString as Wt,isNumber as $t,isObject as Ft,isArray as qt}from"lodash";import{PageForward as V}from"../../../store/annotation/actionCreators.js";import{cKeyCode as kt,EToolName as Gt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Kt,EmptyConfig as zt}from"../../LLMToolView/sidebar/index.js";import Ut from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as at}from"antd";import Qt from"../../LLMToolView/sidebar/components/answerList/index.js";import Jt from"../../../store/LLMMultiWheel/index.js";import Ht from"../../../utils/StepUtils.js";import{getCurrentResultFromResultList as Xt,getRenderDataByResult as Yt}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as ut}from"ahooks";import Zt from"../../LLMToolView/sidebar/components/answerSort/index.js";var te=Object.defineProperty,ee=Object.defineProperties,oe=Object.getOwnPropertyDescriptors,dt=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,ct=(c,i,p)=>i in c?te(c,i,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[i]=p,s=(c,i)=>{for(var p in i||(i={}))ne.call(i,p)&&ct(c,p,i[p]);if(dt)for(var p of dt(i))re.call(i,p)&&ct(c,p,i[p]);return c},d=(c,i)=>ee(c,oe(i));const le=kt.default,pt=`${Dt}-sidebar`,ie={sort:[],answerSort:{},textAttribute:[]},se=c=>{var i,p,G,K,z,U,Q;const{annotation:mt,dispatch:b,checkMode:ft}=c,{imgIndex:E,imgList:N,stepList:y,step:M,skipBeforePageTurning:C}=mt,[m,vt]=S(),{t:h}=Vt(),n=(i=N[E])!=null?i:{},J=it(n==null?void 0:n.result),{toolInstanceRef:v}=Nt({basicInfo:J}),[B,Lt]=S(!0),[j,H]=S({}),{selectedID:W}=Jt(),[A,X]=S(ie),$=lt();lt();const[x,F]=S({}),g=k(()=>j[W],[W,j]),w=!v.current.valid||ft;O(()=>{var t;if(y&&M){const e=(t=It(y,M))==null?void 0:t.config;vt(it(e))}},[M,JSON.stringify(y)]),O(()=>{!n||E===-1||(v.current.setValid=Y,v.current.clearResult=xt,Y(),Z())},[E,m,n==null?void 0:n.id]);const xt=()=>{var t,e,o,a,f;Z((t=n==null?void 0:n.questionList)==null?void 0:t.textList),((e=$.current)==null?void 0:e.clearValue)&&((o=$.current)==null||o.clearValue());const{waitSorts:l}=st({selectedSort:(f=(a=T())==null?void 0:a.sort)!=null?f:[],initSelected:[],modelList:R?P!=null?P:[]:[]});F(d(s({},x),{waitSorts:l,newSort:[]}))},Y=t=>{var e;const o=t!=null?t:J.valid;Bt(o)&&(Lt(o),v.current.valid=o,(e=v.current)==null||e.emit("validUpdated"))},T=()=>{const t=Ht.getCurrentStepInfo(M,y);return Xt(n==null?void 0:n.result,t.step)},Z=t=>{var e,o,a,f,l,L,D;const u=T();let I=(e=n==null?void 0:n.questionList)==null?void 0:e.textList;((o=u==null?void 0:u.modelData)==null?void 0:o.length)&&v.current.valid&&(I=u==null?void 0:u.modelData),t&&(I=t,u.sort=[],u.textAttribute=[],u.answerSort=[]);let nt={};I==null||I.forEach((_,ht)=>{var rt;const jt=Yt(m,d(s({},_),{answerList:(rt=_==null?void 0:_.answerList)==null?void 0:rt.map((At,Tt)=>d(s({},At),{order:`${Tt+1}`}))}));nt[_.id]=d(s({},jt),{order:`${ht+1}`,id:_.id})});const{waitSorts:Mt,newSort:Ct}=st({selectedSort:(f=(a=T())==null?void 0:a.sort)!=null?f:[],modelList:R?P!=null?P:[]:[]});F({waitSorts:Mt,newSort:Ct}),X({sort:(l=u==null?void 0:u.sort)!=null?l:[],textAttribute:(L=u==null?void 0:u.textAttribute)!=null?L:[],answerSort:(D=u==null?void 0:u.answerSort)!=null?D:[]}),H(nt)};O(()=>{gt()},[j,B,A]),O(()=>(window.addEventListener("keydown",tt),()=>{window.removeEventListener("keydown",tt)}),[]);const gt=ut(()=>{var t,e;const o=(e=(t=n==null?void 0:n.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var l;const L=(l=j[f.id])!=null?l:{};return{id:f.id,answerList:L.answerList}}),a=d(s({},A),{modelData:o});v.current.exportData=()=>[[a],{valid:B}],v.current.currentPageResult=d(s({},a),{toolName:Gt.LLMMultiWheel,valid:B})}),tt=t=>{if(t.ctrlKey&&t.keyCode===le.Enter){if(C){C(()=>b(V()));return}b(V())}},wt=ut(({order:t,value:e,key:o})=>{const{answerList:a}=g,f=a==null?void 0:a.map(l=>{var L;if((l==null?void 0:l.order)===t){if(o==="textEdit"&&Wt(e))return d(s({},l),{newAnswer:e});if($t(e))return d(s({},l),{score:e});if(Ft(e)&&o){const D={[e==null?void 0:e.key]:e.value},u=(L=l[o])!=null?L:{};return d(s({},l),{[o]:s(s({},u),D)})}}return l});H(l=>d(s({},l),{[W]:d(s({},g),{answerList:f})}))}),q=(t,e)=>{X(o=>d(s({},o),{[t]:e}))},{indicatorScore:et=[],indicatorDetermine:ot=[],isTextEdit:_t,dialogSort:R=!1,inputList:St=[],tagInputListConfigurable:bt}=m||{},P=k(()=>{var t,e,o;return R?(o=(e=(t=n==null?void 0:n.questionList)==null?void 0:t.textList)==null?void 0:e.map((a,f)=>d(s({},a),{title:`${f+1}`})))!=null?o:[]:[]},[n,R]);if(k(()=>Kt(m),[m]))return r.createElement(zt,null);const Et=bt&&((p=St.filter(t=>!t.isOverall))==null?void 0:p.length)>0,yt=(ot==null?void 0:ot.length)>0||(et==null?void 0:et.length)>0||_t||Et;return r.createElement("div",{className:`${pt}`},r.createElement("div",{className:`${pt}__content`},r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},h("GlobalAnnotation")),r.createElement(Zt,{waitSortList:(x==null?void 0:x.waitSorts)||[],sortList:(x==null?void 0:x.newSort)||[],setSortList:t=>{const e=t.map(o=>o.map(a=>a.id));q("sort",e),F(d(s({},x),{newSort:t}))},disabeledAll:w,title:h("SortConversationQuality"),prefixId:"model"}),(m==null?void 0:m.text)&&r.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},r.createElement(Ut,{textAttribute:(G=A==null?void 0:A.textAttribute)!=null?G:[],textConfig:(m==null?void 0:m.text)&&qt(m.text)?m==null?void 0:m.text:[],setText:t=>q("textAttribute",t),disabeledAll:w})),r.createElement(Ot,{modelData:(z=(K=n==null?void 0:n.questionList)==null?void 0:K.textList)!=null?z:[],selectedAnswerSort:t=>q("answerSort",t),selectedSort:(Q=(U=T())==null?void 0:U.answerSort)!=null?Q:[],ref:$,disabeledAll:w}),g&&r.createElement(r.Fragment,null,r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},h("QualifiedAnnotation")),r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},r.createElement(at,{type:"primary",danger:!0},"\u6B63\u5728\u6807\u6CE8"),r.createElement("div",{style:{padding:16}},"\u7EC4\uFF1A",g.order)),r.createElement("div",null,yt&&r.createElement(Qt,{list:(g==null?void 0:g.answerList)||[],LLMConfig:m,updateValue:wt,disabeledAll:w})))),r.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(N==null?void 0:N.length)-1!==E&&r.createElement(at,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(C){C(()=>b(V()));return}b(V())},disabled:w},h("Save"))))},ae=c=>({annotation:c.annotation});var ue=Pt(ae,null,null,{context:Rt})(se);export{ue as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useTranslation as
|
|
1
|
+
import e from"react";import{useTranslation as u}from"react-i18next";import{Resizable as f}from"re-resizable";import{Radio as i,Image as g}from"antd";import{EDataFormatType as m,prefix as E}from"../../../../../constant/index.js";import{FileTextOutlined as x}from"@ant-design/icons";import w from"../../../../markdownView/index.js";import{isString as y,isObject as T}from"lodash";import{i18n as b}from"@labelbee/lb-utils";import h from"../../../../../assets/annotation/LLMTool/imgFail_cn.svg.js";import v from"../../../../../assets/annotation/LLMTool/imgFail_en.svg.js";const s=`${E}-LLMView`,c=({question:t,dataFormatType:n,isImg:a})=>{const r=y(t)?t:"",o=b.language==="en"?v:h;if(a){const l=T(t)?t==null?void 0:t.url:"";return e.createElement(g,{src:l||o,fallback:o})}return e.createElement("div",{style:{whiteSpace:"pre-wrap"}},n===m.Markdown?e.createElement(w,{value:r}):r)},F=t=>{const{question:n,dataFormatType:a,setDataFormatType:r,isImg:o}=t,l=300,{t:p}=u();return e.createElement(f,{defaultSize:{width:"100%",height:l},minHeight:l,enable:{bottom:!0},style:{padding:"26px 32px",borderBottom:"1px solid #EBEBEB",overflow:"hidden"}},e.createElement("div",{className:`${s}__title`,style:{display:"flex",justifyContent:"space-between"}},p("Title"),e.createElement(d,{dataFormatType:a,setDataFormatType:r})),e.createElement("div",{className:`${s}__headerContent`},e.createElement(c,{question:n,dataFormatType:a,isImg:o})))},d=t=>{const{dataFormatType:n,setDataFormatType:a}=t;return e.createElement("span",{style:{display:"flex"}},e.createElement(i.Group,{value:n,onChange:r=>{a(r.target.value)}},e.createElement(i.Button,{value:m.Default,style:{textAlign:"center",width:"52px"}},"</>"),e.createElement(i.Button,{value:m.Markdown,style:{textAlign:"center",width:"52px"}},e.createElement(x,null))),e.createElement("span",{style:{marginLeft:"8px",width:"4px",background:"#1890ff"}}))};export{c as RenderQuestion,d as ToggleDataFormatType,F as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import n,{useState as O,useEffect as S}from"react";import{Tag as b}from"antd";import{prefix as N,EDataFormatType as u,ELLMDataType as p}from"../../../constant/index.js";import $ from"classnames";import{I18nextProvider as C,useTranslation as D}from"react-i18next";import{i18n as v}from"@labelbee/lb-utils";import k from"../../markdownView/index.js";import L from"../modelAPIView/index.js";import R from"../../diffMatchPatchComponent/index.js";import F from"./components/header/index.js";import q from"./components/imgView/index.js";import{isString as B}from"lodash";var H=Object.defineProperty,f=Object.getOwnPropertySymbols,Q=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable,w=(e,t,r)=>t in e?H(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,K=(e,t)=>{for(var r in t||(t={}))Q.call(t,r)&&w(e,r,t[r]);if(f)for(var r of f(t))W.call(t,r)&&w(e,r,t[r]);return e};const a=`${N}-LLMView`,_=({i:e,dataFormatType:t,isTextControl:r})=>{var l;return t===u.Markdown?n.createElement(k,{value:(l=e==null?void 0:e.newAnswer)!=null?l:e==null?void 0:e.answer}):r?n.createElement("div",{style:{width:"100%",overflowWrap:"break-word"}},n.createElement(R,{originString:e==null?void 0:e.answer,currentString:e==null?void 0:e.newAnswer})):n.createElement("div",{style:{whiteSpace:"pre-wrap"}},(e==null?void 0:e.newAnswer)||(e==null?void 0:e.answer))},E=(e,t)=>{var r;return(t==null?void 0:t.isTextEdit)?!!((r=((t==null?void 0:t.textEdit)||[]).filter(s=>(s==null?void 0:s.title)===e.order)[0])==null?void 0:r.textControl):!1},z=e=>{var t,r;const{hoverKey:l,answerList:s,question:m,lang:d,modelAPIResponse:x,setModelAPIResponse:g,checkMode:y=!0,LLMConfig:i,answerHeaderSlot:P}=e,[c,h]=O(u.Default),I=((t=i==null?void 0:i.dataType)==null?void 0:t.prompt)===p.Picture,A=((r=i==null?void 0:i.dataType)==null?void 0:r.response)===p.Picture,{t:T}=D();S(()=>{var o;d&&((o=v)==null||o.changeLanguage(d))},[]);const V=n.createElement("div",null,s.map((o,j)=>{const M=E(o,i);return n.createElement("div",{className:$({[`${a}__content`]:!0,[`${a}__contentActive`]:l===(o==null?void 0:o.order)}),key:j},n.createElement(b,{className:`${a}-tag`},o==null?void 0:o.order),n.createElement(_,{i:o,isTextControl:M,dataFormatType:c}))}),B(m)&&n.createElement(L,{dataFormatType:c,modelAPIResponse:x,question:m,setModelAPIResponse:g,checkMode:y,annotation:e.annotation}));return n.createElement("div",{className:a},n.createElement(F,{question:m,dataFormatType:c,setDataFormatType:h,isImg:I}),n.createElement("div",{className:`${a}__textBox`},n.createElement("div",{className:`${a}__title`},T("Answer")," ",P),A?n.createElement(q,{hoverKey:l,answerList:s}):V))},G=e=>n.createElement(C,{i18n:v},n.createElement(z,K({},e)));export{a as LLMViewCls,_ as RenderAnswer,G as default,E as getTextControlByConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import s,{useReducer as
|
|
1
|
+
import s,{useReducer as se,useContext as ae,useState as k,useEffect as J}from"react";import{prefix as le}from"../../../../../constant/index.js";import{Tag as de}from"antd";import{useTranslation as Q}from"react-i18next";import{LeftOutlined as ce}from"@ant-design/icons";import{classnames as pe}from"../../../../../utils/index.js";import{isArray as ue,cloneDeep as fe}from"lodash";import{MathUtils as y}from"@labelbee/lb-annotation";import{LLMContext as me}from"../../../../../store/ctx.js";var ge=Object.defineProperty,ve=Object.defineProperties,xe=Object.getOwnPropertyDescriptors,W=Object.getOwnPropertySymbols,he=Object.prototype.hasOwnProperty,_e=Object.prototype.propertyIsEnumerable,q=(i,p,a)=>p in i?ge(i,p,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[p]=a,z=(i,p)=>{for(var a in p||(p={}))he.call(p,a)&&q(i,a,p[a]);if(W)for(var a of W(p))_e.call(p,a)&&q(i,a,p[a]);return i},ye=(i,p)=>ve(i,xe(p)),g;(function(i){i.Top="Top",i.Right="Right",i.Bottom="Bottom",i.Left="Left"})(g||(g={}));const w=`${le}-LLMSidebar-contentBox`,B="@",be=()=>{const{t:i}=Q();return s.createElement("div",{className:`${w}__navigation`},s.createElement("span",null,i("Best")),s.createElement("div",{style:{display:"flex",alignItems:"center",flex:1,margin:"0px 20px"}},s.createElement(ce,null),s.createElement("div",{style:{height:0,border:"1px solid #999999",width:"100%"}})),s.createElement("span",null,i("Worst")))},Le=i=>{const[,p]=se(e=>e+1,0),{sortList:a,setSortList:F,waitSortList:K,disabeledAll:V,header:U,title:Y,prefixId:X="answer"}=i,I=`${X}-waitBox`,x=`${X}-sortBox`,{setHoverKey:G}=ae(me),[O,b]=k(void 0),[E,H]=k(void 0),[_,Z]=k([]),{t:S}=Q();J(()=>{Z(K)},[K]),J(()=>{ne()},[JSON.stringify(a)]);const T=({item:e,operation:t,id:n})=>{const o={[`border${O}`]:"2px solid #8C9AFF"};return s.createElement("div",z({key:`${e==null?void 0:e.id}`,color:"#EBEBEB",id:n,className:pe({[`${w}__answerTag`]:!0}),style:E===(e==null?void 0:e.id)&&O?o:void 0,draggable:V||!(e==null?void 0:e.id)?"":"true",onMouseMove:()=>{G(e.id)},onMouseLeave:()=>{G(-1)}},t),e==null?void 0:e.title)},D=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),ee=(e,t)=>{const n=y.getLineLength(e,D(t.tl,t.tr)),o=y.getLineLength(e,D(t.tr,t.tr)),d=y.getLineLength(e,D(t.bl,t.br)),c=y.getLineLength(e,D(t.tl,t.bl));return{minDistance:Math.min(n,o,d,c),toTopDistance:n,toRightDistance:o,toBottompDistance:d,toLeftDistance:c}},te=(e,t)=>{const{minDistance:n,toTopDistance:o,toRightDistance:d,toBottompDistance:c,toLeftDistance:u}=ee(e,t);switch(n){case o:b(g.Top);break;case d:b(g.Right);break;case c:b(g.Bottom);break;case u:b(g.Left);break}},ne=()=>{const e=document.getElementById(x);if(e==null?void 0:e.childNodes){let t=[];e.childNodes.forEach((n,o)=>{var d;let c=n;((d=n==null?void 0:n.childNodes)==null?void 0:d.length)>1&&(c=n.childNodes[0]);const u=c.getBoundingClientRect()||{},{bottom:r,top:f,left:l,right:m,width:v,height:h,x:A,y:R}=u,M={x:l+v/2,y:f+h/2},j={tl:{x:A,y:R},tr:{x:m,y:f},br:{x:m,y:r},bl:{x:l,y:r}},ie=a[o].reduce((re,$)=>{let N=$;return ue($)&&$.length>1&&(N=$[0]),N=ye(z({},N),{tagCenterPoint:M,tagVertexPoint:j}),[...re,N]},[]);t.push(ie)}),F(t)}},C=e=>{var t,n,o,d,c,u;const r=e.pageX,f=e.pageY,l={x:r,y:f};let m=a;if((m==null?void 0:m.length)>0){let v=m[0];for(let h=0;h<m.length;h++)if(h>0){const A=(t=m[h][0])==null?void 0:t.tagCenterPoint,R=(n=v[0])==null?void 0:n.tagCenterPoint,M=y.getLineLength(l,A),j=y.getLineLength(l,R);M<j&&(v=a[h])}if(!l.x||!l.y)return;if(L(e.target.id)===((o=v[0])==null?void 0:o.id)){H(void 0);return}H((d=v[0])==null?void 0:d.id),((c=v[0])==null?void 0:c.tagVertexPoint)&&l&&te(l,(u=v[0])==null?void 0:u.tagVertexPoint)}},P=e=>{var t;const{target:n}=e;let o=-1,d=-1,c=-1,u=[],r=fe(a);if(c=r.findIndex(f=>f[0].id===Number(E)),((t=n==null?void 0:n.parentNode)==null?void 0:t.parentNode.id)===x){o=L(n.parentNode.id);const f=L(n.id);u=r[~~o].filter(m=>m.id===~~f);const l=r[~~o].findIndex(m=>m.id===~~f);r[~~o].splice(l,1)}if((n==null?void 0:n.parentNode.id)===x){if(!E)return;o=L(n.id),d=r.findIndex(l=>l[0].id===o);const f=r.find(l=>l[0].id===o);f&&(u=f),r.splice(d,1),c=r.findIndex(l=>l[0].id===~~E)}switch(n.parentNode.id===I&&(o=L(n.id),d=_.findIndex(f=>f.id===o),u=[_[d]],_.splice(d,1)),O){case g.Left:r.splice(c,0,u);break;case g.Right:r.splice(c+1,0,u);break;case g.Top:case g.Bottom:r[c].push(...u);break;default:r.push(u);break}F(r),b(void 0),p()},L=e=>{const t=e.indexOf(B);return Number(e.substring(t+1,e.length))},oe=U!=null?U:s.createElement("div",{className:`${w}__title`},s.createElement("span",null,Y!=null?Y:S("RankingQualityOfAnswers")),_.length>0&&s.createElement(de,{color:"#FFD9D9",style:{color:"#F26549",marginLeft:8}},S("Unfinished")));return s.createElement("div",{style:{padding:"0px 16px",marginBottom:"16px",width:"100%"}},oe,s.createElement("div",null,s.createElement("div",{style:{display:"flex",alignItems:"center"}},s.createElement("span",{style:{marginRight:"16px"}},S("ToBeSorted")),s.createElement("div",{id:I,className:`${w}__answerBox`},_.length>0&&_.map(e=>T({item:e,id:`${I}-waitBoxItem${B}${e==null?void 0:e.id}`,operation:{onDrag:C,onDragEnd:P}})))),s.createElement(be,null),s.createElement("div",{id:x,className:`${w}__answerBox`},a.map((e,t)=>{var n;return e.length>1?s.createElement("div",{key:`item-${t}`,id:`${x}${B}${t}`,style:{border:"1px dashed #d9d9d9"}},e.map(o=>T({item:o,id:`${x}-sortBoxItem${B}${o==null?void 0:o.id}`,operation:{onDrag:C,onDragEnd:P}}))):T({item:e[0],id:`${x}${B}${(n=e[0])==null?void 0:n.id}`,operation:{onDrag:C,onDragEnd:P}})}))))};export{Le as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import u,{forwardRef as j,useState as I,useMemo as O,useEffect as V,useImperativeHandle as $}from"react";import{useTranslation as M}from"react-i18next";import{useDebounceFn as R}from"ahooks";import H from"../answerSort/index.js";var T=Object.defineProperty,z=Object.defineProperties,W=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable,A=(a,t,r)=>t in a?T(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,v=(a,t)=>{for(var r in t||(t={}))k.call(t,r)&&A(a,r,t[r]);if(y)for(var r of y(t))F.call(t,r)&&A(a,r,t[r]);return a},S=(a,t)=>z(a,W(t));const P=({selectedSort:a,initSelected:t,modelList:r})=>{const n=t!=null?t:a;let m=[];const _=r.filter(i=>!(n&&(n==null?void 0:n.length)>0?n.flat():[]).includes(i.id));return n&&(n==null?void 0:n.length)>0&&(m=n.map(i=>i.map(p=>r.find(w=>w.id===p)))),{waitSorts:_,newSort:m}},N=(a,t)=>{const{selectedSort:r,modelData:n,selectedAnswerSort:m,disabeledAll:_}=a,[i,p]=I({waitSorts:{},selecteds:r}),{t:w}=M(),D=O(()=>n.map((l,o)=>S(v({},l),{title:o+1})),[n]),h=O(()=>n.reduce((s,e)=>e.answerList.length>s.length?e.answerList:s,[]).map((s,e)=>({id:s.id,title:`${e+1}`}))||[],[n]);V(()=>{r&&x()},[n]);const E=l=>(D.filter(s=>s.answerList.some(e=>e.id===l))||[]).map(s=>S(v({},s),{id:s.id,title:s.title})),x=l=>{const o=i,s=l!=null?l:r;h.forEach(e=>{const d=E(e.id),c=s==null?void 0:s[e.id],{waitSorts:f,newSort:g}=P({selectedSort:c,modelList:d});o.waitSorts[e.id]=f,o.selecteds[e.id]=g}),p(o)};$(t,()=>({clearValue:()=>x({})}),[n]);const L=(l,o)=>{if(o.some(e=>e.some(d=>d==null?void 0:d.id))){const e=S(v({},i.selecteds),{[l]:o}),d={};Object.keys(e).forEach(c=>{d[c]=e[c].map(f=>f.map(g=>g.id))}),m(d),p(S(v({},i),{selecteds:e}))}},{run:b}=R(L,{wait:10});return u.createElement("div",null,u.createElement("div",{style:{fontWeight:500,fontSize:"16px",width:"100%",lineHeight:"46px",padding:"0px 16px"}},u.createElement("span",null,w("RankingQualityOfAnswers"))),h.map((l,o)=>{var s,e,d,c;return u.createElement("div",{key:o,style:{display:"flex"}},u.createElement("div",{style:{fontSize:"16px",fontWeight:500,width:"80px",lineHeight:"50px",textAlign:"center"}},`${w("Answer")}${o+1}`),u.createElement(H,{waitSortList:(e=(s=i==null?void 0:i.waitSorts)==null?void 0:s[l.id])!=null?e:[],sortList:(c=(d=i==null?void 0:i.selecteds)==null?void 0:d[l.id])!=null?c:[],setSortList:f=>{b(l.id,f)},disabeledAll:_,header:"",prefixId:`modelAnswer${o}`}))}))};var Q=j(N);export{Q as default,P as getSorts};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
`);return
|
|
1
|
+
import t,{useEffect as V}from"react";import{Form as g,Input as j,message as F}from"antd";import L from"classnames";import{useTranslation as N}from"react-i18next";import S from"../../../../latexEditor/index.js";import E from"./index.module.scss.js";import C from"../../../../markdownView/index.js";import B from"../../../../longText/index.js";var D=Object.defineProperty,A=Object.defineProperties,R=Object.getOwnPropertyDescriptors,b=Object.getOwnPropertySymbols,k=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,P=(a,e,r)=>e in a?D(a,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[e]=r,$=(a,e)=>{for(var r in e||(e={}))k.call(e,r)&&P(a,r,e[r]);if(b)for(var r of b(e))M.call(e,r)&&P(a,r,e[r]);return a},q=(a,e)=>A(a,R(e));const z=a=>{const{disabeledAll:e,textConfig:r,textAttribute:w,setText:T}=a,{TextArea:I}=j,[v]=g.useForm(),{t:y}=N();V(()=>{const s=r.map((c,n)=>{var d;const m=(w==null?void 0:w.filter(o=>(o==null?void 0:o.textId)===(c==null?void 0:c.textId)))||[];return q($({},c),{value:(d=m[0])==null?void 0:d.value})});v.setFieldsValue({text:s})},[r,w]);const O=({newText:s,fieldName:c,max:n})=>{var d,m;const o=`textInput_${c}`,l=document.getElementById(o),u=l.value||"",f=(d=l==null?void 0:l.selectionStart)!=null?d:u.length,p=(m=l.selectionEnd)!=null?m:u.length,_=u.substring(0,f),x=u.substring(p,u.length),i=_+s+x;if(n&&(i==null?void 0:i.length)>n){F.error(y("MaximumCharacterError",{num:n}));return}l.value=i,v.setFields([{name:["text",c,"value"],value:i,errors:[]}]),h(),l.selectionStart=f+s.length,l.selectionEnd=f+s.length,l.focus()},h=()=>{const s=v.getFieldValue("text");T(s)};return t.createElement(g,{form:v},t.createElement(g.List,{name:"text"},(s,c)=>t.createElement(t.Fragment,null,s.map((n,d)=>{const{max:m,min:o,title:l,tip:u,isLaText:f}=r[n.name]||{},p=l,_=y("LeastCharacterError",{num:o});return t.createElement("div",{style:{display:"flex",flexDirection:"column",marginBottom:"16px"},key:d},p&&t.createElement(g.Item,{name:[n.name,"title"],extra:t.createElement(B,{text:u!=null?u:"",overflowMaxLines:3,openByText:!0}),className:E.textTitle,required:!!o,label:" ",colon:!1},l,p&&t.createElement("span",{className:L({clearText:!0,clearText__disabled:e}),style:{verticalAlign:"initial"},onClick:()=>{e||(v.setFields([{name:["text",n.name,"value"],value:void 0,errors:o?[_]:[]}]),h())}})),f&&p&&t.createElement(S,{onSelectLatex:x=>O({newText:x,fieldName:n.name,max:m}),disabled:e}),p&&t.createElement(g.Item,{name:[n.name,"value"],style:{marginBottom:24},rules:[{validator:(x,i)=>o&&(i==null?void 0:i.length)<Number(o)?Promise.reject(_):Promise.resolve()}],initialValue:void 0},t.createElement(I,{maxLength:m,disabled:e,showCount:!!m,autoSize:{minRows:4,maxRows:10},style:{width:"100%"},id:`textInput_${n.name}`,onChange:()=>h()})),f&&p&&t.createElement(g.Item,{shouldUpdate:!0,noStyle:!0},()=>{const x=v.getFieldValue(["text",n.name,"value"])||"",i=x.replace(/\n/g,`
|
|
2
|
+
`);return t.createElement("div",{className:E.outputDisplay},t.createElement("div",{className:E.title},y("OutputDisplay")),t.createElement("div",{className:E.content},x?t.createElement(C,{value:i}):""))}))}))))};export{z as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import i,{useContext as q,useState as R,useEffect as P,useMemo as ct}from"react";import{prefix as dt}from"../../../constant/index.js";import{Button as ut,Empty as mt}from"antd";import pt from"./components/answerSort/index.js";import{connect as ft}from"react-redux";import{isBoolean as gt,isArray as vt,isString as xt,isNumber as Lt,isObject as wt}from"lodash";import St from"./components/answerList/index.js";import{LabelBeeContext as yt,LLMContext as z}from"../../../store/ctx.js";import{jsonParser as F}from"../../../utils/index.js";import{getStepConfig as Et}from"../../../store/annotation/reducer.js";import{useCustomToolInstance as bt}from"../../../hooks/annotation.js";import{PageForward as T}from"../../../store/annotation/actionCreators.js";import{cKeyCode as _t,EToolName as Ct}from"@labelbee/lb-annotation";import{useTranslation as W}from"react-i18next";import{getCurrentResultFromResultList as ht,getRenderDataByResult as jt,formatSort as Pt}from"../utils/data.js";import Tt from"../../../assets/annotation/LLMTool/empty.svg.js";import It from"./components/textInputBox/index.js";import At from"../../tagList/components/overall/index.js";import Ot from"../../../utils/StepUtils.js";var Nt=Object.defineProperty,Rt=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Bt=Object.prototype.propertyIsEnumerable,J=(s,o,l)=>o in s?Nt(s,o,{enumerable:!0,configurable:!0,writable:!0,value:l}):s[o]=l,d=(s,o)=>{for(var l in o||(o={}))Mt.call(o,l)&&J(s,l,o[l]);if(G)for(var l of G(o))Bt.call(o,l)&&J(s,l,o[l]);return s},p=(s,o)=>Rt(s,Dt(o));const $t=_t.default,I=`${dt}-sidebar`,Q=()=>{const{t:s}=W();return i.createElement("div",{className:`${I}`},i.createElement("div",{className:`${I}__content`,style:{display:"flex",justifyContent:"center",alignItems:"center"}},i.createElement(mt,{description:i.createElement("span",{style:{color:"#ccc"}},s("NoScoringScale")),imageStyle:{width:200,height:200},image:i.createElement("img",{src:Tt})})))},H=s=>{var o,l;const{indicatorScore:_=[],indicatorDetermine:g=[],text:C=[],enableSort:v,isTextEdit:S,tagInputListConfigurable:x,dialogSort:L=!1}=s||{},w=((o=_==null?void 0:_.filter(n=>n.label&&n.value&&n.score))==null?void 0:o.length)>0,h=((l=g==null?void 0:g.filter(n=>n.label&&n.value))==null?void 0:l.length)>0,A=(C==null?void 0:C.length)>0;return!(w||h||A||v||S||x||L)},Vt=s=>{var o,l;const{annotation:_,dispatch:g,checkMode:C}=s,{imgIndex:v,imgList:S,stepList:x,step:L,skipBeforePageTurning:w}=_,{modelAPIResponse:h,setModelAPIResponse:A}=q(z),{t:j}=W(),n=(o=S[v])!=null?o:{},D=F(n==null?void 0:n.result),{toolInstanceRef:f}=bt({basicInfo:D}),[c,X]=R(),[O,Y]=R(!0),{setNewAnswerList:Z}=q(z),[e,y]=R({}),E=!f.current.valid||C;P(()=>{var t;if(x&&L){const r=(t=Et(x,L))==null?void 0:t.config;X(F(r))}},[L,JSON.stringify(x)]),P(()=>{!n||v===-1||(f.current.setValid=M,f.current.clearResult=tt,M(),B())},[v,c,n==null?void 0:n.id]);const tt=()=>{B(n==null?void 0:n.questionList)},M=t=>{var r;const a=t!=null?t:D.valid;gt(a)&&(Y(a),f.current.valid=a,(r=f.current)==null||r.emit("validUpdated"))},B=t=>{const r=Ot.getCurrentStepInfo(L,x),a=ht(n==null?void 0:n.result,r.step);let u=n==null?void 0:n.questionList;(a==null?void 0:a.answerList)&&f.current.valid&&(u=a),t&&(u=t,a.sort=[]);const b=jt(c,u);y(d({},b)),A([])};P(()=>{et(),Z((e==null?void 0:e.answerList)||[])},[e,h,O]),P(()=>(window.addEventListener("keydown",$),()=>{window.removeEventListener("keydown",$)}),[]);const et=()=>{const{newSort:t,answerList:r,textAttribute:a,tagList:u}=e,b=Pt(t||[]),m={answerList:r,sort:b,tagList:u,textAttribute:a,id:n==null?void 0:n.id,modelAPIResponse:h};f.current.exportData=()=>[[m],{valid:O}],f.current.currentPageResult=p(d({},m),{toolName:Ct.LLM,valid:O})},$=t=>{if(t.ctrlKey&&t.keyCode===$t.Enter){if(w){w(()=>g(T()));return}g(T())}},nt=({order:t,value:r,key:a})=>{const{answerList:u}=e,b=u==null?void 0:u.map(m=>{var U;if((m==null?void 0:m.order)===t){if(a==="textEdit"&&xt(r))return p(d({},m),{newAnswer:r});if(Lt(r))return p(d({},m),{score:r});if(wt(r)&&a){const at={[r==null?void 0:r.key]:r.value},lt=(U=m[a])!=null?U:{};return p(d({},m),{[a]:d(d({},lt),at)})}}return m});y(p(d({},e),{answerList:b||[]}))};if(ct(()=>H(c),[c]))return i.createElement(Q,null);const{indicatorScore:V=[],indicatorDetermine:k=[],enableSort:ot,isTextEdit:rt,inputList:N=[],tagInputListConfigurable:K}=c||{},it=K&&((l=N.filter(t=>!t.isOverall))==null?void 0:l.length)>0,st=(k==null?void 0:k.length)>0||(V==null?void 0:V.length)>0||rt||it;return i.createElement("div",{className:`${I}`},i.createElement("div",{className:`${I}__content`},i.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},j("GlobalAnnotation")),ot&&i.createElement(pt,{waitSortList:(e==null?void 0:e.waitSorts)||[],sortList:(e==null?void 0:e.newSort)||[],setSortList:t=>{y(p(d({},e),{newSort:t}))},disabeledAll:E}),K&&N.length&&i.createElement(At,{inputList:N,selectedTags:(e==null?void 0:e.tagList)||{},updateValue:t=>{const{key:r,value:a}=t,u=e==null?void 0:e.tagList;y(p(d({},e),{tagList:p(d({},u),{[r]:a})}))},disabeledAll:E}),(c==null?void 0:c.text)&&i.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},i.createElement(It,{textAttribute:(e==null?void 0:e.textAttribute)||[],textConfig:(c==null?void 0:c.text)&&vt(c.text)?c==null?void 0:c.text:[],setText:t=>y(p(d({},e),{textAttribute:t})),disabeledAll:E})),i.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},j("QualifiedAnnotation")),i.createElement("div",null,st&&i.createElement(St,{list:(e==null?void 0:e.answerList)||[],LLMConfig:c,updateValue:nt,disabeledAll:E}))),i.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(S==null?void 0:S.length)-1!==v&&i.createElement(ut,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(w){w(()=>g(T()));return}g(T())},disabled:E},j("Save"))))},kt=s=>({annotation:s.annotation});var Kt=ft(kt,null,null,{context:yt})(Vt);export{Q as EmptyConfig,Kt as default,H as getLLMIsNoConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var o;(function(n){n[n.Scribble=1]="Scribble",n[n.Erase=2]="Erase"})(o||(o={}));var t;(function(n){n.Rect="rectTool",n.Tag="tagTool",n.Point="pointTool",n.PointMarker="pointMarkerTool",n.Segmentation="segmentationTool",n.Filter="filterTool",n.Text="textTool",n.Polygon="polygonTool",n.Line="lineTool",n.LineMarker="lineMarkerTool",n.Empty="emptyTool",n.FolderTag="folderTagTool",n.RectTrack="rectTrackTool",n.ScribbleTool="scribbleTool",n.Face="faceTool",n.ClientAttribute="clientAttributeTool",n.OCRRelation="OCRRelationTool",n.SegmentByRect="segmentByRectTool",n.Cuboid="cuboidTool",n.PointCloudPolygon="pointCloudPolygon",n.LLM="LLMTool",n.NLP="NLPTool"})(t||(t={}));var r;(function(n){n[n.AnyString=0]="AnyString",n[n.Order=1]="Order",n[n.EnglishOnly=2]="EnglishOnly",n[n.NumberOnly=3]="NumberOnly",n[n.CustomFormat=4]="CustomFormat"})(r||(r={}));const i=1e3;export{o as EScribblePattern,r as ETextType,t as EToolName,i as TEXT_ATTRIBUTE_MAX_LENGTH};
|
|
1
|
+
var o;(function(n){n[n.Scribble=1]="Scribble",n[n.Erase=2]="Erase"})(o||(o={}));var t;(function(n){n.Rect="rectTool",n.Tag="tagTool",n.Point="pointTool",n.PointMarker="pointMarkerTool",n.Segmentation="segmentationTool",n.Filter="filterTool",n.Text="textTool",n.Polygon="polygonTool",n.Line="lineTool",n.LineMarker="lineMarkerTool",n.Empty="emptyTool",n.FolderTag="folderTagTool",n.RectTrack="rectTrackTool",n.ScribbleTool="scribbleTool",n.Face="faceTool",n.ClientAttribute="clientAttributeTool",n.OCRRelation="OCRRelationTool",n.SegmentByRect="segmentByRectTool",n.Cuboid="cuboidTool",n.PointCloudPolygon="pointCloudPolygon",n.LLM="LLMTool",n.NLP="NLPTool",n.LLMMultiWheel="LLMMultiWheelTool"})(t||(t={}));var r;(function(n){n[n.AnyString=0]="AnyString",n[n.Order=1]="Order",n[n.EnglishOnly=2]="EnglishOnly",n[n.NumberOnly=3]="NumberOnly",n[n.CustomFormat=4]="CustomFormat"})(r||(r={}));const i=1e3;export{o as EScribblePattern,r as ETextType,t as EToolName,i as TEXT_ATTRIBUTE_MAX_LENGTH};
|
package/es/index.css
CHANGED
|
@@ -3367,4 +3367,54 @@
|
|
|
3367
3367
|
|
|
3368
3368
|
.bee-audio-combined {
|
|
3369
3369
|
cursor: url("../dist/assets/icons/ad8081bf.svg") 10 12, default;
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
/** LLMMultiWheel style */
|
|
3373
|
+
.bee-LLMMultiWheelView {
|
|
3374
|
+
display: flex;
|
|
3375
|
+
flex: auto;
|
|
3376
|
+
flex-direction: column;
|
|
3377
|
+
overflow: hidden;
|
|
3378
|
+
background-color: #fff;
|
|
3379
|
+
}
|
|
3380
|
+
|
|
3381
|
+
.bee-LLMMultiWheelView-container {
|
|
3382
|
+
flex: auto;
|
|
3383
|
+
display: flex;
|
|
3384
|
+
overflow: hidden;
|
|
3385
|
+
}
|
|
3386
|
+
.bee-LLMMultiWheelView-container .dialog {
|
|
3387
|
+
min-width: 50%;
|
|
3388
|
+
padding: 8px;
|
|
3389
|
+
border: 1px solid transparent;
|
|
3390
|
+
overflow: auto;
|
|
3391
|
+
}
|
|
3392
|
+
.bee-LLMMultiWheelView-container .dialog.selected {
|
|
3393
|
+
border-color: #69b1ff;
|
|
3394
|
+
}
|
|
3395
|
+
.bee-LLMMultiWheelView-container .dialog .header {
|
|
3396
|
+
position: relative;
|
|
3397
|
+
}
|
|
3398
|
+
.bee-LLMMultiWheelView-container .dialog .header .order {
|
|
3399
|
+
position: absolute;
|
|
3400
|
+
left: 0;
|
|
3401
|
+
top: 0;
|
|
3402
|
+
width: 32px;
|
|
3403
|
+
height: 32px;
|
|
3404
|
+
line-height: 32px;
|
|
3405
|
+
text-align: center;
|
|
3406
|
+
background: #d4cbcb;
|
|
3407
|
+
border-radius: 4px;
|
|
3408
|
+
}
|
|
3409
|
+
.bee-LLMMultiWheelView-container .dialog .header .name {
|
|
3410
|
+
display: flex;
|
|
3411
|
+
flex-direction: column;
|
|
3412
|
+
align-items: center;
|
|
3413
|
+
justify-content: center;
|
|
3414
|
+
}
|
|
3415
|
+
.bee-LLMMultiWheelView-container .dialog .header .name .show-name {
|
|
3416
|
+
font-size: 16px;
|
|
3417
|
+
}
|
|
3418
|
+
.bee-LLMMultiWheelView-container .dialog .header .name .tips {
|
|
3419
|
+
color: #d4cbcb;
|
|
3370
3420
|
}
|
package/es/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as s}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as m,useImperativeHandle as u}from"react";import{initReactI18next as f,I18nextProvider as x}from"react-i18next";import{Provider as w}from"react-redux";import P from"./App.js";import v from"./configureStore.js";import{PageBackward as j,PageForward as
|
|
1
|
+
export{default as AnnotationView}from"./components/AnnotationView/index.js";export{default as PointCloudAnnotationView}from"./components/AnnotationView/pointCloudAnnotationView.js";export{default as QuestionView}from"./components/LLMToolView/questionView/index.js";export{default as TextContent}from"./components/NLPToolView/textContent/index.js";import{i18n as s}from"@labelbee/lb-utils";export{i18n}from"@labelbee/lb-utils";import r,{useState as m,useImperativeHandle as u}from"react";import{initReactI18next as f,I18nextProvider as x}from"react-i18next";import{Provider as w}from"react-redux";import P from"./App.js";import v from"./configureStore.js";import{PageBackward as j,PageForward as S,PageJump as T}from"./store/annotation/actionCreators.js";export{VideoTagTool}from"./components/videoAnnotate/videoTagTool/TagToolInstanceAdaptorI18nProvider.js";import{PointCloudProvider as V}from"./components/pointCloudView/PointCloudContext.js";import{LabelBeeContext as b}from"./store/ctx.js";export{default as PredictTracking}from"./components/predictTracking/predictTrackingIcon/index.js";export{default as LLMToolView}from"./components/LLMToolView/index.js";export{default as SwitchCuboidBoxIn2DView,SwitchCuboidBoxIn2DViewStateMode}from"./views/MainView/toolFooter/SwitchCuboidBoxIn2DView/index.js";export{default as BatchSwitchConnectIn2DView}from"./views/MainView/toolFooter/BatchSwitchConnectIn2DView/BatchSwitchConnectIn2DView.js";export{default as MeasureCanvas}from"./components/measureCanvas/index.js";export{default as AnnotatedBox}from"./views/MainView/sidebar/PointCloudToolSidebar/components/annotatedBox/index.js";export{default as RectRotateSensitivitySlider}from"./views/MainView/sidebar/PointCloudToolSidebar/components/rectRotateSensitivitySlider/index.js";export{FindTrackIDIndexInCheckMode as FindTrackIDIndex}from"./views/MainView/sidebar/PointCloudToolSidebar/components/findTrackIDIndex/index.js";export{WrapAudioPlayer as AudioPlayer}from"./components/audioPlayer/index.js";export{generatePointCloudBoxRects}from"./utils/index.js";export{default as SubAttributeList}from"./components/subAttributeList/index.js";import{ToolStyleProvider as g}from"./hooks/useToolStyle.js";import{LoadFileAndFileData as C}from"./store/annotation/reducer.js";export{default as useToolConfigStore}from"./store/toolConfig/index.js";export{LLMMultiWheelSourceView}from"./components/LLMMultiWheelView/index.js";export{EDataFormatType,ELLMDataType,EStepType,ESubmitType,componentCls,prefix}from"./constant/index.js";var I=Object.defineProperty,h=Object.defineProperties,_=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,p=(o,e,t)=>e in o?I(o,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):o[e]=t,L=(o,e)=>{for(var t in e||(e={}))y.call(e,t)&&p(o,t,e[t]);if(l)for(var t of l(e))A.call(e,t)&&p(o,t,e[t]);return o},M=(o,e)=>h(o,_(e));const n=v();s.use(f),s.options.react={useSuspense:!1};const D=(o,e)=>{const[t,c]=m();return u(e,()=>({toolInstance:t,annotationEngine:n.getState().annotation.annotationEngine,pageBackwardActions:()=>n.dispatch(j()),pageForwardActions:()=>n.dispatch(S()),pageJump:(i,a)=>{const d=~~i-1;n.dispatch(T(d)),a&&n.dispatch(C(d))},hello:()=>alert("hello labelBee!!!")}),[t]),r.createElement(w,{store:n,context:b},r.createElement(x,{i18n:s},r.createElement(g,{value:o.toolStyle},r.createElement(V,null,r.createElement(P,M(L({},o),{setToolInstance:i=>{var a;c(i),(a=o.onLoad)==null||a.call(o,{toolInstance:i})}}))))))};var B=r.forwardRef(D);export{B as default,n as store};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{EDataFormatType as s}from"../../constant/index.js";import{create as i}from"zustand";const o=i(e=>({dataFormatType:s.Default,setDataFormatType:t=>e(a=>({dataFormatType:t})),selectedID:"",setSelectedID:t=>e(a=>({selectedID:t})),highlightIDs:[],setHighlightIDs:t=>e(a=>({highlightIDs:t})),selectedIDs:[],setSelectedIDs:t=>e(a=>({selectedIDs:t})),rectRotateSensitivity:2,setRectRotateSensitivity:t=>e(a=>({rectRotateSensitivity:t}))}));export{o as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getFormatSize as yt}from"../../components/customResizeHook/index.js";import{ESubmitType as K}from"../../constant/index.js";import Rt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as x}from"../../utils/index.js";import X from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Pt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as dt,composeResult as Y}from"../../utils/data.js";import O from"../../utils/StepUtils.js";import J from"../../utils/ToolUtils.js";import{MathUtils as pt,CommonToolUtils as Ct,AnnotationEngine as Ot,ImgUtils as ht}from"@labelbee/lb-annotation";import{PointCloudUtils as gt,i18n as G}from"@labelbee/lb-utils";import{Modal as _t}from"antd";import{message as It}from"antd/es";import mt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as W}from"../../data/enums/ToolType.js";var bt=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,Tt=(t,e,u)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,o=(t,e)=>{for(var u in e||(e={}))Bt.call(e,u)&&Tt(t,u,e[u]);if(ft)for(var u of ft(e))xt.call(e,u)&&Tt(t,u,e[u]);return t},s=(t,e)=>Nt(t,Ut(e)),Lt=(t,e,u)=>new Promise((S,d)=>{var A=m=>{try{E(u.next(m))}catch(y){d(y)}},L=m=>{try{E(u.throw(m))}catch(y){d(y)}},E=m=>m.done?S(m.value):Promise.resolve(m.value).then(A,L);E((u=u.apply(t,e)).next())});const w=(t,e)=>t.find(u=>u.step===e),Et={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},wt=t=>{const{imgList:e,imgPageSize:u}=t;return Math.ceil(e.length/u)},St=(t,e)=>t.reduce((u,S)=>{if(S){const d=S.result;if(x(d)[`step_${e}`])return u+1}return u},0)/t.length,Ft=(t,e)=>{const{step:u,stepList:S}=t,d=O.getCurrentStepInfo(u,S),A=Pt.jsonParser(d.config);if(J.isVideoTool(d==null?void 0:d.tool)||J.isAudioTool(d==null?void 0:d.tool)||J.isPointCloudTool(d==null?void 0:d.tool)||[W.LLM,W.NLP].includes(d==null?void 0:d.tool))return;const L=document.getElementById("toolContainer");if(!L)throw"Not exist dom named id-toolContainer";const E=yt({width:window.innerWidth,height:window.innerHeight}),m=new Ot({container:L,toolName:d.tool,size:E,imgNode:e,config:A,style:JSON.parse(Rt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},jt=(t,e)=>(u,S)=>Lt(void 0,null,function*(){var d,A;const{stepList:L,step:E}=S().annotation,m=O.currentToolIsVideo(E,L),y=O.currentToolIsPointCloud(E,L),h=((d=O.getCurrentStepInfo(E,L))==null?void 0:d.tool)===W.LLM,b=((A=O.getCurrentStepInfo(E,L))==null?void 0:A.tool)===W.NLP,N=O.currentToolIsAudio(E,L);if($(u,!0),yield u(Gt(t)),m){u(Vt(t));return}if(y||h||N||b){u(Mt(t));return}u(kt(t,e))}),Gt=t=>(e,u)=>Lt(void 0,null,function*(){const{getFileData:S,imgList:d}=u().annotation;if(S){const A=yield S(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:A,index:t}})}}),Vt=t=>e=>{e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},Mt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},kt=(t,e)=>(u,S)=>{var d;const{toolInstance:A,imgList:L}=S().annotation,E=(d=L==null?void 0:L[t])==null?void 0:d.url;ht.load(E).then(m=>{$(u,!1),u({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(u,!1),A==null||A.setErrorImg(),u({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ht=({toolInstance:t,imgList:e,imgIndex:u,stepList:S,step:d=1})=>{var A,L,E,m;const y=((A=e[u])==null?void 0:A.result)||"",[h,b,N]=(L=t==null?void 0:t.exportData())!=null?L:[],V=(m=(E=t==null?void 0:t.exportCustomData)==null?void 0:E.call(t))!=null?m:{},M=dt(y,b),k=Y(M,{step:d,stepList:S},{rect:h},V);return e.map((F,H)=>H===u?o(s(o({},F),{result:k}),N):o({},F))},zt=(t=o({},Et),e)=>{var u,S,d,A,L,E,m,y,h,b,N,V,M,k,F,H,q,Z,Q,tt,et,nt,ot,lt,st,it,rt,ut;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),Et);case i.UPDATE_TOOL_INSTANCE:return s(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return s(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:l}=t,r=St(n,l);return s(o({},t),{stepProgress:r})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:l,step:r,stepList:a,toolInstance:p,onSubmit:c,resultList:f}=t;if(!p||!n[l])return t;const I=((u=n[l])==null?void 0:u.result)||"",[,_,g]=(S=p==null?void 0:p.exportData())!=null?S:[],T=(A=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?A:{},D=dt(I,_),v=Y(D,{step:r,stepList:a},{rect:f},T),P=t.imgList.map((C,R)=>{if(R===l){const j=X.dataCorrection(v,I,r,a);return o(s(o({},C),{result:j}),g)}return C});if(((L=e.payload)==null?void 0:L.submitType)===K.SyncImgList)return s(o({},t),{imgList:P});const U=St(P,r);return s(o({},t),{stepProgress:U,imgList:P})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:l,onSave:r}=t;return r==null||r(n[l],l,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:l,resultList:r,toolInstance:a,basicResultList:p}=t;if(!a)return t;const[c]=(E=a==null?void 0:a.exportData())!=null?E:[];let f=c;if((p==null?void 0:p.length)>0){const I=(m=p[l])==null?void 0:m.id,_=c.map(g=>s(o({},g),{sourceID:I}));f=mt.cloneDeep(r).filter(g=>g.sourceID!==I),f.push(..._)}return s(o({},t),{resultList:f,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:l,imgList:r,imgIndex:a,stepList:p,annotationEngine:c,resultList:f,basicResultList:I}=t;if(!n||!c)return t;const _=e.payload.basicIndex,g=(y=I[_])==null?void 0:y.id,T=x((h=r[a])==null?void 0:h.result),D=(f||[]).filter(j=>j.sourceID===g),v=w(p,l),{dataSourceStep:P,tool:U}=v,C=w(p,P);let R=[];return P&&U&&(R=(b=T[`step_${P}`])==null?void 0:b.result,(R==null?void 0:R.length)>0?(c==null||c.setBasicInfo(C.tool,R[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),It.info(G.t("NoDependency")))),n==null||n.setResult(D),n==null||n.history.initRecord(D,!0),s(o({},t),{basicIndex:_})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return s(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:l,toolInstance:r,annotationEngine:a,stepList:p}=t;if(!r)return s(o({},t),{imgIndex:e.payload.nextIndex});const c=O.getCurrentStepInfo(l,p),{nextIndex:f,imgNode:I,nextBasicIndex:_,imgError:g}=e.payload,T=_!=null?_:0,D=x((N=n[f])==null?void 0:N.result),v=D[`step_${c.step}`],P=!v,U={rotate:(V=D.rotate)!=null?V:0,valid:(M=D.valid)!=null?M:!0};I&&g!==!0?a==null||a.setImgNode(I,U):r==null||r.setValid(U.valid);const C=w(p,c.step),{dataSourceStep:R,tool:j}=C,at=w(p,R),ct=R&&j,B=(F=(k=D[`step_${R}`])==null?void 0:k.result)!=null?F:[],z=X.getInitialResultList(v==null?void 0:v.result,r,C,B,P);if(a==null||a.launchOperation(),ct&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(at.tool,B[T]):(a==null||a.setBasicInfo(at.tool),a==null||a.forbidOperation(),It.info(G.t("NoDependency")))),c.tool!=="check"){const At=(q=(H=B[T])==null?void 0:H.id)!=null?q:"",Dt=ct?z.filter(vt=>Ct.isSameSourceID(vt.sourceID,At)):z;(Z=r==null?void 0:r.history)==null||Z.initRecord(z,!0),r==null||r.setResult(Dt)}return s(o({},t),{imgIndex:f,basicIndex:T,basicResultList:B,resultList:z})}case i.UPDATE_ANNOTATION_CONFIG:return s(o({},t),{config:(Q=e.payload.config)!=null?Q:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return s(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:l}=e.payload;return s(o({},t),{stepList:n,step:l})}case i.INIT_TOOL:{const{imgNode:n}=t,l=Ft(t,n);if(l){const{toolInstance:r,annotationEngine:a}=l;return s(o({},t),{toolInstance:r,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(tt=e.payload)==null?void 0:tt.instance;return n?s(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return s(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return s(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return s(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return s(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return s(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return s(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return s(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return s(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return s(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return s(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return s(o({},t),{preDataProcess:e.payload.preDataProcess});case i.UPDATE_IMG_INDEX_BY_EXTERNAL:return s(o({},t),{getImgIndexByExternal:e.payload.getImgIndexByExternal});case i.SKIP_BEFORE_PAGE_TURNING:return s(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:l}=e.payload,{imgList:r}=t,a=[...r];return a[l]=o(o({},a[l]),n),s(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:l}=t;return l&&l()===!1||(et=n==null?void 0:n.updateRotate)==null||et.call(n),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,l=(nt=n==null?void 0:n.valid)!=null?nt:!0;return _t.destroyAll(),_t.confirm({content:G.t(l?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!l)},okText:G.t("Confirm"),cancelText:G.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:l,imgList:r,step:a,stepList:p}=t;if(!n)return t;if(l===0||l>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const c=r[l-1].result;if(!c)return t;const f=O.getCurrentStepInfo(a,p),I=(ot=f==null?void 0:f.step)!=null?ot:a,_=(lt=n==null?void 0:n.valid)!=null?lt:!0,g=X.copyResultChange({copyResult:c,step:I,currentResult:(st=r[l].result)!=null?st:"",preMappingImgList:(it=r[l-1].mappingImgList)!=null?it:[],mappingImgList:(rt=r[l].mappingImgList)!=null?rt:[],valid:_});r[l]=s(o({},r[l]),{result:g});const D=x(g)[`step_${a}`],v=(D==null?void 0:D.result)||[];return n==null||n.setResult(v),n==null||n.history.pushHistory(v),(ut=n==null?void 0:n.asyncData)==null||ut.call(n,r[l]),s(o({},t),{imgList:[...r]})}case i.SET_STEP:{const{stepList:n,annotationEngine:l}=t,{toStep:r}=e.payload;if(l){const a=w(n,r);return l==null||l.setToolName(a.tool,a.config),s(o({},t),{step:r,toolInstance:l==null?void 0:l.toolInstance})}return s(o({},t),{step:r})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return s(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return s(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return s(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return s(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return s(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:l,rangeIndex:r,imgList:a}=e.payload,{imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const T=s(o({},_),{result:gt.batchUpdateTrackID({id:n,newID:l,result:_.result})});return f.push({imgIndex:g,newInfo:T}),T}return _});return c&&c([I[p]],K.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:l,rangeIndex:r}=e.payload,{imgList:a,imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const T=s(o({},_),{result:gt.batchUpdateResultByTrackID({id:n,newData:l,result:_.result})});return f.push({imgIndex:g,newInfo:T}),T}return _});return c&&c([I[p]],K.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:l,stepList:r,step:a,predictionResult:p}=t,c={};p.forEach(g=>{const{index:T}=g;c[T]=mt.pick(g,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const f=`step_${a}`,I=[],_=l.map((g,T)=>{if(c[T]){const D=g.result==="{}"?x(Y("",{step:a,stepList:r},{rect:[]},{})):x(g.result);D[f].result.push(c[T]);const v=s(o({},g),{result:JSON.stringify(D)});return I.push({imgIndex:T,newInfo:v}),v}return g});return n==null||n(_,K.BatchUpdateImgList,-1,_,{updateImgList:I}),s(o({},t),{imgList:_})}default:return t}};export{jt as LoadFileAndFileData,zt as annotationReducer,Ht as composeResultByToolInstance,w as getStepConfig,wt as getTotalPage};
|
|
1
|
+
import{getFormatSize as yt}from"../../components/customResizeHook/index.js";import{ESubmitType as W}from"../../constant/index.js";import Rt from"../../constant/styleString.js";import{ANNOTATION_ACTIONS as i}from"../Actions.js";import{jsonParser as x}from"../../utils/index.js";import X from"../../utils/AnnotationDataUtils.js";import{ConfigUtils as Pt}from"../../utils/ConfigUtils.js";import{composeResultWithBasicImgInfo as dt,composeResult as Y}from"../../utils/data.js";import h from"../../utils/StepUtils.js";import J from"../../utils/ToolUtils.js";import{MathUtils as pt,CommonToolUtils as Ct,AnnotationEngine as ht,ImgUtils as Ot}from"@labelbee/lb-annotation";import{PointCloudUtils as gt,i18n as M}from"@labelbee/lb-utils";import{Modal as _t}from"antd";import{message as It}from"antd/es";import mt from"lodash";import{SetAnnotationLoading as $}from"./actionCreators.js";import{EToolName as w}from"../../data/enums/ToolType.js";var bt=Object.defineProperty,Nt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptors,ft=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,xt=Object.prototype.propertyIsEnumerable,Lt=(t,e,u)=>e in t?bt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[e]=u,o=(t,e)=>{for(var u in e||(e={}))Bt.call(e,u)&&Lt(t,u,e[u]);if(ft)for(var u of ft(e))xt.call(e,u)&&Lt(t,u,e[u]);return t},s=(t,e)=>Nt(t,Ut(e)),Tt=(t,e,u)=>new Promise((S,d)=>{var A=m=>{try{E(u.next(m))}catch(y){d(y)}},T=m=>{try{E(u.throw(m))}catch(y){d(y)}},E=m=>m.done?S(m.value):Promise.resolve(m.value).then(A,T);E((u=u.apply(t,e)).next())});const F=(t,e)=>t.find(u=>u.step===e),Et={annotationEngine:null,toolInstance:null,imgList:[],config:"{}",imgIndex:-1,basicIndex:0,imgPageSize:1,step:1,stepList:[],imgNode:new Image,basicResultList:[],resultList:[],stepProgress:0,loading:!1,loadPCDFileLoading:!0,triggerEventAfterIndexChanged:!1,pointCloudLoading:!1,checkMode:!1,predictionResult:[],predictionResultVisible:!1,highlightAttribute:""},wt=t=>{const{imgList:e,imgPageSize:u}=t;return Math.ceil(e.length/u)},St=(t,e)=>t.reduce((u,S)=>{if(S){const d=S.result;if(x(d)[`step_${e}`])return u+1}return u},0)/t.length,Ft=(t,e)=>{const{step:u,stepList:S}=t,d=h.getCurrentStepInfo(u,S),A=Pt.jsonParser(d.config);if(J.isVideoTool(d==null?void 0:d.tool)||J.isAudioTool(d==null?void 0:d.tool)||J.isPointCloudTool(d==null?void 0:d.tool)||[w.LLM,w.NLP,w.LLMMultiWheel].includes(d==null?void 0:d.tool))return;const T=document.getElementById("toolContainer");if(!T)throw"Not exist dom named id-toolContainer";const E=yt({width:window.innerWidth,height:window.innerHeight}),m=new ht({container:T,toolName:d.tool,size:E,imgNode:e,config:A,style:JSON.parse(Rt)});return{toolInstance:m==null?void 0:m.toolInstance,annotationEngine:m}},jt=(t,e)=>(u,S)=>Tt(void 0,null,function*(){var d,A;const{stepList:T,step:E}=S().annotation,m=h.currentToolIsVideo(E,T),y=h.currentToolIsPointCloud(E,T),O=[w.LLM,w.LLMMultiWheel].includes((d=h.getCurrentStepInfo(E,T))==null?void 0:d.tool),b=((A=h.getCurrentStepInfo(E,T))==null?void 0:A.tool)===w.NLP,N=h.currentToolIsAudio(E,T);if($(u,!0),yield u(Gt(t)),m){u(Mt(t));return}if(y||O||N||b){u(Vt(t));return}u(kt(t,e))}),Gt=t=>(e,u)=>Tt(void 0,null,function*(){const{getFileData:S,imgList:d}=u().annotation;if(S){const A=yield S(d[t],t);e({type:i.SET_FILE_DATA,payload:{fileData:A,index:t}})}}),Mt=t=>e=>{e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},Vt=t=>e=>{$(e,!1),e({type:i.LOAD_FILE_DATA,payload:{nextIndex:t}})},kt=(t,e)=>(u,S)=>{var d;const{toolInstance:A,imgList:T}=S().annotation,E=(d=T==null?void 0:T[t])==null?void 0:d.url;Ot.load(E).then(m=>{$(u,!1),u({type:i.LOAD_FILE_DATA,payload:{imgNode:m,nextIndex:t,nextBasicIndex:e}})}).catch(()=>{$(u,!1),A==null||A.setErrorImg(),u({type:i.LOAD_FILE_DATA,payload:{nextIndex:t,nextBasicIndex:e}})})},Ht=({toolInstance:t,imgList:e,imgIndex:u,stepList:S,step:d=1})=>{var A,T,E,m;const y=((A=e[u])==null?void 0:A.result)||"",[O,b,N]=(T=t==null?void 0:t.exportData())!=null?T:[],V=(m=(E=t==null?void 0:t.exportCustomData)==null?void 0:E.call(t))!=null?m:{},k=dt(y,b),H=Y(k,{step:d,stepList:S},{rect:O},V);return e.map((j,z)=>z===u?o(s(o({},j),{result:H}),N):o({},j))},zt=(t=o({},Et),e)=>{var u,S,d,A,T,E,m,y,O,b,N,V,k,H,j,z,q,Z,Q,tt,et,nt,ot,lt,st,it,rt,ut;switch(e.type){case i.INIT_ALL_STATE:return o(o({},t),Et);case i.UPDATE_TOOL_INSTANCE:return s(o({},t),{toolInstance:e.payload.toolInstance});case i.UPDATE_IMG_LIST:return s(o({},t),{imgList:e.payload.imgList});case i.CALC_STEP_PROGRESS:{const{imgList:n,step:l}=t,r=St(n,l);return s(o({},t),{stepProgress:r})}case i.SUBMIT_FILE_DATA:{const{imgList:n,imgIndex:l,step:r,stepList:a,toolInstance:p,onSubmit:c,resultList:f}=t;if(!p||!n[l])return t;const I=((u=n[l])==null?void 0:u.result)||"",[,_,g]=(S=p==null?void 0:p.exportData())!=null?S:[],L=(A=(d=p==null?void 0:p.exportCustomData)==null?void 0:d.call(p))!=null?A:{},D=dt(I,_),v=Y(D,{step:r,stepList:a},{rect:f},L),P=t.imgList.map((C,R)=>{if(R===l){const G=X.dataCorrection(v,I,r,a);return o(s(o({},C),{result:G}),g)}return C});if(((T=e.payload)==null?void 0:T.submitType)===W.SyncImgList)return s(o({},t),{imgList:P});const U=St(P,r);return s(o({},t),{stepProgress:U,imgList:P})}case i.SAVE_RESULT:{const{imgList:n,imgIndex:l,onSave:r}=t;return r==null||r(n[l],l,n),o({},t)}case i.SUBMIT_RESULT:{const{imgList:n,basicIndex:l,resultList:r,toolInstance:a,basicResultList:p}=t;if(!a)return t;const[c]=(E=a==null?void 0:a.exportData())!=null?E:[];let f=c;if((p==null?void 0:p.length)>0){const I=(m=p[l])==null?void 0:m.id,_=c.map(g=>s(o({},g),{sourceID:I}));f=mt.cloneDeep(r).filter(g=>g.sourceID!==I),f.push(..._)}return s(o({},t),{resultList:f,imgList:n})}case i.SET_BASIC_INDEX:{const{toolInstance:n,step:l,imgList:r,imgIndex:a,stepList:p,annotationEngine:c,resultList:f,basicResultList:I}=t;if(!n||!c)return t;const _=e.payload.basicIndex,g=(y=I[_])==null?void 0:y.id,L=x((O=r[a])==null?void 0:O.result),D=(f||[]).filter(G=>G.sourceID===g),v=F(p,l),{dataSourceStep:P,tool:U}=v,C=F(p,P);let R=[];return P&&U&&(R=(b=L[`step_${P}`])==null?void 0:b.result,(R==null?void 0:R.length)>0?(c==null||c.setBasicInfo(C.tool,R[_]),c==null||c.launchOperation()):(c==null||c.setBasicInfo(C.tool),c==null||c.forbidOperation(),It.info(M.t("NoDependency")))),n==null||n.setResult(D),n==null||n.history.initRecord(D,!0),s(o({},t),{basicIndex:_})}case i.SET_TRIGGER_EVENT_AFTER_INDEX_CHANGED:{const{triggerEventAfterIndexChanged:n}=e.payload;return s(o({},t),{triggerEventAfterIndexChanged:!!n})}case i.LOAD_FILE_DATA:{const{imgList:n,step:l,toolInstance:r,annotationEngine:a,stepList:p}=t;if(!r)return s(o({},t),{imgIndex:e.payload.nextIndex});const c=h.getCurrentStepInfo(l,p),{nextIndex:f,imgNode:I,nextBasicIndex:_,imgError:g}=e.payload,L=_!=null?_:0,D=x((N=n[f])==null?void 0:N.result),v=D[`step_${c.step}`],P=!v,U={rotate:(V=D.rotate)!=null?V:0,valid:(k=D.valid)!=null?k:!0};I&&g!==!0?a==null||a.setImgNode(I,U):r==null||r.setValid(U.valid);const C=F(p,c.step),{dataSourceStep:R,tool:G}=C,at=F(p,R),ct=R&&G,B=(j=(H=D[`step_${R}`])==null?void 0:H.result)!=null?j:[],K=X.getInitialResultList(v==null?void 0:v.result,r,C,B,P);if(a==null||a.launchOperation(),ct&&((B==null?void 0:B.length)>0?a==null||a.setBasicInfo(at.tool,B[L]):(a==null||a.setBasicInfo(at.tool),a==null||a.forbidOperation(),It.info(M.t("NoDependency")))),c.tool!=="check"){const At=(q=(z=B[L])==null?void 0:z.id)!=null?q:"",Dt=ct?K.filter(vt=>Ct.isSameSourceID(vt.sourceID,At)):K;(Z=r==null?void 0:r.history)==null||Z.initRecord(K,!0),r==null||r.setResult(Dt)}return s(o({},t),{imgIndex:f,basicIndex:L,basicResultList:B,resultList:K})}case i.UPDATE_ANNOTATION_CONFIG:return s(o({},t),{config:(Q=e.payload.config)!=null?Q:"{}"});case i.SET_TASK_STEP_LIST:{const{stepList:n}=e.payload;return s(o({},t),{stepList:n})}case i.SET_TASK_CONFIG:{const{stepList:n,step:l}=e.payload;return s(o({},t),{stepList:n,step:l})}case i.INIT_TOOL:{const{imgNode:n}=t,l=Ft(t,n);if(l){const{toolInstance:r,annotationEngine:a}=l;return s(o({},t),{toolInstance:r,annotationEngine:a})}return o({},t)}case i.SET_TOOL:{const n=(tt=e.payload)==null?void 0:tt.instance;return n?s(o({},t),{toolInstance:n}):o({},t)}case i.UPDATE_ON_SUBMIT:return s(o({},t),{onSubmit:e.payload.onSubmit});case i.UPDATE_ON_SAVE:return s(o({},t),{onSave:e.payload.onSave});case i.UPDATE_ON_PAGE_CHANGE:return s(o({},t),{onPageChange:e.payload.onPageChange});case i.SET_PREDICT_RESULT:return s(o({},t),{predictionResult:e.payload.result});case i.SET_PREDICT_RESULT_VISIBLE:return s(o({},t),{predictionResultVisible:e.payload.visible});case i.UPDATE_ON_STEP_CHANGE:return s(o({},t),{onStepChange:e.payload.onStepChange});case i.UPDATE_GET_FILE_DATA:return s(o({},t),{getFileData:e.payload.getFileData});case i.UPDATE_PAGE_SIZE:return s(o({},t),{pageSize:e.payload.pageSize});case i.UPDATE_LOAD_FILE_LIST:return s(o({},t),{loadFileList:e.payload.loadFileList});case i.UPDATE_BEFORE_ROTATE:return s(o({},t),{beforeRotate:e.payload.beforeRotate});case i.UPDATE_PRE_DATA_PROCESS:return s(o({},t),{preDataProcess:e.payload.preDataProcess});case i.UPDATE_IMG_INDEX_BY_EXTERNAL:return s(o({},t),{getImgIndexByExternal:e.payload.getImgIndexByExternal});case i.SKIP_BEFORE_PAGE_TURNING:return s(o({},t),{skipBeforePageTurning:e.payload.skipBeforePageTurning});case i.SET_FILE_DATA:{const{fileData:n,index:l}=e.payload,{imgList:r}=t,a=[...r];return a[l]=o(o({},a[l]),n),s(o({},t),{imgList:a})}case i.UPDATE_ROTATE:{const{toolInstance:n,beforeRotate:l}=t;return l&&l()===!1||(et=n==null?void 0:n.updateRotate)==null||et.call(n),t}case i.UPDATE_ANNOTATION_VALID:{const{toolInstance:n}=t,l=(nt=n==null?void 0:n.valid)!=null?nt:!0;return _t.destroyAll(),_t.confirm({content:M.t(l?"updateValidFromValidToInValid":"updateValidFromInValidToValid"),onOk:()=>{n==null||n.setValid(!l)},okText:M.t("Confirm"),cancelText:M.t("Cancel")}),t}case i.COPY_BACKWARD_RESULT:{const{toolInstance:n,imgIndex:l,imgList:r,step:a,stepList:p}=t;if(!n)return t;if(l===0||l>=r.length)return console.error("\u65E0\u6CD5\u590D\u5236\u8FB9\u754C\u5916\u7684\u5185\u5BB9"),t;const c=r[l-1].result;if(!c)return t;const f=h.getCurrentStepInfo(a,p),I=(ot=f==null?void 0:f.step)!=null?ot:a,_=(lt=n==null?void 0:n.valid)!=null?lt:!0,g=X.copyResultChange({copyResult:c,step:I,currentResult:(st=r[l].result)!=null?st:"",preMappingImgList:(it=r[l-1].mappingImgList)!=null?it:[],mappingImgList:(rt=r[l].mappingImgList)!=null?rt:[],valid:_});r[l]=s(o({},r[l]),{result:g});const D=x(g)[`step_${a}`],v=(D==null?void 0:D.result)||[];return n==null||n.setResult(v),n==null||n.history.pushHistory(v),(ut=n==null?void 0:n.asyncData)==null||ut.call(n,r[l]),s(o({},t),{imgList:[...r]})}case i.SET_STEP:{const{stepList:n,annotationEngine:l}=t,{toStep:r}=e.payload;if(l){const a=F(n,r);return l==null||l.setToolName(a.tool,a.config),s(o({},t),{step:r,toolInstance:l==null?void 0:l.toolInstance})}return s(o({},t),{step:r})}case i.SET_LOADPCDFILE_LOADING:{const{loadPCDFileLoading:n}=e.payload;return s(o({},t),{loadPCDFileLoading:!!n})}case i.SET_LOADING:{const{loading:n}=e.payload;return s(o({},t),{loading:!!n})}case i.SET_POINT_CLOUD_LOADING:{const{pointCloudLoading:n}=e.payload;return s(o({},t),{pointCloudLoading:!!n})}case i.SET_CHECK_MODE:{const{checkMode:n}=e.payload;return s(o({},t),{checkMode:!!n})}case i.SET_HIGHLIGHT_ATTRIBUTE:{const{attribute:n}=e.payload;return s(o({},t),{highlightAttribute:n})}case i.BATCH_UPDATE_TRACK_ID:{const{id:n,newID:l,rangeIndex:r,imgList:a}=e.payload,{imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const L=s(o({},_),{result:gt.batchUpdateTrackID({id:n,newID:l,result:_.result})});return f.push({imgIndex:g,newInfo:L}),L}return _});return c&&c([I[p]],W.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_RESULT_BY_TRACK_ID:{const{id:n,newData:l,rangeIndex:r}=e.payload,{imgList:a,imgIndex:p,onSubmit:c}=t,f=[],I=a.map((_,g)=>{if(pt.isInRange(g,r)){const L=s(o({},_),{result:gt.batchUpdateResultByTrackID({id:n,newData:l,result:_.result})});return f.push({imgIndex:g,newInfo:L}),L}return _});return c&&c([I[p]],W.BatchUpdateTrackID,p,I,{updateImgList:f}),s(o({},t),{imgList:I})}case i.BATCH_UPDATE_IMG_LIST_RESULT_BY_PREDICT_RESULT:{const{onSubmit:n,imgList:l,stepList:r,step:a,predictionResult:p}=t,c={};p.forEach(g=>{const{index:L}=g;c[L]=mt.pick(g,["center","width","height","depth","rotation","id","attribute","valid","trackID"])});const f=`step_${a}`,I=[],_=l.map((g,L)=>{if(c[L]){const D=g.result==="{}"?x(Y("",{step:a,stepList:r},{rect:[]},{})):x(g.result);D[f].result.push(c[L]);const v=s(o({},g),{result:JSON.stringify(D)});return I.push({imgIndex:L,newInfo:v}),v}return g});return n==null||n(_,W.BatchUpdateImgList,-1,_,{updateImgList:I}),s(o({},t),{imgList:_})}default:return t}};export{jt as LoadFileAndFileData,zt as annotationReducer,Ht as composeResultByToolInstance,F as getStepConfig,wt as getTotalPage};
|
package/es/store/ctx.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{createDispatchHook as o,createSelectorHook as s}from"react-redux";const t=e.createContext(void 0),r=o(t),c=s(t),n=e.createContext({hoverKey:-1,newAnswerList:[],setHoverKey:()=>{},modelAPIResponse:[],setModelAPIResponse:()=>{},setNewAnswerList:()=>{}}),a=e.createContext({highlightKey:"",setHighlightKey:()=>{}});export{n as LLMContext,t as LabelBeeContext,a as NLPContext,r as useDispatch,c as useSelector};
|
|
1
|
+
import e from"react";import{createDispatchHook as o,createSelectorHook as s}from"react-redux";const t=e.createContext(void 0),r=o(t),c=s(t),n=e.createContext({hoverKey:-1,newAnswerList:[],setHoverKey:()=>{},modelAPIResponse:[],setModelAPIResponse:()=>{},setNewAnswerList:()=>{}}),a=e.createContext({highlightKey:"",setHighlightKey:()=>{}});e.createContext({hoverKey:-1,setHoverKey:()=>{},selectKey:1,setSelectKey:()=>{}});export{n as LLMContext,t as LabelBeeContext,a as NLPContext,r as useDispatch,c as useSelector};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import r from"../../../components/LLMMultiWheelView/index.js";import{prefix as l}from"../../../constant/index.js";import{classnames as m}from"../../../utils/index.js";import{getClassName as d}from"../../../utils/dom.js";import{Layout as a}from"antd/es";import t from"react";import s from"../sidebar/index.js";import c from"../toolFooter/index.js";const u=`${l}-LLMMultiWheelView`,{Sider:L,Content:f}=a,n=`${l}-layout`,M=e=>{var o,i;return t.createElement(a,{className:d("layout","container")},e==null?void 0:e.leftSider,t.createElement(f,{className:m({[`${n}__content`]:!0,[`${l}-LLMLayout`]:!0})},t.createElement(r,{showTips:e.showTips,tips:e.tips,drawLayerSlot:e.drawLayerSlot}),t.createElement(c,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer})),t.createElement(L,{className:`${n}__side`,width:600,style:{position:"relative"}},t.createElement(s,{sider:e==null?void 0:e.sider,checkMode:e==null?void 0:e.checkMode}),(i=e.drawLayerSlot)==null?void 0:i.call(e,{})))};export{u as LLMMultiWheelViewCls,M as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ViewportProvider as b}from"../../components/customResizeHook/index.js";import{prefix as C}from"../../constant/index.js";import{Spin as A}from"antd";import{Layout as
|
|
1
|
+
import{ViewportProvider as b}from"../../components/customResizeHook/index.js";import{prefix as C}from"../../constant/index.js";import{Spin as A}from"antd";import{Layout as E}from"antd/es";import t,{useState as O}from"react";import V from"./annotationOperation/index.js";import W from"./annotationTips/index.js";import k from"./sidebar/index.js";import g from"./toolFooter/index.js";import F from"./toolHeader/index.js";import{getStepConfig as _}from"../../store/annotation/reducer.js";import I from"../../components/videoAnnotate/index.js";import{connect as R}from"react-redux";import h from"../../utils/ToolUtils.js";import B from"../../components/pointCloudView/index.js";import{getClassName as $}from"../../utils/dom.js";import{classnames as H}from"../../utils/index.js";import D from"../../components/predictTracking/previewResult/index.js";import{LabelBeeContext as U}from"../../store/ctx.js";import{EToolName as m}from"../../data/enums/ToolType.js";import z from"./LLMLayout/index.js";import q from"./NLPLayout/index.js";import G from"../../components/audioAnnotate/index.js";import{LoadingOutlined as J}from"@ant-design/icons";import{useTranslation as K}from"react-i18next";import{EPointCloudName as Q}from"@labelbee/lb-annotation";import X from"./LLMMultiWheelLayout/index.js";var Y=Object.defineProperty,T=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,P=(e,o,n)=>o in e?Y(e,o,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[o]=n,l=(e,o)=>{for(var n in o||(o={}))Z.call(o,n)&&P(e,n,o[n]);if(T)for(var n of T(o))p.call(o,n)&&P(e,n,o[n]);return e};const{Sider:ee,Content:te}=E,L=`${C}-layout`,oe=e=>{var o;return t.createElement(t.Fragment,null,e.showTips===!0&&t.createElement(W,{path:e.path,tips:e.tips}),t.createElement(V,l({},e)),t.createElement(g,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},ne=e=>{var o;return t.createElement(t.Fragment,null,t.createElement(B,{drawLayerSlot:e.drawLayerSlot,checkMode:e.checkMode,intelligentFit:e.intelligentFit,measureVisible:e.measureVisible,setResourceLoading:e.setResourceLoading}),t.createElement(g,{style:(o=e.style)==null?void 0:o.footer,mode:e.mode,footer:e==null?void 0:e.footer}))},le=e=>{var o;const{stepList:n,step:r}=e,a=(o=_(n,r))==null?void 0:o.tool,d=h.isPointCloudTool(a),i=h.isVideoTool(a);return d?t.createElement(ne,l({},e)):i?t.createElement(I,{drawLayerSlot:e.drawLayerSlot,footer:e.footer,annotationBefore:e==null?void 0:e.annotationBefore}):t.createElement(oe,l({},e))},s=e=>{var o,n,r;const{t:a}=K(),{stepList:d,step:i}=e,c=(o=_(d,i))==null?void 0:o.tool,u=![m.LLM,m.NLP,m.LLMMultiWheel].includes(c),v=![m.LLM,m.NLP,m.LLMMultiWheel].includes(c),y=[Q.PointCloud].includes(c);return t.createElement(b,null,t.createElement(A,{spinning:e.loading,indicator:t.createElement(J,null),tip:t.createElement("span",{style:{marginTop:200}},a("LoadingTips")),delay:500},t.createElement(E,{className:H([L,e.className]),style:(n=e.style)==null?void 0:n.layout},t.createElement("header",{className:`${L}__header`,style:(r=e.style)==null?void 0:r.header},t.createElement(F,{header:e==null?void 0:e.header,headerName:e.headerName,goBack:e.goBack,exportData:e.exportData,hasLangNode:u,hasHeaderOption:v,hasPredictTrackingIcon:y})),e.children)))},ie=e=>{var o,n,r,a,d,i,c;const[u,v]=O(void 0),y=(n=(o=e.style)==null?void 0:o.sider)==null?void 0:n.width,{stepList:x,step:j}=e,f=(r=_(x,j))==null?void 0:r.tool,M=m.LLM===f,N=m.NLP===f,w=m.LLMMultiWheel===f,S=h.isAudioTool(f);return w?t.createElement(s,l({},e),t.createElement(X,l({},e))):M?t.createElement(s,l({},e),t.createElement(z,l({},e))):N?t.createElement(s,l({},e),t.createElement(q,l({},e))):S?t.createElement(s,l({},e),t.createElement(G,l({},e))):t.createElement(s,l({},e),t.createElement(E,{className:$("layout","container")},e==null?void 0:e.leftSider,t.createElement(te,{className:`${L}__content`},t.createElement(le,l({},e)),t.createElement(D,null)),t.createElement(ee,{className:`${L}__side`,width:(a=u!=null?u:y)!=null?a:240,style:(d=e.style)==null?void 0:d.sider},t.createElement(k,{sider:e==null?void 0:e.sider,enableColorPicker:e==null?void 0:e.enableColorPicker,setSiderWidth:v,propsSiderWidth:(c=(i=e.style)==null?void 0:i.sider)==null?void 0:c.width}))))},re=({annotation:e})=>{var o,n,r;const{imgList:a,loading:d}=e,i=(o=a[e.imgIndex])!=null?o:{};return{path:(r=(n=i==null?void 0:i.path)!=null?n:i==null?void 0:i.url)!=null?r:"",loading:d}};var ae=R(re,null,null,{context:U})(ie);export{ae as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{prefix as
|
|
1
|
+
import{prefix as R}from"../../../constant/index.js";import{EToolName as n}from"../../../data/enums/ToolType.js";import W from"../../../utils/StepUtils.js";import{Collapse as u}from"antd/es";import e,{useState as z}from"react";import{useTranslation as D}from"react-i18next";import G from"./AnnotationText/index.js";import U from"./ClearIcon/index.js";import q,{PointCloudOperation as y}from"./GeneralOperation/index.js";import H from"./ImgAttributeInfo/index.js";import J from"./SwitchAttributeList/index.js";import p,{expandIconFuc as _}from"./TagSidebar/index.js";import f from"./TextToolSidebar/index.js";import $ from"./PointCloudToolSidebar/index.js";import Q from"./ToolStyle/index.js";import{cTool as X}from"@labelbee/lb-annotation";import Y from"./ScribbleSidebar/index.js";import{ToolIcons as Z}from"./ToolIcons.js";import{useSelector as ee}from"../../../store/ctx.js";import{Tabs as I}from"antd";import{classnames as te}from"../../../utils/index.js";import P from"../../../assets/annotation/common/icon_menu_fold.svg.js";import oe from"../../../components/LLMToolView/sidebar/index.js";import ne from"../../../components/LLMMultiWheelView/sidebar/index.js";import re from"./NLPSidebar/index.js";import ie from"../../../components/videoAnnotate/videoClipTool/components/annotatedList/index.js";const{EVideoToolName:E,EPointCloudName:le}=X,{Panel:A}=u,t=`${R}-sidebar`,ae=({sider:l,enableColorPicker:w,setSiderWidth:b,propsSiderWidth:se,checkMode:c})=>{const x=ee(r=>W.getCurrentStepInfo(r.annotation.step,r.annotation.stepList)),[m,M]=z(!0),o=x==null?void 0:x.tool,{t:S}=D();if(!o)return null;const V=r=>{const s=e.createElement(Q,null);return e.createElement(A,{header:S("Style"),className:"panel",key:r},s)},T=e.createElement(Z,{toolName:o,onChange:()=>{}}),a=e.createElement(J,null),g=e.createElement(G,null),N=e.createElement(u,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:_},V("1")),h=e.createElement(u,{defaultActiveKey:["1","imgAttribute"],bordered:!1,expandIconPosition:"right",className:`${t}__content`,expandIcon:_},e.createElement(A,{header:e.createElement("div",null,S("Adjust"),e.createElement(U,null)),className:"panel",key:"imgAttribute"},e.createElement(H,null))),i=e.createElement(q,null),B=e.createElement(p,null),O=r=>e.createElement(f,{disabled:r}),L=e.createElement(Y,{onChange:(r,s)=>{}}),v=e.createElement(ie,null),C=e.createElement(oe,{checkMode:c}),k=e.createElement(ne,{checkMode:c}),j=e.createElement(re,{checkMode:c}),d=e.createElement("div",{className:`${t}__horizontal`}),F=e.createElement($,{enableColorPicker:w}),K=e.createElement(y,null);if(l)return typeof l=="function"?e.createElement("div",{className:`${t}`},l({toolIcon:T,attributeList:a,annotationText:g,toolStyle:N,imageAttributeInfo:h,operation:i,tagToolSideBar:B,textToolSideBar:O,horizontal:d,pointCloudToolSidebar:F,pointCloudOperation:K,scribbleSidebar:L,LLMSidebar:C,LLMMultiWheelSidebar:k,videoClipSidebar:v,NLPSidebar:j})):l;if([n.Rect,n.Point,n.Line,n.Rect,n.Polygon,n.Cuboid].includes(o))return e.createElement("div",{className:`${t}`},T,d,a,g,d,e.createElement("div",{className:`${t}__content`},N,h),i);if(o===n.Tag)return e.createElement("div",{className:`${t}`},e.createElement(p,null));if(o===E.VideoClipTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},v,a),i);if(o===E.VideoTagTool)return e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},e.createElement(p,null)),i);if(o===E.VideoTextTool)return e.createElement("div",{className:`${t}`},e.createElement(f,null));if(o===n.Text)return e.createElement("div",{className:`${t}`},"s",e.createElement(f,null));if(o===le.PointCloud){const r=()=>{M(!m),b&&b(m?48:void 0)},s=e.createElement("div",{style:{width:"48px",height:"100%",display:"flex",justifyContent:"center",background:"#ffffff"}},e.createElement("span",{onClick:()=>r()},e.createElement("img",{style:{width:"16px",height:"16px",marginTop:"18px",cursor:"pointer",transform:"rotate(180deg)"},src:P})));return m?e.createElement(I,{type:"card",activeKey:"1",className:te({[`${t}`]:!0,[`${t}__pointCloud`]:!0}),tabBarExtraContent:{left:e.createElement("span",{onClick:()=>r(),style:{padding:"0px 4px"}},e.createElement("img",{style:{width:"16px",height:"16px",marginLeft:"4px",cursor:"pointer"},src:P}))}},e.createElement(I.TabPane,{tab:"\u5DE5\u5177\u9762\u677F",key:"1",style:{height:"100%",display:"flex",flexDirection:"column"}},e.createElement("div",{className:`${t}__content`},e.createElement($,null)),e.createElement(y,null))):s}return o===n.ScribbleTool?e.createElement("div",{className:`${t}`},e.createElement("div",{className:`${t}__content`},L,a),i):o===n.LLM?C:o===n.NLP?j:null};export{ae as default,t as sidebarCls};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e,{useContext as
|
|
1
|
+
import e,{useContext as L}from"react";import k from"../../../../../assets/annotation/toolHotKeyIcon/icon_kj1.svg.js";import N from"../../../../../assets/annotation/toolHotKeyIcon/icon_kj_h.svg.js";import{EToolName as o}from"../../../../../data/enums/ToolType.js";import w from"./rectToolShortCutTable/index.js";import O from"./point/index.js";import I from"./polygon/index.js";import H from"./line/index.js";import M from"./tag/index.js";import R from"./text/index.js";import G from"./videoTag/index.js";import K,{pointCloudShortCutTable_POLYGON as V,pointCloudShortCutTable_SEGMENT as A}from"./pointCloud/index.js";import W from"./scribble/index.js";import Y from"./cuboid/index.js";import T from"./LLM/index.js";import $ from"./NLP/index.js";import B from"./audioText/index.js";import{footerCls as D}from"../../index.js";import{useTranslation as F}from"react-i18next";import{EAudioToolName as z,cTool as U}from"@labelbee/lb-annotation";import{PointCloudContext as q}from"../../../../../components/pointCloudView/PointCloudContext.js";import J from"../../FooterPopover.js";import{EPointCloudPattern as C}from"@labelbee/lb-utils";var Q=Object.defineProperty,b=Object.getOwnPropertySymbols,X=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,E=(r,n,t)=>n in r?Q(r,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[n]=t,ee=(r,n)=>{for(var t in n||(n={}))X.call(n,t)&&E(r,t,n[t]);if(b)for(var t of b(n))Z.call(n,t)&&E(r,t,n[t]);return r};const{EVideoToolName:te,EPointCloudName:u}=U,f={[o.Rect]:w,[o.Tag]:M,[o.Point]:O,[o.Polygon]:I,[o.Line]:H,[o.Text]:R,[te.VideoTagTool]:G,[u.PointCloud]:K,[u.PointCloud+"_POLYGON"]:V,[u.PointCloud+"_SEGMENT"]:A,[o.ScribbleTool]:W,[o.Cuboid]:Y,[o.LLM]:T,[o.LLMMultiWheel]:T,[o.NLP]:$,[z.AudioTextTool]:B},oe=({icon:r})=>typeof r=="string"?e.createElement("img",{width:16,height:16,src:r}):r||null,x=({title:r,style:n,shortCutList:t})=>{const{t:m}=F(),d={width:320,display:"flex",justifyContent:"space-between",margin:16},s={display:"block",padding:"0 3px",minWidth:"20px",marginRight:"3px",border:"1px solid rgba(204,204,204,1)",verticalAlign:"middle",fontSize:"12px",textAlign:"center"},y=(a,c)=>e.createElement("div",{style:d,key:c},e.createElement("span",{style:{display:"flex",alignItems:"center"}},e.createElement(oe,{icon:a.icon}),e.createElement("span",{style:{marginLeft:a.icon?16:0}},m(a.name))),e.createElement("span",{style:{display:"flex",alignItems:"center"}},a.noticeInfo&&e.createElement("span",{style:{marginRight:"5px",color:"#CCCCCC"}},m(a.noticeInfo)),S(a.shortCut,a.shortCutUseHtml,a.linkSymbol))),S=(a,c=!1,j="+")=>{if(!a)return null;const v=a.map((l,i)=>{var h,g;const p={display:"flex",alignItems:"center"};return c?e.createElement("span",{key:i,style:p},e.createElement("span",{style:s,dangerouslySetInnerHTML:{__html:l}})):i<a.length-1?typeof l=="number"?e.createElement("span",{key:i,style:p},e.createElement("span",{style:s},l),e.createElement("span",{style:{marginRight:"3px"}},"~")):((h=l==null?void 0:l.startsWith)==null?void 0:h.call(l,"data"))?e.createElement("span",{key:i,style:p},e.createElement("span",{className:"shortCutButton",style:{marginRight:"3px"}},e.createElement("img",{width:16,height:23,src:l})),e.createElement("span",{style:{marginRight:"3px"}},"+")):e.createElement("span",{key:i,style:p},e.createElement("span",{style:s},l),e.createElement("span",{style:{marginRight:"3px"}},j)):typeof l=="number"?e.createElement("span",{key:i,style:p},e.createElement("span",{style:s},l)):((g=l==null?void 0:l.startsWith)==null?void 0:g.call(l,"data"))?e.createElement("span",{className:"shortCutButton",key:i,style:{marginRight:"3px"}},e.createElement("img",{width:16,height:23,src:l})):e.createElement("span",{style:s,key:i},l)});return e.createElement("div",{style:{display:"flex",justifyContent:"space-around",alignItems:"center"}},v)},P=e.createElement("div",{className:`${D}__hotkey-content`},t==null?void 0:t.map((a,c)=>y(a,c))),_=n||{};return e.createElement(J,{hoverIcon:N,icon:k,title:m("Hotkeys"),content:P,containerStyle:_})},re=({style:r,title:n,toolName:t})=>{const{pointCloudPattern:m,globalPattern:d}=L(q);if(!t||!f[t])return null;let s=t;switch(d){case C.Detection:switch(m){case o.Polygon:s+="_POLYGON";break;case o.Line:s=o.Line;break;case o.Point:s=o.Point;break}break;case C.Segmentation:s=u.PointCloud+"_SEGMENT";break}const y={style:r,title:n,shortCutList:f[s]};return e.createElement(x,ee({},y))};export{x as ToolHotKeyCom,re as default,f as shortCutTable};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.23.0-alpha.
|
|
3
|
+
"version": "1.23.0-alpha.123",
|
|
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.27.0-alpha.
|
|
47
|
-
"@labelbee/lb-utils": "1.19.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.27.0-alpha.63",
|
|
47
|
+
"@labelbee/lb-utils": "1.19.0-alpha.24",
|
|
48
48
|
"@labelbee/wavesurfer": "1.1.0-alpha.1",
|
|
49
49
|
"@types/react-dom": "^18.2.7",
|
|
50
50
|
"@types/react-transition-group": "^4.4.9",
|