xinference 0.7.5__py3-none-any.whl → 0.8.1__py3-none-any.whl

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.

Potentially problematic release.


This version of xinference might be problematic. Click here for more details.

Files changed (120) hide show
  1. xinference/_version.py +3 -3
  2. xinference/api/oauth2/__init__.py +13 -0
  3. xinference/api/oauth2/common.py +14 -0
  4. xinference/api/oauth2/core.py +93 -0
  5. xinference/api/oauth2/types.py +36 -0
  6. xinference/api/oauth2/utils.py +44 -0
  7. xinference/api/restful_api.py +216 -27
  8. xinference/client/oscar/actor_client.py +18 -18
  9. xinference/client/restful/restful_client.py +96 -33
  10. xinference/conftest.py +63 -1
  11. xinference/constants.py +1 -0
  12. xinference/core/chat_interface.py +143 -3
  13. xinference/core/metrics.py +83 -0
  14. xinference/core/model.py +244 -181
  15. xinference/core/status_guard.py +86 -0
  16. xinference/core/supervisor.py +57 -7
  17. xinference/core/worker.py +134 -13
  18. xinference/deploy/cmdline.py +142 -16
  19. xinference/deploy/local.py +39 -7
  20. xinference/deploy/supervisor.py +2 -0
  21. xinference/deploy/worker.py +33 -5
  22. xinference/fields.py +4 -1
  23. xinference/model/core.py +8 -1
  24. xinference/model/embedding/core.py +3 -2
  25. xinference/model/embedding/model_spec_modelscope.json +60 -18
  26. xinference/model/image/stable_diffusion/core.py +4 -3
  27. xinference/model/llm/__init__.py +7 -0
  28. xinference/model/llm/ggml/llamacpp.py +3 -2
  29. xinference/model/llm/llm_family.json +87 -3
  30. xinference/model/llm/llm_family.py +15 -5
  31. xinference/model/llm/llm_family_modelscope.json +92 -3
  32. xinference/model/llm/pytorch/chatglm.py +70 -28
  33. xinference/model/llm/pytorch/core.py +11 -30
  34. xinference/model/llm/pytorch/internlm2.py +155 -0
  35. xinference/model/llm/pytorch/utils.py +0 -153
  36. xinference/model/llm/utils.py +37 -8
  37. xinference/model/llm/vllm/core.py +15 -3
  38. xinference/model/multimodal/__init__.py +15 -8
  39. xinference/model/multimodal/core.py +8 -1
  40. xinference/model/multimodal/model_spec.json +9 -0
  41. xinference/model/multimodal/model_spec_modelscope.json +45 -0
  42. xinference/model/multimodal/qwen_vl.py +5 -9
  43. xinference/model/utils.py +7 -2
  44. xinference/types.py +2 -0
  45. xinference/web/ui/build/asset-manifest.json +3 -3
  46. xinference/web/ui/build/index.html +1 -1
  47. xinference/web/ui/build/static/js/main.b83095c2.js +3 -0
  48. xinference/web/ui/build/static/js/{main.236e72e7.js.LICENSE.txt → main.b83095c2.js.LICENSE.txt} +7 -0
  49. xinference/web/ui/build/static/js/main.b83095c2.js.map +1 -0
  50. xinference/web/ui/node_modules/.cache/babel-loader/0a853b2fa1902551e262a2f1a4b7894341f27b3dd9587f2ef7aaea195af89518.json +1 -0
  51. xinference/web/ui/node_modules/.cache/babel-loader/101923c539819f26ad11fbcbd6f6e56436b285efbb090dcc7dd648c6e924c4a8.json +1 -0
  52. xinference/web/ui/node_modules/.cache/babel-loader/193e7ba39e70d4bb2895a5cb317f6f293a5fd02e7e324c02a1eba2f83216419c.json +1 -0
  53. xinference/web/ui/node_modules/.cache/babel-loader/22858de5265f2d279fca9f2f54dfb147e4b2704200dfb5d2ad3ec9769417328f.json +1 -0
  54. xinference/web/ui/node_modules/.cache/babel-loader/27696db5fcd4fcf0e7974cadf1e4a2ab89690474045c3188eafd586323ad13bb.json +1 -0
  55. xinference/web/ui/node_modules/.cache/babel-loader/27bcada3ee8f89d21184b359f022fc965f350ffaca52c9814c29f1fc37121173.json +1 -0
  56. xinference/web/ui/node_modules/.cache/babel-loader/27bdbe25deab8cf08f7fab8f05f8f26cf84a98809527a37986a4ab73a57ba96a.json +1 -0
  57. xinference/web/ui/node_modules/.cache/babel-loader/2bee7b8bd3d52976a45d6068e1333df88b943e0e679403c809e45382e3818037.json +1 -0
  58. xinference/web/ui/node_modules/.cache/babel-loader/30670751f55508ef3b861e13dd71b9e5a10d2561373357a12fc3831a0b77fd93.json +1 -0
  59. xinference/web/ui/node_modules/.cache/babel-loader/3605cd3a96ff2a3b443c70a101575482279ad26847924cab0684d165ba0d2492.json +1 -0
  60. xinference/web/ui/node_modules/.cache/babel-loader/3789ef437d3ecbf945bb9cea39093d1f16ebbfa32dbe6daf35abcfb6d48de6f1.json +1 -0
  61. xinference/web/ui/node_modules/.cache/babel-loader/4942da6bc03bf7373af068e22f916341aabc5b5df855d73c1d348c696724ce37.json +1 -0
  62. xinference/web/ui/node_modules/.cache/babel-loader/4d933e35e0fe79867d3aa6c46db28804804efddf5490347cb6c2c2879762a157.json +1 -0
  63. xinference/web/ui/node_modules/.cache/babel-loader/4d96f071168af43965e0fab2ded658fa0a15b8d9ca03789a5ef9c5c16a4e3cee.json +1 -0
  64. xinference/web/ui/node_modules/.cache/babel-loader/4fd24800544873512b540544ae54601240a5bfefd9105ff647855c64f8ad828f.json +1 -0
  65. xinference/web/ui/node_modules/.cache/babel-loader/52a6136cb2dbbf9c51d461724d9b283ebe74a73fb19d5df7ba8e13c42bd7174d.json +1 -0
  66. xinference/web/ui/node_modules/.cache/babel-loader/5c408307c982f07f9c09c85c98212d1b1c22548a9194c69548750a3016b91b88.json +1 -0
  67. xinference/web/ui/node_modules/.cache/babel-loader/663adbcb60b942e9cf094c8d9fabe57517f5e5e6e722d28b4948a40b7445a3b8.json +1 -0
  68. xinference/web/ui/node_modules/.cache/babel-loader/666bb2e1b250dc731311a7e4880886177885dfa768508d2ed63e02630cc78725.json +1 -0
  69. xinference/web/ui/node_modules/.cache/babel-loader/71493aadd34d568fbe605cacaba220aa69bd09273251ee4ba27930f8d01fccd8.json +1 -0
  70. xinference/web/ui/node_modules/.cache/babel-loader/8b071db2a5a9ef68dc14d5f606540bd23d9785e365a11997c510656764d2dccf.json +1 -0
  71. xinference/web/ui/node_modules/.cache/babel-loader/8b246d79cd3f6fc78f11777e6a6acca6a2c5d4ecce7f2dd4dcf9a48126440d3c.json +1 -0
  72. xinference/web/ui/node_modules/.cache/babel-loader/8d33354bd2100c8602afc3341f131a88cc36aaeecd5a4b365ed038514708e350.json +1 -0
  73. xinference/web/ui/node_modules/.cache/babel-loader/95c8cc049fadd23085d8623e1d43d70b614a4e52217676f186a417dca894aa09.json +1 -0
  74. xinference/web/ui/node_modules/.cache/babel-loader/a4d72d3b806ba061919115f0c513738726872e3c79cf258f007519d3f91d1a16.json +1 -0
  75. xinference/web/ui/node_modules/.cache/babel-loader/a8070ce4b780b4a044218536e158a9e7192a6c80ff593fdc126fee43f46296b5.json +1 -0
  76. xinference/web/ui/node_modules/.cache/babel-loader/b4e4fccaf8f2489a29081f0bf3b191656bd452fb3c8b5e3c6d92d94f680964d5.json +1 -0
  77. xinference/web/ui/node_modules/.cache/babel-loader/b53eb7c7967f6577bd3e678293c44204fb03ffa7fdc1dd59d3099015c68f6f7f.json +1 -0
  78. xinference/web/ui/node_modules/.cache/babel-loader/bd04667474fd9cac2983b03725c218908a6cc0ee9128a5953cd00d26d4877f60.json +1 -0
  79. xinference/web/ui/node_modules/.cache/babel-loader/c230a727b8f68f0e62616a75e14a3d33026dc4164f2e325a9a8072d733850edb.json +1 -0
  80. xinference/web/ui/node_modules/.cache/babel-loader/d06af85a84e5c5a29d3acf2dbb5b30c0cf75c8aec4ab5f975e6096f944ee4324.json +1 -0
  81. xinference/web/ui/node_modules/.cache/babel-loader/d44a6eb6106e09082b691a315c9f6ce17fcfe25beb7547810e0d271ce3301cd2.json +1 -0
  82. xinference/web/ui/node_modules/.cache/babel-loader/d5e150bff31715977d8f537c970f06d4fe3de9909d7e8342244a83a9f6447121.json +1 -0
  83. xinference/web/ui/node_modules/.cache/babel-loader/de36e5c08fd524e341d664883dda6cb1745acc852a4f1b011a35a0b4615f72fa.json +1 -0
  84. xinference/web/ui/node_modules/.cache/babel-loader/f037ffef5992af0892d6d991053c1dace364cd39a3f11f1a41f92776e8a59459.json +1 -0
  85. xinference/web/ui/node_modules/.cache/babel-loader/f23ab356a8603d4a2aaa74388c2f381675c207d37c4d1c832df922e9655c9a6b.json +1 -0
  86. xinference/web/ui/node_modules/.cache/babel-loader/f7c23b0922f4087b9e2e3e46f15c946b772daa46c28c3a12426212ecaf481deb.json +1 -0
  87. xinference/web/ui/node_modules/.cache/babel-loader/f95a8bd358eeb55fa2f49f1224cc2f4f36006359856744ff09ae4bb295f59ec1.json +1 -0
  88. xinference/web/ui/node_modules/.cache/babel-loader/fe5db70859503a54cbe71f9637e5a314cda88b1f0eecb733b6e6f837697db1ef.json +1 -0
  89. xinference/web/ui/node_modules/.package-lock.json +36 -0
  90. xinference/web/ui/node_modules/@types/cookie/package.json +30 -0
  91. xinference/web/ui/node_modules/@types/hoist-non-react-statics/package.json +33 -0
  92. xinference/web/ui/node_modules/react-cookie/package.json +55 -0
  93. xinference/web/ui/node_modules/universal-cookie/package.json +48 -0
  94. xinference/web/ui/package-lock.json +37 -0
  95. xinference/web/ui/package.json +3 -2
  96. {xinference-0.7.5.dist-info → xinference-0.8.1.dist-info}/METADATA +17 -6
  97. {xinference-0.7.5.dist-info → xinference-0.8.1.dist-info}/RECORD +101 -66
  98. xinference/web/ui/build/static/js/main.236e72e7.js +0 -3
  99. xinference/web/ui/build/static/js/main.236e72e7.js.map +0 -1
  100. xinference/web/ui/node_modules/.cache/babel-loader/0cccfbe5d963b8e31eb679f9d9677392839cedd04aa2956ac6b33cf19599d597.json +0 -1
  101. xinference/web/ui/node_modules/.cache/babel-loader/0f3b6cc71b7c83bdc85aa4835927aeb86af2ce0d2ac241917ecfbf90f75c6d27.json +0 -1
  102. xinference/web/ui/node_modules/.cache/babel-loader/2f651cf60b1bde50c0601c7110f77dd44819fb6e2501ff748a631724d91445d4.json +0 -1
  103. xinference/web/ui/node_modules/.cache/babel-loader/42bb623f337ad08ed076484185726e072ca52bb88e373d72c7b052db4c273342.json +0 -1
  104. xinference/web/ui/node_modules/.cache/babel-loader/57af83639c604bd3362d0f03f7505e81c6f67ff77bee7c6bb31f6e5523eba185.json +0 -1
  105. xinference/web/ui/node_modules/.cache/babel-loader/667753ce39ce1d4bcbf9a5f1a103d653be1d19d42f4e1fbaceb9b507679a52c7.json +0 -1
  106. xinference/web/ui/node_modules/.cache/babel-loader/66ed1bd4c06748c1b176a625c25c856997edc787856c73162f82f2b465c5d956.json +0 -1
  107. xinference/web/ui/node_modules/.cache/babel-loader/78f2521da2e2a98b075a2666cb782c7e2c019cd3c72199eecd5901c82d8655df.json +0 -1
  108. xinference/web/ui/node_modules/.cache/babel-loader/8d2b0b3c6988d1894694dcbbe708ef91cfe62d62dac317031f09915ced637953.json +0 -1
  109. xinference/web/ui/node_modules/.cache/babel-loader/9427ae7f1e94ae8dcd2333fb361e381f4054fde07394fe5448658e3417368476.json +0 -1
  110. xinference/web/ui/node_modules/.cache/babel-loader/bcee2b4e76b07620f9087989eb86d43c645ba3c7a74132cf926260af1164af0e.json +0 -1
  111. xinference/web/ui/node_modules/.cache/babel-loader/cc2ddd02ccc1dad1a2737ac247c79e6f6ed2c7836c6b68e511e3048f666b64af.json +0 -1
  112. xinference/web/ui/node_modules/.cache/babel-loader/d2e8e6665a7efc832b43907dadf4e3c896a59eaf8129f9a520882466c8f2e489.json +0 -1
  113. xinference/web/ui/node_modules/.cache/babel-loader/d8a42e9df7157de9f28eecefdf178fd113bf2280d28471b6e32a8a45276042df.json +0 -1
  114. xinference/web/ui/node_modules/.cache/babel-loader/e26750d9556e9741912333349e4da454c53dbfddbfc6002ab49518dcf02af745.json +0 -1
  115. xinference/web/ui/node_modules/.cache/babel-loader/ef42ec014d7bc373b874b2a1ff0dcd785490f125e913698bc049b0bd778e4d66.json +0 -1
  116. xinference/web/ui/node_modules/.cache/babel-loader/fe3eb4d76c79ca98833f686d642224eeeb94cc83ad14300d281623796d087f0a.json +0 -1
  117. {xinference-0.7.5.dist-info → xinference-0.8.1.dist-info}/LICENSE +0 -0
  118. {xinference-0.7.5.dist-info → xinference-0.8.1.dist-info}/WHEEL +0 -0
  119. {xinference-0.7.5.dist-info → xinference-0.8.1.dist-info}/entry_points.txt +0 -0
  120. {xinference-0.7.5.dist-info → xinference-0.8.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _toConsumableArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";import _objectSpread from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import _regeneratorRuntime from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _asyncToGenerator from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{Box,Checkbox,FormControl,FormControlLabel}from'@mui/material';import Alert from'@mui/material/Alert';import AlertTitle from'@mui/material/AlertTitle';import Button from'@mui/material/Button';import TextField from'@mui/material/TextField';import React,{useContext,useState}from'react';import{ApiContext}from'../../components/apiContext';import fetcher from'../../components/fetcher';import{useMode}from'../../theme';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var SUPPORTED_LANGUAGES_DICT={en:'English',zh:'Chinese'};// Convert dictionary of supported languages into list\nvar SUPPORTED_LANGUAGES=Object.keys(SUPPORTED_LANGUAGES_DICT);var RegisterRerankModel=function RegisterRerankModel(){var ERROR_COLOR=useMode();var endPoint=useContext(ApiContext).endPoint;var _useContext=useContext(ApiContext),setErrorMsg=_useContext.setErrorMsg;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),successMsg=_useState2[0],setSuccessMsg=_useState2[1];var _useState3=useState({model_name:'custom-rerank',language:['en'],model_uri:'/path/to/rerank-model'}),_useState4=_slicedToArray(_useState3,2),formData=_useState4[0],setFormData=_useState4[1];var errorModelName=formData.model_name.trim().length<=0;var errorLanguage=formData.language===undefined||formData.language.length===0;var handleClick=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var errorAny,response,errorData;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:errorAny=errorModelName||errorLanguage;if(!errorAny){_context.next=4;break;}setErrorMsg('Please fill in valid value for all fields');return _context.abrupt(\"return\");case 4:_context.prev=4;_context.next=7;return fetcher(endPoint+'/v1/model_registrations/rerank',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({model:JSON.stringify(formData),persist:true})});case 7:response=_context.sent;if(response.ok){_context.next=15;break;}_context.next=11;return response.json();case 11:errorData=_context.sent;// Assuming the server returns error details in JSON format\nsetErrorMsg(\"Server error: \".concat(response.status,\" - \").concat(errorData.detail||'Unknown error'));_context.next=16;break;case 15:setSuccessMsg('Model has been registered successfully! Navigate to launch model page to proceed.');case 16:_context.next=22;break;case 18:_context.prev=18;_context.t0=_context[\"catch\"](4);console.error('There was a problem with the fetch operation:',_context.t0);setErrorMsg(_context.t0.message||'An unexpected error occurred.');case 22:case\"end\":return _context.stop();}},_callee,null,[[4,18]]);}));return function handleClick(){return _ref.apply(this,arguments);};}();var toggleLanguage=function toggleLanguage(lang){if(formData.language.includes(lang)){setFormData(_objectSpread(_objectSpread({},formData),{},{language:formData.language.filter(function(l){return l!==lang;})}));}else{setFormData(_objectSpread(_objectSpread({},formData),{},{language:[].concat(_toConsumableArray(formData.language),[lang])}));}};return/*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsx(Box,{padding:\"20px\"}),/*#__PURE__*/_jsxs(FormControl,{sx:styles.baseFormControl,children:[/*#__PURE__*/_jsx(TextField,{label:\"Model Name\",error:errorModelName,defaultValue:formData.model_name,size:\"small\",helperText:\"Alphanumeric characters with properly placed hyphens and underscores. Must not match any built-in model names.\",onChange:function onChange(event){return setFormData(_objectSpread(_objectSpread({},formData),{},{model_name:event.target.value}));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{label:\"Model Path\",size:\"small\",value:formData.model_uri,onChange:function onChange(e){setFormData(_objectSpread(_objectSpread({},formData),{},{model_uri:e.target.value}));},helperText:\"Provide the model directory path.\"}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(\"label\",{style:{paddingLeft:5,color:errorLanguage?ERROR_COLOR:'inherit'},children:\"Model Languages\"}),/*#__PURE__*/_jsx(Box,{sx:styles.checkboxWrapper,children:SUPPORTED_LANGUAGES.map(function(lang){return/*#__PURE__*/_jsx(Box,{sx:{marginRight:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{control:/*#__PURE__*/_jsx(Checkbox,{checked:formData.language.includes(lang),onChange:function onChange(){return toggleLanguage(lang);},name:lang,sx:errorLanguage?{'color':ERROR_COLOR,'&.Mui-checked':{color:ERROR_COLOR}}:{}}),label:SUPPORTED_LANGUAGES_DICT[lang],style:{paddingLeft:10,color:errorLanguage?ERROR_COLOR:'inherit'}})},lang);})}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"})]}),/*#__PURE__*/_jsxs(Box,{width:'100%',children:[successMsg!==''&&/*#__PURE__*/_jsxs(Alert,{severity:\"success\",children:[/*#__PURE__*/_jsx(AlertTitle,{children:\"Success\"}),successMsg]}),/*#__PURE__*/_jsx(Button,{variant:\"contained\",color:\"primary\",type:\"submit\",onClick:handleClick,children:\"Register Model\"})]})]});};export default RegisterRerankModel;var styles={baseFormControl:{width:'100%',margin:'normal',size:'small'},checkboxWrapper:{display:'flex',flexWrap:'wrap',maxWidth:'80%'},labelPaddingLeft:{paddingLeft:5},formControlLabelPaddingLeft:{paddingLeft:10},buttonBox:{width:'100%',margin:'20px'},error:{fontWeight:'bold',margin:'5px 0',padding:'1px',borderRadius:'5px'}};","map":{"version":3,"names":["Box","Checkbox","FormControl","FormControlLabel","Alert","AlertTitle","Button","TextField","React","useContext","useState","ApiContext","fetcher","useMode","jsx","_jsx","jsxs","_jsxs","SUPPORTED_LANGUAGES_DICT","en","zh","SUPPORTED_LANGUAGES","Object","keys","RegisterRerankModel","ERROR_COLOR","endPoint","_useContext","setErrorMsg","_useState","_useState2","_slicedToArray","successMsg","setSuccessMsg","_useState3","model_name","language","model_uri","_useState4","formData","setFormData","errorModelName","trim","length","errorLanguage","undefined","handleClick","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","errorAny","response","errorData","wrap","_callee$","_context","prev","next","abrupt","method","headers","body","JSON","stringify","model","persist","sent","ok","json","concat","status","detail","t0","console","error","message","stop","apply","arguments","toggleLanguage","lang","includes","_objectSpread","filter","l","_toConsumableArray","Fragment","children","padding","sx","styles","baseFormControl","label","defaultValue","size","helperText","onChange","event","target","value","e","style","paddingLeft","color","checkboxWrapper","map","marginRight","control","checked","name","width","severity","variant","type","onClick","margin","display","flexWrap","maxWidth","labelPaddingLeft","formControlLabelPaddingLeft","buttonBox","fontWeight","borderRadius"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/scenes/register_model/register_rerank.js"],"sourcesContent":["import { Box, Checkbox, FormControl, FormControlLabel } from '@mui/material'\nimport Alert from '@mui/material/Alert'\nimport AlertTitle from '@mui/material/AlertTitle'\nimport Button from '@mui/material/Button'\nimport TextField from '@mui/material/TextField'\nimport React, { useContext, useState } from 'react'\n\nimport { ApiContext } from '../../components/apiContext'\nimport fetcher from '../../components/fetcher'\nimport { useMode } from '../../theme'\n\nconst SUPPORTED_LANGUAGES_DICT = { en: 'English', zh: 'Chinese' }\n// Convert dictionary of supported languages into list\nconst SUPPORTED_LANGUAGES = Object.keys(SUPPORTED_LANGUAGES_DICT)\n\nconst RegisterRerankModel = () => {\n const ERROR_COLOR = useMode()\n const endPoint = useContext(ApiContext).endPoint\n const { setErrorMsg } = useContext(ApiContext)\n const [successMsg, setSuccessMsg] = useState('')\n const [formData, setFormData] = useState({\n model_name: 'custom-rerank',\n language: ['en'],\n model_uri: '/path/to/rerank-model',\n })\n\n const errorModelName = formData.model_name.trim().length <= 0\n const errorLanguage =\n formData.language === undefined || formData.language.length === 0\n\n const handleClick = async () => {\n const errorAny = errorModelName || errorLanguage\n\n if (errorAny) {\n setErrorMsg('Please fill in valid value for all fields')\n return\n }\n\n try {\n const response = await fetcher(\n endPoint + '/v1/model_registrations/rerank',\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: JSON.stringify(formData),\n persist: true,\n }),\n }\n )\n if (!response.ok) {\n const errorData = await response.json() // Assuming the server returns error details in JSON format\n setErrorMsg(\n `Server error: ${response.status} - ${\n errorData.detail || 'Unknown error'\n }`\n )\n } else {\n setSuccessMsg(\n 'Model has been registered successfully! Navigate to launch model page to proceed.'\n )\n }\n } catch (error) {\n console.error('There was a problem with the fetch operation:', error)\n setErrorMsg(error.message || 'An unexpected error occurred.')\n }\n }\n\n const toggleLanguage = (lang) => {\n if (formData.language.includes(lang)) {\n setFormData({\n ...formData,\n language: formData.language.filter((l) => l !== lang),\n })\n } else {\n setFormData({\n ...formData,\n language: [...formData.language, lang],\n })\n }\n }\n\n return (\n <React.Fragment>\n <Box padding=\"20px\"></Box>\n {/* Base Information */}\n <FormControl sx={styles.baseFormControl}>\n <TextField\n label=\"Model Name\"\n error={errorModelName}\n defaultValue={formData.model_name}\n size=\"small\"\n helperText=\"Alphanumeric characters with properly placed hyphens and underscores. Must not match any built-in model names.\"\n onChange={(event) =>\n setFormData({ ...formData, model_name: event.target.value })\n }\n />\n <Box padding=\"15px\"></Box>\n\n <TextField\n label=\"Model Path\"\n size=\"small\"\n value={formData.model_uri}\n onChange={(e) => {\n setFormData({\n ...formData,\n model_uri: e.target.value,\n })\n }}\n helperText=\"Provide the model directory path.\"\n />\n <Box padding=\"15px\"></Box>\n\n <label\n style={{\n paddingLeft: 5,\n color: errorLanguage ? ERROR_COLOR : 'inherit',\n }}\n >\n Model Languages\n </label>\n <Box sx={styles.checkboxWrapper}>\n {SUPPORTED_LANGUAGES.map((lang) => (\n <Box key={lang} sx={{ marginRight: '10px' }}>\n <FormControlLabel\n control={\n <Checkbox\n checked={formData.language.includes(lang)}\n onChange={() => toggleLanguage(lang)}\n name={lang}\n sx={\n errorLanguage\n ? {\n 'color': ERROR_COLOR,\n '&.Mui-checked': {\n color: ERROR_COLOR,\n },\n }\n : {}\n }\n />\n }\n label={SUPPORTED_LANGUAGES_DICT[lang]}\n style={{\n paddingLeft: 10,\n color: errorLanguage ? ERROR_COLOR : 'inherit',\n }}\n />\n </Box>\n ))}\n </Box>\n <Box padding=\"15px\"></Box>\n </FormControl>\n\n <Box width={'100%'}>\n {successMsg !== '' && (\n <Alert severity=\"success\">\n <AlertTitle>Success</AlertTitle>\n {successMsg}\n </Alert>\n )}\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n onClick={handleClick}\n >\n Register Model\n </Button>\n </Box>\n </React.Fragment>\n )\n}\n\nexport default RegisterRerankModel\n\nconst styles = {\n baseFormControl: {\n width: '100%',\n margin: 'normal',\n size: 'small',\n },\n checkboxWrapper: {\n display: 'flex',\n flexWrap: 'wrap',\n maxWidth: '80%',\n },\n labelPaddingLeft: {\n paddingLeft: 5,\n },\n formControlLabelPaddingLeft: {\n paddingLeft: 10,\n },\n buttonBox: {\n width: '100%',\n margin: '20px',\n },\n error: {\n fontWeight: 'bold',\n margin: '5px 0',\n padding: '1px',\n borderRadius: '5px',\n },\n}\n"],"mappings":"wtBAAA,OAASA,GAAG,CAAEC,QAAQ,CAAEC,WAAW,CAAEC,gBAAgB,KAAQ,eAAe,CAC5E,MAAO,CAAAC,KAAK,KAAM,qBAAqB,CACvC,MAAO,CAAAC,UAAU,KAAM,0BAA0B,CACjD,MAAO,CAAAC,MAAM,KAAM,sBAAsB,CACzC,MAAO,CAAAC,SAAS,KAAM,yBAAyB,CAC/C,MAAO,CAAAC,KAAK,EAAIC,UAAU,CAAEC,QAAQ,KAAQ,OAAO,CAEnD,OAASC,UAAU,KAAQ,6BAA6B,CACxD,MAAO,CAAAC,OAAO,KAAM,0BAA0B,CAC9C,OAAS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zC,KAAK,CAAE,CACLgD,UAAU,CAAE,MAAM,CAClBP,MAAM,CAAE,OAAO,CACf3B,OAAO,CAAE,KAAK,CACdmC,YAAY,CAAE,KAChB,CACF,CAAC"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{TabContext,TabList,TabPanel}from'@mui/lab';import{Box,Tab}from'@mui/material';import React,{useContext,useEffect,useState}from'react';import{useCookies}from'react-cookie';import{useNavigate}from'react-router-dom';import{ApiContext}from'../../components/apiContext';import ErrorMessageSnackBar from'../../components/errorMessageSnackBar';import Title from'../../components/Title';import LaunchCustom from'./launchCustom';import LaunchEmbedding from'./launchEmbedding';import LaunchLLM from'./launchLLM';import LaunchMultimodal from'./launchMultimodal';import LaunchRerank from'./launchRerank';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var LaunchModel=function LaunchModel(){var endPoint=useContext(ApiContext).endPoint;var _React$useState=React.useState('1'),_React$useState2=_slicedToArray(_React$useState,2),value=_React$useState2[0],setValue=_React$useState2[1];var _useState=useState(-1),_useState2=_slicedToArray(_useState,2),gpuAvailable=_useState2[0],setGPUAvailable=_useState2[1];var _useContext=useContext(ApiContext),setErrorMsg=_useContext.setErrorMsg;var _useCookies=useCookies(['token']),_useCookies2=_slicedToArray(_useCookies,1),cookie=_useCookies2[0];var navigate=useNavigate();var handleTabChange=function handleTabChange(event,newValue){setValue(newValue);};useEffect(function(){if(cookie.token===''||cookie.token===undefined){return;}if(cookie.token==='need_auth'){navigate('/login',{replace:true});return;}if(gpuAvailable===-1){fetch(endPoint+'/v1/cluster/devices',{method:'GET',headers:{'Content-Type':'application/json'}}).then(function(res){if(!res.ok){// Usually, if some errors happen here, check if the cluster is available\nres.json().then(function(errorData){setErrorMsg(\"Server error: \".concat(res.status,\" - \").concat(errorData.detail||'Unknown error'));});}else{res.json().then(function(data){setGPUAvailable(parseInt(data,10));});}});}},[cookie.token]);return/*#__PURE__*/_jsxs(Box,{m:\"20px\",children:[/*#__PURE__*/_jsx(Title,{title:\"Launch Model\"}),/*#__PURE__*/_jsx(ErrorMessageSnackBar,{}),/*#__PURE__*/_jsxs(TabContext,{value:value,children:[/*#__PURE__*/_jsx(Box,{sx:{borderBottom:1,borderColor:'divider'},children:/*#__PURE__*/_jsxs(TabList,{value:value,onChange:handleTabChange,\"aria-label\":\"tabs\",children:[/*#__PURE__*/_jsx(Tab,{label:\"Language Models\",value:\"1\"}),/*#__PURE__*/_jsx(Tab,{label:\"Multimodal Models\",value:\"2\"}),/*#__PURE__*/_jsx(Tab,{label:\"Embedding Models\",value:\"3\"}),/*#__PURE__*/_jsx(Tab,{label:\"Rerank Models\",value:\"4\"}),/*#__PURE__*/_jsx(Tab,{label:\"Custom Models\",value:\"5\"})]})}),/*#__PURE__*/_jsx(TabPanel,{value:\"1\",sx:{padding:0},children:/*#__PURE__*/_jsx(LaunchLLM,{gpuAvailable:gpuAvailable})}),/*#__PURE__*/_jsx(TabPanel,{value:\"2\",sx:{padding:0},children:/*#__PURE__*/_jsx(LaunchMultimodal,{gpuAvailable:gpuAvailable})}),/*#__PURE__*/_jsx(TabPanel,{value:\"3\",sx:{padding:0},children:/*#__PURE__*/_jsx(LaunchEmbedding,{})}),/*#__PURE__*/_jsx(TabPanel,{value:\"4\",sx:{padding:0},children:/*#__PURE__*/_jsx(LaunchRerank,{})}),/*#__PURE__*/_jsx(TabPanel,{value:\"5\",sx:{padding:0},children:/*#__PURE__*/_jsx(LaunchCustom,{gpuAvailable:gpuAvailable})})]})]});};export default LaunchModel;","map":{"version":3,"names":["TabContext","TabList","TabPanel","Box","Tab","React","useContext","useEffect","useState","useCookies","useNavigate","ApiContext","ErrorMessageSnackBar","Title","LaunchCustom","LaunchEmbedding","LaunchLLM","LaunchMultimodal","LaunchRerank","jsx","_jsx","jsxs","_jsxs","LaunchModel","endPoint","_React$useState","_React$useState2","_slicedToArray","value","setValue","_useState","_useState2","gpuAvailable","setGPUAvailable","_useContext","setErrorMsg","_useCookies","_useCookies2","cookie","navigate","handleTabChange","event","newValue","token","undefined","replace","fetch","method","headers","then","res","ok","json","errorData","concat","status","detail","data","parseInt","m","children","title","sx","borderBottom","borderColor","onChange","label","padding"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/scenes/launch_model/index.js"],"sourcesContent":["import { TabContext, TabList, TabPanel } from '@mui/lab'\nimport { Box, Tab } from '@mui/material'\nimport React, { useContext, useEffect, useState } from 'react'\nimport { useCookies } from 'react-cookie'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ApiContext } from '../../components/apiContext'\nimport ErrorMessageSnackBar from '../../components/errorMessageSnackBar'\nimport Title from '../../components/Title'\nimport LaunchCustom from './launchCustom'\nimport LaunchEmbedding from './launchEmbedding'\nimport LaunchLLM from './launchLLM'\nimport LaunchMultimodal from './launchMultimodal'\nimport LaunchRerank from './launchRerank'\n\nconst LaunchModel = () => {\n let endPoint = useContext(ApiContext).endPoint\n const [value, setValue] = React.useState('1')\n const [gpuAvailable, setGPUAvailable] = useState(-1)\n\n const { setErrorMsg } = useContext(ApiContext)\n const [cookie] = useCookies(['token'])\n const navigate = useNavigate()\n\n const handleTabChange = (event, newValue) => {\n setValue(newValue)\n }\n\n useEffect(() => {\n if (cookie.token === '' || cookie.token === undefined) {\n return\n }\n if (cookie.token === 'need_auth') {\n navigate('/login', { replace: true })\n return\n }\n\n if (gpuAvailable === -1) {\n fetch(endPoint + '/v1/cluster/devices', {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n }).then((res) => {\n if (!res.ok) {\n // Usually, if some errors happen here, check if the cluster is available\n res.json().then((errorData) => {\n setErrorMsg(\n `Server error: ${res.status} - ${\n errorData.detail || 'Unknown error'\n }`\n )\n })\n } else {\n res.json().then((data) => {\n setGPUAvailable(parseInt(data, 10))\n })\n }\n })\n }\n }, [cookie.token])\n\n return (\n <Box m=\"20px\">\n <Title title=\"Launch Model\" />\n <ErrorMessageSnackBar />\n <TabContext value={value}>\n <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>\n <TabList value={value} onChange={handleTabChange} aria-label=\"tabs\">\n <Tab label=\"Language Models\" value=\"1\" />\n <Tab label=\"Multimodal Models\" value=\"2\" />\n <Tab label=\"Embedding Models\" value=\"3\" />\n <Tab label=\"Rerank Models\" value=\"4\" />\n <Tab label=\"Custom Models\" value=\"5\" />\n </TabList>\n </Box>\n <TabPanel value=\"1\" sx={{ padding: 0 }}>\n <LaunchLLM gpuAvailable={gpuAvailable} />\n </TabPanel>\n <TabPanel value=\"2\" sx={{ padding: 0 }}>\n <LaunchMultimodal gpuAvailable={gpuAvailable} />\n </TabPanel>\n <TabPanel value=\"3\" sx={{ padding: 0 }}>\n <LaunchEmbedding />\n </TabPanel>\n <TabPanel value=\"4\" sx={{ padding: 0 }}>\n <LaunchRerank />\n </TabPanel>\n <TabPanel value=\"5\" sx={{ padding: 0 }}>\n <LaunchCustom gpuAvailable={gpuAvailable} />\n </TabPanel>\n </TabContext>\n </Box>\n )\n}\n\nexport default LaunchModel\n"],"mappings":"6IAAA,OAASA,UAAU,CAAEC,OAAO,CAAEC,QAAQ,KAAQ,UAAU,CACxD,OAASC,GAAG,CAAEC,GAAG,KAAQ,eAAe,CACxC,MAAO,CAAAC,KAAK,EAAIC,UAAU,CAAEC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,CAC9D,OAASC,UAAU,KAAQ,cAAc,CACzC,OAASC,WAAW,KAAQ,kBAAkB,CAE9C,OAASC,UAAU,KAAQ,6BAA6B,CACxD,MAAO,CAAAC,oBAAoB,KAAM,uCAAuC,CACxE,MAAO,CAAAC,KAAK,KAAM,wBAAwB,CAC1C,MAAO,CAAAC,YAAY,KAAM,gBAAgB,CACzC,MAAO,CAAAC,eAAe,KAAM,mBAAmB,CAC/C,MAAO,CAAAC,SAAS,KAAM,aAAa,C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A,CAAClB,QAAQ,EAAC0B,KAAK,CAAC,GAAG,CAACkC,EAAE,CAAE,CAAEK,OAAO,CAAE,CAAE,CAAE,CAAAP,QAAA,cACrCxC,IAAA,CAACN,YAAY,EAACkB,YAAY,CAAEA,YAAa,CAAE,CAAC,CACpC,CAAC,EACD,CAAC,EACV,CAAC,CAEV,CAAC,CAED,cAAe,CAAAT,WAAW"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _objectSpread from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{RocketLaunchOutlined,UndoOutlined}from'@mui/icons-material';import DeleteIcon from'@mui/icons-material/Delete';import{Box,Chip,CircularProgress,FormControl,Stack,TextField}from'@mui/material';import IconButton from'@mui/material/IconButton';import React,{useContext,useEffect,useState}from'react';import{ApiContext}from'../../components/apiContext';import fetcher from'../../components/fetcher';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var CARD_HEIGHT=270;var CARD_WIDTH=270;var EmbeddingCard=function EmbeddingCard(_ref){var url=_ref.url,modelData=_ref.modelData,_ref$cardHeight=_ref.cardHeight,cardHeight=_ref$cardHeight===void 0?CARD_HEIGHT:_ref$cardHeight,_ref$is_custom=_ref.is_custom,is_custom=_ref$is_custom===void 0?false:_ref$is_custom;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),modelUID=_useState2[0],setModelUID=_useState2[1];var _useState3=useState(false),_useState4=_slicedToArray(_useState3,2),hover=_useState4[0],setHover=_useState4[1];var _useState5=useState(false),_useState6=_slicedToArray(_useState5,2),selected=_useState6[0],setSelected=_useState6[1];var _useState7=useState(false),_useState8=_slicedToArray(_useState7,2),customDeleted=_useState8[0],setCustomDeleted=_useState8[1];var _useContext=useContext(ApiContext),isCallingApi=_useContext.isCallingApi,setIsCallingApi=_useContext.setIsCallingApi;var _useContext2=useContext(ApiContext),isUpdatingModel=_useContext2.isUpdatingModel;var _useContext3=useContext(ApiContext),setErrorMsg=_useContext3.setErrorMsg;// UseEffects for parameter selection, change options based on previous selections\nuseEffect(function(){},[modelData]);var launchModel=function launchModel(url){if(isCallingApi||isUpdatingModel){return;}setIsCallingApi(true);var modelDataWithID={model_uid:modelUID.trim()===''?null:modelUID.trim(),model_name:modelData.model_name,model_type:'embedding'};// First fetcher request to initiate the model\nfetcher(url+'/v1/models',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(modelDataWithID)}).then(function(res){if(!res.ok){res.json().then(function(errData){return setErrorMsg(\"Server error: \".concat(res.status,\" - \").concat(errData.detail||'Unknown error'));});}else{window.open(url+'/ui/#/running_models','_blank','noreferrer');}setIsCallingApi(false);}).catch(function(error){console.error('Error:',error);setIsCallingApi(false);});};var styles={container:{display:'block',position:'relative',width:\"\".concat(CARD_WIDTH,\"px\"),height:\"\".concat(cardHeight,\"px\"),border:'1px solid #ddd',borderRadius:'20px',background:'white',overflow:'hidden'},containerSelected:{display:'block',position:'relative',width:\"\".concat(CARD_WIDTH,\"px\"),height:\"\".concat(cardHeight,\"px\"),border:'1px solid #ddd',borderRadius:'20px',background:'white',overflow:'hidden',boxShadow:'0 0 2px #00000099'},descriptionCard:{position:'relative',top:'-1px',left:'-1px',width:\"\".concat(CARD_WIDTH,\"px\"),height:\"\".concat(cardHeight,\"px\"),border:'1px solid #ddd',padding:'20px',borderRadius:'20px',background:'white'},parameterCard:{position:'relative',top:\"-\".concat(cardHeight+1,\"px\"),left:'-1px',width:\"\".concat(CARD_WIDTH,\"px\"),height:\"\".concat(cardHeight,\"px\"),border:'1px solid #ddd',padding:'20px',borderRadius:'20px',background:'white'},img:{display:'block',margin:'0 auto',width:'180px',height:'180px',objectFit:'cover',borderRadius:'10px'},titleContainer:{minHeight:'120px'},h2:{margin:'10px 10px',fontSize:'20px'},buttonsContainer:{display:'flex',margin:'0 auto',marginTop:'60px',border:'none',justifyContent:'space-between',alignItems:'center'},buttonContainer:{width:'45%',borderWidth:'0px',backgroundColor:'transparent',paddingLeft:'0px',paddingRight:'0px'},buttonItem:{width:'100%',margin:'0 auto',padding:'5px',display:'flex',justifyContent:'center',borderRadius:'4px',border:'1px solid #e5e7eb',borderWidth:'1px',borderColor:'#e5e7eb'},instructionText:{fontSize:'12px',color:'#666666',fontStyle:'italic',margin:'10px 0',textAlign:'center'},slideIn:{transform:'translateX(0%)',transition:'transform 0.2s ease-in-out'},slideOut:{transform:'translateX(100%)',transition:'transform 0.2s ease-in-out'},iconRow:{display:'flex',justifyContent:'space-between',alignItems:'center'},iconItem:{display:'flex',flexDirection:'column',alignItems:'center',margin:'20px'},boldIconText:{fontWeight:'bold',fontSize:'1.2em'},muiIcon:{fontSize:'1.5em'},smallText:{fontSize:'0.8em'},langRow:{margin:'2px 5px 40px 5px'}};var handeCustomDelete=function handeCustomDelete(e){e.stopPropagation();fetcher(url+\"/v1/model_registrations/embedding/\".concat(modelData.model_name),{method:'DELETE',headers:{'Content-Type':'application/json'}}).then(function(){return setCustomDeleted(true);}).catch(console.error);};// Set two different states based on mouse hover\nreturn/*#__PURE__*/_jsxs(Box,{style:hover?styles.containerSelected:styles.container,onMouseEnter:function onMouseEnter(){return setHover(true);},onMouseLeave:function onMouseLeave(){return setHover(false);},onClick:function onClick(){if(!selected&&!customDeleted){setSelected(true);}},children:[/*#__PURE__*/_jsxs(Box,{style:styles.descriptionCard,children:[/*#__PURE__*/_jsxs(\"div\",{style:styles.titleContainer,children:[is_custom&&/*#__PURE__*/_jsxs(Stack,{direction:\"row\",justifyContent:\"space-evenly\",alignItems:\"center\",spacing:1,children:[/*#__PURE__*/_jsx(\"h2\",{style:styles.h2,children:modelData.model_name}),/*#__PURE__*/_jsx(IconButton,{\"aria-label\":\"delete\",onClick:handeCustomDelete,disabled:customDeleted,children:/*#__PURE__*/_jsx(DeleteIcon,{})})]}),!is_custom&&/*#__PURE__*/_jsx(\"h2\",{style:styles.h2,children:modelData.model_name}),/*#__PURE__*/_jsxs(Stack,{spacing:1,direction:\"row\",useFlexGap:true,flexWrap:\"wrap\",sx:{marginLeft:1},children:[function(){return modelData.language.map(function(v){return/*#__PURE__*/_jsx(Chip,{label:v,variant:\"outlined\",size:\"small\"});});}(),function(){if(modelData.is_cached){return/*#__PURE__*/_jsx(Chip,{label:\"Cached\",variant:\"outlined\",size:\"small\"});}}(),function(){if(is_custom&&customDeleted){return/*#__PURE__*/_jsx(Chip,{label:\"Deleted\",variant:\"outlined\",size:\"small\"});}}()]})]}),/*#__PURE__*/_jsxs(\"div\",{style:styles.iconRow,children:[/*#__PURE__*/_jsxs(\"div\",{style:styles.iconItem,children:[/*#__PURE__*/_jsx(\"span\",{style:styles.boldIconText,children:modelData.dimensions}),/*#__PURE__*/_jsx(\"small\",{style:styles.smallText,children:\"dimensions\"})]}),/*#__PURE__*/_jsxs(\"div\",{style:styles.iconItem,children:[/*#__PURE__*/_jsx(\"span\",{style:styles.boldIconText,children:modelData.max_tokens}),/*#__PURE__*/_jsx(\"small\",{style:styles.smallText,children:\"max tokens\"})]})]}),hover?/*#__PURE__*/_jsx(\"p\",{style:styles.instructionText,children:\"Click with mouse to launch the model\"}):/*#__PURE__*/_jsx(\"p\",{style:styles.instructionText})]}),/*#__PURE__*/_jsxs(Box,{style:selected?_objectSpread(_objectSpread({},styles.parameterCard),styles.slideIn):_objectSpread(_objectSpread({},styles.parameterCard),styles.slideOut),children:[/*#__PURE__*/_jsx(\"h2\",{style:styles.h2,children:modelData.model_name}),/*#__PURE__*/_jsx(FormControl,{variant:\"outlined\",margin:\"normal\",fullWidth:true,children:/*#__PURE__*/_jsx(TextField,{variant:\"outlined\",value:modelUID,label:\"(Optional) Model UID, model name by default\",onChange:function onChange(e){return setModelUID(e.target.value);}})}),/*#__PURE__*/_jsxs(Box,{style:styles.buttonsContainer,children:[/*#__PURE__*/_jsx(\"button\",{title:\"Launch Embedding\",style:styles.buttonContainer,onClick:function onClick(){return launchModel(url,modelData);},disabled:isCallingApi||isUpdatingModel||!modelData,children:function(){if(isCallingApi||isUpdatingModel){return/*#__PURE__*/_jsx(Box,{style:_objectSpread(_objectSpread({},styles.buttonItem),{},{backgroundColor:'#f2f2f2'}),children:/*#__PURE__*/_jsx(CircularProgress,{size:\"20px\",sx:{color:'#000000'}})});}else if(!modelData){return/*#__PURE__*/_jsx(Box,{style:_objectSpread(_objectSpread({},styles.buttonItem),{},{backgroundColor:'#f2f2f2'}),children:/*#__PURE__*/_jsx(RocketLaunchOutlined,{size:\"20px\"})});}else{return/*#__PURE__*/_jsx(Box,{style:styles.buttonItem,children:/*#__PURE__*/_jsx(RocketLaunchOutlined,{color:\"#000000\",size:\"20px\"})});}}()}),/*#__PURE__*/_jsx(\"button\",{title:\"Launch Embedding\",style:styles.buttonContainer,onClick:function onClick(){return setSelected(false);},children:/*#__PURE__*/_jsx(Box,{style:styles.buttonItem,children:/*#__PURE__*/_jsx(UndoOutlined,{color:\"#000000\",size:\"20px\"})})})]})]})]});};export default EmbeddingCard;","map":{"version":3,"names":["RocketLaunchOutlined","UndoOutlined","DeleteIcon","Box","Chip","CircularProgress","FormControl","Stack","TextField","IconButton","React","useContext","useEffect","useState","ApiContext","fetcher","jsx","_jsx","jsxs","_jsxs","CARD_HEIGHT","CARD_WIDTH","EmbeddingCard","_ref","url","modelData","_ref$cardHeight","cardHeight","_ref$is_custom","is_custom","_useState","_useState2","_slicedToArray","modelUID","setModelUID","_useState3","_useState4","hover","setHover","_useState5","_useState6","selected","setSelected","_useState7","_useState8","customDeleted","setCustomDeleted","_useContext","isCallingApi","setIsCallingApi","_useContext2","isUpdatingModel","_useContext3","setErrorMsg","launchModel","modelDataWithID","model_uid","trim","model_name","model_type","method","headers","body","JSON","stringify","then","res","ok","json","errData","concat","status","detail","window","open","catch","error","console","styles","container","display","position","width","height","border","borderRadius","background","overflow","containerSelected","boxShadow","descriptionCard","top","left","padding","parameterCard","img","margin","objectFit","titleContainer","minHeight","h2","fontSize","buttonsContainer","marginTop","justifyContent","alignItems","buttonContainer","borderWidth","backgroundColor","paddingLeft","paddingRight","buttonItem","borderColor","instructionText","color","fontStyle","textAlign","slideIn","transform","transition","slideOut","iconRow","iconItem","flexDirection","boldIconText","fontWeight","muiIcon","smallText","langRow","handeCustomDelete","e","stopPropagation","style","onMouseEnter","onMouseLeave","onClick","children","direction","spacing","disabled","useFlexGap","flexWrap","sx","marginLeft","language","map","v","label","variant","size","is_cached","dimensions","max_tokens","_objectSpread","fullWidth","value","onChange","target","title"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/scenes/launch_model/embeddingCard.js"],"sourcesContent":["import { RocketLaunchOutlined, UndoOutlined } from '@mui/icons-material'\nimport DeleteIcon from '@mui/icons-material/Delete'\nimport {\n Box,\n Chip,\n CircularProgress,\n FormControl,\n Stack,\n TextField,\n} from '@mui/material'\nimport IconButton from '@mui/material/IconButton'\nimport React, { useContext, useEffect, useState } from 'react'\n\nimport { ApiContext } from '../../components/apiContext'\nimport fetcher from '../../components/fetcher'\n\nconst CARD_HEIGHT = 270\nconst CARD_WIDTH = 270\n\nconst EmbeddingCard = ({\n url,\n modelData,\n cardHeight = CARD_HEIGHT,\n is_custom = false,\n}) => {\n const [modelUID, setModelUID] = useState('')\n const [hover, setHover] = useState(false)\n const [selected, setSelected] = useState(false)\n const [customDeleted, setCustomDeleted] = useState(false)\n const { isCallingApi, setIsCallingApi } = useContext(ApiContext)\n const { isUpdatingModel } = useContext(ApiContext)\n const { setErrorMsg } = useContext(ApiContext)\n\n // UseEffects for parameter selection, change options based on previous selections\n useEffect(() => {}, [modelData])\n\n const launchModel = (url) => {\n if (isCallingApi || isUpdatingModel) {\n return\n }\n\n setIsCallingApi(true)\n\n const modelDataWithID = {\n model_uid: modelUID.trim() === '' ? null : modelUID.trim(),\n model_name: modelData.model_name,\n model_type: 'embedding',\n }\n\n // First fetcher request to initiate the model\n fetcher(url + '/v1/models', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify(modelDataWithID),\n })\n .then((res) => {\n if (!res.ok) {\n res\n .json()\n .then((errData) =>\n setErrorMsg(\n `Server error: ${res.status} - ${\n errData.detail || 'Unknown error'\n }`\n )\n )\n } else {\n window.open(url + '/ui/#/running_models', '_blank', 'noreferrer')\n }\n setIsCallingApi(false)\n })\n .catch((error) => {\n console.error('Error:', error)\n setIsCallingApi(false)\n })\n }\n\n const styles = {\n container: {\n display: 'block',\n position: 'relative',\n width: `${CARD_WIDTH}px`,\n height: `${cardHeight}px`,\n border: '1px solid #ddd',\n borderRadius: '20px',\n background: 'white',\n overflow: 'hidden',\n },\n containerSelected: {\n display: 'block',\n position: 'relative',\n width: `${CARD_WIDTH}px`,\n height: `${cardHeight}px`,\n border: '1px solid #ddd',\n borderRadius: '20px',\n background: 'white',\n overflow: 'hidden',\n boxShadow: '0 0 2px #00000099',\n },\n descriptionCard: {\n position: 'relative',\n top: '-1px',\n left: '-1px',\n width: `${CARD_WIDTH}px`,\n height: `${cardHeight}px`,\n border: '1px solid #ddd',\n padding: '20px',\n borderRadius: '20px',\n background: 'white',\n },\n parameterCard: {\n position: 'relative',\n top: `-${cardHeight + 1}px`,\n left: '-1px',\n width: `${CARD_WIDTH}px`,\n height: `${cardHeight}px`,\n border: '1px solid #ddd',\n padding: '20px',\n borderRadius: '20px',\n background: 'white',\n },\n img: {\n display: 'block',\n margin: '0 auto',\n width: '180px',\n height: '180px',\n objectFit: 'cover',\n borderRadius: '10px',\n },\n titleContainer: {\n minHeight: '120px',\n },\n h2: {\n margin: '10px 10px',\n fontSize: '20px',\n },\n buttonsContainer: {\n display: 'flex',\n margin: '0 auto',\n marginTop: '60px',\n border: 'none',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n buttonContainer: {\n width: '45%',\n borderWidth: '0px',\n backgroundColor: 'transparent',\n paddingLeft: '0px',\n paddingRight: '0px',\n },\n buttonItem: {\n width: '100%',\n margin: '0 auto',\n padding: '5px',\n display: 'flex',\n justifyContent: 'center',\n borderRadius: '4px',\n border: '1px solid #e5e7eb',\n borderWidth: '1px',\n borderColor: '#e5e7eb',\n },\n instructionText: {\n fontSize: '12px',\n color: '#666666',\n fontStyle: 'italic',\n margin: '10px 0',\n textAlign: 'center',\n },\n slideIn: {\n transform: 'translateX(0%)',\n transition: 'transform 0.2s ease-in-out',\n },\n slideOut: {\n transform: 'translateX(100%)',\n transition: 'transform 0.2s ease-in-out',\n },\n iconRow: {\n display: 'flex',\n justifyContent: 'space-between',\n alignItems: 'center',\n },\n iconItem: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n margin: '20px',\n },\n boldIconText: {\n fontWeight: 'bold',\n fontSize: '1.2em',\n },\n muiIcon: {\n fontSize: '1.5em',\n },\n smallText: {\n fontSize: '0.8em',\n },\n langRow: {\n margin: '2px 5px 40px 5px',\n },\n }\n\n const handeCustomDelete = (e) => {\n e.stopPropagation()\n fetcher(url + `/v1/model_registrations/embedding/${modelData.model_name}`, {\n method: 'DELETE',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n .then(() => setCustomDeleted(true))\n .catch(console.error)\n }\n\n // Set two different states based on mouse hover\n return (\n <Box\n style={hover ? styles.containerSelected : styles.container}\n onMouseEnter={() => setHover(true)}\n onMouseLeave={() => setHover(false)}\n onClick={() => {\n if (!selected && !customDeleted) {\n setSelected(true)\n }\n }}\n >\n {/* First state: show description page */}\n <Box style={styles.descriptionCard}>\n <div style={styles.titleContainer}>\n {is_custom && (\n <Stack\n direction=\"row\"\n justifyContent=\"space-evenly\"\n alignItems=\"center\"\n spacing={1}\n >\n <h2 style={styles.h2}>{modelData.model_name}</h2>\n <IconButton\n aria-label=\"delete\"\n onClick={handeCustomDelete}\n disabled={customDeleted}\n >\n <DeleteIcon />\n </IconButton>\n </Stack>\n )}\n {!is_custom && <h2 style={styles.h2}>{modelData.model_name}</h2>}\n <Stack\n spacing={1}\n direction=\"row\"\n useFlexGap\n flexWrap=\"wrap\"\n sx={{ marginLeft: 1 }}\n >\n {(() => {\n return modelData.language.map((v) => {\n return <Chip label={v} variant=\"outlined\" size=\"small\" />\n })\n })()}\n {(() => {\n if (modelData.is_cached) {\n return <Chip label=\"Cached\" variant=\"outlined\" size=\"small\" />\n }\n })()}\n {(() => {\n if (is_custom && customDeleted) {\n return <Chip label=\"Deleted\" variant=\"outlined\" size=\"small\" />\n }\n })()}\n </Stack>\n </div>\n <div style={styles.iconRow}>\n <div style={styles.iconItem}>\n <span style={styles.boldIconText}>{modelData.dimensions}</span>\n <small style={styles.smallText}>dimensions</small>\n </div>\n <div style={styles.iconItem}>\n <span style={styles.boldIconText}>{modelData.max_tokens}</span>\n <small style={styles.smallText}>max tokens</small>\n </div>\n </div>\n {hover ? (\n <p style={styles.instructionText}>\n Click with mouse to launch the model\n </p>\n ) : (\n <p style={styles.instructionText}></p>\n )}\n </Box>\n {/* Second state: show parameter selection page */}\n <Box\n style={\n selected\n ? { ...styles.parameterCard, ...styles.slideIn }\n : { ...styles.parameterCard, ...styles.slideOut }\n }\n >\n <h2 style={styles.h2}>{modelData.model_name}</h2>\n <FormControl variant=\"outlined\" margin=\"normal\" fullWidth>\n <TextField\n variant=\"outlined\"\n value={modelUID}\n label=\"(Optional) Model UID, model name by default\"\n onChange={(e) => setModelUID(e.target.value)}\n />\n </FormControl>\n <Box style={styles.buttonsContainer}>\n <button\n title=\"Launch Embedding\"\n style={styles.buttonContainer}\n onClick={() => launchModel(url, modelData)}\n disabled={isCallingApi || isUpdatingModel || !modelData}\n >\n {(() => {\n if (isCallingApi || isUpdatingModel) {\n return (\n <Box\n style={{ ...styles.buttonItem, backgroundColor: '#f2f2f2' }}\n >\n <CircularProgress\n size=\"20px\"\n sx={{\n color: '#000000',\n }}\n />\n </Box>\n )\n } else if (!modelData) {\n return (\n <Box\n style={{ ...styles.buttonItem, backgroundColor: '#f2f2f2' }}\n >\n <RocketLaunchOutlined size=\"20px\" />\n </Box>\n )\n } else {\n return (\n <Box style={styles.buttonItem}>\n <RocketLaunchOutlined color=\"#000000\" size=\"20px\" />\n </Box>\n )\n }\n })()}\n </button>\n <button\n title=\"Launch Embedding\"\n style={styles.buttonContainer}\n onClick={() => setSelected(false)}\n >\n <Box style={styles.buttonItem}>\n <UndoOutlined color=\"#000000\" size=\"20px\" />\n </Box>\n </button>\n </Box>\n </Box>\n </Box>\n )\n}\n\nexport default EmbeddingCard\n"],"mappings":"yRAAA,OAASA,oBAAoB,CAAEC,YAAY,KAAQ,qBAAqB,CACxE,MAAO,CAAAC,UAAU,KAAM,4BAA4B,CACnD,OACEC,GAAG,CACHC,IAAI,CACJC,gBAAgB,CAChBC,WAAW,CACXC,KAAK,CACLC,SAAS,KACJ,eAAe,CACtB,MAAO,CAAAC,UAAU,KAAM,0BAA0B,CACjD,MAAO,CAAAC,KAAK,EAAIC,UAAU,CAAEC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,CAE9D,OAASC,UAAU,KAAQ,6BAA6B,CACxD,MAAO,CAAAC,OAAO,KAAM,0BAA0B,QAAAC,GAAA,IAAAC,IAAA,gCAAAC,IAAA,IAAAC,KAAA,yBAE9C,GAAM,CAAAC,WAAW,CAAG,GAAG,CACvB,GAAM,CAAAC,UAAU,CAAG,GAAG,CAEtB,GAAM,CAAAC,aAAa,CAAG,QAAhB,CAAAA,aAAaA,CAAAC,IAAA,CAKb,IAJJ,CAAAC,GAAG,CAAAD,IAAA,CAAHC,GAAG,CACHC,SAAS,CAAAF,IAAA,CAATE,SAAS,CAAAC,eAAA,CAAAH,IAAA,CACTI,UAAU,CAAVA,UAAU,CAAAD,eAAA,UAAGN,WAAW,CAAAM,eAAA,CAAAE,cAAA,CAAAL,IAAA,CACxBM,SAAS,CAATA,SAAS,CAAAD,cAAA,UAAG,KAAK,CAAAA,cAAA,CAEjB,IAAAE,SAAA,CAAgCjB,QAAQ,CAAC,EAAE,CAAC,CAAAkB,UAAA,CAAAC,cAAA,CAAAF,SAAA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ACqJ,IAAI,CAAC,MAAM,CAAE,CAAC,CACjC,CAAC,CAEV,CAAC,IAAM,CACL,mBACEpI,IAAA,CAACd,GAAG,EAACiI,KAAK,CAAEtD,MAAM,CAACiC,UAAW,CAAAyB,QAAA,cAC5BvH,IAAA,CAACjB,oBAAoB,EAACkH,KAAK,CAAC,SAAS,CAACmC,IAAI,CAAC,MAAM,CAAE,CAAC,CACjD,CAAC,CAEV,CACF,CAAC,CAAE,CAAC,CACE,CAAC,cACTpI,IAAA,WACE6I,KAAK,CAAC,kBAAkB,CACxB1B,KAAK,CAAEtD,MAAM,CAAC4B,eAAgB,CAC9B6B,OAAO,CAAE,SAAAA,QAAA,QAAM,CAAA7F,WAAW,CAAC,KAAK,CAAC,EAAC,CAAA8F,QAAA,cAElCvH,IAAA,CAACd,GAAG,EAACiI,KAAK,CAAEtD,MAAM,CAACiC,UAAW,CAAAyB,QAAA,cAC5BvH,IAAA,CAAChB,YAAY,EAACiH,KAAK,CAAC,SAAS,CAACmC,IAAI,CAAC,MAAM,CAAE,CAAC,CACzC,CAAC,CACA,CAAC,EACN,CAAC,EACH,CAAC,EACH,CAAC,CAEV,CAAC,CAED,cAAe,CAAA/H,aAAa"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import Cookies from 'universal-cookie';\nexport default Cookies;","map":{"version":3,"names":["Cookies"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/node_modules/react-cookie/es6/Cookies.js"],"sourcesContent":["import Cookies from 'universal-cookie';\nexport default Cookies;\n"],"mappings":"AAAA,OAAOA,OAAO,MAAM,kBAAkB;AACtC,eAAeA,OAAO"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _classCallCheck from \"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/classCallCheck.js\";\nimport _createClass from \"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/createClass.js\";\nimport _inherits from \"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/inherits.js\";\nimport _createSuper from \"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/createSuper.js\";\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { Consumer } from './CookiesContext';\nexport default function withCookies(WrappedComponent) {\n // @ts-ignore\n var name = WrappedComponent.displayName || WrappedComponent.name;\n var CookieWrapper = /*#__PURE__*/function (_React$Component) {\n _inherits(CookieWrapper, _React$Component);\n var _super = _createSuper(CookieWrapper);\n function CookieWrapper() {\n var _this;\n _classCallCheck(this, CookieWrapper);\n _this = _super.apply(this, arguments);\n _this.onChange = function () {\n // Make sure to update children with new values\n _this.forceUpdate();\n };\n return _this;\n }\n _createClass(CookieWrapper, [{\n key: \"listen\",\n value: function listen() {\n this.props.cookies.addChangeListener(this.onChange);\n }\n }, {\n key: \"unlisten\",\n value: function unlisten(cookies) {\n (cookies || this.props.cookies).removeChangeListener(this.onChange);\n }\n }, {\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.listen();\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps) {\n if (prevProps.cookies !== this.props.cookies) {\n this.unlisten(prevProps.cookies);\n this.listen();\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.unlisten();\n }\n }, {\n key: \"render\",\n value: function render() {\n var _a = this.props,\n forwardedRef = _a.forwardedRef,\n cookies = _a.cookies,\n restProps = __rest(_a, [\"forwardedRef\", \"cookies\"]);\n var allCookies = cookies.getAll();\n return React.createElement(WrappedComponent, Object.assign({}, restProps, {\n ref: forwardedRef,\n cookies: cookies,\n allCookies: allCookies\n }));\n }\n }]);\n return CookieWrapper;\n }(React.Component);\n CookieWrapper.displayName = \"withCookies(\".concat(name, \")\");\n CookieWrapper.WrappedComponent = WrappedComponent;\n var ForwardedComponent = React.forwardRef(function (props, ref) {\n return React.createElement(Consumer, null, function (cookies) {\n return React.createElement(CookieWrapper, Object.assign({\n cookies: cookies\n }, props, {\n forwardedRef: ref\n }));\n });\n });\n ForwardedComponent.displayName = CookieWrapper.displayName;\n ForwardedComponent.WrappedComponent = CookieWrapper.WrappedComponent;\n return hoistStatics(ForwardedComponent, WrappedComponent);\n}","map":{"version":3,"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","hoistStatics","Consumer","withCookies","WrappedComponent","name","displayName","CookieWrapper","_React$Component","_inherits","_super","_createSuper","_this","_classCallCheck","apply","arguments","onChange","forceUpdate","_createClass","key","value","listen","props","cookies","addChangeListener","unlisten","removeChangeListener","componentDidMount","componentDidUpdate","prevProps","componentWillUnmount","render","_a","forwardedRef","restProps","allCookies","getAll","createElement","assign","ref","Component","concat","ForwardedComponent","forwardRef"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/node_modules/react-cookie/es6/withCookies.js"],"sourcesContent":["var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n};\nimport * as React from 'react';\nimport hoistStatics from 'hoist-non-react-statics';\nimport { Consumer } from './CookiesContext';\nexport default function withCookies(WrappedComponent) {\n // @ts-ignore\n const name = WrappedComponent.displayName || WrappedComponent.name;\n class CookieWrapper extends React.Component {\n constructor() {\n super(...arguments);\n this.onChange = () => {\n // Make sure to update children with new values\n this.forceUpdate();\n };\n }\n listen() {\n this.props.cookies.addChangeListener(this.onChange);\n }\n unlisten(cookies) {\n (cookies || this.props.cookies).removeChangeListener(this.onChange);\n }\n componentDidMount() {\n this.listen();\n }\n componentDidUpdate(prevProps) {\n if (prevProps.cookies !== this.props.cookies) {\n this.unlisten(prevProps.cookies);\n this.listen();\n }\n }\n componentWillUnmount() {\n this.unlisten();\n }\n render() {\n const _a = this.props, { forwardedRef, cookies } = _a, restProps = __rest(_a, [\"forwardedRef\", \"cookies\"]);\n const allCookies = cookies.getAll();\n return (React.createElement(WrappedComponent, Object.assign({}, restProps, { ref: forwardedRef, cookies: cookies, allCookies: allCookies })));\n }\n }\n CookieWrapper.displayName = `withCookies(${name})`;\n CookieWrapper.WrappedComponent = WrappedComponent;\n const ForwardedComponent = React.forwardRef((props, ref) => {\n return (React.createElement(Consumer, null, (cookies) => (React.createElement(CookieWrapper, Object.assign({ cookies: cookies }, props, { forwardedRef: ref })))));\n });\n ForwardedComponent.displayName = CookieWrapper.displayName;\n ForwardedComponent.WrappedComponent = CookieWrapper.WrappedComponent;\n return hoistStatics(ForwardedComponent, WrappedComponent);\n}\n"],"mappings":";;;;AAAA,IAAIA,MAAM,GAAI,IAAI,IAAI,IAAI,CAACA,MAAM,IAAK,UAAUC,CAAC,EAAEC,CAAC,EAAE;EAClD,IAAIC,CAAC,GAAG,CAAC,CAAC;EACV,KAAK,IAAIC,CAAC,IAAIH,CAAC,EAAE,IAAII,MAAM,CAACC,SAAS,CAACC,cAAc,CAACC,IAAI,CAACP,CAAC,EAAEG,CAAC,CAAC,IAAIF,CAAC,CAACO,OAAO,CAACL,CAAC,CAAC,GAAG,CAAC,EAC/ED,CAAC,CAACC,CAAC,C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,UAAU,EAAEA;QAAW,CAAC,CAAC,CAAC;MAChJ;IAAC;IAAA,OAAA5B,aAAA;EAAA,EA9BuBP,KAAK,CAACwC,SAAS;EAgC3CjC,aAAa,CAACD,WAAW,kBAAAmC,MAAA,CAAkBpC,IAAI,MAAG;EAClDE,aAAa,CAACH,gBAAgB,GAAGA,gBAAgB;EACjD,IAAMsC,kBAAkB,GAAG1C,KAAK,CAAC2C,UAAU,CAAC,UAACrB,KAAK,EAAEiB,GAAG,EAAK;IACxD,OAAQvC,KAAK,CAACqC,aAAa,CAACnC,QAAQ,EAAE,IAAI,EAAE,UAACqB,OAAO;MAAA,OAAMvB,KAAK,CAACqC,aAAa,CAAC9B,aAAa,EAAEhB,MAAM,CAAC+C,MAAM,CAAC;QAAEf,OAAO,EAAEA;MAAQ,CAAC,EAAED,KAAK,EAAE;QAAEW,YAAY,EAAEM;MAAI,CAAC,CAAC,CAAC;IAAA,CAAC,CAAC;EACrK,CAAC,CAAC;EACFG,kBAAkB,CAACpC,WAAW,GAAGC,aAAa,CAACD,WAAW;EAC1DoC,kBAAkB,CAACtC,gBAAgB,GAAGG,aAAa,CAACH,gBAAgB;EACpE,OAAOH,YAAY,CAACyC,kBAAkB,EAAEtC,gBAAgB,CAAC;AAC7D"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _regeneratorRuntime from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _asyncToGenerator from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{Box,FormControl,TextField}from'@mui/material';import React,{useContext,useEffect,useState}from'react';import{ApiContext}from'../../components/apiContext';import fetcher from'../../components/fetcher';import MultimodalCard from'./multimodalCard';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var LaunchMultimodal=function LaunchMultimodal(_ref){var gpuAvailable=_ref.gpuAvailable;var endPoint=useContext(ApiContext).endPoint;var _useState=useState([]),_useState2=_slicedToArray(_useState,2),registrationData=_useState2[0],setRegistrationData=_useState2[1];var _useContext=useContext(ApiContext),isCallingApi=_useContext.isCallingApi,setIsCallingApi=_useContext.setIsCallingApi;var _useContext2=useContext(ApiContext),isUpdatingModel=_useContext2.isUpdatingModel;// States used for filtering\nvar _useState3=useState(''),_useState4=_slicedToArray(_useState3,2),searchTerm=_useState4[0],setSearchTerm=_useState4[1];var handleChange=function handleChange(event){setSearchTerm(event.target.value);};var filter=function filter(registration){if(!registration||typeof searchTerm!=='string')return false;var modelName=registration.model_name?registration.model_name.toLowerCase():'';var modelDescription=registration.model_description?registration.model_description.toLowerCase():'';if(!modelName.includes(searchTerm.toLowerCase())&&!modelDescription.includes(searchTerm.toLowerCase())){return false;}return true;};var update=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var response,registrations,builtinRegistrations;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!(isCallingApi||isUpdatingModel)){_context.next=2;break;}return _context.abrupt(\"return\");case 2:_context.prev=2;setIsCallingApi(true);_context.next=6;return fetcher(\"\".concat(endPoint,\"/v1/model_registrations/multimodal?detailed=true\"),{method:'GET'});case 6:response=_context.sent;_context.next=9;return response.json();case 9:registrations=_context.sent;builtinRegistrations=registrations.filter(function(v){return v.is_builtin;});setRegistrationData(builtinRegistrations);_context.next=17;break;case 14:_context.prev=14;_context.t0=_context[\"catch\"](2);console.error('Error:',_context.t0);case 17:_context.prev=17;setIsCallingApi(false);return _context.finish(17);case 20:case\"end\":return _context.stop();}},_callee,null,[[2,14,17,20]]);}));return function update(){return _ref2.apply(this,arguments);};}();useEffect(function(){update().catch(console.error);},[]);var style={display:'grid',gridTemplateColumns:'repeat(auto-fill, minmax(300px, 1fr))',paddingLeft:'2rem',gridGap:'2rem 0rem'};return/*#__PURE__*/_jsxs(Box,{m:\"20px\",children:[/*#__PURE__*/_jsx(\"div\",{style:{display:'grid',gridTemplateColumns:'1fr',margin:'30px 2rem'},children:/*#__PURE__*/_jsx(FormControl,{variant:\"outlined\",margin:\"normal\",children:/*#__PURE__*/_jsx(TextField,{id:\"search\",type:\"search\",label:\"Search for model name and description\",value:searchTerm,onChange:handleChange,size:\"small\"})})}),/*#__PURE__*/_jsx(\"div\",{style:style,children:registrationData.filter(function(registration){return filter(registration);}).map(function(filteredRegistration){return/*#__PURE__*/_jsx(MultimodalCard,{url:endPoint,modelData:filteredRegistration,gpuAvailable:gpuAvailable});})})]});};export default LaunchMultimodal;","map":{"version":3,"names":["Box","FormControl","TextField","React","useContext","useEffect","useState","ApiContext","fetcher","MultimodalCard","jsx","_jsx","jsxs","_jsxs","LaunchMultimodal","_ref","gpuAvailable","endPoint","_useState","_useState2","_slicedToArray","registrationData","setRegistrationData","_useContext","isCallingApi","setIsCallingApi","_useContext2","isUpdatingModel","_useState3","_useState4","searchTerm","setSearchTerm","handleChange","event","target","value","filter","registration","modelName","model_name","toLowerCase","modelDescription","model_description","includes","update","_ref2","_asyncToGenerator","_regeneratorRuntime","mark","_callee","response","registrations","builtinRegistrations","wrap","_callee$","_context","prev","next","abrupt","concat","method","sent","json","v","is_builtin","t0","console","error","finish","stop","apply","arguments","catch","style","display","gridTemplateColumns","paddingLeft","gridGap","m","children","margin","variant","id","type","label","onChange","size","map","filteredRegistration","url","modelData"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/scenes/launch_model/launchMultimodal.js"],"sourcesContent":["import { Box, FormControl, TextField } from '@mui/material'\nimport React, { useContext, useEffect, useState } from 'react'\n\nimport { ApiContext } from '../../components/apiContext'\nimport fetcher from '../../components/fetcher'\nimport MultimodalCard from './multimodalCard'\n\nconst LaunchMultimodal = ({ gpuAvailable }) => {\n let endPoint = useContext(ApiContext).endPoint\n const [registrationData, setRegistrationData] = useState([])\n const { isCallingApi, setIsCallingApi } = useContext(ApiContext)\n const { isUpdatingModel } = useContext(ApiContext)\n\n // States used for filtering\n const [searchTerm, setSearchTerm] = useState('')\n\n const handleChange = (event) => {\n setSearchTerm(event.target.value)\n }\n\n const filter = (registration) => {\n if (!registration || typeof searchTerm !== 'string') return false\n const modelName = registration.model_name\n ? registration.model_name.toLowerCase()\n : ''\n const modelDescription = registration.model_description\n ? registration.model_description.toLowerCase()\n : ''\n\n if (\n !modelName.includes(searchTerm.toLowerCase()) &&\n !modelDescription.includes(searchTerm.toLowerCase())\n ) {\n return false\n }\n return true\n }\n\n const update = async () => {\n if (isCallingApi || isUpdatingModel) return\n\n try {\n setIsCallingApi(true)\n\n const response = await fetcher(\n `${endPoint}/v1/model_registrations/multimodal?detailed=true`,\n {\n method: 'GET',\n }\n )\n\n const registrations = await response.json()\n const builtinRegistrations = registrations.filter((v) => v.is_builtin)\n\n setRegistrationData(builtinRegistrations)\n } catch (error) {\n console.error('Error:', error)\n } finally {\n setIsCallingApi(false)\n }\n }\n\n useEffect(() => {\n update().catch(console.error)\n }, [])\n\n const style = {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))',\n paddingLeft: '2rem',\n gridGap: '2rem 0rem',\n }\n\n return (\n <Box m=\"20px\">\n <div\n style={{\n display: 'grid',\n gridTemplateColumns: '1fr',\n margin: '30px 2rem',\n }}\n >\n <FormControl variant=\"outlined\" margin=\"normal\">\n <TextField\n id=\"search\"\n type=\"search\"\n label=\"Search for model name and description\"\n value={searchTerm}\n onChange={handleChange}\n size=\"small\"\n />\n </FormControl>\n </div>\n <div style={style}>\n {registrationData\n .filter((registration) => filter(registration))\n .map((filteredRegistration) => (\n <MultimodalCard\n url={endPoint}\n modelData={filteredRegistration}\n gpuAvailable={gpuAvailable}\n />\n ))}\n </div>\n </Box>\n )\n}\n\nexport default LaunchMultimodal\n"],"mappings":"ubAAA,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O,CACb,CAAC,CACS,CAAC,CACX,CAAC,cACN3E,IAAA,QAAK8D,KAAK,CAAEA,KAAM,CAAAM,QAAA,CACf1D,gBAAgB,CACde,MAAM,CAAC,SAACC,YAAY,QAAK,CAAAD,MAAM,CAACC,YAAY,CAAC,GAAC,CAC9CkD,GAAG,CAAC,SAACC,oBAAoB,qBACxB7E,IAAA,CAACF,cAAc,EACbgF,GAAG,CAAExE,QAAS,CACdyE,SAAS,CAAEF,oBAAqB,CAChCxE,YAAY,CAAEA,YAAa,CAC5B,CAAC,EACH,CAAC,CACD,CAAC,EACH,CAAC,CAEV,CAAC,CAED,cAAe,CAAAF,gBAAgB"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{Box,FormControl,InputLabel,MenuItem,Select,TextField}from'@mui/material';import React,{useContext,useEffect,useState}from'react';import{useCookies}from'react-cookie';import{ApiContext}from'../../components/apiContext';import fetcher from'../../components/fetcher';import ModelCard from'./modelCard';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var LaunchLLM=function LaunchLLM(_ref){var gpuAvailable=_ref.gpuAvailable;var endPoint=useContext(ApiContext).endPoint;var _useContext=useContext(ApiContext),isCallingApi=_useContext.isCallingApi,setIsCallingApi=_useContext.setIsCallingApi;var _useContext2=useContext(ApiContext),isUpdatingModel=_useContext2.isUpdatingModel;var _useContext3=useContext(ApiContext),setErrorMsg=_useContext3.setErrorMsg;var _useCookies=useCookies(['token']),_useCookies2=_slicedToArray(_useCookies,1),cookie=_useCookies2[0];var _useState=useState([]),_useState2=_slicedToArray(_useState,2),registrationData=_useState2[0],setRegistrationData=_useState2[1];// States used for filtering\nvar _useState3=useState(''),_useState4=_slicedToArray(_useState3,2),searchTerm=_useState4[0],setSearchTerm=_useState4[1];var _useState5=useState('all'),_useState6=_slicedToArray(_useState5,2),modelAbility=_useState6[0],setModelAbility=_useState6[1];var handleChange=function handleChange(event){setSearchTerm(event.target.value);};var handleAbilityChange=function handleAbilityChange(event){setModelAbility(event.target.value);};var filter=function filter(registration){if(!registration||typeof searchTerm!=='string')return false;var modelName=registration.model_name?registration.model_name.toLowerCase():'';var modelDescription=registration.model_description?registration.model_description.toLowerCase():'';if(!modelName.includes(searchTerm.toLowerCase())&&!modelDescription.includes(searchTerm.toLowerCase())){return false;}if(modelAbility&&modelAbility!=='all'){if(registration.model_ability.indexOf(modelAbility)<0){return false;}}return true;};var update=function update(){if(isCallingApi||isUpdatingModel||cookie.token===''||cookie.token===undefined||cookie.token==='need_auth')return;try{setIsCallingApi(true);fetcher(\"\".concat(endPoint,\"/v1/model_registrations/LLM?detailed=true\"),{method:'GET'}).then(function(response){if(!response.ok){response.json().then(function(errData){return setErrorMsg(\"Server error: \".concat(response.status,\" - \").concat(errData.detail||'Unknown error'));});}else{response.json().then(function(data){var builtinRegistrations=data.filter(function(v){return v.is_builtin;});setRegistrationData(builtinRegistrations);});}});}catch(error){console.error('Error:',error);}finally{setIsCallingApi(false);}};useEffect(function(){update();},[cookie.token]);var style={display:'grid',gridTemplateColumns:'repeat(auto-fill, minmax(300px, 1fr))',paddingLeft:'2rem',gridGap:'2rem 0rem'};return/*#__PURE__*/_jsxs(Box,{m:\"20px\",children:[/*#__PURE__*/_jsxs(\"div\",{style:{display:'grid',gridTemplateColumns:'150px 1fr',columnGap:'20px',margin:'30px 2rem'},children:[/*#__PURE__*/_jsxs(FormControl,{variant:\"outlined\",margin:\"normal\",children:[/*#__PURE__*/_jsx(InputLabel,{id:\"ability-select-label\",children:\"Model Ability\"}),/*#__PURE__*/_jsxs(Select,{id:\"ability\",labelId:\"ability-select-label\",label:\"Model Ability\",onChange:handleAbilityChange,value:modelAbility,size:\"small\",sx:{width:'150px'},children:[/*#__PURE__*/_jsx(MenuItem,{value:\"all\",children:\"all\"}),/*#__PURE__*/_jsx(MenuItem,{value:\"generate\",children:\"generate\"}),/*#__PURE__*/_jsx(MenuItem,{value:\"chat\",children:\"chat\"})]})]}),/*#__PURE__*/_jsx(FormControl,{variant:\"outlined\",margin:\"normal\",children:/*#__PURE__*/_jsx(TextField,{id:\"search\",type:\"search\",label:\"Search for model name and description\",value:searchTerm,onChange:handleChange,size:\"small\"})})]}),/*#__PURE__*/_jsx(\"div\",{style:style,children:registrationData.filter(function(registration){return filter(registration);}).map(function(filteredRegistration){return/*#__PURE__*/_jsx(ModelCard,{url:endPoint,modelData:filteredRegistration,gpuAvailable:gpuAvailable});})})]});};export default LaunchLLM;","map":{"version":3,"names":["Box","FormControl","InputLabel","MenuItem","Select","TextField","React","useContext","useEffect","useState","useCookies","ApiContext","fetcher","ModelCard","jsx","_jsx","jsxs","_jsxs","LaunchLLM","_ref","gpuAvailable","endPoint","_useContext","isCallingApi","setIsCallingApi","_useContext2","isUpdatingModel","_useContext3","setErrorMsg","_useCookies","_useCookies2","_slicedToArray","cookie","_useState","_useState2","registrationData","setRegistrationData","_useState3","_useState4","searchTerm","setSearchTerm","_useState5","_useState6","modelAbility","setModelAbility","handleChange","event","target","value","handleAbilityChange","filter","registration","modelName","model_name","toLowerCase","modelDescription","model_description","includes","model_ability","indexOf","update","token","undefined","concat","method","then","response","ok","json","errData","status","detail","data","builtinRegistrations","v","is_builtin","error","console","style","display","gridTemplateColumns","paddingLeft","gridGap","m","children","columnGap","margin","variant","id","labelId","label","onChange","size","sx","width","type","map","filteredRegistration","url","modelData"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/scenes/launch_model/launchLLM.js"],"sourcesContent":["import {\n Box,\n FormControl,\n InputLabel,\n MenuItem,\n Select,\n TextField,\n} from '@mui/material'\nimport React, { useContext, useEffect, useState } from 'react'\nimport { useCookies } from 'react-cookie'\n\nimport { ApiContext } from '../../components/apiContext'\nimport fetcher from '../../components/fetcher'\nimport ModelCard from './modelCard'\n\nconst LaunchLLM = ({ gpuAvailable }) => {\n let endPoint = useContext(ApiContext).endPoint\n const { isCallingApi, setIsCallingApi } = useContext(ApiContext)\n const { isUpdatingModel } = useContext(ApiContext)\n const { setErrorMsg } = useContext(ApiContext)\n const [cookie] = useCookies(['token'])\n\n const [registrationData, setRegistrationData] = useState([])\n // States used for filtering\n const [searchTerm, setSearchTerm] = useState('')\n const [modelAbility, setModelAbility] = useState('all')\n\n const handleChange = (event) => {\n setSearchTerm(event.target.value)\n }\n\n const handleAbilityChange = (event) => {\n setModelAbility(event.target.value)\n }\n\n const filter = (registration) => {\n if (!registration || typeof searchTerm !== 'string') return false\n const modelName = registration.model_name\n ? registration.model_name.toLowerCase()\n : ''\n const modelDescription = registration.model_description\n ? registration.model_description.toLowerCase()\n : ''\n\n if (\n !modelName.includes(searchTerm.toLowerCase()) &&\n !modelDescription.includes(searchTerm.toLowerCase())\n ) {\n return false\n }\n if (modelAbility && modelAbility !== 'all') {\n if (registration.model_ability.indexOf(modelAbility) < 0) {\n return false\n }\n }\n return true\n }\n\n const update = () => {\n if (\n isCallingApi ||\n isUpdatingModel ||\n cookie.token === '' ||\n cookie.token === undefined ||\n cookie.token === 'need_auth'\n )\n return\n\n try {\n setIsCallingApi(true)\n\n fetcher(`${endPoint}/v1/model_registrations/LLM?detailed=true`, {\n method: 'GET',\n }).then((response) => {\n if (!response.ok) {\n response\n .json()\n .then((errData) =>\n setErrorMsg(\n `Server error: ${response.status} - ${\n errData.detail || 'Unknown error'\n }`\n )\n )\n } else {\n response.json().then((data) => {\n const builtinRegistrations = data.filter((v) => v.is_builtin)\n setRegistrationData(builtinRegistrations)\n })\n }\n })\n } catch (error) {\n console.error('Error:', error)\n } finally {\n setIsCallingApi(false)\n }\n }\n\n useEffect(() => {\n update()\n }, [cookie.token])\n\n const style = {\n display: 'grid',\n gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))',\n paddingLeft: '2rem',\n gridGap: '2rem 0rem',\n }\n\n return (\n <Box m=\"20px\">\n <div\n style={{\n display: 'grid',\n gridTemplateColumns: '150px 1fr',\n columnGap: '20px',\n margin: '30px 2rem',\n }}\n >\n <FormControl variant=\"outlined\" margin=\"normal\">\n <InputLabel id=\"ability-select-label\">Model Ability</InputLabel>\n <Select\n id=\"ability\"\n labelId=\"ability-select-label\"\n label=\"Model Ability\"\n onChange={handleAbilityChange}\n value={modelAbility}\n size=\"small\"\n sx={{ width: '150px' }}\n >\n <MenuItem value=\"all\">all</MenuItem>\n <MenuItem value=\"generate\">generate</MenuItem>\n <MenuItem value=\"chat\">chat</MenuItem>\n </Select>\n </FormControl>\n <FormControl variant=\"outlined\" margin=\"normal\">\n <TextField\n id=\"search\"\n type=\"search\"\n label=\"Search for model name and description\"\n value={searchTerm}\n onChange={handleChange}\n size=\"small\"\n />\n </FormControl>\n </div>\n <div style={style}>\n {registrationData\n .filter((registration) => filter(registration))\n .map((filteredRegistration) => (\n <ModelCard\n url={endPoint}\n modelData={filteredRegistration}\n gpuAvailable={gpuAvailable}\n />\n ))}\n </div>\n </Box>\n )\n}\n\nexport default LaunchLLM\n"],"mappings":"6IAAA,OACEA,GAAG,CACHC,WAAW,CACXC,UAAU,CACVC,QAAQ,CACRC,MAAM,CACNC,SAAS,KACJ,eAAe,CACtB,MAAO,CAAAC,KAAK,EAAIC,UAAU,CAAEC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,CAC9D,OAASC,UAAU,KAAQ,cAAc,CAEzC,OAASC,UAAU,KAAQ,6BAA6B,CACxD,MAAO,CAAAC,OAAO,KAAM,0BAA0B,CAC9C,MAAO,CAAAC,SAAS,KAAM,aAAa,QAAAC,GAAA,IAAAC,IAAA,gCAAAC,IAAA,IAAAC,KAAA,yBAEnC,GAAM,CAAAC,SAAS,CAAG,QAAZ,CAAAA,SAASA,CAAAC,IAAA,CAAyB,IAAnB,CAAAC,YAAY,CAAAD,IAAA,CAAZC,YAAY,CAC/B,GAAI,CAAAC,QAAQ,CAAGd,UAAU,CAACI,UAAU,CAAC,CAACU,QAAQ,CAC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AAF,SAAS"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"export { default as Cookies } from './Cookies';\nexport { default as CookiesProvider } from './CookiesProvider';\nexport { default as withCookies } from './withCookies';\nexport { default as useCookies } from './useCookies';\nexport * from './types';","map":{"version":3,"names":["default","Cookies","CookiesProvider","withCookies","useCookies"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/node_modules/react-cookie/es6/index.js"],"sourcesContent":["export { default as Cookies } from './Cookies';\nexport { default as CookiesProvider } from './CookiesProvider';\nexport { default as withCookies } from './withCookies';\nexport { default as useCookies } from './useCookies';\nexport * from './types';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,OAAO,QAAQ,WAAW;AAC9C,SAASD,OAAO,IAAIE,eAAe,QAAQ,mBAAmB;AAC9D,SAASF,OAAO,IAAIG,WAAW,QAAQ,eAAe;AACtD,SAASH,OAAO,IAAII,UAAU,QAAQ,cAAc;AACpD,cAAc,SAAS"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import React from'react';import{CookiesProvider}from'react-cookie';import ReactDOM from'react-dom/client';import App from'./App';import{jsx as _jsx}from\"react/jsx-runtime\";var root=ReactDOM.createRoot(document.getElementById('root'));root.render(/*#__PURE__*/_jsx(React.StrictMode,{children:/*#__PURE__*/_jsx(CookiesProvider,{children:/*#__PURE__*/_jsx(App,{})})}));","map":{"version":3,"names":["React","CookiesProvider","ReactDOM","App","jsx","_jsx","root","createRoot","document","getElementById","render","StrictMode","children"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/index.js"],"sourcesContent":["import React from 'react'\nimport { CookiesProvider } from 'react-cookie'\nimport ReactDOM from 'react-dom/client'\n\nimport App from './App'\n\nconst root = ReactDOM.createRoot(document.getElementById('root'))\nroot.render(\n <React.StrictMode>\n <CookiesProvider>\n <App />\n </CookiesProvider>\n </React.StrictMode>\n)\n"],"mappings":"AAAA,MAAO,CAAAA,KAAK,KAAM,OAAO,CACzB,OAASC,eAAe,KAAQ,cAAc,CAC9C,MAAO,CAAAC,QAAQ,KAAM,kBAAkB,CAEvC,MAAO,CAAAC,GAAG,KAAM,OAAO,QAAAC,GAAA,IAAAC,IAAA,yBAEvB,GAAM,CAAAC,IAAI,CAAGJ,QAAQ,CAACK,UAAU,CAACC,QAAQ,CAACC,cAAc,CAAC,MAAM,CAAC,CAAC,CACjEH,IAAI,CAACI,MAAM,cACTL,IAAA,CAACL,KAAK,CAACW,UAAU,EAAAC,QAAA,cACfP,IAAA,CAACJ,eAAe,EAAAW,QAAA,cACdP,IAAA,CAACF,GAAG,GAAE,CAAC,CACQ,CAAC,CACF,CACpB,CAAC"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _toConsumableArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";import _objectSpread from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import _regeneratorRuntime from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _asyncToGenerator from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{Box,Checkbox,FormControl,FormControlLabel}from'@mui/material';import Alert from'@mui/material/Alert';import AlertTitle from'@mui/material/AlertTitle';import Button from'@mui/material/Button';import TextField from'@mui/material/TextField';import React,{useContext,useState}from'react';import{ApiContext}from'../../components/apiContext';import fetcher from'../../components/fetcher';import{useMode}from'../../theme';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var SUPPORTED_LANGUAGES_DICT={en:'English',zh:'Chinese'};// Convert dictionary of supported languages into list\nvar SUPPORTED_LANGUAGES=Object.keys(SUPPORTED_LANGUAGES_DICT);var RegisterEmbeddingModel=function RegisterEmbeddingModel(){var ERROR_COLOR=useMode();var endPoint=useContext(ApiContext).endPoint;var _useContext=useContext(ApiContext),setErrorMsg=_useContext.setErrorMsg;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),successMsg=_useState2[0],setSuccessMsg=_useState2[1];var _useState3=useState({model_name:'custom-embedding',dimensions:768,max_tokens:512,language:['en'],model_uri:'/path/to/embedding-model'}),_useState4=_slicedToArray(_useState3,2),formData=_useState4[0],setFormData=_useState4[1];var errorModelName=formData.model_name.trim().length<=0;var errorDimensions=formData.dimensions<0;var errorMaxTokens=formData.max_tokens<0;var errorLanguage=formData.language===undefined||formData.language.length===0;var handleClick=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var errorAny,response,errorData;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:errorAny=errorModelName||errorDimensions||errorMaxTokens||errorLanguage;if(!errorAny){_context.next=4;break;}setErrorMsg('Please fill in valid value for all fields');return _context.abrupt(\"return\");case 4:_context.prev=4;_context.next=7;return fetcher(endPoint+'/v1/model_registrations/embedding',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({model:JSON.stringify(formData),persist:true})});case 7:response=_context.sent;if(response.ok){_context.next=15;break;}_context.next=11;return response.json();case 11:errorData=_context.sent;// Assuming the server returns error details in JSON format\nsetErrorMsg(\"Server error: \".concat(response.status,\" - \").concat(errorData.detail||'Unknown error'));_context.next=16;break;case 15:setSuccessMsg('Model has been registered successfully! Navigate to launch model page to proceed.');case 16:_context.next=22;break;case 18:_context.prev=18;_context.t0=_context[\"catch\"](4);console.error('There was a problem with the fetch operation:',_context.t0);setErrorMsg(_context.t0.message||'An unexpected error occurred.');case 22:case\"end\":return _context.stop();}},_callee,null,[[4,18]]);}));return function handleClick(){return _ref.apply(this,arguments);};}();var toggleLanguage=function toggleLanguage(lang){if(formData.language.includes(lang)){setFormData(_objectSpread(_objectSpread({},formData),{},{language:formData.language.filter(function(l){return l!==lang;})}));}else{setFormData(_objectSpread(_objectSpread({},formData),{},{language:[].concat(_toConsumableArray(formData.language),[lang])}));}};return/*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsx(Box,{padding:\"20px\"}),/*#__PURE__*/_jsxs(FormControl,{sx:styles.baseFormControl,children:[/*#__PURE__*/_jsx(TextField,{label:\"Model Name\",error:errorModelName,defaultValue:formData.model_name,size:\"small\",helperText:\"Alphanumeric characters with properly placed hyphens and underscores. Must not match any built-in model names.\",onChange:function onChange(event){return setFormData(_objectSpread(_objectSpread({},formData),{},{model_name:event.target.value}));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{error:errorDimensions,label:\"Dimensions\",value:formData.dimensions,size:\"small\",onChange:function onChange(event){setFormData(_objectSpread(_objectSpread({},formData),{},{dimensions:parseInt(event.target.value,10)}));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{error:errorMaxTokens,label:\"Max Tokens\",value:formData.max_tokens,size:\"small\",onChange:function onChange(event){setFormData(_objectSpread(_objectSpread({},formData),{},{max_tokens:parseInt(event.target.value,10)}));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{label:\"Model Path\",size:\"small\",value:formData.model_uri,onChange:function onChange(e){setFormData(_objectSpread(_objectSpread({},formData),{},{model_uri:e.target.value}));},helperText:\"Provide the model directory path.\"}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(\"label\",{style:{paddingLeft:5,color:errorLanguage?ERROR_COLOR:'inherit'},children:\"Model Languages\"}),/*#__PURE__*/_jsx(Box,{sx:styles.checkboxWrapper,children:SUPPORTED_LANGUAGES.map(function(lang){return/*#__PURE__*/_jsx(Box,{sx:{marginRight:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{control:/*#__PURE__*/_jsx(Checkbox,{checked:formData.language.includes(lang),onChange:function onChange(){return toggleLanguage(lang);},name:lang,sx:errorLanguage?{'color':ERROR_COLOR,'&.Mui-checked':{color:ERROR_COLOR}}:{}}),label:SUPPORTED_LANGUAGES_DICT[lang],style:{paddingLeft:10,color:errorLanguage?ERROR_COLOR:'inherit'}})},lang);})}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"})]}),/*#__PURE__*/_jsxs(Box,{width:'100%',children:[successMsg!==''&&/*#__PURE__*/_jsxs(Alert,{severity:\"success\",children:[/*#__PURE__*/_jsx(AlertTitle,{children:\"Success\"}),successMsg]}),/*#__PURE__*/_jsx(Button,{variant:\"contained\",color:\"primary\",type:\"submit\",onClick:handleClick,children:\"Register Model\"})]})]});};export default RegisterEmbeddingModel;var styles={baseFormControl:{width:'100%',margin:'normal',size:'small'},checkboxWrapper:{display:'flex',flexWrap:'wrap',maxWidth:'80%'},labelPaddingLeft:{paddingLeft:5},formControlLabelPaddingLeft:{paddingLeft:10},buttonBox:{width:'100%',margin:'20px'},error:{fontWeight:'bold',margin:'5px 0',padding:'1px',borderRadius:'5px'}};","map":{"version":3,"names":["Box","Checkbox","FormControl","FormControlLabel","Alert","AlertTitle","Button","TextField","React","useContext","useState","ApiContext","fetcher","useMode","jsx","_jsx","jsxs","_jsxs","SUPPORTED_LANGUAGES_DICT","en","zh","SUPPORTED_LANGUAGES","Object","keys","RegisterEmbeddingModel","ERROR_COLOR","endPoint","_useContext","setErrorMsg","_useState","_useState2","_slicedToArray","successMsg","setSuccessMsg","_useState3","model_name","dimensions","max_tokens","language","model_uri","_useState4","formData","setFormData","errorModelName","trim","length","errorDimensions","errorMaxTokens","errorLanguage","undefined","handleClick","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","errorAny","response","errorData","wrap","_callee$","_context","prev","next","abrupt","method","headers","body","JSON","stringify","model","persist","sent","ok","json","concat","status","detail","t0","console","error","message","stop","apply","arguments","toggleLanguage","lang","includes","_objectSpread","filter","l","_toConsumableArray","Fragment","children","padding","sx","styles","baseFormControl","label","defaultValue","size","helperText","onChange","event","target","value","parseInt","e","style","paddingLeft","color","checkboxWrapper","map","marginRight","control","checked","name","width","severity","variant","type","onClick","margin","display","flexWrap","maxWidth","labelPaddingLeft","formControlLabelPaddingLeft","buttonBox","fontWeight","borderRadius"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/scenes/register_model/register_embedding.js"],"sourcesContent":["import { Box, Checkbox, FormControl, FormControlLabel } from '@mui/material'\nimport Alert from '@mui/material/Alert'\nimport AlertTitle from '@mui/material/AlertTitle'\nimport Button from '@mui/material/Button'\nimport TextField from '@mui/material/TextField'\nimport React, { useContext, useState } from 'react'\n\nimport { ApiContext } from '../../components/apiContext'\nimport fetcher from '../../components/fetcher'\nimport { useMode } from '../../theme'\n\nconst SUPPORTED_LANGUAGES_DICT = { en: 'English', zh: 'Chinese' }\n// Convert dictionary of supported languages into list\nconst SUPPORTED_LANGUAGES = Object.keys(SUPPORTED_LANGUAGES_DICT)\n\nconst RegisterEmbeddingModel = () => {\n const ERROR_COLOR = useMode()\n const endPoint = useContext(ApiContext).endPoint\n const { setErrorMsg } = useContext(ApiContext)\n const [successMsg, setSuccessMsg] = useState('')\n const [formData, setFormData] = useState({\n model_name: 'custom-embedding',\n dimensions: 768,\n max_tokens: 512,\n language: ['en'],\n model_uri: '/path/to/embedding-model',\n })\n\n const errorModelName = formData.model_name.trim().length <= 0\n const errorDimensions = formData.dimensions < 0\n const errorMaxTokens = formData.max_tokens < 0\n const errorLanguage =\n formData.language === undefined || formData.language.length === 0\n\n const handleClick = async () => {\n const errorAny =\n errorModelName || errorDimensions || errorMaxTokens || errorLanguage\n\n if (errorAny) {\n setErrorMsg('Please fill in valid value for all fields')\n return\n }\n\n try {\n const response = await fetcher(\n endPoint + '/v1/model_registrations/embedding',\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: JSON.stringify(formData),\n persist: true,\n }),\n }\n )\n if (!response.ok) {\n const errorData = await response.json() // Assuming the server returns error details in JSON format\n setErrorMsg(\n `Server error: ${response.status} - ${\n errorData.detail || 'Unknown error'\n }`\n )\n } else {\n setSuccessMsg(\n 'Model has been registered successfully! Navigate to launch model page to proceed.'\n )\n }\n } catch (error) {\n console.error('There was a problem with the fetch operation:', error)\n setErrorMsg(error.message || 'An unexpected error occurred.')\n }\n }\n\n const toggleLanguage = (lang) => {\n if (formData.language.includes(lang)) {\n setFormData({\n ...formData,\n language: formData.language.filter((l) => l !== lang),\n })\n } else {\n setFormData({\n ...formData,\n language: [...formData.language, lang],\n })\n }\n }\n\n return (\n <React.Fragment>\n <Box padding=\"20px\"></Box>\n {/* Base Information */}\n <FormControl sx={styles.baseFormControl}>\n <TextField\n label=\"Model Name\"\n error={errorModelName}\n defaultValue={formData.model_name}\n size=\"small\"\n helperText=\"Alphanumeric characters with properly placed hyphens and underscores. Must not match any built-in model names.\"\n onChange={(event) =>\n setFormData({ ...formData, model_name: event.target.value })\n }\n />\n <Box padding=\"15px\"></Box>\n\n <TextField\n error={errorDimensions}\n label=\"Dimensions\"\n value={formData.dimensions}\n size=\"small\"\n onChange={(event) => {\n setFormData({\n ...formData,\n dimensions: parseInt(event.target.value, 10),\n })\n }}\n />\n <Box padding=\"15px\"></Box>\n\n <TextField\n error={errorMaxTokens}\n label=\"Max Tokens\"\n value={formData.max_tokens}\n size=\"small\"\n onChange={(event) => {\n setFormData({\n ...formData,\n max_tokens: parseInt(event.target.value, 10),\n })\n }}\n />\n <Box padding=\"15px\"></Box>\n\n <TextField\n label=\"Model Path\"\n size=\"small\"\n value={formData.model_uri}\n onChange={(e) => {\n setFormData({\n ...formData,\n model_uri: e.target.value,\n })\n }}\n helperText=\"Provide the model directory path.\"\n />\n <Box padding=\"15px\"></Box>\n\n <label\n style={{\n paddingLeft: 5,\n color: errorLanguage ? ERROR_COLOR : 'inherit',\n }}\n >\n Model Languages\n </label>\n <Box sx={styles.checkboxWrapper}>\n {SUPPORTED_LANGUAGES.map((lang) => (\n <Box key={lang} sx={{ marginRight: '10px' }}>\n <FormControlLabel\n control={\n <Checkbox\n checked={formData.language.includes(lang)}\n onChange={() => toggleLanguage(lang)}\n name={lang}\n sx={\n errorLanguage\n ? {\n 'color': ERROR_COLOR,\n '&.Mui-checked': {\n color: ERROR_COLOR,\n },\n }\n : {}\n }\n />\n }\n label={SUPPORTED_LANGUAGES_DICT[lang]}\n style={{\n paddingLeft: 10,\n color: errorLanguage ? ERROR_COLOR : 'inherit',\n }}\n />\n </Box>\n ))}\n </Box>\n <Box padding=\"15px\"></Box>\n </FormControl>\n\n <Box width={'100%'}>\n {successMsg !== '' && (\n <Alert severity=\"success\">\n <AlertTitle>Success</AlertTitle>\n {successMsg}\n </Alert>\n )}\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n onClick={handleClick}\n >\n Register Model\n </Button>\n </Box>\n </React.Fragment>\n )\n}\n\nexport default RegisterEmbeddingModel\n\nconst styles = {\n baseFormControl: {\n width: '100%',\n margin: 'normal',\n size: 'small',\n },\n checkboxWrapper: {\n display: 'flex',\n flexWrap: 'wrap',\n maxWidth: '80%',\n },\n labelPaddingLeft: {\n paddingLeft: 5,\n },\n formControlLabelPaddingLeft: {\n paddingLeft: 10,\n },\n buttonBox: {\n width: '100%',\n margin: '20px',\n },\n error: {\n fontWeight: 'bold',\n margin: '5px 0',\n padding: '1px',\n borderRadius: '5px',\n },\n}\n"],"mappings":"wtBAAA,OAASA,GAAG,CAAEC,QAAQ,CAAEC,WAAW,CAAEC,gBAAgB,KAAQ,eAAe,CAC5E,MAAO,CAAAC,KAAK,KAAM,qBAAqB,CACvC,MAAO,CAAAC,UAAU,KAAM,0BAA0B,CACjD,MAAO,CAAAC,MAAM,KAAM,sBAAsB,CACzC,MAAO,CAAAC,SAAS,KAAM,yBAAyB,CAC/C,MAAO,CAAAC,KAAK,EAAIC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MAAM,CAAE,OAAO,CACf5B,OAAO,CAAE,KAAK,CACdoC,YAAY,CAAE,KAChB,CACF,CAAC"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _toConsumableArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js\";import _objectSpread from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import _regeneratorRuntime from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/regeneratorRuntime.js\";import _asyncToGenerator from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import{TabContext,TabList,TabPanel}from'@mui/lab';import{Box,Checkbox,FormControl,FormControlLabel,FormHelperText,Radio,RadioGroup,Tab}from'@mui/material';import Alert from'@mui/material/Alert';import AlertTitle from'@mui/material/AlertTitle';import Button from'@mui/material/Button';import TextField from'@mui/material/TextField';import React,{useContext,useEffect,useState}from'react';import{useCookies}from'react-cookie';import{useNavigate}from'react-router-dom';import{ApiContext}from'../../components/apiContext';import ErrorMessageSnackBar from'../../components/errorMessageSnackBar';import fetcher from'../../components/fetcher';import Title from'../../components/Title';import{useMode}from'../../theme';import RegisterEmbeddingModel from'./register_embedding';import RegisterRerankModel from'./register_rerank';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";var SUPPORTED_LANGUAGES_DICT={en:'English',zh:'Chinese'};var SUPPORTED_FEATURES=['Generate','Chat'];// Convert dictionary of supported languages into list\nvar SUPPORTED_LANGUAGES=Object.keys(SUPPORTED_LANGUAGES_DICT);var RegisterModel=function RegisterModel(){var ERROR_COLOR=useMode();var endPoint=useContext(ApiContext).endPoint;var _useContext=useContext(ApiContext),setErrorMsg=_useContext.setErrorMsg;var _useState=useState(''),_useState2=_slicedToArray(_useState,2),successMsg=_useState2[0],setSuccessMsg=_useState2[1];var _useState3=useState('pytorch'),_useState4=_slicedToArray(_useState3,2),modelFormat=_useState4[0],setModelFormat=_useState4[1];var _useState5=useState(7),_useState6=_slicedToArray(_useState5,2),modelSize=_useState6[0],setModelSize=_useState6[1];var _useState7=useState('/path/to/llama-2'),_useState8=_slicedToArray(_useState7,2),modelUri=_useState8[0],setModelUri=_useState8[1];var _useState9=useState({version:1,context_length:2048,model_name:'custom-llama-2',model_lang:['en'],model_ability:['generate'],model_description:'This is a custom model description.',model_family:'',model_specs:[],prompt_style:undefined}),_useState10=_slicedToArray(_useState9,2),formData=_useState10[0],setFormData=_useState10[1];var _useState11=useState([]),_useState12=_slicedToArray(_useState11,2),promptStyles=_useState12[0],setPromptStyles=_useState12[1];var _useState13=useState({chat:[],generate:[]}),_useState14=_slicedToArray(_useState13,2),family=_useState14[0],setFamily=_useState14[1];var _useState15=useState(''),_useState16=_slicedToArray(_useState15,2),familyLabel=_useState16[0],setFamilyLabel=_useState16[1];var _React$useState=React.useState('1'),_React$useState2=_slicedToArray(_React$useState,2),tabValue=_React$useState2[0],setTabValue=_React$useState2[1];var _useCookies=useCookies(['token']),_useCookies2=_slicedToArray(_useCookies,1),cookie=_useCookies2[0];var navigate=useNavigate();var errorModelName=formData.model_name.trim().length<=0;var errorModelDescription=formData.model_description.length<0;var errorContextLength=formData.context_length===0;var errorLanguage=formData.model_lang===undefined||formData.model_lang.length===0;var errorAbility=formData.model_ability===undefined||formData.model_ability.length===0;var errorModelSize=formData.model_specs&&formData.model_specs.some(function(spec){return spec.model_size_in_billions===undefined||spec.model_size_in_billions===0;});var errorFamily=familyLabel==='';var errorAny=errorModelName||errorModelDescription||errorContextLength||errorLanguage||errorAbility||errorModelSize||errorFamily;useEffect(function(){if(cookie.token===''||cookie.token===undefined){return;}if(cookie.token==='need_auth'){navigate('/login',{replace:true});return;}var getBuiltinFamilies=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var response,errorData,data;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return fetch(endPoint+'/v1/models/families',{method:'GET',headers:{'Content-Type':'application/json'}});case 2:response=_context.sent;if(response.ok){_context.next=10;break;}_context.next=6;return response.json();case 6:errorData=_context.sent;// Assuming the server returns error details in JSON format\nsetErrorMsg(\"Server error: \".concat(response.status,\" - \").concat(errorData.detail||'Unknown error'));_context.next=16;break;case 10:_context.next=12;return response.json();case 12:data=_context.sent;data.chat.push('other');data.generate.push('other');setFamily(data);case 16:case\"end\":return _context.stop();}},_callee);}));return function getBuiltinFamilies(){return _ref.apply(this,arguments);};}();var getBuiltInPromptStyles=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var response,errorData,data,res,key,v;return _regeneratorRuntime().wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return fetch(endPoint+'/v1/models/prompts',{method:'GET',headers:{'Content-Type':'application/json'}});case 2:response=_context2.sent;if(response.ok){_context2.next=10;break;}_context2.next=6;return response.json();case 6:errorData=_context2.sent;// Assuming the server returns error details in JSON format\nsetErrorMsg(\"Server error: \".concat(response.status,\" - \").concat(errorData.detail||'Unknown error'));_context2.next=16;break;case 10:_context2.next=12;return response.json();case 12:data=_context2.sent;res=[];for(key in data){v=data[key];v['name']=key;res.push(v);}setPromptStyles(res);case 16:case\"end\":return _context2.stop();}},_callee2);}));return function getBuiltInPromptStyles(){return _ref2.apply(this,arguments);};}();// avoid keep requesting backend to get prompts\nif(promptStyles.length===0){getBuiltInPromptStyles().catch(function(error){setErrorMsg(error.message||'An unexpected error occurred when getting builtin prompt styles.');console.error('Error: ',error);});}if(family.chat.length===0){getBuiltinFamilies().catch(function(error){setErrorMsg(error.message||'An unexpected error occurred when getting builtin prompt styles.');console.error('Error: ',error);});}},[cookie.token]);var getFamilyByAbility=function getFamilyByAbility(){if(formData.model_ability.includes('chat')){return family.chat;}else{return family.generate;}};var isModelFormatPytorch=function isModelFormatPytorch(){return modelFormat==='pytorch';};var isModelFormatGPTQ=function isModelFormatGPTQ(){return modelFormat==='gptq';};var getPathComponents=function getPathComponents(path){var normalizedPath=path.replace(/\\\\/g,'/');var baseDir=normalizedPath.substring(0,normalizedPath.lastIndexOf('/'));var filename=normalizedPath.substring(normalizedPath.lastIndexOf('/')+1);return{baseDir:baseDir,filename:filename};};var handleClick=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var _getPathComponents,baseDir,filename,ps,_ps$stop,_ps$stop_token_ids,response,errorData;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(isModelFormatGPTQ()){formData.model_specs=[{model_format:modelFormat,model_size_in_billions:modelSize,quantizations:[''],model_id:'',model_uri:modelUri}];}else if(!isModelFormatPytorch()){_getPathComponents=getPathComponents(modelUri),baseDir=_getPathComponents.baseDir,filename=_getPathComponents.filename;formData.model_specs=[{model_format:modelFormat,model_size_in_billions:modelSize,quantizations:[''],model_id:'',model_file_name_template:filename,model_uri:baseDir}];}else{formData.model_specs=[{model_format:modelFormat,model_size_in_billions:modelSize,quantizations:['4-bit','8-bit','none'],model_id:'',model_uri:modelUri}];}formData.model_family=familyLabel;if(formData.model_ability.includes('chat')){ps=promptStyles.find(function(item){return item.name===familyLabel;});if(ps){formData.prompt_style={style_name:ps.style_name,system_prompt:ps.system_prompt,roles:ps.roles,intra_message_sep:ps.intra_message_sep,inter_message_sep:ps.inter_message_sep,stop:(_ps$stop=ps.stop)!==null&&_ps$stop!==void 0?_ps$stop:null,stop_token_ids:(_ps$stop_token_ids=ps.stop_token_ids)!==null&&_ps$stop_token_ids!==void 0?_ps$stop_token_ids:null};}}if(!errorAny){_context3.next=6;break;}setErrorMsg('Please fill in valid value for all fields');return _context3.abrupt(\"return\");case 6:_context3.prev=6;_context3.next=9;return fetcher(endPoint+'/v1/model_registrations/LLM',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({model:JSON.stringify(formData),persist:true})});case 9:response=_context3.sent;if(response.ok){_context3.next=17;break;}_context3.next=13;return response.json();case 13:errorData=_context3.sent;// Assuming the server returns error details in JSON format\nsetErrorMsg(\"Server error: \".concat(response.status,\" - \").concat(errorData.detail||'Unknown error'));_context3.next=18;break;case 17:setSuccessMsg('Model has been registered successfully! Navigate to launch model page to proceed.');case 18:_context3.next=24;break;case 20:_context3.prev=20;_context3.t0=_context3[\"catch\"](6);console.error('There was a problem with the fetch operation:',_context3.t0);setErrorMsg(_context3.t0.message||'An unexpected error occurred.');case 24:case\"end\":return _context3.stop();}},_callee3,null,[[6,20]]);}));return function handleClick(){return _ref3.apply(this,arguments);};}();var toggleLanguage=function toggleLanguage(lang){if(formData.model_lang.includes(lang)){setFormData(_objectSpread(_objectSpread({},formData),{},{model_lang:formData.model_lang.filter(function(l){return l!==lang;})}));}else{setFormData(_objectSpread(_objectSpread({},formData),{},{model_lang:[].concat(_toConsumableArray(formData.model_lang),[lang])}));}};var toggleAbility=function toggleAbility(ability){setFamilyLabel('');if(formData.model_ability.includes(ability)){setFormData(_objectSpread(_objectSpread({},formData),{},{model_ability:formData.model_ability.filter(function(a){return a!==ability;})}));}else{setFormData(_objectSpread(_objectSpread({},formData),{},{model_ability:[].concat(_toConsumableArray(formData.model_ability),[ability])}));}};return/*#__PURE__*/_jsxs(Box,{m:\"20px\",children:[/*#__PURE__*/_jsx(Title,{title:\"Register Model\"}),/*#__PURE__*/_jsx(ErrorMessageSnackBar,{}),/*#__PURE__*/_jsxs(TabContext,{value:tabValue,children:[/*#__PURE__*/_jsx(Box,{sx:{borderBottom:1,borderColor:'divider'},children:/*#__PURE__*/_jsxs(TabList,{value:tabValue,onChange:function onChange(e,v){setTabValue(v);},\"aria-label\":\"tabs\",children:[/*#__PURE__*/_jsx(Tab,{label:\"Language Model\",value:\"1\"}),/*#__PURE__*/_jsx(Tab,{label:\"Embedding Model\",value:\"2\"}),/*#__PURE__*/_jsx(Tab,{label:\"Rerank Model\",value:\"3\"})]})}),/*#__PURE__*/_jsxs(TabPanel,{value:\"1\",sx:{padding:0},children:[/*#__PURE__*/_jsx(Box,{padding:\"20px\"}),/*#__PURE__*/_jsxs(FormControl,{sx:styles.baseFormControl,children:[/*#__PURE__*/_jsx(TextField,{label:\"Model Name\",error:errorModelName,defaultValue:formData.model_name,size:\"small\",helperText:\"Alphanumeric characters with properly placed hyphens and underscores. Must not match any built-in model names.\",onChange:function onChange(event){return setFormData(_objectSpread(_objectSpread({},formData),{},{model_name:event.target.value}));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(\"label\",{style:{paddingLeft:5},children:\"Model Format\"}),/*#__PURE__*/_jsx(RadioGroup,{value:modelFormat,onChange:function onChange(e){setModelFormat(e.target.value);},children:/*#__PURE__*/_jsxs(Box,{sx:styles.checkboxWrapper,children:[/*#__PURE__*/_jsx(Box,{sx:{marginLeft:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{value:\"pytorch\",control:/*#__PURE__*/_jsx(Radio,{}),label:\"PyTorch\"})}),/*#__PURE__*/_jsx(Box,{sx:{marginLeft:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{value:\"ggmlv3\",control:/*#__PURE__*/_jsx(Radio,{}),label:\"GGML\"})}),/*#__PURE__*/_jsx(Box,{sx:{marginLeft:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{value:\"ggufv2\",control:/*#__PURE__*/_jsx(Radio,{}),label:\"GGUF\"})}),/*#__PURE__*/_jsx(Box,{sx:{marginLeft:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{value:\"gptq\",control:/*#__PURE__*/_jsx(Radio,{}),label:\"GPTQ\"})})]})}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{error:errorContextLength,label:\"Context Length\",value:formData.context_length,size:\"small\",onChange:function onChange(event){var value=event.target.value;// Remove leading zeros\nif(/^0+/.test(value)){value=value.replace(/^0+/,'')||'0';}// Ensure it's a positive integer, if not set it to the minimum\nif(!/^\\d+$/.test(value)||parseInt(value)<0){value='0';}// Update with the processed value\nsetFormData(_objectSpread(_objectSpread({},formData),{},{context_length:Number(value)}));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{label:\"Model Size in Billions\",size:\"small\",error:errorModelSize,value:modelSize,onChange:function onChange(e){var value=e.target.value;// Remove leading zeros\nif(/^0+/.test(value)){value=value.replace(/^0+/,'')||'0';}// Ensure it's a positive integer, if not set it to the minimum\nif(!/^\\d+$/.test(value)||parseInt(value)<0){value='0';}setModelSize(Number(value));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{label:\"Model Path\",size:\"small\",value:modelUri,onChange:function onChange(e){setModelUri(e.target.value);},helperText:\"For PyTorch, provide the model directory. For GGML/GGUF, provide the model file path.\"}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(TextField,{label:\"Model Description (Optional)\",error:errorModelDescription,defaultValue:formData.model_description,size:\"small\",onChange:function onChange(event){return setFormData(_objectSpread(_objectSpread({},formData),{},{model_description:event.target.value}));}}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(\"label\",{style:{paddingLeft:5,color:errorLanguage?ERROR_COLOR:'inherit'},children:\"Model Languages\"}),/*#__PURE__*/_jsx(Box,{sx:styles.checkboxWrapper,children:SUPPORTED_LANGUAGES.map(function(lang){return/*#__PURE__*/_jsx(Box,{sx:{marginRight:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{control:/*#__PURE__*/_jsx(Checkbox,{checked:formData.model_lang.includes(lang),onChange:function onChange(){return toggleLanguage(lang);},name:lang,sx:errorLanguage?{'color':ERROR_COLOR,'&.Mui-checked':{color:ERROR_COLOR}}:{}}),label:SUPPORTED_LANGUAGES_DICT[lang],style:{paddingLeft:10,color:errorLanguage?ERROR_COLOR:'inherit'}})},lang);})}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"}),/*#__PURE__*/_jsx(\"label\",{style:{paddingLeft:5,color:errorAbility?ERROR_COLOR:'inherit'},children:\"Model Abilities\"}),/*#__PURE__*/_jsx(Box,{sx:styles.checkboxWrapper,children:SUPPORTED_FEATURES.map(function(ability){return/*#__PURE__*/_jsx(Box,{sx:{marginRight:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{control:/*#__PURE__*/_jsx(Checkbox,{checked:formData.model_ability.includes(ability.toLowerCase()),onChange:function onChange(){return toggleAbility(ability.toLowerCase());},name:ability,sx:errorAbility?{'color':ERROR_COLOR,'&.Mui-checked':{color:ERROR_COLOR}}:{}}),label:ability,style:{paddingLeft:10,color:errorAbility?ERROR_COLOR:'inherit'}})},ability);})}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"})]}),/*#__PURE__*/_jsxs(FormControl,{sx:styles.baseFormControl,children:[/*#__PURE__*/_jsx(\"label\",{style:{paddingLeft:5,color:errorAbility?ERROR_COLOR:'inherit'},children:\"Model Family\"}),/*#__PURE__*/_jsx(FormHelperText,{children:\"Please be careful to select the family name corresponding to the model you want to register. If not found, please choose `other`.\"}),/*#__PURE__*/_jsx(RadioGroup,{value:familyLabel,onChange:function onChange(e){setFamilyLabel(e.target.value);},children:/*#__PURE__*/_jsx(Box,{sx:styles.checkboxWrapper,children:getFamilyByAbility().map(function(v){return/*#__PURE__*/_jsx(Box,{sx:{marginLeft:'10px'},children:/*#__PURE__*/_jsx(FormControlLabel,{value:v,control:/*#__PURE__*/_jsx(Radio,{}),label:v})});})})}),/*#__PURE__*/_jsx(Box,{padding:\"15px\"})]}),/*#__PURE__*/_jsxs(Box,{width:'100%',children:[successMsg!==''&&/*#__PURE__*/_jsxs(Alert,{severity:\"success\",children:[/*#__PURE__*/_jsx(AlertTitle,{children:\"Success\"}),successMsg]}),/*#__PURE__*/_jsx(Button,{variant:\"contained\",color:\"primary\",type:\"submit\",onClick:handleClick,children:\"Register Model\"})]})]}),/*#__PURE__*/_jsx(TabPanel,{value:\"2\",sx:{padding:0},children:/*#__PURE__*/_jsx(RegisterEmbeddingModel,{})}),/*#__PURE__*/_jsx(TabPanel,{value:\"3\",sx:{padding:0},children:/*#__PURE__*/_jsx(RegisterRerankModel,{})})]})]});};export default RegisterModel;var styles={baseFormControl:{width:'100%',margin:'normal',size:'small'},checkboxWrapper:{display:'flex',flexWrap:'wrap',maxWidth:'80%'},labelPaddingLeft:{paddingLeft:5},formControlLabelPaddingLeft:{paddingLeft:10},buttonBox:{width:'100%',margin:'20px'},error:{fontWeight:'bold',margin:'5px 0',padding:'1px',borderRadius:'5px'}};","map":{"version":3,"names":["TabContext","TabList","TabPanel","Box","Checkbox","FormControl","FormControlLabel","FormHelperText","Radio","RadioGroup","Tab","Alert","AlertTitle","Button","TextField","React","useContext","useEffect","useState","useCookies","useNavigate","ApiContext","ErrorMessageSnackBar","fetcher","Title","useMode","RegisterEmbeddingModel","RegisterRerankModel","jsx","_jsx","jsxs","_jsxs","SUPPORTED_LANGUAGES_DICT","en","zh","SUPPORTED_FEATURES","SUPPORTED_LANGUAGES","Object","keys","RegisterModel","ERROR_COLOR","endPoint","_useContext","setErrorMsg","_useState","_useState2","_slicedToArray","successMsg","setSuccessMsg","_useState3","_useState4","modelFormat","setModelFormat","_useState5","_useState6","modelSize","setModelSize","_useState7","_useState8","modelUri","setModelUri","_useState9","version","context_length","model_name","model_lang","model_ability","model_description","model_family","model_specs","prompt_style","undefined","_useState10","formData","setFormData","_useState11","_useState12","promptStyles","setPromptStyles","_useState13","chat","generate","_useState14","family","setFamily","_useState15","_useState16","familyLabel","setFamilyLabel","_React$useState","_React$useState2","tabValue","setTabValue","_useCookies","_useCookies2","cookie","navigate","errorModelName","trim","length","errorModelDescription","errorContextLength","errorLanguage","errorAbility","errorModelSize","some","spec","model_size_in_billions","errorFamily","errorAny","token","replace","getBuiltinFamilies","_ref","_asyncToGenerator","_regeneratorRuntime","mark","_callee","response","errorData","data","wrap","_callee$","_context","prev","next","fetch","method","headers","sent","ok","json","concat","status","detail","push","stop","apply","arguments","getBuiltInPromptStyles","_ref2","_callee2","res","key","v","_callee2$","_context2","catch","error","message","console","getFamilyByAbility","includes","isModelFormatPytorch","isModelFormatGPTQ","getPathComponents","path","normalizedPath","baseDir","substring","lastIndexOf","filename","handleClick","_ref3","_callee3","_getPathComponents","ps","_ps$stop","_ps$stop_token_ids","_callee3$","_context3","model_format","quantizations","model_id","model_uri","model_file_name_template","find","item","name","style_name","system_prompt","roles","intra_message_sep","inter_message_sep","stop_token_ids","abrupt","body","JSON","stringify","model","persist","t0","toggleLanguage","lang","_objectSpread","filter","l","_toConsumableArray","toggleAbility","ability","a","m","children","title","value","sx","borderBottom","borderColor","onChange","e","label","padding","styles","baseFormControl","defaultValue","size","helperText","event","target","style","paddingLeft","checkboxWrapper","marginLeft","control","test","parseInt","Number","color","map","marginRight","checked","toLowerCase","width","severity","variant","type","onClick","margin","display","flexWrap","maxWidth","labelPaddingLeft","formControlLabelPaddingLeft","buttonBox","fontWeight","borderRadius"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/scenes/register_model/index.js"],"sourcesContent":["import { TabContext, TabList, TabPanel } from '@mui/lab'\nimport {\n Box,\n Checkbox,\n FormControl,\n FormControlLabel,\n FormHelperText,\n Radio,\n RadioGroup,\n Tab,\n} from '@mui/material'\nimport Alert from '@mui/material/Alert'\nimport AlertTitle from '@mui/material/AlertTitle'\nimport Button from '@mui/material/Button'\nimport TextField from '@mui/material/TextField'\nimport React, { useContext, useEffect, useState } from 'react'\nimport { useCookies } from 'react-cookie'\nimport { useNavigate } from 'react-router-dom'\n\nimport { ApiContext } from '../../components/apiContext'\nimport ErrorMessageSnackBar from '../../components/errorMessageSnackBar'\nimport fetcher from '../../components/fetcher'\nimport Title from '../../components/Title'\nimport { useMode } from '../../theme'\nimport RegisterEmbeddingModel from './register_embedding'\nimport RegisterRerankModel from './register_rerank'\n\nconst SUPPORTED_LANGUAGES_DICT = { en: 'English', zh: 'Chinese' }\nconst SUPPORTED_FEATURES = ['Generate', 'Chat']\n\n// Convert dictionary of supported languages into list\nconst SUPPORTED_LANGUAGES = Object.keys(SUPPORTED_LANGUAGES_DICT)\n\nconst RegisterModel = () => {\n const ERROR_COLOR = useMode()\n const endPoint = useContext(ApiContext).endPoint\n const { setErrorMsg } = useContext(ApiContext)\n const [successMsg, setSuccessMsg] = useState('')\n const [modelFormat, setModelFormat] = useState('pytorch')\n const [modelSize, setModelSize] = useState(7)\n const [modelUri, setModelUri] = useState('/path/to/llama-2')\n const [formData, setFormData] = useState({\n version: 1,\n context_length: 2048,\n model_name: 'custom-llama-2',\n model_lang: ['en'],\n model_ability: ['generate'],\n model_description: 'This is a custom model description.',\n model_family: '',\n model_specs: [],\n prompt_style: undefined,\n })\n const [promptStyles, setPromptStyles] = useState([])\n const [family, setFamily] = useState({\n chat: [],\n generate: [],\n })\n const [familyLabel, setFamilyLabel] = useState('')\n const [tabValue, setTabValue] = React.useState('1')\n const [cookie] = useCookies(['token'])\n const navigate = useNavigate()\n\n const errorModelName = formData.model_name.trim().length <= 0\n const errorModelDescription = formData.model_description.length < 0\n const errorContextLength = formData.context_length === 0\n const errorLanguage =\n formData.model_lang === undefined || formData.model_lang.length === 0\n const errorAbility =\n formData.model_ability === undefined || formData.model_ability.length === 0\n const errorModelSize =\n formData.model_specs &&\n formData.model_specs.some((spec) => {\n return (\n spec.model_size_in_billions === undefined ||\n spec.model_size_in_billions === 0\n )\n })\n const errorFamily = familyLabel === ''\n const errorAny =\n errorModelName ||\n errorModelDescription ||\n errorContextLength ||\n errorLanguage ||\n errorAbility ||\n errorModelSize ||\n errorFamily\n\n useEffect(() => {\n if (cookie.token === '' || cookie.token === undefined) {\n return\n }\n if (cookie.token === 'need_auth') {\n navigate('/login', { replace: true })\n return\n }\n\n const getBuiltinFamilies = async () => {\n const response = await fetch(endPoint + '/v1/models/families', {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n if (!response.ok) {\n const errorData = await response.json() // Assuming the server returns error details in JSON format\n setErrorMsg(\n `Server error: ${response.status} - ${\n errorData.detail || 'Unknown error'\n }`\n )\n } else {\n const data = await response.json()\n data.chat.push('other')\n data.generate.push('other')\n setFamily(data)\n }\n }\n\n const getBuiltInPromptStyles = async () => {\n const response = await fetch(endPoint + '/v1/models/prompts', {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n },\n })\n if (!response.ok) {\n const errorData = await response.json() // Assuming the server returns error details in JSON format\n setErrorMsg(\n `Server error: ${response.status} - ${\n errorData.detail || 'Unknown error'\n }`\n )\n } else {\n const data = await response.json()\n let res = []\n for (const key in data) {\n let v = data[key]\n v['name'] = key\n res.push(v)\n }\n setPromptStyles(res)\n }\n }\n // avoid keep requesting backend to get prompts\n if (promptStyles.length === 0) {\n getBuiltInPromptStyles().catch((error) => {\n setErrorMsg(\n error.message ||\n 'An unexpected error occurred when getting builtin prompt styles.'\n )\n console.error('Error: ', error)\n })\n }\n if (family.chat.length === 0) {\n getBuiltinFamilies().catch((error) => {\n setErrorMsg(\n error.message ||\n 'An unexpected error occurred when getting builtin prompt styles.'\n )\n console.error('Error: ', error)\n })\n }\n }, [cookie.token])\n\n const getFamilyByAbility = () => {\n if (formData.model_ability.includes('chat')) {\n return family.chat\n } else {\n return family.generate\n }\n }\n\n const isModelFormatPytorch = () => {\n return modelFormat === 'pytorch'\n }\n\n const isModelFormatGPTQ = () => {\n return modelFormat === 'gptq'\n }\n\n const getPathComponents = (path) => {\n const normalizedPath = path.replace(/\\\\/g, '/')\n const baseDir = normalizedPath.substring(0, normalizedPath.lastIndexOf('/'))\n const filename = normalizedPath.substring(\n normalizedPath.lastIndexOf('/') + 1\n )\n return { baseDir, filename }\n }\n\n const handleClick = async () => {\n if (isModelFormatGPTQ()) {\n formData.model_specs = [\n {\n model_format: modelFormat,\n model_size_in_billions: modelSize,\n quantizations: [''],\n model_id: '',\n model_uri: modelUri,\n },\n ]\n } else if (!isModelFormatPytorch()) {\n const { baseDir, filename } = getPathComponents(modelUri)\n formData.model_specs = [\n {\n model_format: modelFormat,\n model_size_in_billions: modelSize,\n quantizations: [''],\n model_id: '',\n model_file_name_template: filename,\n model_uri: baseDir,\n },\n ]\n } else {\n formData.model_specs = [\n {\n model_format: modelFormat,\n model_size_in_billions: modelSize,\n quantizations: ['4-bit', '8-bit', 'none'],\n model_id: '',\n model_uri: modelUri,\n },\n ]\n }\n\n formData.model_family = familyLabel\n\n if (formData.model_ability.includes('chat')) {\n const ps = promptStyles.find((item) => item.name === familyLabel)\n if (ps) {\n formData.prompt_style = {\n style_name: ps.style_name,\n system_prompt: ps.system_prompt,\n roles: ps.roles,\n intra_message_sep: ps.intra_message_sep,\n inter_message_sep: ps.inter_message_sep,\n stop: ps.stop ?? null,\n stop_token_ids: ps.stop_token_ids ?? null,\n }\n }\n }\n\n if (errorAny) {\n setErrorMsg('Please fill in valid value for all fields')\n return\n }\n\n try {\n const response = await fetcher(endPoint + '/v1/model_registrations/LLM', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n },\n body: JSON.stringify({\n model: JSON.stringify(formData),\n persist: true,\n }),\n })\n if (!response.ok) {\n const errorData = await response.json() // Assuming the server returns error details in JSON format\n setErrorMsg(\n `Server error: ${response.status} - ${\n errorData.detail || 'Unknown error'\n }`\n )\n } else {\n setSuccessMsg(\n 'Model has been registered successfully! Navigate to launch model page to proceed.'\n )\n }\n } catch (error) {\n console.error('There was a problem with the fetch operation:', error)\n setErrorMsg(error.message || 'An unexpected error occurred.')\n }\n }\n\n const toggleLanguage = (lang) => {\n if (formData.model_lang.includes(lang)) {\n setFormData({\n ...formData,\n model_lang: formData.model_lang.filter((l) => l !== lang),\n })\n } else {\n setFormData({\n ...formData,\n model_lang: [...formData.model_lang, lang],\n })\n }\n }\n\n const toggleAbility = (ability) => {\n setFamilyLabel('')\n if (formData.model_ability.includes(ability)) {\n setFormData({\n ...formData,\n model_ability: formData.model_ability.filter((a) => a !== ability),\n })\n } else {\n setFormData({\n ...formData,\n model_ability: [...formData.model_ability, ability],\n })\n }\n }\n\n return (\n <Box m=\"20px\">\n <Title title=\"Register Model\" />\n <ErrorMessageSnackBar />\n <TabContext value={tabValue}>\n <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>\n <TabList\n value={tabValue}\n onChange={(e, v) => {\n setTabValue(v)\n }}\n aria-label=\"tabs\"\n >\n <Tab label=\"Language Model\" value=\"1\" />\n <Tab label=\"Embedding Model\" value=\"2\" />\n <Tab label=\"Rerank Model\" value=\"3\" />\n </TabList>\n </Box>\n <TabPanel value=\"1\" sx={{ padding: 0 }}>\n <Box padding=\"20px\"></Box>\n {/* Base Information */}\n <FormControl sx={styles.baseFormControl}>\n <TextField\n label=\"Model Name\"\n error={errorModelName}\n defaultValue={formData.model_name}\n size=\"small\"\n helperText=\"Alphanumeric characters with properly placed hyphens and underscores. Must not match any built-in model names.\"\n onChange={(event) =>\n setFormData({ ...formData, model_name: event.target.value })\n }\n />\n <Box padding=\"15px\"></Box>\n\n <label\n style={{\n paddingLeft: 5,\n }}\n >\n Model Format\n </label>\n\n <RadioGroup\n value={modelFormat}\n onChange={(e) => {\n setModelFormat(e.target.value)\n }}\n >\n <Box sx={styles.checkboxWrapper}>\n <Box sx={{ marginLeft: '10px' }}>\n <FormControlLabel\n value=\"pytorch\"\n control={<Radio />}\n label=\"PyTorch\"\n />\n </Box>\n <Box sx={{ marginLeft: '10px' }}>\n <FormControlLabel\n value=\"ggmlv3\"\n control={<Radio />}\n label=\"GGML\"\n />\n </Box>\n <Box sx={{ marginLeft: '10px' }}>\n <FormControlLabel\n value=\"ggufv2\"\n control={<Radio />}\n label=\"GGUF\"\n />\n </Box>\n <Box sx={{ marginLeft: '10px' }}>\n <FormControlLabel\n value=\"gptq\"\n control={<Radio />}\n label=\"GPTQ\"\n />\n </Box>\n </Box>\n </RadioGroup>\n <Box padding=\"15px\"></Box>\n\n <TextField\n error={errorContextLength}\n label=\"Context Length\"\n value={formData.context_length}\n size=\"small\"\n onChange={(event) => {\n let value = event.target.value\n // Remove leading zeros\n if (/^0+/.test(value)) {\n value = value.replace(/^0+/, '') || '0'\n }\n // Ensure it's a positive integer, if not set it to the minimum\n if (!/^\\d+$/.test(value) || parseInt(value) < 0) {\n value = '0'\n }\n // Update with the processed value\n setFormData({\n ...formData,\n context_length: Number(value),\n })\n }}\n />\n <Box padding=\"15px\"></Box>\n\n <TextField\n label=\"Model Size in Billions\"\n size=\"small\"\n error={errorModelSize}\n value={modelSize}\n onChange={(e) => {\n let value = e.target.value\n // Remove leading zeros\n if (/^0+/.test(value)) {\n value = value.replace(/^0+/, '') || '0'\n }\n // Ensure it's a positive integer, if not set it to the minimum\n if (!/^\\d+$/.test(value) || parseInt(value) < 0) {\n value = '0'\n }\n setModelSize(Number(value))\n }}\n />\n <Box padding=\"15px\"></Box>\n\n <TextField\n label=\"Model Path\"\n size=\"small\"\n value={modelUri}\n onChange={(e) => {\n setModelUri(e.target.value)\n }}\n helperText=\"For PyTorch, provide the model directory. For GGML/GGUF, provide the model file path.\"\n />\n <Box padding=\"15px\"></Box>\n\n <TextField\n label=\"Model Description (Optional)\"\n error={errorModelDescription}\n defaultValue={formData.model_description}\n size=\"small\"\n onChange={(event) =>\n setFormData({\n ...formData,\n model_description: event.target.value,\n })\n }\n />\n <Box padding=\"15px\"></Box>\n\n <label\n style={{\n paddingLeft: 5,\n color: errorLanguage ? ERROR_COLOR : 'inherit',\n }}\n >\n Model Languages\n </label>\n <Box sx={styles.checkboxWrapper}>\n {SUPPORTED_LANGUAGES.map((lang) => (\n <Box key={lang} sx={{ marginRight: '10px' }}>\n <FormControlLabel\n control={\n <Checkbox\n checked={formData.model_lang.includes(lang)}\n onChange={() => toggleLanguage(lang)}\n name={lang}\n sx={\n errorLanguage\n ? {\n 'color': ERROR_COLOR,\n '&.Mui-checked': {\n color: ERROR_COLOR,\n },\n }\n : {}\n }\n />\n }\n label={SUPPORTED_LANGUAGES_DICT[lang]}\n style={{\n paddingLeft: 10,\n color: errorLanguage ? ERROR_COLOR : 'inherit',\n }}\n />\n </Box>\n ))}\n </Box>\n <Box padding=\"15px\"></Box>\n\n <label\n style={{\n paddingLeft: 5,\n color: errorAbility ? ERROR_COLOR : 'inherit',\n }}\n >\n Model Abilities\n </label>\n <Box sx={styles.checkboxWrapper}>\n {SUPPORTED_FEATURES.map((ability) => (\n <Box key={ability} sx={{ marginRight: '10px' }}>\n <FormControlLabel\n control={\n <Checkbox\n checked={formData.model_ability.includes(\n ability.toLowerCase()\n )}\n onChange={() => toggleAbility(ability.toLowerCase())}\n name={ability}\n sx={\n errorAbility\n ? {\n 'color': ERROR_COLOR,\n '&.Mui-checked': {\n color: ERROR_COLOR,\n },\n }\n : {}\n }\n />\n }\n label={ability}\n style={{\n paddingLeft: 10,\n color: errorAbility ? ERROR_COLOR : 'inherit',\n }}\n />\n </Box>\n ))}\n </Box>\n <Box padding=\"15px\"></Box>\n </FormControl>\n\n <FormControl sx={styles.baseFormControl}>\n <label\n style={{\n paddingLeft: 5,\n color: errorAbility ? ERROR_COLOR : 'inherit',\n }}\n >\n Model Family\n </label>\n <FormHelperText>\n Please be careful to select the family name corresponding to the\n model you want to register. If not found, please choose `other`.\n </FormHelperText>\n <RadioGroup\n value={familyLabel}\n onChange={(e) => {\n setFamilyLabel(e.target.value)\n }}\n >\n <Box sx={styles.checkboxWrapper}>\n {getFamilyByAbility().map((v) => (\n <Box sx={{ marginLeft: '10px' }}>\n <FormControlLabel value={v} control={<Radio />} label={v} />\n </Box>\n ))}\n </Box>\n </RadioGroup>\n <Box padding=\"15px\"></Box>\n </FormControl>\n\n <Box width={'100%'}>\n {successMsg !== '' && (\n <Alert severity=\"success\">\n <AlertTitle>Success</AlertTitle>\n {successMsg}\n </Alert>\n )}\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n onClick={handleClick}\n >\n Register Model\n </Button>\n </Box>\n </TabPanel>\n <TabPanel value=\"2\" sx={{ padding: 0 }}>\n <RegisterEmbeddingModel />\n </TabPanel>\n <TabPanel value=\"3\" sx={{ padding: 0 }}>\n <RegisterRerankModel />\n </TabPanel>\n </TabContext>\n </Box>\n )\n}\n\nexport default RegisterModel\n\nconst styles = {\n baseFormControl: {\n width: '100%',\n margin: 'normal',\n size: 'small',\n },\n checkboxWrapper: {\n display: 'flex',\n flexWrap: 'wrap',\n maxWidth: '80%',\n },\n labelPaddingLeft: {\n paddingLeft: 5,\n },\n formControlLabelPaddingLeft: {\n paddingLeft: 10,\n },\n buttonBox: {\n width: '100%',\n margin: '20px',\n },\n error: {\n fontWeight: 'bold',\n margin: '5px 0',\n padding: '1px',\n borderRadius: '5px',\n },\n}\n"],"mappings":"wtBAAA,OAASA,UAAU,CAAEC,OAAO,CAAEC,QAAQ,KAAQ,UAAU,CACxD,OACEC,GAAG,CACHC,QAAQ,CACRC,WAAW,CACXC,gBAAgB,CAChBC,cAAc,CACdC,KAAK,CACLC,UAAU,CACVC,GAAG,KACE,eAAe,CACtB,MAAO,CAAAC,KAAK,KAAM,qBAAqB,CACvC,MAAO,CAAAC,UAAU,KAAM,0BAA0B,CACjD,MAAO,CAAAC,MAAM,KAAM,sBAAsB,CACzC,MAAO,CAAAC,SAAS,KAAM,yBAAyB,CAC/C,MAAO,CAAAC,KAAK,EAAIC,UAAU,CAAEC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,CAC9D,OAASC,UAAU,KAAQ,cAAc,CACzC,OAASC,WAAW,KAAQ,kBAAkB,CAE9C,OAASC,UAAU,KAAQ,6BAA6B,CACxD,MAAO,CAAAC,oBAAoB,KAAM,uCAAuC,CACxE,MAAO,CAAAC,OAAO,KAAM,0BAA0B,CAC9C,MAAO,CAAAC,KAAK,KAAM,wBAAwB,CAC1C,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ClB,CAAC,cACXG,IAAA,CAAC3B,QAAQ,EAAC0M,KAAK,CAAC,GAAG,CAACC,EAAE,CAAE,CAAEM,OAAO,CAAE,CAAE,CAAE,CAAAT,QAAA,cACrC7K,IAAA,CAACF,mBAAmB,GAAE,CAAC,CACf,CAAC,EACD,CAAC,EACV,CAAC,CAEV,CAAC,CAED,cAAe,CAAAY,aAAa,CAE5B,GAAM,CAAA6K,MAAM,CAAG,CACbC,eAAe,CAAE,CACfmB,KAAK,CAAE,MAAM,CACbK,MAAM,CAAE,QAAQ,CAChBtB,IAAI,CAAE,OACR,CAAC,CACDM,eAAe,CAAE,CACfiB,OAAO,CAAE,MAAM,CACfC,QAAQ,CAAE,MAAM,CAChBC,QAAQ,CAAE,KACZ,CAAC,CACDC,gBAAgB,CAAE,CAChBrB,WAAW,CAAE,CACf,CAAC,CACDsB,2BAA2B,CAAE,CAC3BtB,WAAW,CAAE,EACf,CAAC,CACDuB,SAAS,CAAE,CACTX,KAAK,CAAE,MAAM,CACbK,MAAM,CAAE,MACV,CAAC,CACDzF,KAAK,CAAE,CACLgG,UAAU,CAAE,MAAM,CAClBP,MAAM,CAAE,OAAO,CACf1B,OAAO,CAAE,KAAK,CACdkC,YAAY,CAAE,KAChB,CACF,CAAC"},"metadata":{},"sourceType":"module","externalDependencies":[]}
@@ -0,0 +1 @@
1
+ {"ast":null,"code":"import _slicedToArray from\"/home/runner/work/inference/inference/xinference/web/ui/node_modules/@babel/runtime/helpers/esm/slicedToArray.js\";import Button from'@mui/material/Button';import Dialog from'@mui/material/Dialog';import DialogActions from'@mui/material/DialogActions';import DialogContent from'@mui/material/DialogContent';import DialogContentText from'@mui/material/DialogContentText';import DialogTitle from'@mui/material/DialogTitle';import*as React from'react';import{useEffect,useState}from'react';import{useCookies}from'react-cookie';import{useNavigate}from'react-router-dom';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";export default function AuthAlertDialog(){var navigate=useNavigate();var _useState=useState(''),_useState2=_slicedToArray(_useState,2),authStatus=_useState2[0],setAuthStatus=_useState2[1];var _useCookies=useCookies(['token']),_useCookies2=_slicedToArray(_useCookies,3),removeCookie=_useCookies2[2];var handleAuthStatus=function handleAuthStatus(){var status=localStorage.getItem('authStatus');if(status){setAuthStatus(status);}else{setAuthStatus('');}};useEffect(function(){localStorage.removeItem('authStatus');window.addEventListener('auth-status',handleAuthStatus);return function(){window.removeEventListener('auth-status',handleAuthStatus);};},[]);var handleClose=function handleClose(){// trigger first\nvar code=localStorage.getItem('authStatus');localStorage.removeItem('authStatus');setAuthStatus('');if(code==='401'){removeCookie('token',{path:'/'});navigate('/login',{replace:true});}};var handleDialogClose=function handleDialogClose(event,reason){if(reason&&reason==='backdropClick'){return;}localStorage.removeItem('authStatus');setAuthStatus('');};return/*#__PURE__*/_jsx(React.Fragment,{children:/*#__PURE__*/_jsxs(Dialog,{fullWidth:true,maxWidth:\"md\",open:authStatus==='401'||authStatus==='403',onClose:handleDialogClose,\"aria-labelledby\":\"alert-dialog-title\",\"aria-describedby\":\"alert-dialog-description\",children:[authStatus==='403'&&/*#__PURE__*/_jsx(DialogTitle,{id:\"alert-dialog-title\",children:'Permission Error'}),authStatus==='401'&&/*#__PURE__*/_jsx(DialogTitle,{id:\"alert-dialog-title\",children:'Authentication Error'}),/*#__PURE__*/_jsxs(DialogContent,{children:[authStatus==='403'&&/*#__PURE__*/_jsx(DialogContentText,{id:\"alert-dialog-description\",children:'You do not have permissions to do this!'}),authStatus==='401'&&/*#__PURE__*/_jsx(DialogContentText,{id:\"alert-dialog-description\",children:'Invalid credentials! Please login.'})]}),/*#__PURE__*/_jsx(DialogActions,{children:/*#__PURE__*/_jsx(Button,{onClick:handleClose,children:\"CONFIRMED\"})})]})});}","map":{"version":3,"names":["Button","Dialog","DialogActions","DialogContent","DialogContentText","DialogTitle","React","useEffect","useState","useCookies","useNavigate","jsx","_jsx","jsxs","_jsxs","AuthAlertDialog","navigate","_useState","_useState2","_slicedToArray","authStatus","setAuthStatus","_useCookies","_useCookies2","removeCookie","handleAuthStatus","status","localStorage","getItem","removeItem","window","addEventListener","removeEventListener","handleClose","code","path","replace","handleDialogClose","event","reason","Fragment","children","fullWidth","maxWidth","open","onClose","id","onClick"],"sources":["/home/runner/work/inference/inference/xinference/web/ui/src/components/authAlertDialog.js"],"sourcesContent":["import Button from '@mui/material/Button'\nimport Dialog from '@mui/material/Dialog'\nimport DialogActions from '@mui/material/DialogActions'\nimport DialogContent from '@mui/material/DialogContent'\nimport DialogContentText from '@mui/material/DialogContentText'\nimport DialogTitle from '@mui/material/DialogTitle'\nimport * as React from 'react'\nimport { useEffect, useState } from 'react'\nimport { useCookies } from 'react-cookie'\nimport { useNavigate } from 'react-router-dom'\n\nexport default function AuthAlertDialog() {\n const navigate = useNavigate()\n const [authStatus, setAuthStatus] = useState('')\n const [, , removeCookie] = useCookies(['token'])\n\n const handleAuthStatus = () => {\n const status = localStorage.getItem('authStatus')\n if (status) {\n setAuthStatus(status)\n } else {\n setAuthStatus('')\n }\n }\n\n useEffect(() => {\n localStorage.removeItem('authStatus')\n window.addEventListener('auth-status', handleAuthStatus)\n\n return () => {\n window.removeEventListener('auth-status', handleAuthStatus)\n }\n }, [])\n\n const handleClose = () => {\n // trigger first\n const code = localStorage.getItem('authStatus')\n localStorage.removeItem('authStatus')\n setAuthStatus('')\n if (code === '401') {\n removeCookie('token', { path: '/' })\n navigate('/login', { replace: true })\n }\n }\n\n const handleDialogClose = (event, reason) => {\n if (reason && reason === 'backdropClick') {\n return\n }\n localStorage.removeItem('authStatus')\n setAuthStatus('')\n }\n\n return (\n <React.Fragment>\n <Dialog\n fullWidth\n maxWidth=\"md\"\n open={authStatus === '401' || authStatus === '403'}\n onClose={handleDialogClose}\n aria-labelledby=\"alert-dialog-title\"\n aria-describedby=\"alert-dialog-description\"\n >\n {authStatus === '403' && (\n <DialogTitle id=\"alert-dialog-title\">\n {'Permission Error'}\n </DialogTitle>\n )}\n {authStatus === '401' && (\n <DialogTitle id=\"alert-dialog-title\">\n {'Authentication Error'}\n </DialogTitle>\n )}\n <DialogContent>\n {authStatus === '403' && (\n <DialogContentText id=\"alert-dialog-description\">\n {'You do not have permissions to do this!'}\n </DialogContentText>\n )}\n {authStatus === '401' && (\n <DialogContentText id=\"alert-dialog-description\">\n {'Invalid credentials! Please login.'}\n </DialogContentText>\n )}\n </DialogContent>\n <DialogActions>\n <Button onClick={handleClose}>CONFIRMED</Button>\n </DialogActions>\n </Dialog>\n </React.Fragment>\n )\n}\n"],"mappings":"6IAAA,MAAO,CAAAA,MAAM,KAAM,sBAAsB,CACzC,MAAO,CAAAC,MAAM,KAAM,sBAAsB,CACzC,MAAO,CAAAC,aAAa,KAAM,6BAA6B,CACvD,MAAO,CAAAC,aAAa,KAAM,6BAA6B,CACvD,MAAO,CAAAC,iBAAiB,KAAM,iCAAiC,CAC/D,MAAO,CAAAC,WAAW,KAAM,2BAA2B,CACnD,MAAO,GAAK,CAAAC,KAAK,KAAM,OAAO,CAC9B,OAASC,SAAS,CAAEC,QAAQ,KAAQ,OAAO,CAC3C,OAASC,UAAU,KAAQ,cAAc,CACzC,OAASC,WAAW,KAAQ,kBAAkB,QAAAC,GAAA,IAAAC,IAAA,gCAAAC,IAAA,IAAAC,KAAA,yBAE9C,cAAe,SAAS,CAAAC,eAAeA,CAAA,CAAG,CACxC,GAAM,CAAAC,QAAQ,CAAGN,WAAW,CAAC,CAAC,CAC9B,IAAAO,SAAA,CAAoCT,QAAQ,CAAC,EAAE,CAAC,CAAAU,UAAA,CAAAC,cAAA,CAAAF,SAAA,IAAzCG,UAAU,CAAAF,UAAA,IAAEG,aAAa,CAAAH,UAAA,IAChC,IAAAI,WAAA,CAA2Bb,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC,CAAAc,YAAA,CAAAJ,cAAA,CAAAG,WAAA,IAArCE,YAAY,CAAAD,YAAA,IAEvB,GAAM,CAAAE,gBAAgB,CAAG,QAAnB,CAAAA,gBAAgBA,CAAA,CA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