@labelbee/lb-components 1.23.0-alpha.133 → 1.23.0-alpha.135

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{getTextControlByConfig as P,RenderAnswer as I}from"../../LLMToolView/questionView/index.js";import{RenderQuestion as N}from"../../LLMToolView/questionView/components/header/index.js";import V from"../../LLMToolView/questionView/components/imgView/index.js";import j from"../../../store/LLMMultiWheel/index.js";import{classnames as h}from"../../../utils/index.js";import{Button as n}from"antd";import e from"react";var x=Object.defineProperty,D=Object.defineProperties,M=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable,u=(o,t,r)=>t in o?x(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,B=(o,t)=>{for(var r in t||(t={}))F.call(t,r)&&u(o,r,t[r]);if(c)for(var r of c(t))q.call(t,r)&&u(o,r,t[r]);return o},C=(o,t)=>D(o,M(t));const T=o=>{const{id:t,answerList:r,question:d,index:p,name:f="",answerIsImg:w,questionIsImg:E,LLMConfig:v}=o,{dataFormatType:s,selectedID:_,setSelectedID:g}=j(),a=p+1,y=f||`\u5BF9\u8BDD${a}`;return e.createElement("div",{key:t,onClick:()=>g(t),className:h({dialog:!0,selected:t===_})},e.createElement("div",{className:"header"},e.createElement("span",{className:"order"},a),e.createElement("div",{className:"name"},e.createElement("div",{className:"show-name"},y),e.createElement("div",{className:"tips"},"\uFF08\u9009\u4E2D\u6807\u6CE8\uFF09"))),e.createElement("div",{className:"dialog-question"},e.createElement(n,{type:"primary"},"\u9898\u76EE",a),e.createElement("div",null,e.createElement(N,{question:d,dataFormatType:s,isImg:E}))),e.createElement("div",{className:"dialog-answer"},w?e.createElement(e.Fragment,null,e.createElement(n,{type:"primary"},"\u7B54\u6848"),e.createElement(V,{answerList:r})):r==null?void 0:r.map((L,i)=>{const l=i+1,m=C(B({},L),{order:l}),O=P(m,v);return e.createElement("div",{key:i},e.createElement(n,{type:"primary"},"\u7B54\u6848",l),e.createElement(I,{i:m,isTextControl:O,dataFormatType:s}))})))};export{T as default};
1
+ import{getTextControlByConfig as I,RenderAnswer as N}from"../../LLMToolView/questionView/index.js";import{RenderQuestion as V}from"../../LLMToolView/questionView/components/header/index.js";import j from"../../LLMToolView/questionView/components/imgView/index.js";import x from"../../../store/LLMMultiWheel/index.js";import{classnames as h}from"../../../utils/index.js";import{Button as s}from"antd";import e from"react";import{useTranslation as M}from"react-i18next";var T=Object.defineProperty,q=Object.defineProperties,D=Object.getOwnPropertyDescriptors,p=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,d=(o,t,r)=>t in o?T(o,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[t]=r,S=(o,t)=>{for(var r in t||(t={}))F.call(t,r)&&d(o,r,t[r]);if(p)for(var r of p(t))C.call(t,r)&&d(o,r,t[r]);return o},b=(o,t)=>q(o,D(t));const A=o=>{const{id:t,answerList:r,question:u,index:f,name:w="",answerIsImg:v,questionIsImg:_,LLMConfig:g}=o,{t:n}=M(),{dataFormatType:i,selectedID:E,setSelectedID:y}=x(),a=f+1,L=w||`${n("Dialog")}${a}`;return e.createElement("div",{key:t,onClick:()=>y(t),className:h({dialog:!0,selected:t===E})},e.createElement("div",{className:"header"},e.createElement("span",{className:"order"},a),e.createElement("div",{className:"name"},e.createElement("div",{className:"show-name"},L),e.createElement("div",{className:"tips"},"\uFF08",n("SelectionOfAnnotation"),"\uFF09"))),e.createElement("div",{className:"dialog-question"},e.createElement(s,{type:"primary"},n("Title"),a),e.createElement("div",null,e.createElement(V,{question:u,dataFormatType:i,isImg:_}))),e.createElement("div",{className:"dialog-answer"},v?e.createElement(e.Fragment,null,e.createElement(s,{type:"primary"},n("Answer")),e.createElement(j,{answerList:r})):r==null?void 0:r.map((O,l)=>{const m=l+1,c=b(S({},O),{order:m}),P=I(c,g);return e.createElement("div",{key:l},e.createElement(s,{type:"primary"},n("Answer"),m),e.createElement(N,{i:c,isTextControl:P,dataFormatType:i}))})))};export{A as default};
@@ -1 +1 @@
1
- import a,{useState as E,useEffect as M}from"react";import{ELLMDataType as W}from"../../constant/index.js";import{getStepConfig as X}from"../../store/annotation/reducer.js";import{LabelBeeContext as Y}from"../../store/ctx.js";import{jsonParser as Z}from"../../utils/index.js";import{connect as ee}from"react-redux";import A from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as $}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as te}from"../LLMToolView/questionView/components/header/index.js";import ne from"./dialogView/index.js";import oe from"../messageMaskLayer/index.js";import re from"../../views/MainView/annotationTips/index.js";import{useTranslation as ie}from"react-i18next";import{LLMViewCls as ae}from"../LLMToolView/questionView/index.js";import{Layout as se}from"antd";var le=Object.defineProperty,ue=Object.defineProperties,de=Object.getOwnPropertyDescriptors,F=Object.getOwnPropertySymbols,ce=Object.prototype.hasOwnProperty,pe=Object.prototype.propertyIsEnumerable,N=(t,e,n)=>e in t?le(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))ce.call(e,n)&&N(t,n,e[n]);if(F)for(var n of F(e))pe.call(e,n)&&N(t,n,e[n]);return t},h=(t,e)=>ue(t,de(e));const k=t=>{const{questionIsImg:e,answerIsImg:n,LLMConfig:s,dialogList:d}=t,{dataFormatType:L,setDataFormatType:l}=A();return a.createElement("div",{className:`${$}`},a.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},a.createElement(te,{dataFormatType:L,setDataFormatType:l})),a.createElement("div",{className:`${$}-container`},d==null?void 0:d.map((r,u)=>a.createElement(ne,h(y({},r),{key:u,index:u,questionIsImg:e,answerIsImg:n,LLMConfig:s})))))},R=({type:t,questionIndex:e,answerIndex:n,llmFile:s})=>{if(t==="question")return s==null?void 0:s.find((L,l)=>e===l);let d=null;return s==null||s.forEach((L,l)=>{var r;(r=L.answerList)==null||r.forEach((u,v)=>{l===e&&n===v&&(d=u)})}),d},me=t=>{var e,n;const{annotation:s,tips:d,showTips:L,drawLayerSlot:l}=t,{imgIndex:r,imgList:u,stepList:v,step:x,toolInstance:f}=s,[w,U]=E(),{setSelectedID:B,newAnswerListMap:T}=A(),[Q,V]=E([]),j=((e=w==null?void 0:w.dataType)==null?void 0:e.prompt)===W.Picture,P=((n=w==null?void 0:w.dataType)==null?void 0:n.response)===W.Picture,{t:z}=ie(),[,G]=E(0);return M(()=>{var o,c,p;if(!u[r])return;const _=(o=u[r])!=null?o:{},m=(p=(c=_==null?void 0:_.questionList)==null?void 0:c.textList)!=null?p:[];V(m),(m==null?void 0:m.length)&&B(m[0].id)},[r]),M(()=>{var o,c;const p=(o=u[r])!=null?o:{},_=p==null?void 0:p.questionList,m=(c=p==null?void 0:p.llmFile)==null?void 0:c.textList,I=_==null?void 0:_.textList,H=I==null?void 0:I.map((i,D)=>{var O;return h(y({},i),{question:j&&R({type:"question",questionIndex:D,llmFile:m})||(i==null?void 0:i.question),answerList:(O=i==null?void 0:i.answerList)==null?void 0:O.map((g,S)=>{var b,q,C;const J=`${(b=i==null?void 0:i.id)!=null?b:""}-${(q=g==null?void 0:g.id)!=null?q:""}`,K=P?R({type:"answer",questionIndex:D,answerIndex:S,llmFile:m})||{}:{};return y(h(y({},g),{answer:g.answer,newAnswer:(C=T[J])!=null?C:g.answer,order:S+1}),K)})})});V(H)},[T,j,P]),M(()=>{var o;if(v&&x){const c=(o=X(v,x))==null?void 0:o.config;U(Z(c))}},[v,x]),M(()=>{if(f)return f.on("validUpdated",()=>{G(o=>o+1)}),()=>{f.unbindAll("validUpdated")}},[f]),a.createElement(se,{className:ae},!(f==null?void 0:f.valid)&&a.createElement(oe,{message:z("InvalidQuestionAndSkip")}),l==null?void 0:l({}),L===!0&&a.createElement(re,{tips:d}),a.createElement(k,{questionIsImg:j,answerIsImg:P,LLMConfig:w,dialogList:Q}))},Le=t=>({annotation:t.annotation});var fe=ee(Le,null,null,{context:Y})(me);export{k as LLMMultiWheelSourceView,fe as default};
1
+ import i,{useEffect as M,useState as E}from"react";import{ELLMDataType as W}from"../../constant/index.js";import{getStepConfig as Y}from"../../store/annotation/reducer.js";import{LabelBeeContext as Z}from"../../store/ctx.js";import{jsonParser as ee}from"../../utils/index.js";import{connect as te}from"react-redux";import A from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as $}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as ne}from"../LLMToolView/questionView/components/header/index.js";import oe from"./dialogView/index.js";import re from"../messageMaskLayer/index.js";import ie from"../../views/MainView/annotationTips/index.js";import{I18nextProvider as ae,useTranslation as se}from"react-i18next";import{LLMViewCls as le}from"../LLMToolView/questionView/index.js";import{Layout as ue}from"antd";import{i18n as F}from"@labelbee/lb-utils";var ce=Object.defineProperty,de=Object.defineProperties,pe=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,me=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,k=(t,e,n)=>e in t?ce(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,y=(t,e)=>{for(var n in e||(e={}))me.call(e,n)&&k(t,n,e[n]);if(N)for(var n of N(e))Le.call(e,n)&&k(t,n,e[n]);return t},h=(t,e)=>de(t,pe(e));const R=t=>{const{questionIsImg:e,answerIsImg:n,LLMConfig:l,dialogList:p,lang:u="cn"}=t,{dataFormatType:c,setDataFormatType:a}=A();return M(()=>{var o;u&&((o=F)==null||o.changeLanguage(u))},[u]),i.createElement(ae,{i18n:F},i.createElement("div",{className:`${$}`},i.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},i.createElement(ne,{dataFormatType:c,setDataFormatType:a})),i.createElement("div",{className:`${$}-container`},p==null?void 0:p.map((o,d)=>i.createElement(oe,h(y({},o),{key:d,index:d,questionIsImg:e,answerIsImg:n,LLMConfig:l}))))))},U=({type:t,questionIndex:e,answerIndex:n,llmFile:l})=>{if(t==="question")return l==null?void 0:l.find((u,c)=>e===c);let p=null;return l==null||l.forEach((u,c)=>{var a;(a=u.answerList)==null||a.forEach((o,d)=>{c===e&&n===d&&(p=o)})}),p},fe=t=>{var e,n;const{annotation:l,tips:p,showTips:u,drawLayerSlot:c}=t,{imgIndex:a,imgList:o,stepList:d,step:x,toolInstance:v}=l,[w,B]=E(),{setSelectedID:Q,newAnswerListMap:I}=A(),[z,T]=E([]),j=((e=w==null?void 0:w.dataType)==null?void 0:e.prompt)===W.Picture,P=((n=w==null?void 0:w.dataType)==null?void 0:n.response)===W.Picture,{t:G}=se(),[,H]=E(0);return M(()=>{var r,m,L;if(!o[a])return;const g=(r=o[a])!=null?r:{},f=(L=(m=g==null?void 0:g.questionList)==null?void 0:m.textList)!=null?L:[];T(f),(f==null?void 0:f.length)&&Q(f[0].id)},[a]),M(()=>{var r,m;const L=(r=o[a])!=null?r:{},g=L==null?void 0:L.questionList,f=(m=L==null?void 0:L.llmFile)==null?void 0:m.textList,V=g==null?void 0:g.textList,J=V==null?void 0:V.map((s,b)=>{var D;return h(y({},s),{question:j&&U({type:"question",questionIndex:b,llmFile:f})||(s==null?void 0:s.question),answerList:(D=s==null?void 0:s.answerList)==null?void 0:D.map((_,O)=>{var S,q,C;const K=`${(S=s==null?void 0:s.id)!=null?S:""}-${(q=_==null?void 0:_.id)!=null?q:""}`,X=P?U({type:"answer",questionIndex:b,answerIndex:O,llmFile:f})||{}:{};return y(h(y({},_),{answer:_.answer,newAnswer:(C=I[K])!=null?C:_.answer,order:O+1}),X)})})});T(J)},[I,j,P]),M(()=>{var r;if(d&&x){const m=(r=Y(d,x))==null?void 0:r.config;B(ee(m))}},[d,x]),M(()=>{if(v)return v.on("validUpdated",()=>{H(r=>r+1)}),()=>{v.unbindAll("validUpdated")}},[v]),i.createElement(ue,{className:le},!(v==null?void 0:v.valid)&&i.createElement(re,{message:G("InvalidQuestionAndSkip")}),c==null?void 0:c({}),u===!0&&i.createElement(ie,{tips:p}),i.createElement(R,{questionIsImg:j,answerIsImg:P,LLMConfig:w,dialogList:z}))},ve=t=>({annotation:t.annotation});var we=te(ve,null,null,{context:Z})(fe);export{R as LLMMultiWheelSourceView,we as default};
@@ -1 +1 @@
1
- import r,{useState as A,useRef as It,useMemo as N,useEffect as B}from"react";import{LabelBeeContext as Vt}from"../../../store/ctx.js";import{connect as Nt}from"react-redux";import{prefix as Bt}from"../../../constant/index.js";import{getStepConfig as $t}from"../../../store/annotation/reducer.js";import{jsonParser as dt}from"../../../utils/index.js";import Wt,{getSorts as ct}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Ft}from"react-i18next";import{useCustomToolInstance as kt}from"../../../hooks/annotation.js";import{isBoolean as qt,isString as Gt,isNumber as Kt,isObject as zt,isArray as Ut}from"lodash";import{PageForward as $}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Qt,EToolName as Jt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Ht,EmptyConfig as Xt}from"../../LLMToolView/sidebar/index.js";import Yt from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as pt}from"antd";import Zt from"../../LLMToolView/sidebar/components/answerList/index.js";import te from"../../../store/LLMMultiWheel/index.js";import ee from"../../../utils/StepUtils.js";import{getRenderDataByResult as ne,getTagResult as oe,getCurrentResultFromResultList as re}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as z}from"ahooks";import le from"../../LLMToolView/sidebar/components/answerSort/index.js";import ie from"../../tagList/components/overall/index.js";var se=Object.defineProperty,ae=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,ft=(p,d,m)=>d in p?se(p,d,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[d]=m,l=(p,d)=>{for(var m in d||(d={}))de.call(d,m)&&ft(p,m,d[m]);if(mt)for(var m of mt(d))ce.call(d,m)&&ft(p,m,d[m]);return p},u=(p,d)=>ae(p,ue(d));const pe=Qt.default,vt=`${Bt}-sidebar`,me={sort:[],answerSort:{},textAttribute:[],tagList:{}},fe=p=>{var d,m,U,Q,J,H;const{annotation:Lt,dispatch:T,checkMode:gt}=p,{imgIndex:y,imgList:W,stepList:M,step:C,skipBeforePageTurning:R}=Lt,[c,xt]=A(),{t:D}=Ft(),o=(d=W[y])!=null?d:{},X=dt(o==null?void 0:o.result),{toolInstanceRef:L}=kt({basicInfo:X}),[F,wt]=A(!0),[O,Y]=A({}),[g,Z]=A(me),k=It(),[S,q]=A({}),{selectedID:P,setNewAnswerListMap:tt,newAnswerListMap:et}=te(),_=N(()=>O[P],[P,O]),b=!L.current.valid||gt;B(()=>{var t;if(M&&C){const e=(t=$t(M,C))==null?void 0:t.config;xt(dt(e))}},[C,JSON.stringify(M)]),B(()=>{!o||y===-1||(L.current.setValid=nt,L.current.clearResult=St,nt(),ot())},[y,c,o==null?void 0:o.id]);const St=()=>{var t,e,n,i;ot((t=o==null?void 0:o.questionList)==null?void 0:t.textList),((e=k.current)==null?void 0:e.clearValue)&&((n=k.current)==null||n.clearValue());const{waitSorts:f}=ct({selectedSort:(i=x==null?void 0:x.sort)!=null?i:[],initSelected:[],modelList:h?V!=null?V:[]:[]});q(u(l({},S),{waitSorts:f,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;qt(n)&&(wt(n),L.current.valid=n,(e=L.current)==null||e.emit("validUpdated"))},_t=()=>{const t=ee.getCurrentStepInfo(C,M);return re(o==null?void 0:o.result,t.step)},x=N(()=>_t(),[C,M,o]),ot=z(t=>{var e,n,i,f,s,w,j;const a=x;let E=(e=o==null?void 0:o.questionList)==null?void 0:e.textList;((n=a==null?void 0:a.modelData)==null?void 0:n.length)&&L.current.valid&&(E=a==null?void 0:a.modelData),t&&(E=t,a.sort=[],a.textAttribute=[],a.answerSort=[]);let at={};E==null||E.forEach((v,Dt)=>{var ut;const Ot=ne(c,u(l({},v),{answerList:(ut=v==null?void 0:v.answerList)==null?void 0:ut.map((K,Pt)=>(tt(u(l({},et),{[`${v.id}-${K.id}`]:K.answer})),u(l({},K),{order:Pt+1})))}));at[v.id]=u(l({},Ot),{order:Dt+1,id:v.id})});const{waitSorts:jt,newSort:At}=ct({selectedSort:(i=x==null?void 0:x.sort)!=null?i:[],modelList:h?V!=null?V:[]:[]});q({waitSorts:jt,newSort:At});const Tt=((f=c==null?void 0:c.inputList)==null?void 0:f.filter(v=>v==null?void 0:v.isOverall))||[],Rt=oe(Tt,a==null?void 0:a.tagList);Z({sort:(s=a==null?void 0:a.sort)!=null?s:[],textAttribute:(w=a==null?void 0:a.textAttribute)!=null?w:[],answerSort:(j=a==null?void 0:a.answerSort)!=null?j:{},tagList:Rt}),Y(at)});B(()=>{bt()},[O,F,g]),B(()=>(window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt)}),[]);const bt=z(()=>{var t,e;const n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var s;const w=(s=O[f.id])!=null?s:{};return{id:f.id,answerList:w.answerList}}),i=u(l({},g),{modelData:n});L.current.exportData=()=>[[i],{valid:F}],L.current.currentPageResult=u(l({},i),{toolName:Jt.LLMMultiWheel,valid:F})}),rt=t=>{if(t.ctrlKey&&t.keyCode===pe.Enter){if(R){R(()=>T($()));return}T($())}},Et=z(({order:t,value:e,key:n})=>{const{answerList:i}=_,f=i==null?void 0:i.map(s=>{var w,j;if((s==null?void 0:s.order)===t){if(n==="textEdit"&&Gt(e))return tt(u(l({},et),{[`${P}-${(w=s==null?void 0:s.id)!=null?w:""}`]:e})),u(l({},s),{newAnswer:e});if(Kt(e))return u(l({},s),{score:e});if(zt(e)&&n){const a={[e==null?void 0:e.key]:e.value},E=(j=s[n])!=null?j:{};return u(l({},s),{[n]:l(l({},E),a)})}}return s});Y(s=>u(l({},s),{[P]:u(l({},_),{answerList:f})}))}),I=(t,e)=>{Z(n=>u(l({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:yt,dialogSort:h=!1,inputList:G=[],tagInputListConfigurable:st,enableSort:Mt=!1}=c||{},V=N(()=>{var t,e,n;return h?(n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map((i,f)=>u(l({},i),{title:f+1})))!=null?n:[]:[]},[o,h]);if(N(()=>Ht(c),[c]))return r.createElement(Xt,null);const Ct=st&&((m=G.filter(t=>!t.isOverall))==null?void 0:m.length)>0,ht=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||yt||Ct;return r.createElement("div",{className:`${vt}`},r.createElement("div",{className:`${vt}__content`},r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},D("GlobalAnnotation")),h&&r.createElement(le,{waitSortList:(S==null?void 0:S.waitSorts)||[],sortList:(S==null?void 0:S.newSort)||[],setSortList:t=>{const e=t.map(n=>n.map(i=>i.id));I("sort",e),q(u(l({},S),{newSort:t}))},disabeledAll:b,title:D("SortConversationQuality"),prefixId:"model"}),(c==null?void 0:c.text)&&r.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},r.createElement(Yt,{textAttribute:(U=g==null?void 0:g.textAttribute)!=null?U:[],textConfig:(c==null?void 0:c.text)&&Ut(c.text)?c==null?void 0:c.text:[],setText:t=>I("textAttribute",t),disabeledAll:b})),Mt&&r.createElement(Wt,{modelData:(J=(Q=o==null?void 0:o.questionList)==null?void 0:Q.textList)!=null?J:[],selectedAnswerSort:t=>I("answerSort",t),selectedSort:(H=x==null?void 0:x.answerSort)!=null?H:[],ref:k,disabeledAll:b,imgIndex:y}),st&&G.length&&r.createElement(ie,{inputList:G,selectedTags:(g==null?void 0:g.tagList)||{},updateValue:t=>{const{key:e,value:n}=t,i=(g==null?void 0:g.tagList)||{};I("tagList",u(l({},i),{[e]:n}))},disabeledAll:b}),_&&r.createElement(r.Fragment,null,r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},D("QualifiedAnnotation")),r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},r.createElement(pt,{type:"primary",danger:!0},"\u6B63\u5728\u6807\u6CE8"),r.createElement("div",{style:{padding:16}},"\u7EC4\uFF1A",_.order)),r.createElement("div",null,ht&&r.createElement(Zt,{list:(_==null?void 0:_.answerList)||[],LLMConfig:c,updateValue:Et,disabeledAll:b})))),r.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(W==null?void 0:W.length)-1!==y&&r.createElement(pt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(R){R(()=>T($()));return}T($())},disabled:b},D("Save"))))},ve=p=>({annotation:p.annotation});var Le=Nt(ve,null,null,{context:Vt})(fe);export{Le as default};
1
+ import r,{useState as T,useRef as It,useMemo as N,useEffect as $}from"react";import{LabelBeeContext as Vt}from"../../../store/ctx.js";import{connect as Nt}from"react-redux";import{prefix as $t}from"../../../constant/index.js";import{getStepConfig as Bt}from"../../../store/annotation/reducer.js";import{jsonParser as dt}from"../../../utils/index.js";import Wt,{getSorts as ct}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Ft}from"react-i18next";import{useCustomToolInstance as kt}from"../../../hooks/annotation.js";import{isBoolean as qt,isString as Gt,isNumber as Kt,isObject as zt,isArray as Ut}from"lodash";import{PageForward as B}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Qt,EToolName as Jt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Ht,EmptyConfig as Xt}from"../../LLMToolView/sidebar/index.js";import Yt from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as pt}from"antd";import Zt from"../../LLMToolView/sidebar/components/answerList/index.js";import te from"../../../store/LLMMultiWheel/index.js";import ee from"../../../utils/StepUtils.js";import{getRenderDataByResult as ne,getTagResult as oe,getCurrentResultFromResultList as re}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as z}from"ahooks";import le from"../../LLMToolView/sidebar/components/answerSort/index.js";import ie from"../../tagList/components/overall/index.js";var se=Object.defineProperty,ae=Object.defineProperties,ue=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable,ft=(p,d,m)=>d in p?se(p,d,{enumerable:!0,configurable:!0,writable:!0,value:m}):p[d]=m,l=(p,d)=>{for(var m in d||(d={}))de.call(d,m)&&ft(p,m,d[m]);if(mt)for(var m of mt(d))ce.call(d,m)&&ft(p,m,d[m]);return p},u=(p,d)=>ae(p,ue(d));const pe=Qt.default,vt=`${$t}-sidebar`,me={sort:[],answerSort:{},textAttribute:[],tagList:{}},fe=p=>{var d,m,U,Q,J,H;const{annotation:Lt,dispatch:R,checkMode:gt}=p,{imgIndex:M,imgList:W,stepList:A,step:h,skipBeforePageTurning:D}=Lt,[c,xt]=T(),{t:S}=Ft(),o=(d=W[M])!=null?d:{},X=dt(o==null?void 0:o.result),{toolInstanceRef:L}=kt({basicInfo:X}),[F,wt]=T(!0),[O,Y]=T({}),[g,Z]=T(me),k=It(),[_,q]=T({}),{selectedID:P,setNewAnswerListMap:tt,newAnswerListMap:et}=te(),b=N(()=>O[P],[P,O]),y=!L.current.valid||gt;$(()=>{var t;if(A&&h){const e=(t=Bt(A,h))==null?void 0:t.config;xt(dt(e))}},[h,JSON.stringify(A)]),$(()=>{!o||M===-1||(L.current.setValid=nt,L.current.clearResult=St,nt(),ot())},[M,c,o==null?void 0:o.id]);const St=()=>{var t,e,n,i;ot((t=o==null?void 0:o.questionList)==null?void 0:t.textList),((e=k.current)==null?void 0:e.clearValue)&&((n=k.current)==null||n.clearValue());const{waitSorts:f}=ct({selectedSort:(i=x==null?void 0:x.sort)!=null?i:[],initSelected:[],modelList:j?V!=null?V:[]:[]});q(u(l({},_),{waitSorts:f,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;qt(n)&&(wt(n),L.current.valid=n,(e=L.current)==null||e.emit("validUpdated"))},_t=()=>{const t=ee.getCurrentStepInfo(h,A);return re(o==null?void 0:o.result,t.step)},x=N(()=>_t(),[h,A,o]),ot=z(t=>{var e,n,i,f,s,w,C;const a=x;let E=(e=o==null?void 0:o.questionList)==null?void 0:e.textList;((n=a==null?void 0:a.modelData)==null?void 0:n.length)&&L.current.valid&&(E=a==null?void 0:a.modelData),t&&(E=t,a.sort=[],a.textAttribute=[],a.answerSort=[]);let at={};E==null||E.forEach((v,Dt)=>{var ut;const Ot=ne(c,u(l({},v),{answerList:(ut=v==null?void 0:v.answerList)==null?void 0:ut.map((K,Pt)=>(tt(u(l({},et),{[`${v.id}-${K.id}`]:K.answer})),u(l({},K),{order:Pt+1})))}));at[v.id]=u(l({},Ot),{order:Dt+1,id:v.id})});const{waitSorts:jt,newSort:Ct}=ct({selectedSort:(i=x==null?void 0:x.sort)!=null?i:[],modelList:j?V!=null?V:[]:[]});q({waitSorts:jt,newSort:Ct});const Tt=((f=c==null?void 0:c.inputList)==null?void 0:f.filter(v=>v==null?void 0:v.isOverall))||[],Rt=oe(Tt,a==null?void 0:a.tagList);Z({sort:(s=a==null?void 0:a.sort)!=null?s:[],textAttribute:(w=a==null?void 0:a.textAttribute)!=null?w:[],answerSort:(C=a==null?void 0:a.answerSort)!=null?C:{},tagList:Rt}),Y(at)});$(()=>{bt()},[O,F,g]),$(()=>(window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt)}),[]);const bt=z(()=>{var t,e;const n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var s;const w=(s=O[f.id])!=null?s:{};return{id:f.id,answerList:w.answerList}}),i=u(l({},g),{modelData:n});L.current.exportData=()=>[[i],{valid:F}],L.current.currentPageResult=u(l({},i),{toolName:Jt.LLMMultiWheel,valid:F})}),rt=t=>{if(t.ctrlKey&&t.keyCode===pe.Enter){if(D){D(()=>R(B()));return}R(B())}},yt=z(({order:t,value:e,key:n})=>{const{answerList:i}=b,f=i==null?void 0:i.map(s=>{var w,C;if((s==null?void 0:s.order)===t){if(n==="textEdit"&&Gt(e))return tt(u(l({},et),{[`${P}-${(w=s==null?void 0:s.id)!=null?w:""}`]:e})),u(l({},s),{newAnswer:e});if(Kt(e))return u(l({},s),{score:e});if(zt(e)&&n){const a={[e==null?void 0:e.key]:e.value},E=(C=s[n])!=null?C:{};return u(l({},s),{[n]:l(l({},E),a)})}}return s});Y(s=>u(l({},s),{[P]:u(l({},b),{answerList:f})}))}),I=(t,e)=>{Z(n=>u(l({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:Et,dialogSort:j=!1,inputList:G=[],tagInputListConfigurable:st,enableSort:Mt=!1}=c||{},V=N(()=>{var t,e,n;return j?(n=(e=(t=o==null?void 0:o.questionList)==null?void 0:t.textList)==null?void 0:e.map((i,f)=>u(l({},i),{title:f+1})))!=null?n:[]:[]},[o,j]);if(N(()=>Ht(c),[c]))return r.createElement(Xt,null);const At=st&&((m=G.filter(t=>!t.isOverall))==null?void 0:m.length)>0,ht=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||Et||At;return r.createElement("div",{className:`${vt}`},r.createElement("div",{className:`${vt}__content`},r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("GlobalAnnotation")),j&&r.createElement(le,{waitSortList:(_==null?void 0:_.waitSorts)||[],sortList:(_==null?void 0:_.newSort)||[],setSortList:t=>{const e=t.map(n=>n.map(i=>i.id));I("sort",e),q(u(l({},_),{newSort:t}))},disabeledAll:y,title:S("SortConversationQuality"),prefixId:"model"}),(c==null?void 0:c.text)&&r.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},r.createElement(Yt,{textAttribute:(U=g==null?void 0:g.textAttribute)!=null?U:[],textConfig:(c==null?void 0:c.text)&&Ut(c.text)?c==null?void 0:c.text:[],setText:t=>I("textAttribute",t),disabeledAll:y})),Mt&&r.createElement(Wt,{modelData:(J=(Q=o==null?void 0:o.questionList)==null?void 0:Q.textList)!=null?J:[],selectedAnswerSort:t=>I("answerSort",t),selectedSort:(H=x==null?void 0:x.answerSort)!=null?H:[],ref:k,disabeledAll:y,imgIndex:M}),st&&G.length&&r.createElement(ie,{inputList:G,selectedTags:(g==null?void 0:g.tagList)||{},updateValue:t=>{const{key:e,value:n}=t,i=(g==null?void 0:g.tagList)||{};I("tagList",u(l({},i),{[e]:n}))},disabeledAll:y}),b&&r.createElement(r.Fragment,null,r.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},S("QualifiedAnnotation")),r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},r.createElement(pt,{type:"primary",danger:!0},S("Annotating")),r.createElement("div",{style:{padding:16}},S("Group"),"\uFF1A",b.order)),r.createElement("div",null,ht&&r.createElement(Zt,{list:(b==null?void 0:b.answerList)||[],LLMConfig:c,updateValue:yt,disabeledAll:y})))),r.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(W==null?void 0:W.length)-1!==M&&r.createElement(pt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(D){D(()=>R(B()));return}R(B())},disabled:y},S("Save"))))},ve=p=>({annotation:p.annotation});var Le=Nt(ve,null,null,{context:Vt})(fe);export{Le as default};
@@ -1 +1 @@
1
- import{getCuboidFromPointCloudBox as l}from"@labelbee/lb-annotation";var i;(function(t){t.Default="Default",t.UndoRedo="UndoRedo",t.ClearAll="ClearAll",t.Single="Single",t.SingleDelete="SingleDelete",t.SingleToggleValid="SingleToggleValid",t.SingleRotate="SingleRotate",t.MultiPaste="MultiPaste",t.MultiMove="MultiMove",t.MulitSelect="MulitSelect"})(i||(i={}));var d;(function(t){t.ChangeAttribute="ChangeAttribute",t.Move="Move",t.ChangeDepth="ChangeDepth",t.ChangeSize="ChangeSize",t.ToggleValid="ToggleValid"})(d||(d={}));const A=(t,n)=>{const o=u(t).concat(u(n));for(const e of o){const s=g(t,e),r=g(n,e);if(!y(s,r))return!1}return!0},u=t=>{const n=[];for(let o=0;o<t.length;o++){const e=t[o],s=t[(o+1)%t.length],r={x:s.x-e.x,y:s.y-e.y},c={x:-r.y,y:r.x};n.push(c)}return n},g=(t,n)=>{let o=h(t[0],n),e=o;for(const s of t){const r=h(s,n);r<o&&(o=r),r>e&&(e=r)}return{min:o,max:e}},y=(t,n)=>!(t.max<n.min||n.max<t.min),h=(t,n)=>t.x*n.x+t.y*n.y,M=(t,n)=>{const o=[];return n.forEach(e=>{const{polygonPointList:s}=l(e);A(t,s)&&o.push(e.id)}),o},S=(t,n)=>{const o=t.map(s=>s.id),e=n.map(s=>s.id);return o.find(s=>!e.includes(s))||""},v=(t,n)=>{const o=t.map(e=>e.id);return n.find(e=>!o.includes(e.id))},x=(t,n)=>t.find(e=>{const s=n.find(r=>r.id===e.id);return s&&s.valid!==e.valid}),B=(t,n)=>t.find(e=>{const s=n.find(r=>r.id===e.id);return s&&s.rotation!==e.rotation}),f=(t,n)=>{const{polygonPointList:o}=l(t);return{ids:M(o,n.filter(s=>s.id!==t.id)),rect:o}},D=(t,n)=>{const o=(e,s)=>e.attribute===s.attribute&&e.center.x===s.center.x&&e.center.y===s.center.y&&e.depth===s.depth&&e.width===s.width&&e.height===s.height;for(const e of t){const s=n.find(r=>r.id===e.id);if(s&&!o(e,s)){let r;if(s.attribute!==e.attribute?r=d.ChangeAttribute:s.center.x!==e.center.x||s.center.y!==e.center.y?r=d.Move:s.depth!==e.depth?r=d.ChangeDepth:(s.width!==e.width||s.height!==e.height)&&(r=d.ChangeSize),r!==void 0)return{modifiedType:r,box:e}}}},C=(t,n,o)=>{try{switch(t){case i.Single:if(n.length>o.length){const e=S(n,o);return e?{modifiedBoxIds:[e],resetAreas:[]}:{modifiedBoxIds:[],resetAreas:[]}}else{const e=[],s=[],r=D(n,o);if(r&&(e.push(r.box.id),r.modifiedType===d.ChangeSize||r.modifiedType===d.Move)){const c=o.find(I=>I.id===r.box.id),{ids:a,rect:m}=f(c,n);e.push(...a),s.push(m)}return{modifiedBoxIds:e,resetAreas:s}}case i.SingleDelete:if(n.length<o.length){const e=v(n,o);if(e){const r=[l(e).polygonPointList],c=[];if(n.length>1){const{ids:a}=f(e,n);a.length&&c.push(...a)}return{modifiedBoxIds:c,resetAreas:r}}return{modifiedBoxIds:[],resetAreas:[]}}return{modifiedBoxIds:[],resetAreas:[]};case i.SingleRotate:if(B(n,o)){const e=B(n,o);if(e){const s=o.find(a=>a.id===e.id),{ids:r,rect:c}=f(s,n);return{modifiedBoxIds:[e.id,...r],resetAreas:[c]}}}return{modifiedBoxIds:[],resetAreas:[]};case i.SingleToggleValid:if(x(n,o)){const e=x(n,o);return e?{modifiedBoxIds:[e.id],resetAreas:[]}:{modifiedBoxIds:[],resetAreas:[]}}return{modifiedBoxIds:[],resetAreas:[]};case i.MulitSelect:return{modifiedBoxIds:k(n,o),resetAreas:[]};case i.MultiPaste:case i.MultiMove:case i.Default:case i.UndoRedo:case i.ClearAll:default:return{modifiedBoxIds:[],resetAreas:[]}}}catch(e){return console.error("calcResetAreasAndBoxIds error:",e),{modifiedBoxIds:[],resetAreas:[]}}},p=(t,n)=>{if(t===n)return!0;if(typeof t!="object"||typeof n!="object"||t===null||n===null)return!1;const o=Object.keys(t),e=Object.keys(n);if(o.length!==e.length)return!1;for(const s of o)if(!p(t[s],n[s]))return!1;return!0},k=(t,n)=>{const o=new Map;for(const e of n)o.set(e.id,e);return t.filter(e=>{const s=o.get(e.id);return!s||!p(e,s)}).map(e=>e.id)};export{i as EPointCloudBoxRenderTrigger,d as EPointCloudBoxSingleModifiedType,C as calcResetAreasAndBoxIds};
1
+ import{getCuboidFromPointCloudBox as l}from"@labelbee/lb-annotation";import{isEqual as p}from"lodash";var i;(function(t){t.Default="Default",t.UndoRedo="UndoRedo",t.ClearAll="ClearAll",t.Single="Single",t.SingleDelete="SingleDelete",t.SingleToggleValid="SingleToggleValid",t.SingleRotate="SingleRotate",t.MultiPaste="MultiPaste",t.MultiMove="MultiMove",t.MulitSelect="MulitSelect"})(i||(i={}));var d;(function(t){t.ChangeAttribute="ChangeAttribute",t.Move="Move",t.ChangeDepth="ChangeDepth",t.ChangeSize="ChangeSize",t.ToggleValid="ToggleValid"})(d||(d={}));const A=(t,o)=>{const s=u(t).concat(u(o));for(const e of s){const n=g(t,e),r=g(o,e);if(!M(n,r))return!1}return!0},u=t=>{const o=[];for(let s=0;s<t.length;s++){const e=t[s],n=t[(s+1)%t.length],r={x:n.x-e.x,y:n.y-e.y},c={x:-r.y,y:r.x};o.push(c)}return o},g=(t,o)=>{let s=h(t[0],o),e=s;for(const n of t){const r=h(n,o);r<s&&(s=r),r>e&&(e=r)}return{min:s,max:e}},M=(t,o)=>!(t.max<o.min||o.max<t.min),h=(t,o)=>t.x*o.x+t.y*o.y,S=(t,o)=>{const s=[];return o.forEach(e=>{const{polygonPointList:n}=l(e);A(t,n)&&s.push(e.id)}),s},y=(t,o)=>{const s=t.map(n=>n.id),e=o.map(n=>n.id);return s.find(n=>!e.includes(n))||""},v=(t,o)=>{const s=t.map(e=>e.id);return o.find(e=>!s.includes(e.id))},x=(t,o)=>t.find(e=>{const n=o.find(r=>r.id===e.id);return n&&n.valid!==e.valid}),B=(t,o)=>t.find(e=>{const n=o.find(r=>r.id===e.id);return n&&n.rotation!==e.rotation}),f=(t,o)=>{const{polygonPointList:s}=l(t);return{ids:S(s,o.filter(n=>n.id!==t.id)),rect:s}},D=(t,o)=>{const s=(e,n)=>e.attribute===n.attribute&&e.center.x===n.center.x&&e.center.y===n.center.y&&e.depth===n.depth&&e.width===n.width&&e.height===n.height;for(const e of t){const n=o.find(r=>r.id===e.id);if(n&&!s(e,n)){let r;if(n.attribute!==e.attribute?r=d.ChangeAttribute:n.center.x!==e.center.x||n.center.y!==e.center.y?r=d.Move:n.depth!==e.depth?r=d.ChangeDepth:(n.width!==e.width||n.height!==e.height)&&(r=d.ChangeSize),r!==void 0)return{modifiedType:r,box:e}}}},C=(t,o,s)=>{try{switch(t){case i.Single:if(o.length>s.length){const e=y(o,s);return e?{modifiedBoxIds:[e],resetAreas:[]}:{modifiedBoxIds:[],resetAreas:[]}}else{const e=[],n=[],r=D(o,s);if(r&&(e.push(r.box.id),r.modifiedType===d.ChangeSize||r.modifiedType===d.Move)){const c=s.find(I=>I.id===r.box.id),{ids:a,rect:m}=f(c,o);e.push(...a),n.push(m)}return{modifiedBoxIds:e,resetAreas:n}}case i.SingleDelete:if(o.length<s.length){const e=v(o,s);if(e){const r=[l(e).polygonPointList],c=[];if(o.length>1){const{ids:a}=f(e,o);a.length&&c.push(...a)}return{modifiedBoxIds:c,resetAreas:r}}return{modifiedBoxIds:[],resetAreas:[]}}return{modifiedBoxIds:[],resetAreas:[]};case i.SingleRotate:if(B(o,s)){const e=B(o,s);if(e){const n=s.find(a=>a.id===e.id),{ids:r,rect:c}=f(n,o);return{modifiedBoxIds:[e.id,...r],resetAreas:[c]}}}return{modifiedBoxIds:[],resetAreas:[]};case i.SingleToggleValid:if(x(o,s)){const e=x(o,s);return e?{modifiedBoxIds:[e.id],resetAreas:[]}:{modifiedBoxIds:[],resetAreas:[]}}return{modifiedBoxIds:[],resetAreas:[]};case i.MulitSelect:return{modifiedBoxIds:V(o,s),resetAreas:[]};case i.MultiPaste:case i.MultiMove:case i.Default:case i.UndoRedo:case i.ClearAll:default:return{modifiedBoxIds:[],resetAreas:[]}}}catch(e){return console.error("calcResetAreasAndBoxIds error:",e),{modifiedBoxIds:[],resetAreas:[]}}},V=(t,o)=>{const s=new Map;for(const e of o)s.set(e.id,e);return t.filter(e=>{const n=s.get(e.id);return!n||!p(e,n)}).map(e=>e.id)};export{i as EPointCloudBoxRenderTrigger,d as EPointCloudBoxSingleModifiedType,C as calcResetAreasAndBoxIds};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.133",
3
+ "version": "1.23.0-alpha.135",
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.64",
47
- "@labelbee/lb-utils": "1.19.0-alpha.24",
46
+ "@labelbee/lb-annotation": "1.27.0-alpha.66",
47
+ "@labelbee/lb-utils": "1.19.0-alpha.26",
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",