@labelbee/lb-components 1.23.0-alpha.132 → 1.23.0-alpha.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/2DViewWorker.js +1 -1
- package/dist/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/dist/types/components/LLMMultiWheelView/index.d.ts +1 -0
- package/es/_virtual/2DViewWorker.js +1 -1
- package/es/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/es/components/LLMMultiWheelView/index.js +1 -1
- package/es/components/LLMMultiWheelView/sidebar/index.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getTextControlByConfig as
|
|
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
|
|
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
|
|
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};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@labelbee/lb-components",
|
|
3
|
-
"version": "1.23.0-alpha.
|
|
3
|
+
"version": "1.23.0-alpha.134",
|
|
4
4
|
"description": "Provide a complete library of annotation components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"es": "./es/index.js",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ant-design/icons": "^4.6.2",
|
|
46
|
-
"@labelbee/lb-annotation": "1.27.0-alpha.
|
|
47
|
-
"@labelbee/lb-utils": "1.19.0-alpha.
|
|
46
|
+
"@labelbee/lb-annotation": "1.27.0-alpha.65",
|
|
47
|
+
"@labelbee/lb-utils": "1.19.0-alpha.25",
|
|
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",
|