@labelbee/lb-components 1.24.0-alpha.16 → 1.24.0-alpha.17
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/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/dist/components/LLMMultiWheelView/index.js +1 -1
- package/dist/components/LLMToolView/index.js +1 -1
- package/dist/components/LLMToolView/questionView/components/audioView/index.js +1 -0
- package/dist/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/dist/components/LLMToolView/questionView/index.js +1 -1
- package/dist/constant/index.js +1 -1
- package/dist/types/components/LLMMultiWheelView/dialogView/index.d.ts +2 -0
- package/dist/types/components/LLMMultiWheelView/index.d.ts +2 -0
- package/dist/types/components/LLMToolView/questionView/components/audioView/index.d.ts +8 -0
- package/dist/types/components/LLMToolView/questionView/components/header/index.d.ts +3 -1
- package/dist/types/constant/index.d.ts +2 -1
- package/es/components/LLMMultiWheelView/dialogView/index.js +1 -1
- package/es/components/LLMMultiWheelView/index.js +1 -1
- package/es/components/LLMToolView/index.js +1 -1
- package/es/components/LLMToolView/questionView/components/audioView/index.js +1 -0
- package/es/components/LLMToolView/questionView/components/header/index.js +1 -1
- package/es/components/LLMToolView/questionView/index.js +1 -1
- package/es/constant/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var index$4=require("../../LLMToolView/questionView/index.js"),index$2=require("../../LLMToolView/questionView/components/header/index.js"),index$3=require("../../LLMToolView/questionView/components/imgView/index.js"),index=require("../../../store/LLMMultiWheel/index.js"),index$1=require("../../../utils/index.js"),antd=require("antd"),React=require("react"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const DialogView=e=>{const{id:t,answerList:r,question:d,index:u,name:c="",answerIsImg:m,questionIsImg:f,LLMConfig:
|
|
1
|
+
"use strict";var index$5=require("../../LLMToolView/questionView/index.js"),index$4=require("../../LLMToolView/questionView/components/audioView/index.js"),index$2=require("../../LLMToolView/questionView/components/header/index.js"),index$3=require("../../LLMToolView/questionView/components/imgView/index.js"),index=require("../../../store/LLMMultiWheel/index.js"),index$1=require("../../../utils/index.js"),antd=require("antd"),React=require("react"),reactI18next=require("react-i18next");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const DialogView=e=>{const{id:t,answerList:r,question:d,index:u,name:c="",answerIsImg:m,questionIsImg:f,questionIsAudio:p,answerIsAudio:v,LLMConfig:w}=e,{t:a}=reactI18next.useTranslation(),{dataFormatType:i,selectedID:E,setSelectedID:g}=index(),n=u+1,y=c||`${a("Dialog")}${n}`,_=()=>m?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Button,{type:"primary"},a("Answer")),React__default.default.createElement(index$3,{answerList:r})):v?React__default.default.createElement(React__default.default.Fragment,null,React__default.default.createElement(antd.Button,{type:"primary"},a("Answer")),React__default.default.createElement(index$4,{answerList:r})):r==null?void 0:r.map((x,l)=>{const o=l+1,s=__spreadProps(__spreadValues({},x),{order:o}),q=index$5.getTextControlByConfig(s,w);return React__default.default.createElement("div",{key:l},React__default.default.createElement(antd.Button,{type:"primary"},a("Answer"),o),React__default.default.createElement(index$5.RenderAnswer,{i:s,isTextControl:q,dataFormatType:i}))});return React__default.default.createElement("div",{key:t,onClick:()=>g(t),className:index$1.classnames({dialog:!0,selected:t===E})},React__default.default.createElement("div",{className:"header"},React__default.default.createElement("span",{className:"order"},n),React__default.default.createElement("div",{className:"name"},React__default.default.createElement("div",{className:"show-name"},y),React__default.default.createElement("div",{className:"tips"},"\uFF08",a("SelectionOfAnnotation"),"\uFF09"))),React__default.default.createElement("div",{className:"dialog-question"},React__default.default.createElement(antd.Button,{type:"primary"},a("Title"),n),React__default.default.createElement("div",null,React__default.default.createElement(index$2.RenderQuestion,{question:d,dataFormatType:i,isImg:f,isAudio:p}))),React__default.default.createElement("div",{className:"dialog-answer"},_()))};module.exports=DialogView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index$4=require("../../constant/index.js"),reducer=require("../../store/annotation/reducer.js"),ctx=require("../../store/ctx.js"),index$5=require("../../utils/index.js"),reactRedux=require("react-redux"),index=require("../../store/LLMMultiWheel/index.js"),index$1=require("../../views/MainView/LLMMultiWheelLayout/index.js"),index$2=require("../LLMToolView/questionView/components/header/index.js"),index$3=require("./dialogView/index.js"),index$7=require("../messageMaskLayer/index.js"),index$8=require("../../views/MainView/annotationTips/index.js"),reactI18next=require("react-i18next"),index$6=require("../LLMToolView/questionView/index.js"),antd=require("antd"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const LLMMultiWheelSourceView=e=>{const{questionIsImg:t,answerIsImg:n,LLMConfig:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),index$4=require("../../constant/index.js"),reducer=require("../../store/annotation/reducer.js"),ctx=require("../../store/ctx.js"),index$5=require("../../utils/index.js"),reactRedux=require("react-redux"),index=require("../../store/LLMMultiWheel/index.js"),index$1=require("../../views/MainView/LLMMultiWheelLayout/index.js"),index$2=require("../LLMToolView/questionView/components/header/index.js"),index$3=require("./dialogView/index.js"),index$7=require("../messageMaskLayer/index.js"),index$8=require("../../views/MainView/annotationTips/index.js"),reactI18next=require("react-i18next"),index$6=require("../LLMToolView/questionView/index.js"),antd=require("antd"),lbUtils=require("@labelbee/lb-utils");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),__defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,n)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,__spreadValues=(e,t)=>{for(var n in t||(t={}))__hasOwnProp.call(t,n)&&__defNormalProp(e,n,t[n]);if(__getOwnPropSymbols)for(var n of __getOwnPropSymbols(t))__propIsEnum.call(t,n)&&__defNormalProp(e,n,t[n]);return e},__spreadProps=(e,t)=>__defProps(e,__getOwnPropDescs(t));const LLMMultiWheelSourceView=e=>{const{questionIsImg:t,answerIsImg:n,questionIsAudio:a,answerIsAudio:c,LLMConfig:f,dialogList:l,lang:s="cn"}=e,{dataFormatType:w,setDataFormatType:u}=index();return React.useEffect(()=>{var d;s&&((d=lbUtils.i18n)==null||d.changeLanguage(s))},[s]),React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement("div",{className:`${index$1.LLMMultiWheelViewCls}`},React__default.default.createElement("div",{style:{display:"flex",justifyContent:"flex-end",margin:"10px"}},React__default.default.createElement(index$2.ToggleDataFormatType,{dataFormatType:w,setDataFormatType:u})),React__default.default.createElement("div",{className:`${index$1.LLMMultiWheelViewCls}-container`},l==null?void 0:l.map((d,_)=>React__default.default.createElement(index$3,__spreadProps(__spreadValues({},d),{key:_,index:_,questionIsImg:t,answerIsImg:n,questionIsAudio:a,answerIsAudio:c,LLMConfig:f}))))))},getInfoFromLLMFile=({type:e,questionIndex:t,answerIndex:n,llmFile:a})=>{if(e==="question")return a==null?void 0:a.find((f,l)=>t===l);let c=null;return a==null||a.forEach((f,l)=>{var s;(s=f.answerList)==null||s.forEach((w,u)=>{l===t&&n===u&&(c=w)})}),c},LLMMultiWheelView=e=>{var t,n,a,c;const{annotation:f,tips:l,showTips:s,drawLayerSlot:w}=e,{imgIndex:u,imgList:d,stepList:_,step:m,toolInstance:g}=f,[i,$]=React.useState(),{setSelectedID:A,newAnswerListMap:j}=index(),[C,I]=React.useState([]),y=((t=i==null?void 0:i.dataType)==null?void 0:t.prompt)===index$4.ELLMDataType.Picture,q=((n=i==null?void 0:i.dataType)==null?void 0:n.response)===index$4.ELLMDataType.Picture,E=((a=i==null?void 0:i.dataType)==null?void 0:a.prompt)===index$4.ELLMDataType.Audio,P=((c=i==null?void 0:i.dataType)==null?void 0:c.response)===index$4.ELLMDataType.Audio,{t:W}=reactI18next.useTranslation(),[,F]=React.useState(0);return React.useEffect(()=>{var r,v,p;if(!d[u])return;const x=(r=d[u])!=null?r:{},L=(p=(v=x==null?void 0:x.questionList)==null?void 0:v.textList)!=null?p:[];I(L),(L==null?void 0:L.length)&&A(L[0].id)},[u]),React.useEffect(()=>{var r,v;const p=(r=d[u])!=null?r:{},x=p==null?void 0:p.questionList,L=(v=p==null?void 0:p.llmFile)==null?void 0:v.textList,T=x==null?void 0:x.textList,N=T==null?void 0:T.map((o,b)=>{var h;return __spreadProps(__spreadValues({},o),{question:(y||E)&&getInfoFromLLMFile({type:"question",questionIndex:b,llmFile:L})||(o==null?void 0:o.question),answerList:(h=o==null?void 0:o.answerList)==null?void 0:h.map((M,D)=>{var V,O,S;const R=`${(V=o==null?void 0:o.id)!=null?V:""}-${(O=M==null?void 0:M.id)!=null?O:""}`,U=q||P?getInfoFromLLMFile({type:"answer",questionIndex:b,answerIndex:D,llmFile:L})||{}:{};return __spreadValues(__spreadProps(__spreadValues({},M),{answer:M.answer,newAnswer:(S=j[R])!=null?S:M.answer,order:D+1}),U)})})});I(N)},[j,y,E,q]),React.useEffect(()=>{var r;if(_&&m){const v=(r=reducer.getStepConfig(_,m))==null?void 0:r.config;$(index$5.jsonParser(v))}},[_,m]),React.useEffect(()=>{if(g)return g.on("validUpdated",()=>{F(r=>r+1)}),()=>{g.unbindAll("validUpdated")}},[g]),React__default.default.createElement(antd.Layout,{className:index$6.LLMViewCls},!(g==null?void 0:g.valid)&&React__default.default.createElement(index$7,{message:W("InvalidQuestionAndSkip")}),w==null?void 0:w({}),s===!0&&React__default.default.createElement(index$8,{tips:l}),React__default.default.createElement(LLMMultiWheelSourceView,{questionIsImg:y,answerIsImg:q,questionIsAudio:E,answerIsAudio:P,LLMConfig:i,dialogList:C}))},mapStateToProps=e=>({annotation:e.annotation});var LLMMultiWheelView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(LLMMultiWheelView);exports.LLMMultiWheelSourceView=LLMMultiWheelSourceView,exports.default=LLMMultiWheelView$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),antd=require("antd"),index=require("../../constant/index.js"),es=require("antd/es"),index$4=require("./questionView/index.js"),reactI18next=require("react-i18next"),index$3=require("../../views/MainView/annotationTips/index.js"),data=require("./utils/data.js"),reducer=require("../../store/annotation/reducer.js"),index$1=require("../../utils/index.js"),index$2=require("../messageMaskLayer/index.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const LLMViewCls=`${index.prefix}-LLMView`,LLMToolView=n=>{var p;const{annotation:x,checkMode:m=!0,tips:
|
|
1
|
+
"use strict";var React=require("react"),reactRedux=require("react-redux"),ctx=require("../../store/ctx.js"),antd=require("antd"),index=require("../../constant/index.js"),es=require("antd/es"),index$4=require("./questionView/index.js"),reactI18next=require("react-i18next"),index$3=require("../../views/MainView/annotationTips/index.js"),data=require("./utils/data.js"),reducer=require("../../store/annotation/reducer.js"),index$1=require("../../utils/index.js"),index$2=require("../messageMaskLayer/index.js");function _interopDefaultLegacy(n){return n&&typeof n=="object"&&"default"in n?n:{default:n}}var React__default=_interopDefaultLegacy(React);const LLMViewCls=`${index.prefix}-LLMView`,LLMToolView=n=>{var p;const{annotation:x,checkMode:m=!0,tips:I,showTips:_,drawLayerSlot:q}=n,{imgIndex:i,imgList:o,stepList:L,step:u,toolInstance:r}=x,{hoverKey:A,modelAPIResponse:j,setModelAPIResponse:g,newAnswerList:d}=React.useContext(ctx.LLMContext),[R,C]=React.useState([]),[D,S]=React.useState(""),[e,P]=React.useState(),{t:T}=reactI18next.useTranslation(),[,$]=React.useState(0);return React.useEffect(()=>{let t;if(!m)return t=setInterval(()=>{antd.message.info(T("EfficientListening"))},1e3*60),()=>{t&&clearInterval(t)}},[]),React.useEffect(()=>{if(r)return r.on("validUpdated",()=>{$(t=>t+1)}),()=>{r.unbindAll("validUpdated")}},[r]),React.useEffect(()=>{var t,a,s,l,y,M,w,E;if(!o[i])return;const h=((t=e==null?void 0:e.dataType)==null?void 0:t.prompt)===index.ELLMDataType.Picture,V=((a=e==null?void 0:e.dataType)==null?void 0:a.prompt)===index.ELLMDataType.Audio,b=((s=e==null?void 0:e.dataType)==null?void 0:s.response)===index.ELLMDataType.Picture,k=((l=e==null?void 0:e.dataType)==null?void 0:l.response)===index.ELLMDataType.Audio,c=(y=o[i])==null?void 0:y.questionList,v=(M=o[i])==null?void 0:M.llmFile,F=h||V?v==null?void 0:v.question:c==null?void 0:c.question;S(F);let f=(c==null?void 0:c.answerList)||[];(b||k)&&(f=(v==null?void 0:v.answerList)||[]),((w=e==null?void 0:e.dataType)==null?void 0:w.response)===index.ELLMDataType.None&&(f=[]),((E=e==null?void 0:e.dataType)==null?void 0:E.response)===index.ELLMDataType.Text&&(d==null?void 0:d.length)>0&&(f=d),C(f)},[i,d,e,(p=o[i])==null?void 0:p.id]),React.useEffect(()=>{var t;if(!o[i])return;const a=(t=o[i])!=null?t:{},s=data.getCurrentResultFromResultList(a==null?void 0:a.result,u),l=(s==null?void 0:s.length)>0?s[0]:s;g((l==null?void 0:l.modelAPIResponse)||[])},[i]),React.useEffect(()=>{var t;if(L&&u){const a=(t=reducer.getStepConfig(L,u))==null?void 0:t.config;P(index$1.jsonParser(a))}},[L,u]),React__default.default.createElement(es.Layout,{className:LLMViewCls},!(r==null?void 0:r.valid)&&React__default.default.createElement(index$2,{message:T("InvalidQuestionAndSkip")}),q==null?void 0:q({}),React__default.default.createElement("div",{className:`${LLMViewCls}-question`},_===!0&&React__default.default.createElement(index$3,{tips:I}),React__default.default.createElement(index$4.default,{hoverKey:A,question:D,answerList:R,modelAPIResponse:j,setModelAPIResponse:g,checkMode:m,annotation:x,LLMConfig:e})))},mapStateToProps=n=>({annotation:n.annotation});var LLMToolView$1=reactRedux.connect(mapStateToProps,null,null,{context:ctx.LabelBeeContext})(LLMToolView);module.exports=LLMToolView$1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var React=require("react"),antd=require("antd"),index=require("../../../../../constant/index.js"),classNames=require("classnames");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames);const LLMViewCls=`${index.prefix}-LLMView`,AudioPlayer=React__default.default.memo(({url:e})=>React__default.default.createElement("audio",{controls:!0},React__default.default.createElement("source",{src:e,type:"audio/mpeg"}))),AudioView=e=>{const{answerList:a,hoverKey:l}=e;return React__default.default.createElement("div",null,(a==null?void 0:a.length)>0&&a.map((t,r)=>React__default.default.createElement("div",{key:r,className:classNames__default.default({[`${LLMViewCls}__content`]:!0,[`${LLMViewCls}__contentActive`]:l===(t==null?void 0:t.order)})},React__default.default.createElement(antd.Tag,{className:`${LLMViewCls}-tag`},t==null?void 0:t.order),React__default.default.createElement("div",null,React__default.default.createElement(AudioPlayer,{key:t==null?void 0:t.url,url:t==null?void 0:t.url})))))};module.exports=AudioView;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactI18next=require("react-i18next"),reResizable=require("re-resizable"),antd=require("antd"),index=require("../../../../../constant/index.js"),icons=require("@ant-design/icons"),index$1=require("../../../../markdownView/index.js"),_=require("lodash"),lbUtils=require("@labelbee/lb-utils"),imgFail_cn=require("../../../../../assets/annotation/LLMTool/imgFail_cn.svg.js"),imgFail_en=require("../../../../../assets/annotation/LLMTool/imgFail_en.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LLMViewCls=`${index.prefix}-LLMView`,RenderQuestion=({question:e,dataFormatType:r,isImg:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),reactI18next=require("react-i18next"),reResizable=require("re-resizable"),antd=require("antd"),index=require("../../../../../constant/index.js"),icons=require("@ant-design/icons"),index$1=require("../../../../markdownView/index.js"),_=require("lodash"),lbUtils=require("@labelbee/lb-utils"),imgFail_cn=require("../../../../../assets/annotation/LLMTool/imgFail_cn.svg.js"),imgFail_en=require("../../../../../assets/annotation/LLMTool/imgFail_en.svg.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React);const LLMViewCls=`${index.prefix}-LLMView`,RenderQuestion=({question:e,dataFormatType:r,isImg:a,isAudio:l})=>{const n=_.isString(e)?e:"",i=lbUtils.i18n.language==="en"?imgFail_en:imgFail_cn;if(a){const t=_.isObject(e)?e==null?void 0:e.url:"";return React__default.default.createElement(antd.Image,{src:t||i,fallback:i})}if(l){const t=_.isObject(e)?e==null?void 0:e.url:"";return t?React__default.default.createElement("audio",{controls:!0},React__default.default.createElement("source",{src:t,type:"audio/mpeg"})):React__default.default.createElement(antd.Empty,{image:antd.Empty.PRESENTED_IMAGE_SIMPLE})}return React__default.default.createElement("div",{style:{whiteSpace:"pre-wrap"}},r===index.EDataFormatType.Markdown?React__default.default.createElement(index$1,{value:n}):n)},Header=e=>{const{question:r,dataFormatType:a,setDataFormatType:l,isImg:n,isAudio:i}=e,t=300,{t:o}=reactI18next.useTranslation();return React__default.default.createElement(reResizable.Resizable,{defaultSize:{width:"100%",height:t},minHeight:t,enable:{bottom:!0},style:{padding:"26px 32px",borderBottom:"1px solid #EBEBEB",overflow:"hidden"}},React__default.default.createElement("div",{className:`${LLMViewCls}__title`,style:{display:"flex",justifyContent:"space-between"}},o("Title"),React__default.default.createElement(ToggleDataFormatType,{dataFormatType:a,setDataFormatType:l})),React__default.default.createElement("div",{className:`${LLMViewCls}__headerContent`},React__default.default.createElement(RenderQuestion,{question:r,dataFormatType:a,isImg:n,isAudio:i})))},ToggleDataFormatType=e=>{const{dataFormatType:r,setDataFormatType:a}=e;return React__default.default.createElement("span",{style:{display:"flex"}},React__default.default.createElement(antd.Radio.Group,{value:r,onChange:l=>{a(l.target.value)}},React__default.default.createElement(antd.Radio.Button,{value:index.EDataFormatType.Default,style:{textAlign:"center",width:"52px"}},"</>"),React__default.default.createElement(antd.Radio.Button,{value:index.EDataFormatType.Markdown,style:{textAlign:"center",width:"52px"}},React__default.default.createElement(icons.FileTextOutlined,null))),React__default.default.createElement("span",{style:{marginLeft:"8px",width:"4px",background:"#1890ff"}}))};exports.RenderQuestion=RenderQuestion,exports.ToggleDataFormatType=ToggleDataFormatType,exports.default=Header;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),index=require("../../../constant/index.js"),classNames=require("classnames"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var React=require("react"),antd=require("antd"),index=require("../../../constant/index.js"),classNames=require("classnames"),reactI18next=require("react-i18next"),lbUtils=require("@labelbee/lb-utils"),index$3=require("../../markdownView/index.js"),index$1=require("../modelAPIView/index.js"),index$4=require("../../diffMatchPatchComponent/index.js"),index$2=require("./components/header/index.js"),index$6=require("./components/imgView/index.js"),_=require("lodash"),index$5=require("./components/audioView/index.js");function _interopDefaultLegacy(e){return e&&typeof e=="object"&&"default"in e?e:{default:e}}var React__default=_interopDefaultLegacy(React),classNames__default=_interopDefaultLegacy(classNames),__defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,t,r)=>t in e?__defProp(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,__spreadValues=(e,t)=>{for(var r in t||(t={}))__hasOwnProp.call(t,r)&&__defNormalProp(e,r,t[r]);if(__getOwnPropSymbols)for(var r of __getOwnPropSymbols(t))__propIsEnum.call(t,r)&&__defNormalProp(e,r,t[r]);return e};const LLMViewCls=`${index.prefix}-LLMView`,RenderAnswer=({i:e,dataFormatType:t,isTextControl:r})=>{var l;return t===index.EDataFormatType.Markdown?React__default.default.createElement(index$3,{value:(l=e==null?void 0:e.newAnswer)!=null?l:e==null?void 0:e.answer}):r?React__default.default.createElement("div",{style:{width:"100%",overflowWrap:"break-word"}},React__default.default.createElement(index$4,{originString:e==null?void 0:e.answer,currentString:e==null?void 0:e.newAnswer})):React__default.default.createElement("div",{style:{whiteSpace:"pre-wrap",overflowWrap:"break-word"}},(e==null?void 0:e.newAnswer)||(e==null?void 0:e.answer))},getTextControlByConfig=(e,t)=>{var r;return(t==null?void 0:t.isTextEdit)?!!((r=((t==null?void 0:t.textEdit)||[]).filter(o=>(o==null?void 0:o.title)===e.order)[0])==null?void 0:r.textControl):!1},QuestionView=e=>{var t,r,l,o;const{hoverKey:i,answerList:s,question:d,lang:c,modelAPIResponse:v,setModelAPIResponse:f,checkMode:p=!0,LLMConfig:a,answerHeaderSlot:m}=e,[u,w]=React.useState(index.EDataFormatType.Default),x=((t=a==null?void 0:a.dataType)==null?void 0:t.prompt)===index.ELLMDataType.Picture,E=((r=a==null?void 0:a.dataType)==null?void 0:r.response)===index.ELLMDataType.Picture,y=((l=a==null?void 0:a.dataType)==null?void 0:l.prompt)===index.ELLMDataType.Audio,g=((o=a==null?void 0:a.dataType)==null?void 0:o.response)===index.ELLMDataType.Audio,{t:T}=reactI18next.useTranslation();React.useEffect(()=>{var n;c&&((n=lbUtils.i18n)==null||n.changeLanguage(c))},[]);const q=React__default.default.createElement("div",null,s.map((n,P)=>{const I=getTextControlByConfig(n,a);return React__default.default.createElement("div",{className:classNames__default.default({[`${LLMViewCls}__content`]:!0,[`${LLMViewCls}__contentActive`]:i===(n==null?void 0:n.order)}),key:P},React__default.default.createElement(antd.Tag,{className:`${LLMViewCls}-tag`},n==null?void 0:n.order),React__default.default.createElement(RenderAnswer,{i:n,isTextControl:I,dataFormatType:u}))}),_.isString(d)&&React__default.default.createElement(index$1,{dataFormatType:u,modelAPIResponse:v,question:d,setModelAPIResponse:f,checkMode:p,annotation:e.annotation})),A=()=>g?React__default.default.createElement(index$5,{hoverKey:i,answerList:s}):E?React__default.default.createElement(index$6,{hoverKey:i,answerList:s}):q;return React__default.default.createElement("div",{className:LLMViewCls},React__default.default.createElement(index$2.default,{question:d,dataFormatType:u,setDataFormatType:w,isImg:x,isAudio:y}),React__default.default.createElement("div",{className:`${LLMViewCls}__textBox`},React__default.default.createElement("div",{className:`${LLMViewCls}__title`},T("Answer")," ",m),A()))},WrapQuestionView=e=>React__default.default.createElement(reactI18next.I18nextProvider,{i18n:lbUtils.i18n},React__default.default.createElement(QuestionView,__spreadValues({},e)));exports.LLMViewCls=LLMViewCls,exports.RenderAnswer=RenderAnswer,exports.default=WrapQuestionView,exports.getTextControlByConfig=getTextControlByConfig;
|
package/dist/constant/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EStepType=void 0,function(o){o[o.Check=0]="Check",o[o.ANNOTATION=1]="ANNOTATION",o[o.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",o[o.PRE_ANNOTATION=3]="PRE_ANNOTATION",o[o.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"}(exports.EStepType||(exports.EStepType={})),exports.ESubmitType=void 0,function(o){o[o.Backward=1]="Backward",o[o.Forward=2]="Forward",o[o.Jump=3]="Jump",o[o.Quit=4]="Quit",o[o.Export=5]="Export",o[o.StepChanged=6]="StepChanged",o[o.Save=7]="Save",o[o.BatchUpdateTrackID=8]="BatchUpdateTrackID",o[o.BatchUpdateImgList=9]="BatchUpdateImgList",o[o.SyncImgList=10001]="SyncImgList",o[o.SyncCurrentPageData=10002]="SyncCurrentPageData"}(exports.ESubmitType||(exports.ESubmitType={}));const prefix="bee",componentCls=`${prefix}-component`;exports.EDataFormatType=void 0,function(o){o.Default="default",o.Markdown="markdown"}(exports.EDataFormatType||(exports.EDataFormatType={})),exports.ELLMDataType=void 0,function(o){o.Picture="picture",o.Text="text",o.None="none"}(exports.ELLMDataType||(exports.ELLMDataType={})),exports.componentCls=componentCls,exports.prefix=prefix;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.EStepType=void 0,function(o){o[o.Check=0]="Check",o[o.ANNOTATION=1]="ANNOTATION",o[o.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",o[o.PRE_ANNOTATION=3]="PRE_ANNOTATION",o[o.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"}(exports.EStepType||(exports.EStepType={})),exports.ESubmitType=void 0,function(o){o[o.Backward=1]="Backward",o[o.Forward=2]="Forward",o[o.Jump=3]="Jump",o[o.Quit=4]="Quit",o[o.Export=5]="Export",o[o.StepChanged=6]="StepChanged",o[o.Save=7]="Save",o[o.BatchUpdateTrackID=8]="BatchUpdateTrackID",o[o.BatchUpdateImgList=9]="BatchUpdateImgList",o[o.SyncImgList=10001]="SyncImgList",o[o.SyncCurrentPageData=10002]="SyncCurrentPageData"}(exports.ESubmitType||(exports.ESubmitType={}));const prefix="bee",componentCls=`${prefix}-component`;exports.EDataFormatType=void 0,function(o){o.Default="default",o.Markdown="markdown"}(exports.EDataFormatType||(exports.EDataFormatType={})),exports.ELLMDataType=void 0,function(o){o.Picture="picture",o.Text="text",o.None="none",o.Audio="audio"}(exports.ELLMDataType||(exports.ELLMDataType={})),exports.componentCls=componentCls,exports.prefix=prefix;
|
|
@@ -10,6 +10,8 @@ interface IDialogViewProps {
|
|
|
10
10
|
answerIsImg: boolean;
|
|
11
11
|
questionIsImg: boolean;
|
|
12
12
|
LLMConfig?: ILLMMultiWheelToolConfig;
|
|
13
|
+
answerIsAudio?: boolean;
|
|
14
|
+
questionIsAudio?: boolean;
|
|
13
15
|
}
|
|
14
16
|
declare const DialogView: (props: IDialogViewProps) => React.JSX.Element;
|
|
15
17
|
export default DialogView;
|
|
@@ -13,6 +13,8 @@ interface ILLMMultiWheelSourceViewProps {
|
|
|
13
13
|
LLMConfig?: ILLMMultiWheelToolConfig;
|
|
14
14
|
dialogList: any[];
|
|
15
15
|
lang?: string;
|
|
16
|
+
questionIsAudio?: boolean;
|
|
17
|
+
answerIsAudio?: boolean;
|
|
16
18
|
}
|
|
17
19
|
export declare const LLMMultiWheelSourceView: React.FC<ILLMMultiWheelSourceViewProps>;
|
|
18
20
|
declare const _default: import("react-redux").ConnectedComponent<React.FC<IProps>, import("react-redux").Omit<IProps & {
|
|
@@ -11,8 +11,9 @@ interface IProps {
|
|
|
11
11
|
dataFormatType: EDataFormatType;
|
|
12
12
|
setDataFormatType: (v: EDataFormatType) => void;
|
|
13
13
|
isImg?: boolean;
|
|
14
|
+
isAudio?: boolean;
|
|
14
15
|
}
|
|
15
|
-
export declare const RenderQuestion: ({ question, dataFormatType, isImg, }: {
|
|
16
|
+
export declare const RenderQuestion: ({ question, dataFormatType, isImg, isAudio, }: {
|
|
16
17
|
question: string | {
|
|
17
18
|
id: number;
|
|
18
19
|
path: string;
|
|
@@ -22,6 +23,7 @@ export declare const RenderQuestion: ({ question, dataFormatType, isImg, }: {
|
|
|
22
23
|
};
|
|
23
24
|
dataFormatType: EDataFormatType;
|
|
24
25
|
isImg?: boolean | undefined;
|
|
26
|
+
isAudio?: boolean | undefined;
|
|
25
27
|
}) => React.JSX.Element;
|
|
26
28
|
declare const Header: (props: IProps) => React.JSX.Element;
|
|
27
29
|
export declare const ToggleDataFormatType: (props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getTextControlByConfig as
|
|
1
|
+
import{getTextControlByConfig as x,RenderAnswer as A}from"../../LLMToolView/questionView/index.js";import N from"../../LLMToolView/questionView/components/audioView/index.js";import{RenderQuestion as M}from"../../LLMToolView/questionView/components/header/index.js";import T from"../../LLMToolView/questionView/components/imgView/index.js";import h from"../../../store/LLMMultiWheel/index.js";import{classnames as q}from"../../../utils/index.js";import{Button as a}from"antd";import e from"react";import{useTranslation as F}from"react-i18next";var D=Object.defineProperty,C=Object.defineProperties,S=Object.getOwnPropertyDescriptors,d=Object.getOwnPropertySymbols,b=Object.prototype.hasOwnProperty,R=Object.prototype.propertyIsEnumerable,p=(n,t,r)=>t in n?D(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,B=(n,t)=>{for(var r in t||(t={}))b.call(t,r)&&p(n,r,t[r]);if(d)for(var r of d(t))R.call(t,r)&&p(n,r,t[r]);return n},W=(n,t)=>C(n,S(t));const $=n=>{const{id:t,answerList:r,question:u,index:w,name:f="",answerIsImg:E,questionIsImg:g,questionIsAudio:v,answerIsAudio:_,LLMConfig:y}=n,{t:o}=F(),{dataFormatType:s,selectedID:L,setSelectedID:V}=h(),i=w+1,O=f||`${o("Dialog")}${i}`,I=()=>E?e.createElement(e.Fragment,null,e.createElement(a,{type:"primary"},o("Answer")),e.createElement(T,{answerList:r})):_?e.createElement(e.Fragment,null,e.createElement(a,{type:"primary"},o("Answer")),e.createElement(N,{answerList:r})):r==null?void 0:r.map((P,l)=>{const m=l+1,c=W(B({},P),{order:m}),j=x(c,y);return e.createElement("div",{key:l},e.createElement(a,{type:"primary"},o("Answer"),m),e.createElement(A,{i:c,isTextControl:j,dataFormatType:s}))});return e.createElement("div",{key:t,onClick:()=>V(t),className:q({dialog:!0,selected:t===L})},e.createElement("div",{className:"header"},e.createElement("span",{className:"order"},i),e.createElement("div",{className:"name"},e.createElement("div",{className:"show-name"},O),e.createElement("div",{className:"tips"},"\uFF08",o("SelectionOfAnnotation"),"\uFF09"))),e.createElement("div",{className:"dialog-question"},e.createElement(a,{type:"primary"},o("Title"),i),e.createElement("div",null,e.createElement(M,{question:u,dataFormatType:s,isImg:g,isAudio:v}))),e.createElement("div",{className:"dialog-answer"},I()))};export{$ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r,{useEffect as x,useState as V}from"react";import{ELLMDataType as I}from"../../constant/index.js";import{getStepConfig as ne}from"../../store/annotation/reducer.js";import{LabelBeeContext as oe}from"../../store/ctx.js";import{jsonParser as re}from"../../utils/index.js";import{connect as ie}from"react-redux";import k from"../../store/LLMMultiWheel/index.js";import{LLMMultiWheelViewCls as R}from"../../views/MainView/LLMMultiWheelLayout/index.js";import{ToggleDataFormatType as ae}from"../LLMToolView/questionView/components/header/index.js";import se from"./dialogView/index.js";import le from"../messageMaskLayer/index.js";import ue from"../../views/MainView/annotationTips/index.js";import{I18nextProvider as de,useTranslation as ce}from"react-i18next";import{LLMViewCls as pe}from"../LLMToolView/questionView/index.js";import{Layout as me}from"antd";import{i18n as U}from"@labelbee/lb-utils";var ve=Object.defineProperty,Le=Object.defineProperties,fe=Object.getOwnPropertyDescriptors,B=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,ge=Object.prototype.propertyIsEnumerable,Q=(t,e,n)=>e in t?ve(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,j=(t,e)=>{for(var n in e||(e={}))we.call(e,n)&&Q(t,n,e[n]);if(B)for(var n of B(e))ge.call(e,n)&&Q(t,n,e[n]);return t},b=(t,e)=>Le(t,fe(e));const z=t=>{const{questionIsImg:e,answerIsImg:n,questionIsAudio:i,answerIsAudio:p,LLMConfig:f,dialogList:l,lang:u="cn"}=t,{dataFormatType:w,setDataFormatType:d}=k();return x(()=>{var c;u&&((c=U)==null||c.changeLanguage(u))},[u]),r.createElement(de,{i18n:U},r.createElement("div",{className:`${R}`},r.createElement("div",{style:{display:"flex",justifyContent:"flex-end",margin:"10px"}},r.createElement(ae,{dataFormatType:w,setDataFormatType:d})),r.createElement("div",{className:`${R}-container`},l==null?void 0:l.map((c,g)=>r.createElement(se,b(j({},c),{key:g,index:g,questionIsImg:e,answerIsImg:n,questionIsAudio:i,answerIsAudio:p,LLMConfig:f}))))))},G=({type:t,questionIndex:e,answerIndex:n,llmFile:i})=>{if(t==="question")return i==null?void 0:i.find((f,l)=>e===l);let p=null;return i==null||i.forEach((f,l)=>{var u;(u=f.answerList)==null||u.forEach((w,d)=>{l===e&&n===d&&(p=w)})}),p},_e=t=>{var e,n,i,p;const{annotation:f,tips:l,showTips:u,drawLayerSlot:w}=t,{imgIndex:d,imgList:c,stepList:g,step:P,toolInstance:_}=f,[a,H]=V(),{setSelectedID:J,newAnswerListMap:q}=k(),[K,D]=V([]),E=((e=a==null?void 0:a.dataType)==null?void 0:e.prompt)===I.Picture,T=((n=a==null?void 0:a.dataType)==null?void 0:n.response)===I.Picture,h=((i=a==null?void 0:a.dataType)==null?void 0:i.prompt)===I.Audio,O=((p=a==null?void 0:a.dataType)==null?void 0:p.response)===I.Audio,{t:X}=ce(),[,Y]=V(0);return x(()=>{var o,m,v;if(!c[d])return;const M=(o=c[d])!=null?o:{},L=(v=(m=M==null?void 0:M.questionList)==null?void 0:m.textList)!=null?v:[];D(L),(L==null?void 0:L.length)&&J(L[0].id)},[d]),x(()=>{var o,m;const v=(o=c[d])!=null?o:{},M=v==null?void 0:v.questionList,L=(m=v==null?void 0:v.llmFile)==null?void 0:m.textList,A=M==null?void 0:M.textList,Z=A==null?void 0:A.map((s,S)=>{var C;return b(j({},s),{question:(E||h)&&G({type:"question",questionIndex:S,llmFile:L})||(s==null?void 0:s.question),answerList:(C=s==null?void 0:s.answerList)==null?void 0:C.map((y,W)=>{var $,F,N;const ee=`${($=s==null?void 0:s.id)!=null?$:""}-${(F=y==null?void 0:y.id)!=null?F:""}`,te=T||O?G({type:"answer",questionIndex:S,answerIndex:W,llmFile:L})||{}:{};return j(b(j({},y),{answer:y.answer,newAnswer:(N=q[ee])!=null?N:y.answer,order:W+1}),te)})})});D(Z)},[q,E,h,T]),x(()=>{var o;if(g&&P){const m=(o=ne(g,P))==null?void 0:o.config;H(re(m))}},[g,P]),x(()=>{if(_)return _.on("validUpdated",()=>{Y(o=>o+1)}),()=>{_.unbindAll("validUpdated")}},[_]),r.createElement(me,{className:pe},!(_==null?void 0:_.valid)&&r.createElement(le,{message:X("InvalidQuestionAndSkip")}),w==null?void 0:w({}),u===!0&&r.createElement(ue,{tips:l}),r.createElement(z,{questionIsImg:E,answerIsImg:T,questionIsAudio:h,answerIsAudio:O,LLMConfig:a,dialogList:K}))},Me=t=>({annotation:t.annotation});var ye=ie(Me,null,null,{context:oe})(_e);export{z as LLMMultiWheelSourceView,ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import u,{useContext as W,useState as L,useEffect as d}from"react";import{connect as z}from"react-redux";import{LabelBeeContext as G,LLMContext as H}from"../../store/ctx.js";import{message as J}from"antd";import{ELLMDataType as r,prefix as O}from"../../constant/index.js";import{Layout as X}from"antd/es";import Y from"./questionView/index.js";import{useTranslation as Z}from"react-i18next";import ee from"../../views/MainView/annotationTips/index.js";import{getCurrentResultFromResultList as te}from"./utils/data.js";import{getStepConfig as ne}from"../../store/annotation/reducer.js";import{jsonParser as oe}from"../../utils/index.js";import ie from"../messageMaskLayer/index.js";const E=`${O}-LLMView`,se=g=>{var x;const{annotation:M,checkMode:T=!0,tips:R,showTips:P,drawLayerSlot:I}=g,{imgIndex:n,imgList:s,stepList:w,step:c,toolInstance:l}=M,{hoverKey:V,modelAPIResponse:h,setModelAPIResponse:_,newAnswerList:m}=W(H),[S,k]=L([]),[Q,b]=L(""),[e,D]=L(),{t:y}=Z(),[,F]=L(0);return d(()=>{let t;if(!T)return t=setInterval(()=>{J.info(y("EfficientListening"))},1e3*60),()=>{t&&clearInterval(t)}},[]),d(()=>{if(l)return l.on("validUpdated",()=>{F(t=>t+1)}),()=>{l.unbindAll("validUpdated")}},[l]),d(()=>{var t,o,i,a,A,j,q,C;if(!s[n])return;const N=((t=e==null?void 0:e.dataType)==null?void 0:t.prompt)===r.Picture,$=((o=e==null?void 0:e.dataType)==null?void 0:o.prompt)===r.Audio,U=((i=e==null?void 0:e.dataType)==null?void 0:i.response)===r.Picture,B=((a=e==null?void 0:e.dataType)==null?void 0:a.response)===r.Audio,p=(A=s[n])==null?void 0:A.questionList,v=(j=s[n])==null?void 0:j.llmFile,K=N||$?v==null?void 0:v.question:p==null?void 0:p.question;b(K);let f=(p==null?void 0:p.answerList)||[];(U||B)&&(f=(v==null?void 0:v.answerList)||[]),((q=e==null?void 0:e.dataType)==null?void 0:q.response)===r.None&&(f=[]),((C=e==null?void 0:e.dataType)==null?void 0:C.response)===r.Text&&(m==null?void 0:m.length)>0&&(f=m),k(f)},[n,m,e,(x=s[n])==null?void 0:x.id]),d(()=>{var t;if(!s[n])return;const o=(t=s[n])!=null?t:{},i=te(o==null?void 0:o.result,c),a=(i==null?void 0:i.length)>0?i[0]:i;_((a==null?void 0:a.modelAPIResponse)||[])},[n]),d(()=>{var t;if(w&&c){const o=(t=ne(w,c))==null?void 0:t.config;D(oe(o))}},[w,c]),u.createElement(X,{className:E},!(l==null?void 0:l.valid)&&u.createElement(ie,{message:y("InvalidQuestionAndSkip")}),I==null?void 0:I({}),u.createElement("div",{className:`${E}-question`},P===!0&&u.createElement(ee,{tips:R}),u.createElement(Y,{hoverKey:V,question:Q,answerList:S,modelAPIResponse:h,setModelAPIResponse:_,checkMode:T,annotation:M,LLMConfig:e})))},le=g=>({annotation:g.annotation});var re=z(le,null,null,{context:G})(se);export{re as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"react";import{Tag as c}from"antd";import{prefix as m}from"../../../../../constant/index.js";import s from"classnames";const n=`${m}-LLMView`,u=t.memo(({url:r})=>t.createElement("audio",{controls:!0},t.createElement("source",{src:r,type:"audio/mpeg"}))),d=r=>{const{answerList:l,hoverKey:o}=r;return t.createElement("div",null,(l==null?void 0:l.length)>0&&l.map((e,a)=>t.createElement("div",{key:a,className:s({[`${n}__content`]:!0,[`${n}__contentActive`]:o===(e==null?void 0:e.order)})},t.createElement(c,{className:`${n}-tag`},e==null?void 0:e.order),t.createElement("div",null,t.createElement(u,{key:e==null?void 0:e.url,url:e==null?void 0:e.url})))))};export{d as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"react";import{useTranslation as
|
|
1
|
+
import e from"react";import{useTranslation as g}from"react-i18next";import{Resizable as x}from"re-resizable";import{Radio as m,Image as y,Empty as c}from"antd";import{EDataFormatType as s,prefix as w}from"../../../../../constant/index.js";import{FileTextOutlined as T}from"@ant-design/icons";import v from"../../../../markdownView/index.js";import{isString as b,isObject as d}from"lodash";import{i18n as h}from"@labelbee/lb-utils";import F from"../../../../../assets/annotation/LLMTool/imgFail_cn.svg.js";import L from"../../../../../assets/annotation/LLMTool/imgFail_en.svg.js";const p=`${w}-LLMView`,u=({question:t,dataFormatType:n,isImg:r,isAudio:l})=>{const o=b(t)?t:"",i=h.language==="en"?L:F;if(r){const a=d(t)?t==null?void 0:t.url:"";return e.createElement(y,{src:a||i,fallback:i})}if(l){const a=d(t)?t==null?void 0:t.url:"";return a?e.createElement("audio",{controls:!0},e.createElement("source",{src:a,type:"audio/mpeg"})):e.createElement(c,{image:c.PRESENTED_IMAGE_SIMPLE})}return e.createElement("div",{style:{whiteSpace:"pre-wrap"}},n===s.Markdown?e.createElement(v,{value:o}):o)},_=t=>{const{question:n,dataFormatType:r,setDataFormatType:l,isImg:o,isAudio:i}=t,a=300,{t:f}=g();return e.createElement(x,{defaultSize:{width:"100%",height:a},minHeight:a,enable:{bottom:!0},style:{padding:"26px 32px",borderBottom:"1px solid #EBEBEB",overflow:"hidden"}},e.createElement("div",{className:`${p}__title`,style:{display:"flex",justifyContent:"space-between"}},f("Title"),e.createElement(E,{dataFormatType:r,setDataFormatType:l})),e.createElement("div",{className:`${p}__headerContent`},e.createElement(u,{question:n,dataFormatType:r,isImg:o,isAudio:i})))},E=t=>{const{dataFormatType:n,setDataFormatType:r}=t;return e.createElement("span",{style:{display:"flex"}},e.createElement(m.Group,{value:n,onChange:l=>{r(l.target.value)}},e.createElement(m.Button,{value:s.Default,style:{textAlign:"center",width:"52px"}},"</>"),e.createElement(m.Button,{value:s.Markdown,style:{textAlign:"center",width:"52px"}},e.createElement(T,null))),e.createElement("span",{style:{marginLeft:"8px",width:"4px",background:"#1890ff"}}))};export{u as RenderQuestion,E as ToggleDataFormatType,_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import n,{useState as
|
|
1
|
+
import n,{useState as $,useEffect as k}from"react";import{Tag as D}from"antd";import{prefix as L,EDataFormatType as w,ELLMDataType as d}from"../../../constant/index.js";import R from"classnames";import{I18nextProvider as q,useTranslation as F}from"react-i18next";import{i18n as f}from"@labelbee/lb-utils";import W from"../../markdownView/index.js";import B from"../modelAPIView/index.js";import H from"../../diffMatchPatchComponent/index.js";import Q from"./components/header/index.js";import K from"./components/imgView/index.js";import{isString as z}from"lodash";import G from"./components/audioView/index.js";var J=Object.defineProperty,_=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,X=Object.prototype.propertyIsEnumerable,E=(e,t,r)=>t in e?J(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y=(e,t)=>{for(var r in t||(t={}))U.call(t,r)&&E(e,r,t[r]);if(_)for(var r of _(t))X.call(t,r)&&E(e,r,t[r]);return e};const l=`${L}-LLMView`,x=({i:e,dataFormatType:t,isTextControl:r})=>{var i;return t===w.Markdown?n.createElement(W,{value:(i=e==null?void 0:e.newAnswer)!=null?i:e==null?void 0:e.answer}):r?n.createElement("div",{style:{width:"100%",overflowWrap:"break-word"}},n.createElement(H,{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))},y=(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,i,s;const{hoverKey:m,answerList:c,question:u,lang:v,modelAPIResponse:g,setModelAPIResponse:A,checkMode:P=!0,LLMConfig:o,answerHeaderSlot:I}=e,[p,h]=$(w.Default),T=((t=o==null?void 0:o.dataType)==null?void 0:t.prompt)===d.Picture,V=((r=o==null?void 0:o.dataType)==null?void 0:r.response)===d.Picture,j=((i=o==null?void 0:o.dataType)==null?void 0:i.prompt)===d.Audio,b=((s=o==null?void 0:o.dataType)==null?void 0:s.response)===d.Audio,{t:M}=F();k(()=>{var a;v&&((a=f)==null||a.changeLanguage(v))},[]);const O=n.createElement("div",null,c.map((a,N)=>{const C=y(a,o);return n.createElement("div",{className:R({[`${l}__content`]:!0,[`${l}__contentActive`]:m===(a==null?void 0:a.order)}),key:N},n.createElement(D,{className:`${l}-tag`},a==null?void 0:a.order),n.createElement(x,{i:a,isTextControl:C,dataFormatType:p}))}),z(u)&&n.createElement(B,{dataFormatType:p,modelAPIResponse:g,question:u,setModelAPIResponse:A,checkMode:P,annotation:e.annotation})),S=()=>b?n.createElement(G,{hoverKey:m,answerList:c}):V?n.createElement(K,{hoverKey:m,answerList:c}):O;return n.createElement("div",{className:l},n.createElement(Q,{question:u,dataFormatType:p,setDataFormatType:h,isImg:T,isAudio:j}),n.createElement("div",{className:`${l}__textBox`},n.createElement("div",{className:`${l}__title`},M("Answer")," ",I),S()))},ee=e=>n.createElement(q,{i18n:f},n.createElement(Z,Y({},e)));export{l as LLMViewCls,x as RenderAnswer,ee as default,y as getTextControlByConfig};
|
package/es/constant/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var n;(function(a){a[a.Check=0]="Check",a[a.ANNOTATION=1]="ANNOTATION",a[a.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",a[a.PRE_ANNOTATION=3]="PRE_ANNOTATION",a[a.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"})(n||(n={}));var c;(function(a){a[a.Backward=1]="Backward",a[a.Forward=2]="Forward",a[a.Jump=3]="Jump",a[a.Quit=4]="Quit",a[a.Export=5]="Export",a[a.StepChanged=6]="StepChanged",a[a.Save=7]="Save",a[a.BatchUpdateTrackID=8]="BatchUpdateTrackID",a[a.BatchUpdateImgList=9]="BatchUpdateImgList",a[a.SyncImgList=10001]="SyncImgList",a[a.SyncCurrentPageData=10002]="SyncCurrentPageData"})(c||(c={}));const
|
|
1
|
+
var n;(function(a){a[a.Check=0]="Check",a[a.ANNOTATION=1]="ANNOTATION",a[a.QUALITY_INSPECTION=2]="QUALITY_INSPECTION",a[a.PRE_ANNOTATION=3]="PRE_ANNOTATION",a[a.MANUAL_CORRECTION=4]="MANUAL_CORRECTION"})(n||(n={}));var c;(function(a){a[a.Backward=1]="Backward",a[a.Forward=2]="Forward",a[a.Jump=3]="Jump",a[a.Quit=4]="Quit",a[a.Export=5]="Export",a[a.StepChanged=6]="StepChanged",a[a.Save=7]="Save",a[a.BatchUpdateTrackID=8]="BatchUpdateTrackID",a[a.BatchUpdateImgList=9]="BatchUpdateImgList",a[a.SyncImgList=10001]="SyncImgList",a[a.SyncCurrentPageData=10002]="SyncCurrentPageData"})(c||(c={}));const N="bee",I=`${N}-component`;var r;(function(a){a.Default="default",a.Markdown="markdown"})(r||(r={}));var o;(function(a){a.Picture="picture",a.Text="text",a.None="none",a.Audio="audio"})(o||(o={}));export{r as EDataFormatType,o as ELLMDataType,n as EStepType,c as ESubmitType,I as componentCls,N as prefix};
|