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

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 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,p=(a,t,r)=>t in a?x(a,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):a[t]=r,B=(a,t)=>{for(var r in t||(t={}))F.call(t,r)&&p(a,r,t[r]);if(c)for(var r of c(t))q.call(t,r)&&p(a,r,t[r]);return a},C=(a,t)=>D(a,M(t));const T=a=>{const{id:t,answerList:r,question:u,index:d,name:f="",answerIsImg:w,questionIsImg:E,LLMConfig:_}=a,{dataFormatType:s,selectedID:v,setSelectedID:g}=j(),o=d+1,y=f||`\u5BF9\u8BDD${o}`;return e.createElement("div",{key:t,onClick:()=>g(t),className:h({dialog:!0,selected:t===v})},e.createElement("div",{className:"header"},e.createElement("span",{className:"order"},o),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",o),e.createElement("div",null,e.createElement(N,{question:u,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.map((L,i)=>{const m=i+1,l=C(B({},L),{order:m}),O=P(l,_);return e.createElement("div",{key:i},e.createElement(n,{type:"primary"},"\u7B54\u6848",m),e.createElement(I,{i:l,isTextControl:O,dataFormatType:s}))})))};export{T 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 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 +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 y,useRef as ut,useMemo as G,useEffect as V}from"react";import{LabelBeeContext as It}from"../../../store/ctx.js";import{connect as Ot}from"react-redux";import{prefix as Vt}from"../../../constant/index.js";import{getStepConfig as Nt}from"../../../store/annotation/reducer.js";import{jsonParser as dt}from"../../../utils/index.js";import Bt,{getSorts as ct}from"../../LLMToolView/sidebar/components/modelAnswerSort/index.js";import{useTranslation as $t}from"react-i18next";import{useCustomToolInstance as Wt}from"../../../hooks/annotation.js";import{isBoolean as Ft,isString as qt,isNumber as kt,isObject as Gt,isArray as Kt}from"lodash";import{PageForward as N}from"../../../store/annotation/actionCreators.js";import{cKeyCode as zt,EToolName as Ut}from"@labelbee/lb-annotation";import{getLLMIsNoConfig as Qt,EmptyConfig as Jt}from"../../LLMToolView/sidebar/index.js";import Ht from"../../LLMToolView/sidebar/components/textInputBox/index.js";import{Button as pt}from"antd";import Xt from"../../LLMToolView/sidebar/components/answerList/index.js";import Yt from"../../../store/LLMMultiWheel/index.js";import Zt from"../../../utils/StepUtils.js";import{getCurrentResultFromResultList as te,getRenderDataByResult as ee}from"../../LLMToolView/utils/data.js";import{useMemoizedFn as K}from"ahooks";import ne from"../../LLMToolView/sidebar/components/answerSort/index.js";var oe=Object.defineProperty,re=Object.defineProperties,le=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,ie=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,ft=(c,s,p)=>s in c?oe(c,s,{enumerable:!0,configurable:!0,writable:!0,value:p}):c[s]=p,i=(c,s)=>{for(var p in s||(s={}))ie.call(s,p)&&ft(c,p,s[p]);if(mt)for(var p of mt(s))se.call(s,p)&&ft(c,p,s[p]);return c},a=(c,s)=>re(c,le(s));const ae=zt.default,vt=`${Vt}-sidebar`,ue={sort:[],answerSort:{},textAttribute:[]},de=c=>{var s,p,z,U,Q,J,H;const{annotation:Lt,dispatch:M,checkMode:xt}=c,{imgIndex:C,imgList:B,stepList:A,step:h,skipBeforePageTurning:j}=Lt,[m,gt]=y(),{t:T}=$t(),r=(s=B[C])!=null?s:{},X=dt(r==null?void 0:r.result),{toolInstanceRef:v}=Wt({basicInfo:X}),[$,wt]=y(!0),[R,Y]=y({}),[P,Z]=y(ue),W=ut();ut();const[x,F]=y({}),{selectedID:D,setNewAnswerListMap:tt,newAnswerListMap:et}=Yt(),g=G(()=>R[D],[D,R]),S=!v.current.valid||xt;V(()=>{var t;if(A&&h){const e=(t=Nt(A,h))==null?void 0:t.config;gt(dt(e))}},[h,JSON.stringify(A)]),V(()=>{!r||C===-1||(v.current.setValid=nt,v.current.clearResult=_t,nt(),ot())},[C,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=I())==null?void 0:u.sort)!=null?f:[],initSelected:[],modelList:b?O!=null?O:[]:[]});F(a(i({},x),{waitSorts:o,newSort:[]}))},nt=t=>{var e;const n=t!=null?t:X.valid;Ft(n)&&(wt(n),v.current.valid=n,(e=v.current)==null||e.emit("validUpdated"))},I=()=>{const t=Zt.getCurrentStepInfo(h,A);return te(r==null?void 0:r.result,t.step)},ot=K(t=>{var e,n,u,f,o,L,E;const d=I();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((_,Rt)=>{var at;const Pt=ee(m,a(i({},_),{answerList:(at=_==null?void 0:_.answerList)==null?void 0:at.map((k,Dt)=>(tt(a(i({},et),{[`${_.id}-${k.id}`]:k.answer})),a(i({},k),{order:Dt+1})))}));st[_.id]=a(i({},Pt),{order:Rt+1,id:_.id})});const{waitSorts:jt,newSort:Tt}=ct({selectedSort:(f=(u=I())==null?void 0:u.sort)!=null?f:[],modelList:b?O!=null?O:[]:[]});F({waitSorts:jt,newSort:Tt}),Z({sort:(o=d==null?void 0:d.sort)!=null?o:[],textAttribute:(L=d==null?void 0:d.textAttribute)!=null?L:[],answerSort:(E=d==null?void 0:d.answerSort)!=null?E:[]}),Y(st)});V(()=>{St()},[R,$,P]),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=R[f.id])!=null?o:{};return{id:f.id,answerList:L.answerList}}),u=a(i({},P),{modelData:n});v.current.exportData=()=>[[u],{valid:$}],v.current.currentPageResult=a(i({},u),{toolName:Ut.LLMMultiWheel,valid:$})}),rt=t=>{if(t.ctrlKey&&t.keyCode===ae.Enter){if(j){j(()=>M(N()));return}M(N())}},bt=K(({order:t,value:e,key:n})=>{const{answerList:u}=g,f=u==null?void 0:u.map(o=>{var L,E;if((o==null?void 0:o.order)===t){if(n==="textEdit"&&qt(e))return tt(a(i({},et),{[`${D}-${(L=o==null?void 0:o.id)!=null?L:""}`]:e})),a(i({},o),{newAnswer:e});if(kt(e))return a(i({},o),{score:e});if(Gt(e)&&n){const d={[e==null?void 0:e.key]:e.value},w=(E=o[n])!=null?E:{};return a(i({},o),{[n]:i(i({},w),d)})}}return o});Y(o=>a(i({},o),{[D]:a(i({},g),{answerList:f})}))}),q=(t,e)=>{Z(n=>a(i({},n),{[t]:e}))},{indicatorScore:lt=[],indicatorDetermine:it=[],isTextEdit:Et,dialogSort:b=!1,inputList:yt=[],tagInputListConfigurable:Mt,enableSort:Ct=!1}=m||{},O=G(()=>{var t,e,n;return b?(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,b]);if(G(()=>Qt(m),[m]))return l.createElement(Jt,null);const At=Mt&&((p=yt.filter(t=>!t.isOverall))==null?void 0:p.length)>0,ht=(it==null?void 0:it.length)>0||(lt==null?void 0:lt.length)>0||Et||At;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"}},T("GlobalAnnotation")),b&&l.createElement(ne,{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:T("SortConversationQuality"),prefixId:"model"}),(m==null?void 0:m.text)&&l.createElement("div",{style:{padding:"0px 16px",marginTop:"16px"}},l.createElement(Ht,{textAttribute:(z=P==null?void 0:P.textAttribute)!=null?z:[],textConfig:(m==null?void 0:m.text)&&Kt(m.text)?m==null?void 0:m.text:[],setText:t=>q("textAttribute",t),disabeledAll:S})),Ct&&l.createElement(Bt,{modelData:(Q=(U=r==null?void 0:r.questionList)==null?void 0:U.textList)!=null?Q:[],selectedAnswerSort:t=>q("answerSort",t),selectedSort:(H=(J=I())==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"}},T("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,ht&&l.createElement(Xt,{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!==C&&l.createElement(pt,{type:"primary",style:{marginLeft:"auto"},onClick:()=>{if(j){j(()=>M(N()));return}M(N())},disabled:S},T("Save"))))},ce=c=>({annotation:c.annotation});var pe=Ot(ce,null,null,{context:It})(de);export{pe as default};
@@ -1 +1 @@
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
+ import n,{useState as M,useEffect as O}from"react";import{Tag as S}from"antd";import{prefix as N,EDataFormatType as u,ELLMDataType as p}from"../../../constant/index.js";import $ from"classnames";import{I18nextProvider as k,useTranslation as C}from"react-i18next";import{i18n as v}from"@labelbee/lb-utils";import D from"../../markdownView/index.js";import L from"../modelAPIView/index.js";import R from"../../diffMatchPatchComponent/index.js";import F from"./components/header/index.js";import W from"./components/imgView/index.js";import{isString as q}from"lodash";var B=Object.defineProperty,w=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,f=(e,t,r)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,K=(e,t)=>{for(var r in t||(t={}))H.call(t,r)&&f(e,r,t[r]);if(w)for(var r of w(t))Q.call(t,r)&&f(e,r,t[r]);return e};const a=`${N}-LLMView`,_=({i:e,dataFormatType:t,isTextControl:r})=>{var l;return t===u.Markdown?n.createElement(D,{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",overflowWrap:"break-word"}},(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:c,modelAPIResponse:x,setModelAPIResponse:g,checkMode:y=!0,LLMConfig:i,answerHeaderSlot:P}=e,[d,h]=M(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}=C();O(()=>{var o;c&&((o=v)==null||o.changeLanguage(c))},[]);const V=n.createElement("div",null,s.map((o,b)=>{const j=E(o,i);return n.createElement("div",{className:$({[`${a}__content`]:!0,[`${a}__contentActive`]:l===(o==null?void 0:o.order)}),key:b},n.createElement(S,{className:`${a}-tag`},o==null?void 0:o.order),n.createElement(_,{i:o,isTextControl:j,dataFormatType:d}))}),q(m)&&n.createElement(L,{dataFormatType:d,modelAPIResponse:x,question:m,setModelAPIResponse:g,checkMode:y,annotation:e.annotation}));return n.createElement("div",{className:a},n.createElement(F,{question:m,dataFormatType:d,setDataFormatType:h,isImg:I}),n.createElement("div",{className:`${a}__textBox`},n.createElement("div",{className:`${a}__title`},T("Answer")," ",P),A?n.createElement(W,{hoverKey:l,answerList:s}):V))},G=e=>n.createElement(k,{i18n:v},n.createElement(z,K({},e)));export{a as LLMViewCls,_ as RenderAnswer,G as default,E as getTextControlByConfig};
package/es/index.css CHANGED
@@ -3372,7 +3372,7 @@
3372
3372
  /** LLMMultiWheel style */
3373
3373
  .bee-LLMMultiWheelView {
3374
3374
  display: flex;
3375
- flex: auto;
3375
+ flex: 1;
3376
3376
  flex-direction: column;
3377
3377
  overflow: hidden;
3378
3378
  background-color: #fff;
@@ -3381,7 +3381,7 @@
3381
3381
  .bee-LLMMultiWheelView-container {
3382
3382
  flex: auto;
3383
3383
  display: flex;
3384
- overflow: hidden;
3384
+ overflow: auto;
3385
3385
  }
3386
3386
  .bee-LLMMultiWheelView-container .dialog {
3387
3387
  min-width: 50%;
@@ -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.125",
4
4
  "description": "Provide a complete library of annotation components",
5
5
  "main": "./dist/index.js",
6
6
  "es": "./es/index.js",