@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.
- 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/components/LLMToolView/questionView/index.js +1 -1
- package/dist/index.css +2 -2
- package/dist/store/LLMMultiWheel/index.js +1 -1
- package/dist/types/components/LLMToolView/types.d.ts +1 -0
- package/dist/types/components/LLMToolView/utils/data.d.ts +1 -0
- package/dist/types/store/LLMMultiWheel/index.d.ts +5 -6
- 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/es/components/LLMToolView/questionView/index.js +1 -1
- package/es/index.css +2 -2
- package/es/store/LLMMultiWheel/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getTextControlByConfig as
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
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:
|
|
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
|
|
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};
|