@labelbee/lb-components 1.23.0-alpha.123 → 1.23.0-alpha.124

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 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};
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 l}from"antd";import t from"react";var x=Object.defineProperty,D=Object.defineProperties,M=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,q=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,d=(o,e,r)=>e in o?x(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,F=(o,e)=>{for(var r in e||(e={}))q.call(e,r)&&d(o,r,e[r]);if(c)for(var r of c(e))C.call(e,r)&&d(o,r,e[r]);return o},T=(o,e)=>D(o,M(e));const B=o=>{const{id:e,answerList:r,question:p,index:u,name:f="",answerIsImg:w,questionIsImg:E,LLMConfig:_}=o,{dataFormatType:s,selectedID:v,setSelectedID:g}=j(),a=u+1,y=f||`\u5BF9\u8BDD${a}`;return t.createElement("div",{key:e,onClick:()=>g(e),className:h({dialog:!0,selected:e===v})},t.createElement("div",{className:"header"},t.createElement("span",{className:"order"},a),t.createElement("div",{className:"name"},t.createElement("div",{className:"show-name"},y),t.createElement("div",{className:"tips"},"\uFF08\u9009\u4E2D\u6807\u6CE8\uFF09"))),t.createElement("div",{className:"dialog-question"},t.createElement(l,{type:"primary"},"\u9898\u76EE",a),t.createElement("div",null,t.createElement(N,{question:p,dataFormatType:s,isImg:E}))),t.createElement("div",{className:"dialog-answer"},r.map((L,n)=>{const i=n+1,m=T(F({},L),{order:i}),O=P(m,_);return t.createElement("div",{key:n},t.createElement(l,{type:"primary"},"\u7B54\u6848",i),w?t.createElement(V,{answerList:r}):t.createElement(I,{i:m,isTextControl:O,dataFormatType:s}))})))};export{B as default};
@@ -1 +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};
1
+ import i,{useState as M,useEffect as f}from"react";import{ELLMDataType as E}from"../../constant/index.js";import{getStepConfig as k}from"../../store/annotation/reducer.js";import{LabelBeeContext as R}from"../../store/ctx.js";import{jsonParser as U}from"../../utils/index.js";import{connect as B}from"react-redux";import h from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as O}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as Q}from"../LLMToolView/questionView/components/header/index.js";import z from"./dialogView/index.js";import G from"../messageMaskLayer/index.js";import H from"../../views/MainView/annotationTips/index.js";import{useTranslation as J}from"react-i18next";import{LLMViewCls as K}from"../LLMToolView/questionView/index.js";import{Layout as X}from"antd";var Y=Object.defineProperty,Z=Object.defineProperties,ee=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,D=(t,e,o)=>e in t?Y(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,y=(t,e)=>{for(var o in e||(e={}))te.call(e,o)&&D(t,o,e[o]);if(S)for(var o of S(e))oe.call(e,o)&&D(t,o,e[o]);return t},x=(t,e)=>Z(t,ee(e));const b=t=>{const{questionIsImg:e,answerIsImg:o,LLMConfig:v,dialogList:m}=t,{dataFormatType:g,setDataFormatType:L}=h();return i.createElement("div",{className:`${O}`},i.createElement("div",{style:{display:"flex",justifyContent:"flex-end"}},i.createElement(Q,{dataFormatType:g,setDataFormatType:L})),i.createElement("div",{className:`${O}-container`},m==null?void 0:m.map((u,d)=>i.createElement(z,x(y({},u),{key:d,index:d,questionIsImg:e,answerIsImg:o,LLMConfig:v})))))},ne=t=>{var e,o;const{annotation:v,tips:m,showTips:g,drawLayerSlot:L}=t,{imgIndex:u,imgList:d,stepList:w,step:_,toolInstance:l}=v,[p,C]=M(),{setSelectedID:W,newAnswerListMap:j}=h(),[P,I]=M([]),q=((e=p==null?void 0:p.dataType)==null?void 0:e.prompt)===E.Picture,A=((o=p==null?void 0:p.dataType)==null?void 0:o.response)===E.Picture,{t:$}=J(),[,N]=M(0);return f(()=>{var r,n,c;if(!d[u])return;const a=(r=d[u])!=null?r:{},s=(c=(n=a==null?void 0:a.questionList)==null?void 0:n.textList)!=null?c:[];I(s),(s==null?void 0:s.length)&&W(s[0].id)},[u]),f(()=>{const r=P.map(n=>{var c;return x(y({},n),{answerList:(c=n==null?void 0:n.answerList)==null?void 0:c.map(a=>{var s,T,V;const F=`${(s=n==null?void 0:n.id)!=null?s:""}-${(T=a==null?void 0:a.id)!=null?T:""}`;return x(y({},a),{newAnswer:(V=j[F])!=null?V:a.answer})})})});I(r)},[j]),f(()=>{var r;if(w&&_){const n=(r=k(w,_))==null?void 0:r.config;C(U(n))}},[w,_]),f(()=>{if(l)return l.on("validUpdated",()=>{N(r=>r+1)}),()=>{l.unbindAll("validUpdated")}},[l]),i.createElement(X,{className:K},!(l==null?void 0:l.valid)&&i.createElement(G,{message:$("InvalidQuestionAndSkip")}),L==null?void 0:L({}),g===!0&&i.createElement(H,{tips:m}),i.createElement(b,{questionIsImg:q,answerIsImg:A,LLMConfig:p,dialogList:P}))},re=t=>({annotation:t.annotation});var ie=B(re,null,null,{context:R})(ne);export{b as LLMMultiWheelSourceView,ie as default};
@@ -1 +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
+ import l,{useState as E,useRef as ut,useMemo as G,useEffect as V}from"react";import{LabelBeeContext as Dt}from"../../../store/ctx.js";import{connect as It}from"react-redux";import{prefix as Ot}from"../../../constant/index.js";import{getStepConfig as Vt}from"../../../store/annotation/reducer.js";import{jsonParser as dt}from"../../../utils/index.js";import Nt,{getSorts as ct}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as Bt}from"react-i18next";import{useCustomToolInstance as $t}from"../../../hooks/annotation.js";import{isBoolean as Wt,isString as Ft,isNumber as qt,isObject as kt,isArray as Gt}from"lodash";import{PageForward as N}from"../../../store/annotation/actionCreators.js";import{cKeyCode as Kt,EToolName as zt}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Ut,EmptyConfig as Qt}from"../../LLMToolView/sidebar/index.js";import Jt from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as pt}from"antd";import Ht from"../../LLMToolView/sidebar/components/answerList/index.js";import Xt from"../../../store/LLMMultiWheel/index.js";import Yt from"../../../utils/StepUtils.js";import{getCurrentResultFromResultList as Zt,getRenderDataByResult as te}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as K}from"ahooks";import ee from"../../LLMToolView/sidebar/components/answerSort/index.js";var ne=Object.defineProperty,oe=Object.defineProperties,re=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,le=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable,ft=(c,s,p)=>s in c?ne(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p,i=(c,s)=>{for(var p in s||(s={}))le.call(s,p)&&ft(c,p,s[p]);if(mt)for(var p of mt(s))ie.call(s,p)&&ft(c,p,s[p]);return c},a=(c,s)=>oe(c,re(s));const se=Kt.default,vt=`${Ot}-sidebar`,ae={sort:[],answerSort:{},textAttribute:[]},ue=c=>{var s,p,z,U,Q,J,H;const{annotation:Lt,dispatch:y,checkMode:xt}=c,{imgIndex:M,imgList:B,stepList:C,step:A,skipBeforePageTurning:h}=Lt,[m,gt]=E(),{t:j}=Bt(),r=(s=B[M])!=null?s:{},X=dt(r==null?void 0:r.result),{toolInstanceRef:v}=$t({basicInfo:X}),[$,wt]=E(!0),[T,Y]=E({}),[R,Z]=E(ae),W=ut();ut();const[x,F]=E({}),{selectedID:P,setNewAnswerListMap:tt,newAnswerListMap:et}=Xt(),g=G(()=>T[P],[P,T]),S=!v.current.valid||xt;V(()=>{var t;if(C&&A){const e=(t=Vt(C,A))==null?void 0:t.config;gt(dt(e))}},[A,JSON.stringify(C)]),V(()=>{!r||M===-1||(v.current.setValid=nt,v.current.clearResult=_t,nt(),ot())},[M,m,r==null?void 0:r.id]);const _t=()=>{var t,e,n,u,f;ot((t=r==null?void 0:r.questionList)==null?void 0:t.textList),((e=W.current)==null?void 0:e.clearValue)&&((n=W.current)==null||n.clearValue());const{waitSorts:o}=ct({selectedSort:(f=(u=D())==null?void 0:u.sort)!=null?f:[],initSelected:[],modelList:I?O!=null?O:[]:[]});F(a(i({},x),{waitSorts:o,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;Wt(n)&&(wt(n),v.current.valid=n,(e=v.current)==null||e.emit("validUpdated"))},D=()=>{const t=Yt.getCurrentStepInfo(A,C);return Zt(r==null?void 0:r.result,t.step)},ot=K(t=>{var e,n,u,f,o,L,b;const d=D();let w=(e=r==null?void 0:r.questionList)==null?void 0:e.textList;((n=d==null?void 0:d.modelData)==null?void 0:n.length)&&v.current.valid&&(w=d==null?void 0:d.modelData),t&&(w=t,d.sort=[],d.textAttribute=[],d.answerSort=[]);let st={};w==null||w.forEach((_,Tt)=>{var at;const Rt=te(m,a(i({},_),{answerList:(at=_==null?void 0:_.answerList)==null?void 0:at.map((k,Pt)=>(tt(a(i({},et),{[`${_.id}-${k.id}`]:k.answer})),a(i({},k),{order:Pt+1})))}));st[_.id]=a(i({},Rt),{order:Tt+1,id:_.id})});const{waitSorts:ht,newSort:jt}=ct({selectedSort:(f=(u=D())==null?void 0:u.sort)!=null?f:[],modelList:I?O!=null?O:[]:[]});F({waitSorts:ht,newSort:jt}),Z({sort:(o=d==null?void 0:d.sort)!=null?o:[],textAttribute:(L=d==null?void 0:d.textAttribute)!=null?L:[],answerSort:(b=d==null?void 0:d.answerSort)!=null?b:[]}),Y(st)});V(()=>{St()},[T,$,R]),V(()=>(window.addEventListener("keydown",rt),()=>{window.removeEventListener("keydown",rt)}),[]);const St=K(()=>{var t,e;const n=(e=(t=r==null?void 0:r.questionList)==null?void 0:t.textList)==null?void 0:e.map(f=>{var o;const L=(o=T[f.id])!=null?o:{};return{id:f.id,answerList:L.answerList}}),u=a(i({},R),{modelData:n});v.current.exportData=()=>[[u],{valid:$}],v.current.currentPageResult=a(i({},u),{toolName:zt.LLMMultiWheel,valid:$})}),rt=t=>{if(t.ctrlKey&&t.keyCode===se.Enter){if(h){h(()=>y(N()));return}y(N())}},bt=K(({order:t,value:e,key:n})=>{const{answerList:u}=g,f=u==null?void 0:u.map(o=>{var L,b;if((o==null?void 0:o.order)===t){if(n==="textEdit"&&Ft(e))return tt(a(i({},et),{[`${P}-${(L=o==null?void 0:o.id)!=null?L:""}`]:e})),a(i({},o),{newAnswer:e});if(qt(e))return a(i({},o),{score:e});if(kt(e)&&n){const d={[e==null?void 0:e.key]:e.value},w=(b=o[n])!=null?b:{};return a(i({},o),{[n]:i(i({},w),d)})}}return o});Y(o=>a(i({},o),{[P]:a(i({},g),{answerList:f})}))}),q=(t,e)=>{Z(n=>a(i({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:Et,dialogSort:I=!1,inputList:yt=[],tagInputListConfigurable:Mt}=m||{},O=G(()=>{var t,e,n;return I?(n=(e=(t=r==null?void 0:r.questionList)==null?void 0:t.textList)==null?void 0:e.map((u,f)=>a(i({},u),{title:f+1})))!=null?n:[]:[]},[r,I]);if(G(()=>Ut(m),[m]))return l.createElement(Qt,null);const Ct=Mt&&((p=yt.filter(t=>!t.isOverall))==null?void 0:p.length)>0,At=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||Et||Ct;return l.createElement("div",{className:`${vt}`},l.createElement("div",{className:`${vt}__content`},l.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},j("GlobalAnnotation")),l.createElement(ee,{waitSortList:(x==null?void 0:x.waitSorts)||[],sortList:(x==null?void 0:x.newSort)||[],setSortList:t=>{const e=t.map(n=>n.map(u=>u.id));q("sort",e),F(a(i({},x),{newSort:t}))},disabeledAll:S,title:j("SortConversationQuality"),prefixId:"model"}),(m==null?void 0:m.text)&&l.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},l.createElement(Jt,{textAttribute:(z=R==null?void 0:R.textAttribute)!=null?z:[],textConfig:(m==null?void 0:m.text)&&Gt(m.text)?m==null?void 0:m.text:[],setText:t=>q("textAttribute",t),disabeledAll:S})),l.createElement(Nt,{modelData:(Q=(U=r==null?void 0:r.questionList)==null?void 0:U.textList)!=null?Q:[],selectedAnswerSort:t=>q("answerSort",t),selectedSort:(H=(J=D())==null?void 0:J.answerSort)!=null?H:[],ref:W,disabeledAll:S}),g&&l.createElement(l.Fragment,null,l.createElement("div",{style:{fontSize:"18px",fontWeight:500,padding:"0px 16px",marginTop:"16px"}},j("QualifiedAnnotation")),l.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"}},l.createElement(pt,{type:"primary",danger:!0},"\u6B63\u5728\u6807\u6CE8"),l.createElement("div",{style:{padding:16}},"\u7EC4\uFF1A",g.order)),l.createElement("div",null,At&&l.createElement(Ht,{list:(g==null?void 0:g.answerList)||[],LLMConfig:m,updateValue:bt,disabeledAll:S})))),l.createElement("div",{style:{margin:"24px 16px",display:"flex"}},(B==null?void 0:B.length)-1!==M&&l.createElement(pt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(h){h(()=>y(N()));return}y(N())},disabled:S},j("Save"))))},de=c=>({annotation:c.annotation});var ce=It(de,null,null,{context:Dt})(ue);export{ce as default};
@@ -1 +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
+ import{EDataFormatType as s}from"../../constant/index.js";import{create as r}from"zustand";const o=r(e=>({dataFormatType:s.Default,setDataFormatType:t=>e(a=>({dataFormatType:t})),selectedID:"",setSelectedID:t=>e(a=>({selectedID:t})),newAnswerListMap:{},setNewAnswerListMap:t=>e(a=>({newAnswerListMap:t}))}));export{o as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@labelbee/lb-components",
3
- "version": "1.23.0-alpha.123",
3
+ "version": "1.23.0-alpha.124",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",