@gientech/modual 2.2.30 → 2.2.32

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.
Files changed (41) hide show
  1. package/README.md +761 -761
  2. package/assets/{GientechStreamReader-Bmx4xCIT.js → GientechStreamReader-_ih9ja1B.js} +2 -2
  3. package/assets/{circle-plus-2ioHM-Sb.js → circle-plus-RlDPoPkb.js} +1 -1
  4. package/assets/client-ClH9pVlh.js +1 -0
  5. package/assets/{x-CX-iE6EL.js → createLucideIcon-Bj5DlX2s.js} +3 -8
  6. package/assets/database.svg +11 -11
  7. package/assets/database_add.svg +53 -53
  8. package/assets/database_connect.svg +66 -66
  9. package/assets/database_upload.svg +29 -29
  10. package/assets/databse.svg +6 -6
  11. package/assets/defaultWeLogo.svg +14 -14
  12. package/assets/graph.svg +4 -4
  13. package/assets/iconAi.svg +9 -9
  14. package/assets/index-Bi5ePMtR.js +345 -0
  15. package/assets/{index-DCoRawSB.js → index-CVBBj_Pf.js} +3 -3
  16. package/assets/{index-C3NkyTp6.js → index-D3YrsAA1.js} +5 -5
  17. package/assets/knowledge.svg +4 -4
  18. package/assets/{loader-circle-B52xZ7Tn.js → loader-circle-C1Oa97Sz.js} +1 -1
  19. package/assets/mysql.svg +14 -14
  20. package/assets/{plus-Cok3acFd.js → plus-B679mjyt.js} +1 -1
  21. package/assets/{search-BfgWf2Me.js → search-CEuIa9-_.js} +1 -1
  22. package/assets/sensitive.svg +5 -5
  23. package/assets/style-C0xb5cv_.js +269 -0
  24. package/assets/style8.css +1 -0
  25. package/assets/{triangle-alert-Dm0U8aST.js → triangle-alert-LqO4u4ts.js} +1 -1
  26. package/assets/x-CdZQbi--.js +6 -0
  27. package/assistantConfig.js +1 -1
  28. package/chat.js +1 -1
  29. package/chatCompare.js +1 -1
  30. package/database.js +2 -2
  31. package/databaseId.js +2 -2
  32. package/databaseTable.js +2 -2
  33. package/index.js +1 -1
  34. package/modelManage.js +2 -2
  35. package/oprecords.js +1 -22
  36. package/package.json +7 -7
  37. package/sensitive.js +12 -12
  38. package/sensitiveWords.js +1 -1
  39. package/streamFilesReader.js +1 -1
  40. package/worker/pdf.worker.min.js +21 -21
  41. package/assets/style-CQZIirQ8.js +0 -332
package/modelManage.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsx as l,jsxs as q}from"react/jsx-runtime";import Z,{useState as w,useMemo as j,useRef as oe,useEffect as Fe}from"react";import{message as z,Drawer as Re,Form as O,Modal as pe,Select as ce,Tooltip as se,Badge as ie}from"antd";import{Button as R,DashboardContainer as Ne}from"@mxmweb/zui";import{Xviwer as Ee}from"@mxmweb/xviewer";import Pe from"axios";import Ue from"styled-components";import{X as qe}from"./assets/x-CX-iE6EL.js";import{T as He}from"./assets/triangle-alert-Dm0U8aST.js";/* empty css *//* empty css */import{P as ze}from"./assets/plus-Cok3acFd.js";const Ve=""+new URL("assets/empty.png",import.meta.url).href,We=({url:t,token:F,role:r,eventsEmit:c,getMessage:B})=>{const h=(e,s)=>B?B(e):s,m=Pe.create({baseURL:t,timeout:1e6});return m.interceptors.request.use(e=>{let s=F;return!s&&!["user/login","user/kaptcha","user/regist"].some(n=>e.url.includes(n))?(c&&c("request:error_auth",{errorMsg:h("server.notLoggedIn","\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"),redirect:"/login"}),Promise.reject(new Error(h("server.notLoggedIn","\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F")))):(e.headers.Authorization=s||"",e.headers.userName=r==="\u672A\u767B\u5F55\u7528\u6237"?"":r,e)}),m.interceptors.response.use(e=>{const s=["user/kaptcha"],a=e.data;if(s.some(x=>e.config.url&&e.config.url.includes(x))||a.size&&a.type)return a;const{success:n,errorMsg:A,errorCode:b}=a;return n?a:c?(c("request:error_business",{errorCode:b,errorMsg:A||h("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"),response:a}),a):!1},e=>{var s,a,n,A,b,x,W,T,M;if(e.message==="canceled")return Promise.reject(e);if(c){let U="request:error_network",S={errorMsg:h("server.requestError","\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"),error:e};((s=e==null?void 0:e.response)==null?void 0:s.status)===401?(U="request:error_auth",S={errorMsg:h("server.noPermission","\u6CA1\u6709\u8DB3\u591F\u6743\u9650"),error:e,redirect:"/login"}):(((n=(a=e==null?void 0:e.response)==null?void 0:a.data)==null?void 0:n.errorCode)==="30013"||((b=(A=e==null?void 0:e.response)==null?void 0:A.data)==null?void 0:b.errorCode)==="30023")&&(U="request:error_business",S={errorCode:(W=(x=e==null?void 0:e.response)==null?void 0:x.data)==null?void 0:W.errorCode,errorMsg:((M=(T=e==null?void 0:e.response)==null?void 0:T.data)==null?void 0:M.message)||h("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"),error:e}),c(U,S)}return Promise.reject(e)}),{getModelList:async e=>{try{const s=await m.get(`/allPage?${new URLSearchParams(e).toString()}`),{success:a,data:n}=s;if(a)return n}catch(s){return console.log("getModelList error:",s),!1}},delModelById:async e=>{try{const s=await m.delete(`/delete?id=${e}`),{success:a,data:n}=s;if(a)return n}catch(s){console.log("delModelById error:",s)}},createModel:async e=>{try{const s=await m.post("/create",e),{success:a,data:n}=s;if(a)return n}catch(s){console.log("createModel error:",s)}},updateModelById:async e=>{try{const s=await m.put("/update",e),{success:a,data:n}=s;if(a)return n;console.log("====eee==",s),z.error(`\u4FDD\u5B58\u5931\u8D25: ${s==null?void 0:s.errorMsg}`)}catch(s){console.log("updateModelById error:",s)}},getUseTypeList:async()=>{try{const e=await m.get("/getModelTypes"),{success:s,data:a}=e;if(s)return a}catch(e){return console.log("getUseTypeList error:",e),!1}},getModelProtocolsList:async()=>{try{const e=await m.get("/getModelProtocols"),{success:s,data:a}=e;if(s)return a}catch(e){return console.log("getModelProtocolsList error:",e),!1}},testStatus:async()=>{try{const e=await m.post("/check"),{success:s,data:a}=e;if(s)return a}catch(e){console.log("testStatus error:",e)}},replaceModel:async(e,s)=>{try{const a=await m.get(`/replaceModel?sourceModelId=${e}&targetModelId=${s}`),{success:n,data:A}=a;if(n)return A}catch(a){console.log("replaceModel error:",a)}},checkModel:async e=>{try{const s=await m.get(`/checkModelReference?modelName=${e}`),{success:a,data:n}=s;if(a)return n}catch(s){console.log("checkModelReference error:",s)}}}},Y={common:{loading:"\u52A0\u8F7D\u4E2D..."},dashboard:{title:"\u6A21\u578B\u7BA1\u7406"},table:{viewLabel:"\u6A21\u578B",columns:{modelName:"\u6A21\u578B\u540D\u79F0",modelProtocol:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"\u4F7F\u7528\u7C7B\u578B",dec:"\u8BF4\u660E",status:"\u72B6\u6001",actions:"\u64CD\u4F5C"},statusHelpText:"\u5F53\u524D\u6A21\u578B\u72B6\u6001\u4E3A\u521D\u6B21\u65B0\u589E\u6821\u9A8C\u72B6\u6001\uFF0C\u82E5\u6A21\u578B\u4E0B\u7EBF\uFF0C\u6B64\u72B6\u6001\u4E0D\u4F1A\u4E3B\u52A8\u66F4\u65B0\uFF0C\u9700\u624B\u52A8\u6267\u884C\u6A21\u578B\u5220\u9664",toolbar:{add:"\u65B0\u5EFA",test:"\u6A21\u578B\u72B6\u6001\u68C0\u6D4B",replace:"\u6A21\u578B\u66FF\u6362"},actionEdit:"\u7F16\u8F91",actionAuth:"\u6388\u6743",actionDelete:"\u5220\u9664",tooltipChecking:"\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u7A0D\u540E",tooltipNoPermission:"\u89D2\u8272\u65E0\u6743\u9650\u64CD\u4F5C"},status:{available:"\u53EF\u7528",unavailable:"\u4E0D\u53EF\u7528",checking:"\u68C0\u6D4B\u4E2D"},empty:{noDataHint:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u65B0\u5EFA\u6A21\u578B",createModelBtn:"\u65B0\u5EFA\u6A21\u578B"},drawer:{titleNew:"\u65B0\u5EFA",titleEdit:"\u7F16\u8F91",cancel:"\u53D6\u6D88",confirm:"\u786E\u8BA4"},form:{labels:{modelName:"\u6A21\u578B\u540D\u79F0",modelIde:"\u6A21\u578BID",apiKey:"APIKey",url:"\u8BF7\u6C42URL",modelProtocol:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"\u4F7F\u7528\u7C7B\u578B",maxTokens:"\u4E0A\u4E0B\u6587\u957F\u5EA6",dec:"\u8BF4\u660E"},placeholders:{modelName:"\u8BF7\u8F93\u5165\u6A21\u578B\u540D\u79F0",modelIde:"\u8BF7\u8F93\u5165\u6A21\u578BID",apiKey:"\u8BF7\u8F93\u5165APIKey",url:"\u8BF7\u8F93\u5165\u8BF7\u6C42URL"},maxTokensHelpText:"\u8BF7\u5411\u6A21\u578B\u90E8\u7F72\u6216\u8FD0\u7EF4\u4EBA\u5458\u786E\u8BA4\u5F53\u524D\u6A21\u578B\u7684\u6700\u5927\u4E0A\u4E0B\u6587\u957F\u5EA6\uFF08Max Tokens / Context Length\uFF09\uFF0C\u5E76\u786E\u8BA4\u63A8\u7406\u670D\u52A1\uFF08\u5982 vLLM\uFF09\u662F\u5426\u914D\u7F6E\u4E86\u989D\u5916\u7684\u8F93\u5165\u957F\u5EA6\u9650\u5236"},replaceModal:{title:"\u6A21\u578B\u66FF\u6362",warningParagraph:"\u5982\u9700\u66F4\u6362\u6A21\u578B\uFF0C\u5728\u4E00\u952E\u66FF\u6362\u65F6\uFF0C\u7CFB\u7EDF\u5C06\u81EA\u52A8\u66F4\u65B0\u77E5\u8BC6\u89E3\u6790\u914D\u7F6E\u3001\u68C0\u7D22\u6D4B\u8BD5\u548C\u52A9\u624B\u914D\u7F6E\u4E2D\u7684\u6A21\u578B\u3002\u82E5\u66FF\u6362\u7684\u662F\u6587\u6863\u89E3\u6790\u7528\u7684Embedding\u6A21\u578B\uFF0C\u5219\u4F7F\u7528\u8BE5\u6A21\u578B\u7684\u6587\u6863\u5C06\u5168\u90E8\u91CD\u65B0\u6392\u961F\u89E3\u6790\uFF0C\u72B6\u6001\u53D8\u4E3A\u201C\u89E3\u6790\u4E2D\u201D\uFF0C\u4E14\u672A\u89E3\u6790\u5B8C\u6210\u7684\u6587\u6863\u6682\u4E0D\u53EF\u68C0\u7D22\uFF01",sourceLabel:"\u6A21\u578B\u540D\u79F0",targetLabel:"\u66FF\u6362\u4E3A",placeholderSelect:"\u8BF7\u9009\u62E9",cancel:"\u53D6\u6D88",confirm:"\u786E\u8BA4",messageSuccess:"\u6A21\u578B\u66FF\u6362\u6210\u529F"},message:{testSuccess:"\u6A21\u578B\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\u72B6\u6001\u66F4\u65B0\uFF01",deleteSuccess:"\u5220\u9664\u6210\u529F",createSuccess:"\u6A21\u578B\u65B0\u589E\u6210\u529F\uFF01",editSuccess:"\u6A21\u578B\u7F16\u8F91\u6210\u529F\uFF01"},deleteConfirm:{title:"\u786E\u8BA4\u5220\u9664\uFF1F",content:'\u786E\u5B9A\u8981\u5220\u9664\u6A21\u578B "{{name}}" \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002',titleWhenInUse:"\u5220\u9664\u6A21\u578B",contentWhenInUse:"\u5F53\u524D\u6A21\u578B\u5728\u7CFB\u7EDF\u5185\u5DF2\u88AB\u914D\u7F6E\u4F7F\u7528\uFF0C\u5220\u9664\u53EF\u80FD\u5F71\u54CD\u6587\u6863\u89E3\u6790\u3001\u95EE\u7B54\u3001\u591A\u6A21\u6001\u80FD\u529B\u4F7F\u7528\u7B49\uFF0C\u8BF7\u60A8\u5148\u4F7F\u7528\u201C\u6A21\u578B\u4E00\u952E\u66FF\u6362\u201D\u80FD\u529B\u5C06\u8BE5\u6A21\u578B\u66FF\u6362\u4E3A\u540C\u7C7B\u578B\u6A21\u578B\uFF0C\u518D\u5220\u9664\u6A21\u578B",okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",deleteOkText:"\u5220\u9664"},server:{requestError:"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",noPermission:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",notLoggedIn:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"}},Ke={common:{loading:"Loading..."},dashboard:{title:"Model management"},table:{viewLabel:"Models",columns:{modelName:"Model name",modelProtocol:"Protocol",type:"Use type",dec:"Description",status:"Status",actions:"Actions"},statusHelpText:"Status is validated on first add; if the model goes offline, it will not update automatically. Delete the model manually if needed.",toolbar:{add:"Add",test:"Test model status",replace:"Replace model"},actionEdit:"Edit",actionAuth:"Authorize",actionDelete:"Delete",tooltipChecking:"Checking, please wait",tooltipNoPermission:"No permission"},status:{available:"Available",unavailable:"Unavailable",checking:"Checking"},empty:{noDataHint:"No data. Add a model first.",createModelBtn:"Add model"},drawer:{titleNew:"Add",titleEdit:"Edit",cancel:"Cancel",confirm:"Confirm"},form:{labels:{modelName:"Model name",modelIde:"Model ID",apiKey:"API Key",url:"Request URL",modelProtocol:"Protocol",type:"Use type",maxTokens:"Context length",dec:"Description"},placeholders:{modelName:"Enter model name",modelIde:"Enter model ID",apiKey:"Enter API Key",url:"Enter request URL"},maxTokensHelpText:"Confirm with your deployment team the model's max context length (Max Tokens) and any limits set by the inference service (e.g. vLLM)."},replaceModal:{title:"Replace model",warningParagraph:'When you replace a model, the system will update knowledge parsing, retrieval tests, and assistant configs. If you replace an Embedding model used for documents, all documents using it will be re-queued for parsing and become "Parsing"; unparsed documents will not be searchable until done.',sourceLabel:"Model name",targetLabel:"Replace with",placeholderSelect:"Select",cancel:"Cancel",confirm:"Confirm",messageSuccess:"Model replaced successfully"},message:{testSuccess:"Model check in progress. Status will update shortly.",deleteSuccess:"Deleted",createSuccess:"Model added.",editSuccess:"Model updated."},deleteConfirm:{title:"Confirm delete?",content:'Delete model "{{name}}"? This cannot be undone.',titleWhenInUse:"Delete model",contentWhenInUse:'This model is in use. Deleting it may affect document parsing, Q&A, and multimodal features. Use "Replace model" to switch to another model of the same type first, then delete.',okText:"OK",cancelText:"Cancel",deleteOkText:"Delete"},server:{requestError:"Request failed, please try again.",noPermission:"Insufficient permission",notLoggedIn:"Not logged in or token expired"}},je={common:{loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D..."},dashboard:{title:"\u30E2\u30C7\u30EB\u7BA1\u7406"},table:{viewLabel:"\u30E2\u30C7\u30EB",columns:{modelName:"\u30E2\u30C7\u30EB\u540D",modelProtocol:"\u30D7\u30ED\u30C8\u30B3\u30EB",type:"\u7528\u9014",dec:"\u8AAC\u660E",status:"\u72B6\u614B",actions:"\u64CD\u4F5C"},statusHelpText:"\u72B6\u614B\u306F\u521D\u56DE\u8FFD\u52A0\u6642\u306B\u691C\u8A3C\u3055\u308C\u307E\u3059\u3002\u30E2\u30C7\u30EB\u304C\u30AA\u30D5\u30E9\u30A4\u30F3\u306B\u306A\u3063\u3066\u3082\u81EA\u52D5\u3067\u306F\u66F4\u65B0\u3055\u308C\u307E\u305B\u3093\u3002\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u624B\u52D5\u3067\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",toolbar:{add:"\u65B0\u898F",test:"\u30E2\u30C7\u30EB\u72B6\u614B\u691C\u8A3C",replace:"\u30E2\u30C7\u30EB\u7F6E\u63DB"},actionEdit:"\u7DE8\u96C6",actionAuth:"\u6A29\u9650",actionDelete:"\u524A\u9664",tooltipChecking:"\u691C\u8A3C\u4E2D\u3001\u3057\u3070\u3089\u304F\u304A\u5F85\u3061\u304F\u3060\u3055\u3044",tooltipNoPermission:"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093"},status:{available:"\u5229\u7528\u53EF",unavailable:"\u5229\u7528\u4E0D\u53EF",checking:"\u691C\u8A3C\u4E2D"},empty:{noDataHint:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u5148\u306B\u30E2\u30C7\u30EB\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",createModelBtn:"\u30E2\u30C7\u30EB\u3092\u8FFD\u52A0"},drawer:{titleNew:"\u65B0\u898F",titleEdit:"\u7DE8\u96C6",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",confirm:"\u78BA\u8A8D"},form:{labels:{modelName:"\u30E2\u30C7\u30EB\u540D",modelIde:"\u30E2\u30C7\u30EBID",apiKey:"API\u30AD\u30FC",url:"\u30EA\u30AF\u30A8\u30B9\u30C8URL",modelProtocol:"\u30D7\u30ED\u30C8\u30B3\u30EB",type:"\u7528\u9014",maxTokens:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u9577",dec:"\u8AAC\u660E"},placeholders:{modelName:"\u30E2\u30C7\u30EB\u540D\u3092\u5165\u529B",modelIde:"\u30E2\u30C7\u30EBID\u3092\u5165\u529B",apiKey:"API\u30AD\u30FC\u3092\u5165\u529B",url:"\u30EA\u30AF\u30A8\u30B9\u30C8URL\u3092\u5165\u529B"},maxTokensHelpText:"\u30E2\u30C7\u30EB\u306E\u6700\u5927\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u9577\uFF08Max Tokens\uFF09\u3068\u63A8\u8AD6\u30B5\u30FC\u30D3\u30B9\uFF08vLLM\u7B49\uFF09\u306E\u5236\u9650\u3092\u30C7\u30D7\u30ED\u30A4\u62C5\u5F53\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},replaceModal:{title:"\u30E2\u30C7\u30EB\u7F6E\u63DB",warningParagraph:"\u30E2\u30C7\u30EB\u3092\u7F6E\u63DB\u3059\u308B\u3068\u3001\u77E5\u8B58\u89E3\u6790\u30FB\u691C\u7D22\u30C6\u30B9\u30C8\u30FB\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u8A2D\u5B9A\u304C\u66F4\u65B0\u3055\u308C\u307E\u3059\u3002\u6587\u66F8\u89E3\u6790\u7528Embedding\u30E2\u30C7\u30EB\u3092\u7F6E\u63DB\u3057\u305F\u5834\u5408\u3001\u305D\u306E\u30E2\u30C7\u30EB\u3092\u4F7F\u3046\u6587\u66F8\u306F\u518D\u89E3\u6790\u30AD\u30E5\u30FC\u306B\u5165\u308A\u300C\u89E3\u6790\u4E2D\u300D\u3068\u306A\u308A\u3001\u89E3\u6790\u5B8C\u4E86\u307E\u3067\u691C\u7D22\u3067\u304D\u307E\u305B\u3093\u3002",sourceLabel:"\u30E2\u30C7\u30EB\u540D",targetLabel:"\u7F6E\u63DB\u5148",placeholderSelect:"\u9078\u629E",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",confirm:"\u78BA\u8A8D",messageSuccess:"\u30E2\u30C7\u30EB\u3092\u7F6E\u63DB\u3057\u307E\u3057\u305F"},message:{testSuccess:"\u30E2\u30C7\u30EB\u3092\u691C\u8A3C\u4E2D\u3067\u3059\u3002\u72B6\u614B\u304C\u66F4\u65B0\u3055\u308C\u308B\u307E\u3067\u304A\u5F85\u3061\u304F\u3060\u3055\u3044\u3002",deleteSuccess:"\u524A\u9664\u3057\u307E\u3057\u305F",createSuccess:"\u30E2\u30C7\u30EB\u3092\u8FFD\u52A0\u3057\u307E\u3057\u305F\u3002",editSuccess:"\u30E2\u30C7\u30EB\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F\u3002"},deleteConfirm:{title:"\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",content:"\u30E2\u30C7\u30EB\u300C{{name}}\u300D\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002",titleWhenInUse:"\u30E2\u30C7\u30EB\u3092\u524A\u9664",contentWhenInUse:"\u3053\u306E\u30E2\u30C7\u30EB\u306F\u4F7F\u7528\u4E2D\u3067\u3059\u3002\u524A\u9664\u3059\u308B\u3068\u6587\u66F8\u89E3\u6790\u30FBQ&A\u30FB\u30DE\u30EB\u30C1\u30E2\u30FC\u30C0\u30EB\u306B\u5F71\u97FF\u3059\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\u5148\u306B\u300C\u30E2\u30C7\u30EB\u7F6E\u63DB\u300D\u3067\u540C\u7A2E\u306E\u30E2\u30C7\u30EB\u306B\u7F6E\u304D\u63DB\u3048\u3066\u304B\u3089\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",okText:"\u78BA\u8A8D",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB",deleteOkText:"\u524A\u9664"},server:{requestError:"\u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",noPermission:"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093",notLoggedIn:"\u672A\u30ED\u30B0\u30A4\u30F3\u307E\u305F\u306F\u30C8\u30FC\u30AF\u30F3\u671F\u9650\u5207\u308C"}},_e={zh:Y,en:Ke,ja:je};function $e(t,F){return t.replace(/\{\{(\w+)\}\}/g,(r,c)=>F[c]??"")}function Oe(t,F){const r=_e[t]??Y;return F?{...r,...F}:r}function Be(t,F){const r=F.split(".");let c=t;for(const B of r)c=c==null?void 0:c[B];return typeof c=="string"?c:F}const fe=Z.createContext({locale:"zh",messages:Y,getMessage:t=>Be(Y,t)});function le(){return Z.useContext(fe)}function Xe({locale:t,messages:F,children:r}){const c=Z.useMemo(()=>{const B=Oe(t,F);return{locale:t,messages:B,getMessage:h=>Be(B,h)}},[t,F]);return Z.createElement(fe.Provider,{value:c},r)}const Ze=Ue.div.attrs({className:"config-model-drawer-scroll-wrap"})`
1
+ import{jsx as l,jsxs as q}from"react/jsx-runtime";import Z,{useState as w,useMemo as j,useRef as oe,useEffect as Fe}from"react";import{message as z,Drawer as Re,Form as O,Modal as pe,Select as ce,Tooltip as se,Badge as ie}from"antd";import{Button as R,DashboardContainer as Ne}from"@mxmweb/zui";import{Xviwer as Ee}from"@mxmweb/xviewer";import Pe from"axios";import Ue from"styled-components";import{X as qe}from"./assets/x-CdZQbi--.js";import{T as He}from"./assets/triangle-alert-LqO4u4ts.js";/* empty css *//* empty css */import{P as ze}from"./assets/plus-B679mjyt.js";import"./assets/createLucideIcon-Bj5DlX2s.js";const Ve=""+new URL("assets/empty.png",import.meta.url).href,We=({url:t,token:F,role:r,eventsEmit:c,getMessage:B})=>{const h=(e,s)=>B?B(e):s,m=Pe.create({baseURL:t,timeout:1e6});return m.interceptors.request.use(e=>{let s=F;return!s&&!["user/login","user/kaptcha","user/regist"].some(n=>e.url.includes(n))?(c&&c("request:error_auth",{errorMsg:h("server.notLoggedIn","\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"),redirect:"/login"}),Promise.reject(new Error(h("server.notLoggedIn","\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F")))):(e.headers.Authorization=s||"",e.headers.userName=r==="\u672A\u767B\u5F55\u7528\u6237"?"":r,e)}),m.interceptors.response.use(e=>{const s=["user/kaptcha"],a=e.data;if(s.some(x=>e.config.url&&e.config.url.includes(x))||a.size&&a.type)return a;const{success:n,errorMsg:A,errorCode:b}=a;return n?a:c?(c("request:error_business",{errorCode:b,errorMsg:A||h("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"),response:a}),a):!1},e=>{var s,a,n,A,b,x,W,T,M;if(e.message==="canceled")return Promise.reject(e);if(c){let U="request:error_network",S={errorMsg:h("server.requestError","\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"),error:e};((s=e==null?void 0:e.response)==null?void 0:s.status)===401?(U="request:error_auth",S={errorMsg:h("server.noPermission","\u6CA1\u6709\u8DB3\u591F\u6743\u9650"),error:e,redirect:"/login"}):(((n=(a=e==null?void 0:e.response)==null?void 0:a.data)==null?void 0:n.errorCode)==="30013"||((b=(A=e==null?void 0:e.response)==null?void 0:A.data)==null?void 0:b.errorCode)==="30023")&&(U="request:error_business",S={errorCode:(W=(x=e==null?void 0:e.response)==null?void 0:x.data)==null?void 0:W.errorCode,errorMsg:((M=(T=e==null?void 0:e.response)==null?void 0:T.data)==null?void 0:M.message)||h("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"),error:e}),c(U,S)}return Promise.reject(e)}),{getModelList:async e=>{try{const s=await m.get(`/allPage?${new URLSearchParams(e).toString()}`),{success:a,data:n}=s;if(a)return n}catch(s){return console.log("getModelList error:",s),!1}},delModelById:async e=>{try{const s=await m.delete(`/delete?id=${e}`),{success:a,data:n}=s;if(a)return n}catch(s){console.log("delModelById error:",s)}},createModel:async e=>{try{const s=await m.post("/create",e),{success:a,data:n}=s;if(a)return n}catch(s){console.log("createModel error:",s)}},updateModelById:async e=>{try{const s=await m.put("/update",e),{success:a,data:n}=s;if(a)return n;console.log("====eee==",s),z.error(`\u4FDD\u5B58\u5931\u8D25: ${s==null?void 0:s.errorMsg}`)}catch(s){console.log("updateModelById error:",s)}},getUseTypeList:async()=>{try{const e=await m.get("/getModelTypes"),{success:s,data:a}=e;if(s)return a}catch(e){return console.log("getUseTypeList error:",e),!1}},getModelProtocolsList:async()=>{try{const e=await m.get("/getModelProtocols"),{success:s,data:a}=e;if(s)return a}catch(e){return console.log("getModelProtocolsList error:",e),!1}},testStatus:async()=>{try{const e=await m.post("/check"),{success:s,data:a}=e;if(s)return a}catch(e){console.log("testStatus error:",e)}},replaceModel:async(e,s)=>{try{const a=await m.get(`/replaceModel?sourceModelId=${e}&targetModelId=${s}`),{success:n,data:A}=a;if(n)return A}catch(a){console.log("replaceModel error:",a)}},checkModel:async e=>{try{const s=await m.get(`/checkModelReference?modelName=${e}`),{success:a,data:n}=s;if(a)return n}catch(s){console.log("checkModelReference error:",s)}}}},Y={common:{loading:"\u52A0\u8F7D\u4E2D..."},dashboard:{title:"\u6A21\u578B\u7BA1\u7406"},table:{viewLabel:"\u6A21\u578B",columns:{modelName:"\u6A21\u578B\u540D\u79F0",modelProtocol:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"\u4F7F\u7528\u7C7B\u578B",dec:"\u8BF4\u660E",status:"\u72B6\u6001",actions:"\u64CD\u4F5C"},statusHelpText:"\u5F53\u524D\u6A21\u578B\u72B6\u6001\u4E3A\u521D\u6B21\u65B0\u589E\u6821\u9A8C\u72B6\u6001\uFF0C\u82E5\u6A21\u578B\u4E0B\u7EBF\uFF0C\u6B64\u72B6\u6001\u4E0D\u4F1A\u4E3B\u52A8\u66F4\u65B0\uFF0C\u9700\u624B\u52A8\u6267\u884C\u6A21\u578B\u5220\u9664",toolbar:{add:"\u65B0\u5EFA",test:"\u6A21\u578B\u72B6\u6001\u68C0\u6D4B",replace:"\u6A21\u578B\u66FF\u6362"},actionEdit:"\u7F16\u8F91",actionAuth:"\u6388\u6743",actionDelete:"\u5220\u9664",tooltipChecking:"\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u7A0D\u540E",tooltipNoPermission:"\u89D2\u8272\u65E0\u6743\u9650\u64CD\u4F5C"},status:{available:"\u53EF\u7528",unavailable:"\u4E0D\u53EF\u7528",checking:"\u68C0\u6D4B\u4E2D"},empty:{noDataHint:"\u6682\u65E0\u6570\u636E\uFF0C\u8BF7\u5148\u65B0\u5EFA\u6A21\u578B",createModelBtn:"\u65B0\u5EFA\u6A21\u578B"},drawer:{titleNew:"\u65B0\u5EFA",titleEdit:"\u7F16\u8F91",cancel:"\u53D6\u6D88",confirm:"\u786E\u8BA4"},form:{labels:{modelName:"\u6A21\u578B\u540D\u79F0",modelIde:"\u6A21\u578BID",apiKey:"APIKey",url:"\u8BF7\u6C42URL",modelProtocol:"\u6A21\u578B\u4F20\u8F93\u534F\u8BAE",type:"\u4F7F\u7528\u7C7B\u578B",maxTokens:"\u4E0A\u4E0B\u6587\u957F\u5EA6",dec:"\u8BF4\u660E"},placeholders:{modelName:"\u8BF7\u8F93\u5165\u6A21\u578B\u540D\u79F0",modelIde:"\u8BF7\u8F93\u5165\u6A21\u578BID",apiKey:"\u8BF7\u8F93\u5165APIKey",url:"\u8BF7\u8F93\u5165\u8BF7\u6C42URL"},maxTokensHelpText:"\u8BF7\u5411\u6A21\u578B\u90E8\u7F72\u6216\u8FD0\u7EF4\u4EBA\u5458\u786E\u8BA4\u5F53\u524D\u6A21\u578B\u7684\u6700\u5927\u4E0A\u4E0B\u6587\u957F\u5EA6\uFF08Max Tokens / Context Length\uFF09\uFF0C\u5E76\u786E\u8BA4\u63A8\u7406\u670D\u52A1\uFF08\u5982 vLLM\uFF09\u662F\u5426\u914D\u7F6E\u4E86\u989D\u5916\u7684\u8F93\u5165\u957F\u5EA6\u9650\u5236"},replaceModal:{title:"\u6A21\u578B\u66FF\u6362",warningParagraph:"\u5982\u9700\u66F4\u6362\u6A21\u578B\uFF0C\u5728\u4E00\u952E\u66FF\u6362\u65F6\uFF0C\u7CFB\u7EDF\u5C06\u81EA\u52A8\u66F4\u65B0\u77E5\u8BC6\u89E3\u6790\u914D\u7F6E\u3001\u68C0\u7D22\u6D4B\u8BD5\u548C\u52A9\u624B\u914D\u7F6E\u4E2D\u7684\u6A21\u578B\u3002\u82E5\u66FF\u6362\u7684\u662F\u6587\u6863\u89E3\u6790\u7528\u7684Embedding\u6A21\u578B\uFF0C\u5219\u4F7F\u7528\u8BE5\u6A21\u578B\u7684\u6587\u6863\u5C06\u5168\u90E8\u91CD\u65B0\u6392\u961F\u89E3\u6790\uFF0C\u72B6\u6001\u53D8\u4E3A\u201C\u89E3\u6790\u4E2D\u201D\uFF0C\u4E14\u672A\u89E3\u6790\u5B8C\u6210\u7684\u6587\u6863\u6682\u4E0D\u53EF\u68C0\u7D22\uFF01",sourceLabel:"\u6A21\u578B\u540D\u79F0",targetLabel:"\u66FF\u6362\u4E3A",placeholderSelect:"\u8BF7\u9009\u62E9",cancel:"\u53D6\u6D88",confirm:"\u786E\u8BA4",messageSuccess:"\u6A21\u578B\u66FF\u6362\u6210\u529F"},message:{testSuccess:"\u6A21\u578B\u68C0\u6D4B\u4E2D\uFF0C\u8BF7\u8010\u5FC3\u7B49\u5F85\u72B6\u6001\u66F4\u65B0\uFF01",deleteSuccess:"\u5220\u9664\u6210\u529F",createSuccess:"\u6A21\u578B\u65B0\u589E\u6210\u529F\uFF01",editSuccess:"\u6A21\u578B\u7F16\u8F91\u6210\u529F\uFF01"},deleteConfirm:{title:"\u786E\u8BA4\u5220\u9664\uFF1F",content:'\u786E\u5B9A\u8981\u5220\u9664\u6A21\u578B "{{name}}" \u5417\uFF1F\u6B64\u64CD\u4F5C\u4E0D\u53EF\u6062\u590D\u3002',titleWhenInUse:"\u5220\u9664\u6A21\u578B",contentWhenInUse:"\u5F53\u524D\u6A21\u578B\u5728\u7CFB\u7EDF\u5185\u5DF2\u88AB\u914D\u7F6E\u4F7F\u7528\uFF0C\u5220\u9664\u53EF\u80FD\u5F71\u54CD\u6587\u6863\u89E3\u6790\u3001\u95EE\u7B54\u3001\u591A\u6A21\u6001\u80FD\u529B\u4F7F\u7528\u7B49\uFF0C\u8BF7\u60A8\u5148\u4F7F\u7528\u201C\u6A21\u578B\u4E00\u952E\u66FF\u6362\u201D\u80FD\u529B\u5C06\u8BE5\u6A21\u578B\u66FF\u6362\u4E3A\u540C\u7C7B\u578B\u6A21\u578B\uFF0C\u518D\u5220\u9664\u6A21\u578B",okText:"\u786E\u8BA4",cancelText:"\u53D6\u6D88",deleteOkText:"\u5220\u9664"},server:{requestError:"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",noPermission:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",notLoggedIn:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"}},Ke={common:{loading:"Loading..."},dashboard:{title:"Model management"},table:{viewLabel:"Models",columns:{modelName:"Model name",modelProtocol:"Protocol",type:"Use type",dec:"Description",status:"Status",actions:"Actions"},statusHelpText:"Status is validated on first add; if the model goes offline, it will not update automatically. Delete the model manually if needed.",toolbar:{add:"Add",test:"Test model status",replace:"Replace model"},actionEdit:"Edit",actionAuth:"Authorize",actionDelete:"Delete",tooltipChecking:"Checking, please wait",tooltipNoPermission:"No permission"},status:{available:"Available",unavailable:"Unavailable",checking:"Checking"},empty:{noDataHint:"No data. Add a model first.",createModelBtn:"Add model"},drawer:{titleNew:"Add",titleEdit:"Edit",cancel:"Cancel",confirm:"Confirm"},form:{labels:{modelName:"Model name",modelIde:"Model ID",apiKey:"API Key",url:"Request URL",modelProtocol:"Protocol",type:"Use type",maxTokens:"Context length",dec:"Description"},placeholders:{modelName:"Enter model name",modelIde:"Enter model ID",apiKey:"Enter API Key",url:"Enter request URL"},maxTokensHelpText:"Confirm with your deployment team the model's max context length (Max Tokens) and any limits set by the inference service (e.g. vLLM)."},replaceModal:{title:"Replace model",warningParagraph:'When you replace a model, the system will update knowledge parsing, retrieval tests, and assistant configs. If you replace an Embedding model used for documents, all documents using it will be re-queued for parsing and become "Parsing"; unparsed documents will not be searchable until done.',sourceLabel:"Model name",targetLabel:"Replace with",placeholderSelect:"Select",cancel:"Cancel",confirm:"Confirm",messageSuccess:"Model replaced successfully"},message:{testSuccess:"Model check in progress. Status will update shortly.",deleteSuccess:"Deleted",createSuccess:"Model added.",editSuccess:"Model updated."},deleteConfirm:{title:"Confirm delete?",content:'Delete model "{{name}}"? This cannot be undone.',titleWhenInUse:"Delete model",contentWhenInUse:'This model is in use. Deleting it may affect document parsing, Q&A, and multimodal features. Use "Replace model" to switch to another model of the same type first, then delete.',okText:"OK",cancelText:"Cancel",deleteOkText:"Delete"},server:{requestError:"Request failed, please try again.",noPermission:"Insufficient permission",notLoggedIn:"Not logged in or token expired"}},je={common:{loading:"\u8AAD\u307F\u8FBC\u307F\u4E2D..."},dashboard:{title:"\u30E2\u30C7\u30EB\u7BA1\u7406"},table:{viewLabel:"\u30E2\u30C7\u30EB",columns:{modelName:"\u30E2\u30C7\u30EB\u540D",modelProtocol:"\u30D7\u30ED\u30C8\u30B3\u30EB",type:"\u7528\u9014",dec:"\u8AAC\u660E",status:"\u72B6\u614B",actions:"\u64CD\u4F5C"},statusHelpText:"\u72B6\u614B\u306F\u521D\u56DE\u8FFD\u52A0\u6642\u306B\u691C\u8A3C\u3055\u308C\u307E\u3059\u3002\u30E2\u30C7\u30EB\u304C\u30AA\u30D5\u30E9\u30A4\u30F3\u306B\u306A\u3063\u3066\u3082\u81EA\u52D5\u3067\u306F\u66F4\u65B0\u3055\u308C\u307E\u305B\u3093\u3002\u5FC5\u8981\u306B\u5FDC\u3058\u3066\u624B\u52D5\u3067\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",toolbar:{add:"\u65B0\u898F",test:"\u30E2\u30C7\u30EB\u72B6\u614B\u691C\u8A3C",replace:"\u30E2\u30C7\u30EB\u7F6E\u63DB"},actionEdit:"\u7DE8\u96C6",actionAuth:"\u6A29\u9650",actionDelete:"\u524A\u9664",tooltipChecking:"\u691C\u8A3C\u4E2D\u3001\u3057\u3070\u3089\u304F\u304A\u5F85\u3061\u304F\u3060\u3055\u3044",tooltipNoPermission:"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093"},status:{available:"\u5229\u7528\u53EF",unavailable:"\u5229\u7528\u4E0D\u53EF",checking:"\u691C\u8A3C\u4E2D"},empty:{noDataHint:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u5148\u306B\u30E2\u30C7\u30EB\u3092\u8FFD\u52A0\u3057\u3066\u304F\u3060\u3055\u3044\u3002",createModelBtn:"\u30E2\u30C7\u30EB\u3092\u8FFD\u52A0"},drawer:{titleNew:"\u65B0\u898F",titleEdit:"\u7DE8\u96C6",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",confirm:"\u78BA\u8A8D"},form:{labels:{modelName:"\u30E2\u30C7\u30EB\u540D",modelIde:"\u30E2\u30C7\u30EBID",apiKey:"API\u30AD\u30FC",url:"\u30EA\u30AF\u30A8\u30B9\u30C8URL",modelProtocol:"\u30D7\u30ED\u30C8\u30B3\u30EB",type:"\u7528\u9014",maxTokens:"\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u9577",dec:"\u8AAC\u660E"},placeholders:{modelName:"\u30E2\u30C7\u30EB\u540D\u3092\u5165\u529B",modelIde:"\u30E2\u30C7\u30EBID\u3092\u5165\u529B",apiKey:"API\u30AD\u30FC\u3092\u5165\u529B",url:"\u30EA\u30AF\u30A8\u30B9\u30C8URL\u3092\u5165\u529B"},maxTokensHelpText:"\u30E2\u30C7\u30EB\u306E\u6700\u5927\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8\u9577\uFF08Max Tokens\uFF09\u3068\u63A8\u8AD6\u30B5\u30FC\u30D3\u30B9\uFF08vLLM\u7B49\uFF09\u306E\u5236\u9650\u3092\u30C7\u30D7\u30ED\u30A4\u62C5\u5F53\u306B\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002"},replaceModal:{title:"\u30E2\u30C7\u30EB\u7F6E\u63DB",warningParagraph:"\u30E2\u30C7\u30EB\u3092\u7F6E\u63DB\u3059\u308B\u3068\u3001\u77E5\u8B58\u89E3\u6790\u30FB\u691C\u7D22\u30C6\u30B9\u30C8\u30FB\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u8A2D\u5B9A\u304C\u66F4\u65B0\u3055\u308C\u307E\u3059\u3002\u6587\u66F8\u89E3\u6790\u7528Embedding\u30E2\u30C7\u30EB\u3092\u7F6E\u63DB\u3057\u305F\u5834\u5408\u3001\u305D\u306E\u30E2\u30C7\u30EB\u3092\u4F7F\u3046\u6587\u66F8\u306F\u518D\u89E3\u6790\u30AD\u30E5\u30FC\u306B\u5165\u308A\u300C\u89E3\u6790\u4E2D\u300D\u3068\u306A\u308A\u3001\u89E3\u6790\u5B8C\u4E86\u307E\u3067\u691C\u7D22\u3067\u304D\u307E\u305B\u3093\u3002",sourceLabel:"\u30E2\u30C7\u30EB\u540D",targetLabel:"\u7F6E\u63DB\u5148",placeholderSelect:"\u9078\u629E",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",confirm:"\u78BA\u8A8D",messageSuccess:"\u30E2\u30C7\u30EB\u3092\u7F6E\u63DB\u3057\u307E\u3057\u305F"},message:{testSuccess:"\u30E2\u30C7\u30EB\u3092\u691C\u8A3C\u4E2D\u3067\u3059\u3002\u72B6\u614B\u304C\u66F4\u65B0\u3055\u308C\u308B\u307E\u3067\u304A\u5F85\u3061\u304F\u3060\u3055\u3044\u3002",deleteSuccess:"\u524A\u9664\u3057\u307E\u3057\u305F",createSuccess:"\u30E2\u30C7\u30EB\u3092\u8FFD\u52A0\u3057\u307E\u3057\u305F\u3002",editSuccess:"\u30E2\u30C7\u30EB\u3092\u66F4\u65B0\u3057\u307E\u3057\u305F\u3002"},deleteConfirm:{title:"\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",content:"\u30E2\u30C7\u30EB\u300C{{name}}\u300D\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F\u5143\u306B\u623B\u305B\u307E\u305B\u3093\u3002",titleWhenInUse:"\u30E2\u30C7\u30EB\u3092\u524A\u9664",contentWhenInUse:"\u3053\u306E\u30E2\u30C7\u30EB\u306F\u4F7F\u7528\u4E2D\u3067\u3059\u3002\u524A\u9664\u3059\u308B\u3068\u6587\u66F8\u89E3\u6790\u30FBQ&A\u30FB\u30DE\u30EB\u30C1\u30E2\u30FC\u30C0\u30EB\u306B\u5F71\u97FF\u3059\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059\u3002\u5148\u306B\u300C\u30E2\u30C7\u30EB\u7F6E\u63DB\u300D\u3067\u540C\u7A2E\u306E\u30E2\u30C7\u30EB\u306B\u7F6E\u304D\u63DB\u3048\u3066\u304B\u3089\u524A\u9664\u3057\u3066\u304F\u3060\u3055\u3044\u3002",okText:"\u78BA\u8A8D",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB",deleteOkText:"\u524A\u9664"},server:{requestError:"\u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",noPermission:"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093",notLoggedIn:"\u672A\u30ED\u30B0\u30A4\u30F3\u307E\u305F\u306F\u30C8\u30FC\u30AF\u30F3\u671F\u9650\u5207\u308C"}},_e={zh:Y,en:Ke,ja:je};function $e(t,F){return t.replace(/\{\{(\w+)\}\}/g,(r,c)=>F[c]??"")}function Oe(t,F){const r=_e[t]??Y;return F?{...r,...F}:r}function Be(t,F){const r=F.split(".");let c=t;for(const B of r)c=c==null?void 0:c[B];return typeof c=="string"?c:F}const fe=Z.createContext({locale:"zh",messages:Y,getMessage:t=>Be(Y,t)});function le(){return Z.useContext(fe)}function Xe({locale:t,messages:F,children:r}){const c=Z.useMemo(()=>{const B=Oe(t,F);return{locale:t,messages:B,getMessage:h=>Be(B,h)}},[t,F]);return Z.createElement(fe.Provider,{value:c},r)}const Ze=Ue.div.attrs({className:"config-model-drawer-scroll-wrap"})`
2
2
  width: 100%;
3
3
  flex: 1 1 0;
4
4
  min-height: min-content;
@@ -11,4 +11,4 @@ import{jsx as l,jsxs as q}from"react/jsx-runtime";import Z,{useState as w,useMem
11
11
  overflow: visible !important;
12
12
  min-height: min-content !important;
13
13
  }
14
- `,Ye=({drawerTitle:t,drawerVisible:F,modelInfo:r,handleDrawerClose:c,modelUseTypeOpt:B,modelProtocolsOpt:h,eventsEmit:m})=>{const{messages:d}=le(),[u,N]=w(!1),[P,I]=w(!1),D=j(()=>({id:"config-model",layout:"vertical",formWidth:"550px",fields:[{id:"modelName",name:"modelName",label:d.form.labels.modelName,type:"input",required:!0,placeholder:d.form.placeholders.modelName,counter:30},{id:"modelIde",name:"modelIde",label:d.form.labels.modelIde,type:"input",required:!0,placeholder:d.form.placeholders.modelIde,defaultValue:""},{id:"apiKey",name:"apiKey",label:d.form.labels.apiKey,type:"input",required:!1,placeholder:d.form.placeholders.apiKey,defaultValue:""},{id:"url",name:"url",label:d.form.labels.url,type:"input",required:!0,placeholder:d.form.placeholders.url,defaultValue:""},{id:"modelProtocol",name:"modelProtocol",label:d.form.labels.modelProtocol,type:"select",required:!0,options:Array.isArray(h)?h:[]},{id:"type",name:"type",label:d.form.labels.type,type:"select",required:!0,options:Array.isArray(B)?B:[],defaultValue:1,controlledItems:{2:{defaults:{maxTokens:512}}}},{id:"maxTokens",name:"maxTokens",label:d.form.labels.maxTokens,type:"slider",range:{max:1e5,min:200},step:1,sliderInline:!0,required:!0,helpText:d.form.maxTokensHelpText},{id:"dec",name:"dec",label:d.form.labels.dec,type:"textarea",required:!1}]}),[d,B,h]),p=oe(null),V=async(a,n,A)=>{var b;switch(console.log("[Form] eventsEmit:",a,n,A),a){case"form:ready":n.formRef&&(p.current=n.formRef);break;case"form:change":if(!((b=p.current)!=null&&b.getValue)){console.log("\u8868\u5355\u5F15\u7528\u672A\u5C31\u7EEA\uFF0C\u8DF3\u8FC7 formdata_onchange \u4E8B\u4EF6");return}const x=await p.current.getValue("type");x==2||x==3?I(!0):I(!1);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,n)}m==null||m(a,n,A)},_=async()=>{try{N(!0);const a=await p.current.getAllData();a.isValid&&(r!=null&&r.id?await m("form_submitted_edit",a,void 0):await m("form_submitted_add",a,void 0))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{N(!1)}},e=j(()=>{const a=r==null?void 0:r.data.reduce((n,A)=>(n[A.columnId]=A.value,n),{});return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:D.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:D.id,type:"form",size:"md",formWidth:D.formWidth,formConfig:{layout:D.layout,showReset:!1,showSubmit:!1,formWidth:D.formWidth}}],dataSource:[{id:D.id,fields:D.fields,defaultValues:a||{}}],eventsEmit:V}},[r,P,D]),s=j(()=>{const n=(Array.isArray(e.dataSource)?e.dataSource:[]).map(b=>{const x=b==null?void 0:b.fields,T=(Array.isArray(x)?x:[]).map(M=>({...M,options:M&&"options"in M?Array.isArray(M.options)?M.options:[]:void 0,controlledItems:M==null?void 0:M.controlledItems}));return{...b,fields:T}}),A=Array.isArray(e.views)?e.views:[];return{...e,views:A,dataSource:n}},[e]);return l(Re,{title:t,placement:"right",width:560,onClose:c,closeIcon:!1,extra:l(qe,{size:20,color:"#888888",onClick:c,className:"cursor-pointer"}),open:F,destroyOnHidden:!0,rootClassName:"config-model-drawer",styles:{body:{display:"flex",flexDirection:"column",flex:1,minHeight:0,overflowY:"auto",overflowX:"hidden"}},footer:q("div",{className:"flex justify-end items-center gap-3",children:[l(R,{mode:"default",label:d.drawer.cancel,onClick:c}),l(R,{mode:"primary",label:d.drawer.confirm,loading:u,onClick:_})]}),children:l(Ze,{children:l(Ee,{...s},"example-form")})})},{Item:de}=O,Ge=({modelVisible:t,options:F,eventsEmit:r,replaceModel:c})=>{const{messages:B}=le(),[h,m]=w(!1),[d]=O.useForm(),u=O.useWatch("sourceModelId",d),N=j(()=>{const I=F.find(D=>D.value==u);return I?F.filter(p=>p.useType==I.useType&&p.value!==u&&p.status==1):[]},[u]);Fe(()=>{u&&d.setFieldValue("targetModelId",void 0)},[u]);const P=async()=>{try{m(!0);const I=await d.validateFields(),{sourceModelId:D,targetModelId:p}=I;await c(D,p)&&(z.success(B.replaceModal.messageSuccess),d.resetFields(),r&&r("replace_model"))}catch(I){console.log("e---->",I)}finally{m(!1)}};return q(pe,{open:t,title:B.replaceModal.title,width:620,destroyOnHidden:!0,onCancel:()=>{d.resetFields(),r&&r("close_model")},footer:q("div",{className:"flex justify-end gap-3",style:{justifyContent:"end",margin:"20px 4px"},children:[l(R,{mode:"default",label:B.replaceModal.cancel,onClick:()=>{d.resetFields(),r&&r("close_model")}}),l(R,{mode:"primary",label:B.replaceModal.confirm,loading:h,onClick:P})]}),children:[q("div",{className:"flex gap-3",style:{margin:"20px 4px"},children:[l("div",{children:l(He,{size:22,color:"#f4a02a"})}),l("span",{className:"text-[14px]",children:B.replaceModal.warningParagraph})]}),q(O,{form:d,colon:!1,labelCol:{span:5},wrapperCol:{span:18},style:{margin:"40px 60px"},children:[l(de,{label:B.replaceModal.sourceLabel,name:"sourceModelId",rules:[{required:!0,message:""}],children:l(ce,{placeholder:B.replaceModal.placeholderSelect,options:F})}),l(de,{label:B.replaceModal.targetLabel,name:"targetModelId",rules:[{required:!0,message:""}],children:l(ce,{placeholder:B.replaceModal.placeholderSelect,options:N})})]})]})},te={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},ae=[{statusType:"success",value:"\u53EF\u7528",status:1},{statusType:"error",value:"\u4E0D\u53EF\u7528",status:0},{statusType:"warning",value:"\u68C0\u6D4B\u4E2D",status:2}],Qe=t=>typeof t=="string"&&t in te?te[t]:te.default;var X=(t=>(t[t.DATE=0]="DATE",t[t.VIEW=1]="VIEW",t[t.ERROR=2]="ERROR",t[t.AUTHORIZE=3]="AUTHORIZE",t[t.DELETE=4]="DELETE",t[t.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",t[t.DOWNLOAD=6]="DOWNLOAD",t[t.EDIT=7]="EDIT",t[t.ADD=8]="ADD",t[t.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",t[t.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",t))(X||{});const{confirm:me}=pe,Je={pageNum:1,pageSize:1e3},eu=t=>{const{value:F,cell:r}=t,c=Qe(t.cell.statusType);return r.status===0?l(se,{title:r.errorMsg,children:l("div",{className:"flex items-center gap-2",children:l(ie,{color:c,text:F})})}):l(ie,{color:c,text:F})};function uu(t){const{url:F,token:r,role:c,CustomComponents:B,eventsEmit:h,getBtnDisabled:m,showModelReplace:d}=t,{messages:u,getMessage:N,locale:P}=le(),[I,D]=w({container:"ready",content:"ready"}),p=oe(null),[V,_]=w(),e=oe(null),[s,a]=w(!1),[n,A]=w(!1),[b,x]=w([]),[W,T]=w(!1),[M,U]=w(""),[S,re]=w(),[G,Ae]=w([]),[Q,Ce]=w([]),{getModelList:ge,delModelById:De,createModel:ye,updateModelById:he,getUseTypeList:be,getModelProtocolsList:Me,testStatus:ve,replaceModel:we,checkModel:Ie}=We({url:F,token:r,role:c,eventsEmit:h,getMessage:N});Fe(()=>(D(i=>({...i,content:"loading"})),J(),ke(),()=>{e.current&&(clearTimeout(e.current),e.current=null)}),[]);const xe=i=>(i||[]).map(o=>{const f=ae.find(y=>y.status==o.status),E=o.status===1?u.status.available:o.status===0?u.status.unavailable:u.status.checking;return{id:o.id,data:[{columnId:"modelName",value:o.modelName},{columnId:"modelProtocol",value:o.modelProtocol,type:"customized"},{columnId:"type",value:o.type,type:"customized"},{columnId:"dec",value:o.dec},{columnId:"status",...f,value:E,type:"customized",errorMsg:o.errorMsg},{columnId:"actions",value:"edit",label:u.table.actionEdit,status:o.status,type:"action",disabled:m&&m(X.EDIT,o.permission)},{columnId:"actions",value:"auth",label:u.table.actionAuth,type:"action",status:o.status,disabled:m&&m(X.AUTHORIZE,o.permission)},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action",status:o.status,disabled:m&&m(X.AUTHORIZE,o.permission)},{columnId:"url",value:o.url},{columnId:"apiKey",value:o.apiKey},{columnId:"modelIde",value:o.modelIde},{columnId:"thinking",value:o.thinking},{columnId:"maxTokens",value:o.maxTokens}]}}),ke=async()=>{try{const[i,o]=await Promise.allSettled([be(),Me()]);if(i.status==="fulfilled"&&i.value){const f=i.value,E=Array.isArray(f)?f:[];Ae(E.map(y=>({...y,value:Number(y.value)})))}if(o.status==="fulfilled"&&o.value){const f=o.value,E=Array.isArray(f)?f:[];Ce(E.map(y=>({...y,value:Number(y.value)})))}}catch(i){console.error("[TableApiError] getTableList:",i)}},ne=async()=>{try{const i=await ge(Je);if(i.records){const o=xe(i.records),f=(i.records||[]).map(E=>({value:E.id,label:E.modelName,useType:E.type,status:E.status}));return x(f),_(o||[]),D(E=>({...E,content:"ready"})),o||[]}}catch(i){console.error("[TableApiError] getTableList:",i)}},J=async()=>{const i=await ne();Le(i||[])?e.current&&(clearTimeout(e.current),e.current=null):(e.current&&(clearTimeout(e.current),e.current=null),e.current=setTimeout(()=>{J()},5e3))};function Le(i){if(!Array.isArray(i))return!0;for(const o of i)if(o.data){const f=o.data.find(E=>E.columnId==="status");if(f&&f.status===2)return!1}return!0}const Se=j(()=>({defaultActiveId:"model-table",model:null,views:[{label:u.table.viewLabel,id:"model-table",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,paginationLocale:P,columns:[{id:"modelName",title:u.table.columns.modelName,type:"label"},{id:"modelProtocol",title:u.table.columns.modelProtocol,type:"customized",component:i=>{var E;const{value:o}=i,f=(E=Q.find(y=>y.value==o))==null?void 0:E.label;return l("span",{children:f})}},{id:"type",title:u.table.columns.type,type:"customized",component:i=>{var E;const{value:o}=i,f=(E=G.find(y=>y.value==o))==null?void 0:E.label;return l("span",{children:f})}},{id:"dec",title:u.table.columns.dec,type:"paragraph"},{id:"status",title:u.table.columns.status,type:"customized",component:l(eu,{}),helpText:u.table.statusHelpText},{id:"actions",title:u.table.columns.actions,type:"customized",component:i=>{const{value:o,cell:f,row:E}=i,{disabled:y,label:H,status:$}=f;return $==2?l(se,{title:u.table.tooltipChecking,children:l(R,{mode:"text",label:H,disabled:!0})}):y?l(se,{title:u.table.tooltipNoPermission,children:l(R,{mode:"text",label:H,disabled:y})}):l(R,{mode:"text",label:H,onClick:()=>K(`table_action_${o}`,E,void 0)})}}],toolbar:[{type:"button",btnType:"primary",key:"add",label:u.table.toolbar.add,icon:l(ze,{size:14})},...d?[{type:"customized",key:"test",render:()=>l(R,{loading:s,mode:"primary",label:u.table.toolbar.test,onClick:()=>K("toolbar_test")})},{type:"button",btnType:"primary",key:"replace",label:u.table.toolbar.replace}]:[]]}]}),[u,P,G,Q,s,d]),Te=()=>q("div",{className:"flex flex-col items-center justify-center h-full",children:[l("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:l("img",{src:Ve,width:120})}),l("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:u.empty.noDataHint}),l("div",{className:"flex gap-3",children:l(R,{mode:"primary",label:u.empty.createModelBtn,onClick:()=>{U(u.drawer.titleNew),T(!0)}})})]});async function K(i,o,f){var E,y,H,$;switch(console.log("[adopter] mergedEventsEmit",i,o,f),i){case"toolbar_add":{U(u.drawer.titleNew),T(!0);break}case"toolbar_test":{a(!0),await ve()&&(a(!1),await J(),z.success(u.message.testSuccess));break}case"toolbar_replace":{A(!0);break}case"table_action_delete":{try{const k=o.data.find(v=>v.columnId=="modelName").value;if(await Ie(k)>0)me({title:u.deleteConfirm.titleWhenInUse,content:l("div",{style:{marginRight:"20px"},children:u.deleteConfirm.contentWhenInUse}),okText:u.deleteConfirm.okText,cancelText:u.deleteConfirm.cancelText});else{const v=o.data.find(L=>L.columnId=="modelName").value;me({title:u.deleteConfirm.title,content:$e(u.deleteConfirm.content,{name:v}),okText:u.deleteConfirm.deleteOkText,cancelText:u.deleteConfirm.cancelText,async onOk(){await De(o.id)&&(p!=null&&p.current)&&(p==null||p.current.appFn.removeItem(o.id),z.success(u.message.deleteSuccess))}})}}catch(k){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25",k)}break}case"table_action_edit":{U(u.drawer.titleEdit),T(!0),re(o);break}case"form_submitted_add":{try{const k=o.fields.reduce((v,L)=>(v[L.name]=L.value,v),{}),C=await ye({...k});if(C){const v=ae.find(g=>g.status==C.status),L=C.status===1?u.status.available:C.status===0?u.status.unavailable:u.status.checking,ue={id:C.id,data:[...(Object.keys(C)||[]).map(g=>g==="status"?{columnId:g,value:L,...v,type:"customized",errorMsg:C.errorMsg}:{columnId:g,value:C[g],...(g=="modelProtocol"||g=="type")&&{type:"customized"}}),{columnId:"actions",value:"edit",label:u.table.actionEdit,type:"action"},{columnId:"actions",value:"auth",label:u.table.actionAuth,type:"action"},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action"}]};(y=(E=p==null?void 0:p.current)==null?void 0:E.appFn)==null||y.addItem(ue,{animate:!0,position:"start"}),z.success(u.message.createSuccess),ee()}}catch(k){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",k)}finally{}break}case"form_submitted_edit":{try{const k=o.fields.reduce((v,L)=>(v[L.name]=L.value,v),{}),C=await he({...k,id:S.id});if(console.log("======res",C),C){const v=ae.find(g=>g.status==C.status),L=C.status===1?u.status.available:C.status===0?u.status.unavailable:u.status.checking,ue={...S,data:S.data.map(g=>{if(C[g.columnId]!==null&&C[g.columnId]!==void 0){if(g.columnId=="status")return{...g,...v,value:L};g.value=C[g.columnId]}return g})};($=(H=p==null?void 0:p.current)==null?void 0:H.appFn)==null||$.updateItem(ue,S==null?void 0:S.id),z.success(u.message.editSuccess),ee()}}catch(k){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",k)}break}case"replace_model":{await ne(),A(!1);break}case"close_model":{A(!1);break}default:typeof t.eventsEmit=="function"&&t.eventsEmit(i,o);break}}const ee=()=>{T(!1),re(void 0)};return q(Ne,{title:u.dashboard.title,children:[l(Ee,{dataSource:V,ref:p,eventsEmit:K,status:I,CustomComponents:{EmptyData:Te,...B},...Se}),l(Ye,{drawerTitle:M,drawerVisible:W,handleDrawerClose:ee,modelInfo:S,modelUseTypeOpt:G,modelProtocolsOpt:Q,eventsEmit:K}),l(Ge,{modelVisible:n,options:b,eventsEmit:K,replaceModel:we})]})}function pu(t){const{locale:F="zh",messages:r,...c}=t;return l(Xe,{locale:F,messages:r,children:l(uu,{...c})})}export{fe as ModelManageI18nContext,Xe as ModelManageI18nProvider,pu as default,Oe as getModelManageMessages,$e as interpolateModelManage,le as useModelManageI18n};
14
+ `,Ye=({drawerTitle:t,drawerVisible:F,modelInfo:r,handleDrawerClose:c,modelUseTypeOpt:B,modelProtocolsOpt:h,eventsEmit:m})=>{const{messages:d}=le(),[u,N]=w(!1),[P,I]=w(!1),D=j(()=>({id:"config-model",layout:"vertical",formWidth:"550px",fields:[{id:"modelName",name:"modelName",label:d.form.labels.modelName,type:"input",required:!0,placeholder:d.form.placeholders.modelName,counter:30},{id:"modelIde",name:"modelIde",label:d.form.labels.modelIde,type:"input",required:!0,placeholder:d.form.placeholders.modelIde,defaultValue:""},{id:"apiKey",name:"apiKey",label:d.form.labels.apiKey,type:"input",required:!1,placeholder:d.form.placeholders.apiKey,defaultValue:""},{id:"url",name:"url",label:d.form.labels.url,type:"input",required:!0,placeholder:d.form.placeholders.url,defaultValue:""},{id:"modelProtocol",name:"modelProtocol",label:d.form.labels.modelProtocol,type:"select",required:!0,options:Array.isArray(h)?h:[]},{id:"type",name:"type",label:d.form.labels.type,type:"select",required:!0,options:Array.isArray(B)?B:[],defaultValue:1,controlledItems:{2:{defaults:{maxTokens:512}}}},{id:"maxTokens",name:"maxTokens",label:d.form.labels.maxTokens,type:"slider",range:{max:1e5,min:200},step:1,sliderInline:!0,required:!0,helpText:d.form.maxTokensHelpText},{id:"dec",name:"dec",label:d.form.labels.dec,type:"textarea",required:!1}]}),[d,B,h]),p=oe(null),V=async(a,n,A)=>{var b;switch(console.log("[Form] eventsEmit:",a,n,A),a){case"form:ready":n.formRef&&(p.current=n.formRef);break;case"form:change":if(!((b=p.current)!=null&&b.getValue)){console.log("\u8868\u5355\u5F15\u7528\u672A\u5C31\u7EEA\uFF0C\u8DF3\u8FC7 formdata_onchange \u4E8B\u4EF6");return}const x=await p.current.getValue("type");x==2||x==3?I(!0):I(!1);break;default:console.log("\u672A\u5904\u7406\u7684\u4E8B\u4EF6:",a,n)}m==null||m(a,n,A)},_=async()=>{try{N(!0);const a=await p.current.getAllData();a.isValid&&(r!=null&&r.id?await m("form_submitted_edit",a,void 0):await m("form_submitted_add",a,void 0))}catch(a){console.error("\u274C \u63D0\u4EA4\u8868\u5355\u6570\u636E\u5931\u8D25:",a)}finally{N(!1)}},e=j(()=>{const a=r==null?void 0:r.data.reduce((n,A)=>(n[A.columnId]=A.value,n),{});return{label:"\u52A8\u6001\u8868\u5355\u793A\u4F8B",defaultActiveId:D.id,model:null,views:[{label:"\u7528\u6237\u6CE8\u518C\u8868\u5355",id:D.id,type:"form",size:"md",formWidth:D.formWidth,formConfig:{layout:D.layout,showReset:!1,showSubmit:!1,formWidth:D.formWidth}}],dataSource:[{id:D.id,fields:D.fields,defaultValues:a||{}}],eventsEmit:V}},[r,P,D]),s=j(()=>{const n=(Array.isArray(e.dataSource)?e.dataSource:[]).map(b=>{const x=b==null?void 0:b.fields,T=(Array.isArray(x)?x:[]).map(M=>({...M,options:M&&"options"in M?Array.isArray(M.options)?M.options:[]:void 0,controlledItems:M==null?void 0:M.controlledItems}));return{...b,fields:T}}),A=Array.isArray(e.views)?e.views:[];return{...e,views:A,dataSource:n}},[e]);return l(Re,{title:t,placement:"right",width:560,onClose:c,closeIcon:!1,extra:l(qe,{size:20,color:"#888888",onClick:c,className:"cursor-pointer"}),open:F,destroyOnHidden:!0,rootClassName:"config-model-drawer",styles:{body:{display:"flex",flexDirection:"column",flex:1,minHeight:0,overflowY:"auto",overflowX:"hidden"}},footer:q("div",{className:"flex justify-end items-center gap-3",children:[l(R,{mode:"default",label:d.drawer.cancel,onClick:c}),l(R,{mode:"primary",label:d.drawer.confirm,loading:u,onClick:_})]}),children:l(Ze,{children:l(Ee,{...s},"example-form")})})},{Item:de}=O,Ge=({modelVisible:t,options:F,eventsEmit:r,replaceModel:c})=>{const{messages:B}=le(),[h,m]=w(!1),[d]=O.useForm(),u=O.useWatch("sourceModelId",d),N=j(()=>{const I=F.find(D=>D.value==u);return I?F.filter(p=>p.useType==I.useType&&p.value!==u&&p.status==1):[]},[u]);Fe(()=>{u&&d.setFieldValue("targetModelId",void 0)},[u]);const P=async()=>{try{m(!0);const I=await d.validateFields(),{sourceModelId:D,targetModelId:p}=I;await c(D,p)&&(z.success(B.replaceModal.messageSuccess),d.resetFields(),r&&r("replace_model"))}catch(I){console.log("e---->",I)}finally{m(!1)}};return q(pe,{open:t,title:B.replaceModal.title,width:620,destroyOnHidden:!0,onCancel:()=>{d.resetFields(),r&&r("close_model")},footer:q("div",{className:"flex justify-end gap-3",style:{justifyContent:"end",margin:"20px 4px"},children:[l(R,{mode:"default",label:B.replaceModal.cancel,onClick:()=>{d.resetFields(),r&&r("close_model")}}),l(R,{mode:"primary",label:B.replaceModal.confirm,loading:h,onClick:P})]}),children:[q("div",{className:"flex gap-3",style:{margin:"20px 4px"},children:[l("div",{children:l(He,{size:22,color:"#f4a02a"})}),l("span",{className:"text-[14px]",children:B.replaceModal.warningParagraph})]}),q(O,{form:d,colon:!1,labelCol:{span:5},wrapperCol:{span:18},style:{margin:"40px 60px"},children:[l(de,{label:B.replaceModal.sourceLabel,name:"sourceModelId",rules:[{required:!0,message:""}],children:l(ce,{placeholder:B.replaceModal.placeholderSelect,options:F})}),l(de,{label:B.replaceModal.targetLabel,name:"targetModelId",rules:[{required:!0,message:""}],children:l(ce,{placeholder:B.replaceModal.placeholderSelect,options:N})})]})]})},te={success:"green",error:"red",warning:"orange",processing:"blue",info:"cyan",default:"default"},ae=[{statusType:"success",value:"\u53EF\u7528",status:1},{statusType:"error",value:"\u4E0D\u53EF\u7528",status:0},{statusType:"warning",value:"\u68C0\u6D4B\u4E2D",status:2}],Qe=t=>typeof t=="string"&&t in te?te[t]:te.default;var X=(t=>(t[t.DATE=0]="DATE",t[t.VIEW=1]="VIEW",t[t.ERROR=2]="ERROR",t[t.AUTHORIZE=3]="AUTHORIZE",t[t.DELETE=4]="DELETE",t[t.ANALYSIS_OR_EXTRACT=5]="ANALYSIS_OR_EXTRACT",t[t.DOWNLOAD=6]="DOWNLOAD",t[t.EDIT=7]="EDIT",t[t.ADD=8]="ADD",t[t.ANALYSIS_CONFIG=9]="ANALYSIS_CONFIG",t[t.AUTHORIZE_CONFIG=10]="AUTHORIZE_CONFIG",t))(X||{});const{confirm:me}=pe,Je={pageNum:1,pageSize:1e3},eu=t=>{const{value:F,cell:r}=t,c=Qe(t.cell.statusType);return r.status===0?l(se,{title:r.errorMsg,children:l("div",{className:"flex items-center gap-2",children:l(ie,{color:c,text:F})})}):l(ie,{color:c,text:F})};function uu(t){const{url:F,token:r,role:c,CustomComponents:B,eventsEmit:h,getBtnDisabled:m,showModelReplace:d}=t,{messages:u,getMessage:N,locale:P}=le(),[I,D]=w({container:"ready",content:"ready"}),p=oe(null),[V,_]=w(),e=oe(null),[s,a]=w(!1),[n,A]=w(!1),[b,x]=w([]),[W,T]=w(!1),[M,U]=w(""),[S,re]=w(),[G,Ae]=w([]),[Q,Ce]=w([]),{getModelList:ge,delModelById:De,createModel:ye,updateModelById:he,getUseTypeList:be,getModelProtocolsList:Me,testStatus:ve,replaceModel:we,checkModel:Ie}=We({url:F,token:r,role:c,eventsEmit:h,getMessage:N});Fe(()=>(D(i=>({...i,content:"loading"})),J(),ke(),()=>{e.current&&(clearTimeout(e.current),e.current=null)}),[]);const xe=i=>(i||[]).map(o=>{const f=ae.find(y=>y.status==o.status),E=o.status===1?u.status.available:o.status===0?u.status.unavailable:u.status.checking;return{id:o.id,data:[{columnId:"modelName",value:o.modelName},{columnId:"modelProtocol",value:o.modelProtocol,type:"customized"},{columnId:"type",value:o.type,type:"customized"},{columnId:"dec",value:o.dec},{columnId:"status",...f,value:E,type:"customized",errorMsg:o.errorMsg},{columnId:"actions",value:"edit",label:u.table.actionEdit,status:o.status,type:"action",disabled:m&&m(X.EDIT,o.permission)},{columnId:"actions",value:"auth",label:u.table.actionAuth,type:"action",status:o.status,disabled:m&&m(X.AUTHORIZE,o.permission)},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action",status:o.status,disabled:m&&m(X.AUTHORIZE,o.permission)},{columnId:"url",value:o.url},{columnId:"apiKey",value:o.apiKey},{columnId:"modelIde",value:o.modelIde},{columnId:"thinking",value:o.thinking},{columnId:"maxTokens",value:o.maxTokens}]}}),ke=async()=>{try{const[i,o]=await Promise.allSettled([be(),Me()]);if(i.status==="fulfilled"&&i.value){const f=i.value,E=Array.isArray(f)?f:[];Ae(E.map(y=>({...y,value:Number(y.value)})))}if(o.status==="fulfilled"&&o.value){const f=o.value,E=Array.isArray(f)?f:[];Ce(E.map(y=>({...y,value:Number(y.value)})))}}catch(i){console.error("[TableApiError] getTableList:",i)}},ne=async()=>{try{const i=await ge(Je);if(i.records){const o=xe(i.records),f=(i.records||[]).map(E=>({value:E.id,label:E.modelName,useType:E.type,status:E.status}));return x(f),_(o||[]),D(E=>({...E,content:"ready"})),o||[]}}catch(i){console.error("[TableApiError] getTableList:",i)}},J=async()=>{const i=await ne();Le(i||[])?e.current&&(clearTimeout(e.current),e.current=null):(e.current&&(clearTimeout(e.current),e.current=null),e.current=setTimeout(()=>{J()},5e3))};function Le(i){if(!Array.isArray(i))return!0;for(const o of i)if(o.data){const f=o.data.find(E=>E.columnId==="status");if(f&&f.status===2)return!1}return!0}const Se=j(()=>({defaultActiveId:"model-table",model:null,views:[{label:u.table.viewLabel,id:"model-table",type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,paginationLocale:P,columns:[{id:"modelName",title:u.table.columns.modelName,type:"label"},{id:"modelProtocol",title:u.table.columns.modelProtocol,type:"customized",component:i=>{var E;const{value:o}=i,f=(E=Q.find(y=>y.value==o))==null?void 0:E.label;return l("span",{children:f})}},{id:"type",title:u.table.columns.type,type:"customized",component:i=>{var E;const{value:o}=i,f=(E=G.find(y=>y.value==o))==null?void 0:E.label;return l("span",{children:f})}},{id:"dec",title:u.table.columns.dec,type:"paragraph"},{id:"status",title:u.table.columns.status,type:"customized",component:l(eu,{}),helpText:u.table.statusHelpText},{id:"actions",title:u.table.columns.actions,type:"customized",component:i=>{const{value:o,cell:f,row:E}=i,{disabled:y,label:H,status:$}=f;return $==2?l(se,{title:u.table.tooltipChecking,children:l(R,{mode:"text",label:H,disabled:!0})}):y?l(se,{title:u.table.tooltipNoPermission,children:l(R,{mode:"text",label:H,disabled:y})}):l(R,{mode:"text",label:H,onClick:()=>K(`table_action_${o}`,E,void 0)})}}],toolbar:[{type:"button",btnType:"primary",key:"add",label:u.table.toolbar.add,icon:l(ze,{size:14})},...d?[{type:"customized",key:"test",render:()=>l(R,{loading:s,mode:"primary",label:u.table.toolbar.test,onClick:()=>K("toolbar_test")})},{type:"button",btnType:"primary",key:"replace",label:u.table.toolbar.replace}]:[]]}]}),[u,P,G,Q,s,d]),Te=()=>q("div",{className:"flex flex-col items-center justify-center h-full",children:[l("div",{className:"text-xl font-semibold mb-3",style:{color:"#374151"},children:l("img",{src:Ve,width:120})}),l("div",{className:"text-base mb-6",style:{color:"#6b7280"},children:u.empty.noDataHint}),l("div",{className:"flex gap-3",children:l(R,{mode:"primary",label:u.empty.createModelBtn,onClick:()=>{U(u.drawer.titleNew),T(!0)}})})]});async function K(i,o,f){var E,y,H,$;switch(console.log("[adopter] mergedEventsEmit",i,o,f),i){case"toolbar_add":{U(u.drawer.titleNew),T(!0);break}case"toolbar_test":{a(!0),await ve()&&(a(!1),await J(),z.success(u.message.testSuccess));break}case"toolbar_replace":{A(!0);break}case"table_action_delete":{try{const k=o.data.find(v=>v.columnId=="modelName").value;if(await Ie(k)>0)me({title:u.deleteConfirm.titleWhenInUse,content:l("div",{style:{marginRight:"20px"},children:u.deleteConfirm.contentWhenInUse}),okText:u.deleteConfirm.okText,cancelText:u.deleteConfirm.cancelText});else{const v=o.data.find(L=>L.columnId=="modelName").value;me({title:u.deleteConfirm.title,content:$e(u.deleteConfirm.content,{name:v}),okText:u.deleteConfirm.deleteOkText,cancelText:u.deleteConfirm.cancelText,async onOk(){await De(o.id)&&(p!=null&&p.current)&&(p==null||p.current.appFn.removeItem(o.id),z.success(u.message.deleteSuccess))}})}}catch(k){console.error("\u5220\u9664\u8868\u6570\u636E\u5931\u8D25",k)}break}case"table_action_edit":{U(u.drawer.titleEdit),T(!0),re(o);break}case"form_submitted_add":{try{const k=o.fields.reduce((v,L)=>(v[L.name]=L.value,v),{}),C=await ye({...k});if(C){const v=ae.find(g=>g.status==C.status),L=C.status===1?u.status.available:C.status===0?u.status.unavailable:u.status.checking,ue={id:C.id,data:[...(Object.keys(C)||[]).map(g=>g==="status"?{columnId:g,value:L,...v,type:"customized",errorMsg:C.errorMsg}:{columnId:g,value:C[g],...(g=="modelProtocol"||g=="type")&&{type:"customized"}}),{columnId:"actions",value:"edit",label:u.table.actionEdit,type:"action"},{columnId:"actions",value:"auth",label:u.table.actionAuth,type:"action"},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action"}]};(y=(E=p==null?void 0:p.current)==null?void 0:E.appFn)==null||y.addItem(ue,{animate:!0,position:"start"}),z.success(u.message.createSuccess),ee()}}catch(k){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",k)}finally{}break}case"form_submitted_edit":{try{const k=o.fields.reduce((v,L)=>(v[L.name]=L.value,v),{}),C=await he({...k,id:S.id});if(console.log("======res",C),C){const v=ae.find(g=>g.status==C.status),L=C.status===1?u.status.available:C.status===0?u.status.unavailable:u.status.checking,ue={...S,data:S.data.map(g=>{if(C[g.columnId]!==null&&C[g.columnId]!==void 0){if(g.columnId=="status")return{...g,...v,value:L};g.value=C[g.columnId]}return g})};($=(H=p==null?void 0:p.current)==null?void 0:H.appFn)==null||$.updateItem(ue,S==null?void 0:S.id),z.success(u.message.editSuccess),ee()}}catch(k){console.error("\u4FDD\u5B58\u5931\u8D25\uFF01",k)}break}case"replace_model":{await ne(),A(!1);break}case"close_model":{A(!1);break}default:typeof t.eventsEmit=="function"&&t.eventsEmit(i,o);break}}const ee=()=>{T(!1),re(void 0)};return q(Ne,{title:u.dashboard.title,children:[l(Ee,{dataSource:V,ref:p,eventsEmit:K,status:I,CustomComponents:{EmptyData:Te,...B},...Se}),l(Ye,{drawerTitle:M,drawerVisible:W,handleDrawerClose:ee,modelInfo:S,modelUseTypeOpt:G,modelProtocolsOpt:Q,eventsEmit:K}),l(Ge,{modelVisible:n,options:b,eventsEmit:K,replaceModel:we})]})}function Eu(t){const{locale:F="zh",messages:r,...c}=t;return l(Xe,{locale:F,messages:r,children:l(uu,{...c})})}export{fe as ModelManageI18nContext,Xe as ModelManageI18nProvider,Eu as default,Oe as getModelManageMessages,$e as interpolateModelManage,le as useModelManageI18n};
package/oprecords.js CHANGED
@@ -1,22 +1 @@
1
- import{jsx as r,jsxs as g,Fragment as J}from"react/jsx-runtime";import x,{useState as E,useMemo as C,useEffect as Q}from"react";import b from"styled-components";import{DatePicker as V,Card as m,Input as X,Spin as Z,Row as I,Col as y,Statistic as v,Table as M}from"antd";import{d as q}from"./assets/dayjs.min-9C0uSO6x.js";import{DashboardContainer as ee}from"@mxmweb/zui";import te from"axios";const A={dashboard:{title:"\u7528\u6237\u64CD\u4F5C\u8BB0\u5F55",description:"\u4ECE\u63A5\u53E3\u805A\u5408\u7EDF\u8BA1\u7528\u6237\u64CD\u4F5C\u884C\u4E3A\uFF08\u6309\u5929+\u64CD\u4F5C\u540D\uFF09"},toolbar:{keywordPlaceholder:"\u6309\u64CD\u4F5C\u540D\u79F0\u8FC7\u6EE4",dataSourceLabel:"\u6570\u636E\u6765\u6E90"},stats:{totalCount:"\u603B\u64CD\u4F5C\u6B21\u6570",totalFailCount:"\u5931\u8D25\u6B21\u6570",groupRows:"\u805A\u5408\u6761\u76EE\u6570",suffixTimes:"\u6B21",suffixRows:"\u6761"},sections:{dailyTotal:"\u6BCF\u65E5\u5408\u8BA1\uFF08\u8FC7\u6EE4\u540E\uFF09",opTop:"\u64CD\u4F5C Top 20\uFF08\u8FC7\u6EE4\u540E\uFF09",detailTable:"\u6309\u5929 + \u64CD\u4F5C\u540D\u660E\u7EC6"},table:{date:"\u65E5\u671F",opName:"\u64CD\u4F5C\u540D\u79F0",count:"\u6B21\u6570",dailyCount:"\u5408\u8BA1\u6B21\u6570"},error:{requestFailed:"\u83B7\u53D6\u64CD\u4F5C\u8BB0\u5F55\u5931\u8D25",networkError:"\u7F51\u7EDC\u9519\u8BEF"},server:{requestError:"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",noPermission:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650",notLoggedIn:"\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"}},ue={dashboard:{title:"User operations",description:"Aggregated user operations (by day + action)"},toolbar:{keywordPlaceholder:"Filter by action name",dataSourceLabel:"Data source"},stats:{totalCount:"Total",totalFailCount:"Failed",groupRows:"Grouped rows",suffixTimes:"times",suffixRows:"rows"},sections:{dailyTotal:"Daily total (filtered)",opTop:"Top actions (filtered)",detailTable:"Daily + action detail"},table:{date:"Date",opName:"Action",count:"Count",dailyCount:"Daily total"},error:{requestFailed:"Failed to fetch user operations",networkError:"Network error"},server:{requestError:"Request failed, please try again later",noPermission:"No permission",notLoggedIn:"Not logged in or token expired"}},re={dashboard:{title:"\u30E6\u30FC\u30B6\u30FC\u64CD\u4F5C",description:"\u30E6\u30FC\u30B6\u30FC\u64CD\u4F5C\u3092\u96C6\u8A08\uFF08\u65E5\u6642 + \u64CD\u4F5C\u540D\uFF09"},toolbar:{keywordPlaceholder:"\u64CD\u4F5C\u540D\u3067\u30D5\u30A3\u30EB\u30BF",dataSourceLabel:"\u30C7\u30FC\u30BF\u30BD\u30FC\u30B9"},stats:{totalCount:"\u5408\u8A08",totalFailCount:"\u5931\u6557",groupRows:"\u96C6\u8A08\u884C\u6570",suffixTimes:"\u56DE",suffixRows:"\u884C"},sections:{dailyTotal:"\u65E5\u5225\u5408\u8A08\uFF08\u30D5\u30A3\u30EB\u30BF\u5F8C\uFF09",opTop:"Top \u64CD\u4F5C\uFF08\u30D5\u30A3\u30EB\u30BF\u5F8C\uFF09",detailTable:"\u65E5\u4ED8 + \u64CD\u4F5C\u540D\u306E\u8A73\u7D30"},table:{date:"\u65E5\u4ED8",opName:"\u64CD\u4F5C\u540D",count:"\u56DE\u6570",dailyCount:"\u5408\u8A08\u56DE\u6570"},error:{requestFailed:"\u30E6\u30FC\u30B6\u30FC\u64CD\u4F5C\u306E\u53D6\u5F97\u306B\u5931\u6557\u3057\u307E\u3057\u305F",networkError:"\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u30A8\u30E9\u30FC"},server:{requestError:"\u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F",noPermission:"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093",notLoggedIn:"\u672A\u30ED\u30B0\u30A4\u30F3\u3001\u307E\u305F\u306F\u30C8\u30FC\u30AF\u30F3\u304C\u671F\u9650\u5207\u308C\u3067\u3059"}},oe={zh:A,en:ue,ja:re};function ae(i,l){const c=oe[i]??A;return l?{...c,...l}:c}function P(i,l){const c=l.split(".");let n=i;for(const d of c)n=n==null?void 0:n[d];return typeof n=="string"?n:l}const N=x.createContext({locale:"zh",messages:A,getMessage:i=>P(A,i)});function se(){return x.useContext(N)}function ne({locale:i,messages:l,children:c}){const n=x.useMemo(()=>{const d=ae(i,l);return{locale:i,messages:d,getMessage:t=>P(d,t)}},[i,l]);return x.createElement(N.Provider,{value:n},c)}function le({url:i,token:l,role:c,eventsEmit:n,getMessage:d}){const t=(a,s)=>d?d(a):s,h=te.create({baseURL:i,timeout:15e3});return h.interceptors.request.use(a=>{const s=l;return s?(a.headers.Authorization=s||"",a.headers.userName=c==="\u672A\u767B\u5F55\u7528\u6237"?"":c,a):(n&&n("request:error_auth",{errorMsg:t("server.notLoggedIn","\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"),redirect:"/login"}),Promise.reject(new Error(t("server.notLoggedIn","\u672A\u767B\u5F55\u6216token\u5DF2\u8FC7\u671F"))))}),h.interceptors.response.use(a=>{const s=a.data;if(s&&typeof s=="object"&&"success"in s){if(s.success)return s;if(n)return n("request:error_business",{errorCode:s.errorCode,errorMsg:s.errorMsg||t("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5"),response:s}),s}return s},a=>{var s;if((a==null?void 0:a.message)==="canceled")return Promise.reject(a);if(n){let w="request:error_network",D={errorMsg:t("server.requestError","\u7F51\u7EDC\u8BF7\u6C42\u5931\u8D25"),error:a};((s=a==null?void 0:a.response)==null?void 0:s.status)===401&&(w="request:error_auth",D={errorMsg:t("server.noPermission","\u6CA1\u6709\u8DB3\u591F\u6743\u9650"),error:a,redirect:"/login"}),n(w,D)}return Promise.reject(a)}),{getUserOperate:async a=>await h.get("/auth/userOperate/getUserOperate",{params:a})}}const{RangePicker:ie}=V;function ce(i){const{url:l="http://127.0.0.1:2230",token:c,role:n,eventsEmit:d}=i,{getMessage:t}=se(),h=b.div.attrs({className:"oprecords-wrapper"})`
2
- width: 100%;
3
- height: 100%;
4
- min-height: 0;
5
- `,S=b.div.attrs({className:"oprecords-toolbar"})`
6
- display: flex;
7
- align-items: center;
8
- justify-content: space-between;
9
- gap: 12px;
10
- flex-wrap: wrap;
11
- margin-bottom: 12px;
12
- `,a=b.div.attrs({className:"oprecords-toolbar-left"})`
13
- display: flex;
14
- align-items: center;
15
- gap: 12px;
16
- flex-wrap: wrap;
17
- `,s=b.div.attrs({className:"oprecords-toolbar-right"})`
18
- display: flex;
19
- align-items: center;
20
- gap: 12px;
21
- flex-wrap: wrap;
22
- `,[w,D]=E(!1),[z,k]=E(null),[F,T]=E(null),[B,L]=E(()=>[q("2026-01-04"),q("2026-03-28")]),[R,j]=E(""),O=C(()=>le({url:l,token:c,role:n,eventsEmit:d,getMessage:t}),[l,c,n,d,t]);Q(()=>{let e=!1;return(async()=>{try{D(!0),k(null);const u=await O.getUserOperate({start:B[0].format("YYYY-MM-DD"),end:B[1].format("YYYY-MM-DD")});if(e)return;if(!(u!=null&&u.success)||!(u!=null&&u.data)){T(null),k((u==null?void 0:u.errorMsg)||t("error.requestFailed"));return}T(u.data)}catch(u){if(e)return;T(null),k((u==null?void 0:u.message)||t("error.networkError"))}finally{e||D(!1)}})(),()=>{e=!0}},[O,B,t]);const f=C(()=>{const e=(F==null?void 0:F.operateGroupDetail)??[],o=R.trim();return o?e.filter(u=>{var p;return(p=u.name)==null?void 0:p.includes(o)}):e},[F,R]),_=(F==null?void 0:F.totalCount)??0,Y=(F==null?void 0:F.totalFailCount)??0,U=C(()=>{const e=new Map;for(const o of f)e.set(o.date,(e.get(o.date)||0)+(o.count||0));return Array.from(e.entries()).map(([o,u])=>({date:o,value:u,key:o})).sort((o,u)=>o.date.localeCompare(u.date))},[f]),$=C(()=>{const e=new Map;for(const u of f){const p=u.name||"\u672A\u77E5\u64CD\u4F5C";e.set(p,(e.get(p)||0)+(u.count||0))}return Array.from(e.entries()).map(([u,p])=>({name:u,value:p,key:u})).sort((u,p)=>p.value-u.value).slice(0,20)},[f]),G=C(()=>[{title:t("table.date"),dataIndex:"date",key:"date",width:140,sorter:(e,o)=>e.date.localeCompare(o.date),defaultSortOrder:"descend"},{title:t("table.opName"),dataIndex:"name",key:"name",ellipsis:!0},{title:t("table.count"),dataIndex:"count",key:"count",width:120,align:"right",sorter:(e,o)=>(e.count||0)-(o.count||0)}],[t]),K=C(()=>f.map((e,o)=>({...e,key:`${e.date}-${e.name}-${o}`})),[f]),W=C(()=>[{title:t("table.date"),dataIndex:"date",key:"date",width:140,sorter:(e,o)=>e.date.localeCompare(o.date)},{title:t("table.dailyCount"),dataIndex:"value",key:"value",align:"right",sorter:(e,o)=>e.value-o.value}],[t]),H=C(()=>[{title:t("table.opName"),dataIndex:"name",key:"name",ellipsis:!0},{title:t("table.count"),dataIndex:"value",key:"value",width:120,align:"right",sorter:(e,o)=>e.value-o.value}],[t]);return r(ee,{title:t("dashboard.title"),description:t("dashboard.description"),children:r(h,{children:g(m,{children:[g(S,{children:[g(a,{children:[r(ie,{value:B,allowClear:!1,onChange:e=>{e&&e[0]&&e[1]&&L([e[0],e[1]])}}),r(X,{value:R,onChange:e=>j(e.target.value),placeholder:t("toolbar.keywordPlaceholder"),style:{width:240},allowClear:!0})]}),r(s,{children:g("div",{style:{color:"#64748b",fontSize:12},children:[t("toolbar.dataSourceLabel"),"\uFF1A",r("span",{style:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace"},children:`${l}/auth/userOperate/getUserOperate`})]})})]}),w?r("div",{style:{padding:24,display:"flex",justifyContent:"center"},children:r(Z,{})}):z?r("div",{style:{padding:16,color:"#cf1322"},children:z}):g(J,{children:[g(I,{gutter:12,style:{marginBottom:12},children:[r(y,{xs:24,md:8,children:r(m,{children:r(v,{title:t("stats.totalCount"),value:_,suffix:t("stats.suffixTimes")})})}),r(y,{xs:24,md:8,children:r(m,{children:r(v,{title:t("stats.totalFailCount"),value:Y,suffix:t("stats.suffixTimes")})})}),r(y,{xs:24,md:8,children:r(m,{children:r(v,{title:t("stats.groupRows"),value:f.length,suffix:t("stats.suffixRows")})})})]}),g(I,{gutter:12,style:{marginBottom:12},children:[r(y,{xs:24,lg:12,children:r(m,{title:t("sections.dailyTotal"),size:"small",children:r(M,{columns:W,dataSource:U,size:"small",pagination:{pageSize:8,showSizeChanger:!1}})})}),r(y,{xs:24,lg:12,children:r(m,{title:t("sections.opTop"),size:"small",children:r(M,{columns:H,dataSource:$,size:"small",pagination:{pageSize:8,showSizeChanger:!1}})})})]}),r(m,{title:t("sections.detailTable"),size:"small",children:r(M,{columns:G,dataSource:K,size:"middle",pagination:{pageSize:20,showSizeChanger:!0}})})]})]})})})}function he({locale:i="zh",messages:l,...c}){return r(ne,{locale:i,messages:l,children:r(ce,{...c})})}export{he as default};
1
+ import"react/jsx-runtime";import"react";import"styled-components";import"antd";import"./assets/dayjs.min-9C0uSO6x.js";import"@mxmweb/zui";import{O as s}from"./assets/index-Bi5ePMtR.js";import"./assets/search-CEuIa9-_.js";import"axios";import"./assets/createLucideIcon-Bj5DlX2s.js";export{s as default};
package/package.json CHANGED
@@ -3,11 +3,15 @@
3
3
  "license": "MIT",
4
4
  "style": "assets/style.css",
5
5
  "private": false,
6
- "version": "2.2.30",
6
+ "version": "2.2.32",
7
7
  "author": "hanfeng_Zhang",
8
8
  "type": "module",
9
9
  "main": "index.js",
10
10
  "types": "index.d.ts",
11
+ "scripts": {
12
+ "test": "yarn link",
13
+ "disconnect": "yarn unlink"
14
+ },
11
15
  "peerDependencies": {
12
16
  "@mxmweb/aichat": "^1.8.0",
13
17
  "@mxmweb/fviewer": "^1.5.3",
@@ -84,16 +88,12 @@
84
88
  "./assets/style.css": "./assets/style.css"
85
89
  },
86
90
  "dependencies": {
87
- "@mxmweb/aichat": "2.1.6 ",
91
+ "@mxmweb/aichat": "2.1.7",
88
92
  "@mxmweb/fviewer": "1.5.7",
89
93
  "@mxmweb/rtext": "1.6.23",
90
94
  "@mxmweb/xviewer": "1.4.10",
91
95
  "@mxmweb/zui": "1.3.18",
92
96
  "antd": "^5.18.0",
93
97
  "axios": "^1.7.2"
94
- },
95
- "scripts": {
96
- "test": "yarn link",
97
- "disconnect": "yarn unlink"
98
98
  }
99
- }
99
+ }
package/sensitive.js CHANGED
@@ -1,4 +1,4 @@
1
- import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useState as _,useRef as Ce,useEffect as be,useCallback as k,useMemo as ee}from"react";import v from"styled-components";import{message as b,Upload as Ae,Input as de,Modal as pe,Dropdown as we,Form as ce}from"antd";import{Xviwer as ye}from"@mxmweb/xviewer";import{defaultTheme as Fe,Button as z,useTheme as Se,deepMergeTheme as ge,DashboardContainer as ke}from"@mxmweb/zui";import _e from"axios";import{C as Te}from"./assets/circle-plus-2ioHM-Sb.js";import{c as De,X as Le}from"./assets/x-CX-iE6EL.js";import{S as xe}from"./assets/search-BfgWf2Me.js";import{P as Be}from"./assets/plus-Cok3acFd.js";/* empty css *//**
1
+ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useState as _,useRef as Ce,useEffect as be,useCallback as k,useMemo as ee}from"react";import v from"styled-components";import{message as b,Upload as Ae,Input as de,Modal as pe,Dropdown as we,Form as ce}from"antd";import{Xviwer as ye}from"@mxmweb/xviewer";import{defaultTheme as Fe,Button as z,useTheme as Se,deepMergeTheme as ge,DashboardContainer as ke}from"@mxmweb/zui";import _e from"axios";import{C as Te}from"./assets/circle-plus-RlDPoPkb.js";import{c as De}from"./assets/createLucideIcon-Bj5DlX2s.js";import{S as xe}from"./assets/search-CEuIa9-_.js";import{X as Le}from"./assets/x-CdZQbi--.js";import{P as Be}from"./assets/plus-B679mjyt.js";/* empty css *//**
2
2
  * @license lucide-react v0.456.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -8,12 +8,12 @@ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useS
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const he=De("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),$e=["10014"],Me=({url:e,token:r,role:F,getMessage:f})=>{const c=(t,o)=>f?f(t):o,i=_e.create({baseURL:e,timeout:1e6});return i.interceptors.request.use(t=>{let o=r;if(!o&&!["user/login","user/kaptcha","user/regist"].some(p=>t.url.includes(p))){window.location.pathname="/login";return}return t.headers.Authorization=o||"",t.headers.userName=F==="\u672A\u767B\u5F55\u7528\u6237"?"":F,t}),i.interceptors.response.use(t=>{const o=["user/kaptcha"],l=t.data;if(o.some(g=>t.config.url&&t.config.url.includes(g))||l.size&&l.type)return l;const{success:p,errorMsg:E,errorCode:M}=l;return $e.includes(M)||p?l:(b.error(E||c("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5")),!1)},t=>{var o,l,p,E,M,g,y,N,R,q;t.message!=="canceled"&&((((l=(o=t==null?void 0:t.response)==null?void 0:o.data)==null?void 0:l.errorCode)==="30013"||((E=(p=t==null?void 0:t.response)==null?void 0:p.data)==null?void 0:E.errorCode)==="30023")&&b.error((((M=t==null?void 0:t.response)==null?void 0:M.data)||{}).errorMsg||c("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5")),((g=t==null?void 0:t.response)==null?void 0:g.status)===401&&(console.log("Error url:",(y=t==null?void 0:t.request)==null?void 0:y.responseURL),b.error((((N=t==null?void 0:t.response)==null?void 0:N.data)||{}).errorMsg||c("server.noPermission","\u6CA1\u6709\u8DB3\u591F\u6743\u9650"))),console.log("Error occurs",t),(((R=t==null?void 0:t.response)==null?void 0:R.data)||{}).errorMsg!="\u672A\u8BBE\u7F6E\u9ED8\u8BA4\u914D\u7F6E\uFF01"&&b.error((((q=t==null?void 0:t.response)==null?void 0:q.data)||{}).errorMsg||c("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5")))}),{getLibraryList:async t=>{try{const o=await i.get(`/sensitive/library?${new URLSearchParams(t).toString()}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},createLibrary:async t=>{try{const o=await i.post("/sensitive/library",t),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},deleteLibrary:async t=>{try{const o=await i.delete(`/sensitive/library/${t}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},updateLibrary:async(t,o)=>{try{const l=await i.put(`/sensitive/library/${t}`,o),{success:p,data:E}=l;return p?E:!1}catch(l){return console.log("e",l),!1}},downloadTemplate:async t=>{try{const o=await i.get("/sensitive/word/downloadTemplate",{params:{fileType:t},responseType:"blob"});return o&&typeof o.size=="number"?o:!1}catch(o){return console.log("e",o),!1}},importWords:async(t,o)=>{try{const l=new FormData;l.append("file",o);const p=await i.put(`/sensitive/word/${t}/import`,l);return p&&p.success!==!1?p:!1}catch(l){return console.log("e",l),!1}},getWords:async t=>{try{const o=await i.get(`/sensitive/library/${t}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},getLibraryData:async t=>{try{const o=await i.get(`/sensitive/library/${t}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}}}},te={toolbar:{searchPlaceholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},tagCell:{viewAllTitle:"\u5171 {{total}} \u4E2A\uFF0C\u5F53\u524D\u4EC5\u5C55\u793A\u524D {{max}} \u4E2A",viewAllLink:"\u2026\u67E5\u770B\u5168\u90E8\uFF08+{{count}}\uFF09"},table:{label:"\u654F\u611F\u8BCD\u914D\u7F6E",viewLabel:"\u654F\u611F\u8BCD\u5E93\u5217\u8868",columns:{name:"\u540D\u79F0",sensitiveWords:"\u654F\u611F\u8BCD",createDate:"\u521B\u5EFA\u65E5\u671F",count:"\u6570\u91CF",actions:"\u64CD\u4F5C"},toolbar:{create:"\u65B0\u5EFA\u654F\u611F\u8BCD\u5E93",searchPlaceholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664"},dashboard:{title:"\u654F\u611F\u8BCD\u5E93\u7BA1\u7406"},deleteConfirm:{title:"\u786E\u8BA4\u5220\u9664\u654F\u611F\u8BCD\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u654F\u611F\u8BCD\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88"},createModal:{title:"\u65B0\u5EFA\u654F\u611F\u8BCD\u5E93",cancel:"\u53D6\u6D88",confirm:"\u786E\u8BA4",nameRequired:"\u8BF7\u8F93\u5165\u654F\u611F\u8BCD\u5E93\u540D\u79F0!",namePlaceholder:"\u8BF7\u8F93\u5165"},message:{saveSuccess:"\u4FDD\u5B58\u6210\u529F",createSuccess:"\u65B0\u589E\u654F\u611F\u8BCD\u6210\u529F!",deleteSuccess:"\u5220\u9664\u6210\u529F",downloadTemplateFail:"\u6A21\u677F\u4E0B\u8F7D\u5931\u8D25",importSuccess:"\u5BFC\u5165\u6210\u529F",importFail:"\u5BFC\u5165\u5931\u8D25"},downloadTemplateFilename:"\u654F\u611F\u8BCD\u6A21\u677F",editor:{maxLengthHint:"\u654F\u611F\u8BCD\u6700\u591A\u53EF\u8F93\u5165{{max}}\u4E2A\u5B57\u7B26",maxLengthWarning:"\u654F\u611F\u8BCD\u6700\u591A\u53EF\u8F93\u5165{{max}}\u4E2A\u5B57\u7B26",duplicateWarning:"\u5DF2\u5B58\u5728\u76F8\u540C\u654F\u611F\u8BCD",configTemplateHint:"\u8BF7\u914D\u7F6E\u6A21\u677F\u4E0B\u8F7D\u5730\u5740",selectFileWarning:"\u8BF7\u5148\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6",importFailRetry:"\u5BFC\u5165\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",importCountSuccess:"\u5DF2\u5BFC\u5165 {{count}} \u4E2A\u654F\u611F\u8BCD",parseFail:"\u6587\u4EF6\u89E3\u6790\u5931\u8D25\uFF0C\u8BF7\u786E\u4FDD\u4E3A csv \u6216 txt \u683C\u5F0F",readFileFail:"\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25",searchPlaceholder:"\u8BF7\u8F93\u5165\u654F\u611F\u8BCD\u641C\u7D22",inputPlaceholder:"\u8BF7\u8F93\u5165",add:"\u6DFB\u52A0",import:"\u5BFC\u5165",cancel:"\u53D6\u6D88",save:"\u4FDD\u5B58",confirm:"\u786E\u8BA4",downloadTemplate:"\u4E0B\u8F7D\u6A21\u677F",uploadModalTitle:"\u4E0A\u4F20\u6587\u4EF6",uploadModalHint:"\u5148\u4E0B\u8F7D\u6A21\u677F\u540E\u4E0A\u4F20",uploadDragText:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20",uploadDragHint:"\u652F\u6301\u5355\u6B21\u4E0A\u4F20\uFF0C\u652F\u6301 csv\u3001txt \u683C\u5F0F\u3002",formatCsv:"csv",formatTxt:"txt"},server:{requestError:"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",noPermission:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650"}},Pe={toolbar:{searchPlaceholder:"Enter keyword"},tagCell:{viewAllTitle:"{{total}} total, showing first {{max}}",viewAllLink:"\u2026View all (+{{count}})"},table:{label:"Sensitive words",viewLabel:"Sensitive word libraries",columns:{name:"Name",sensitiveWords:"Sensitive words",createDate:"Created",count:"Count",actions:"Actions"},toolbar:{create:"New library",searchPlaceholder:"Enter keyword"},actionEdit:"Edit",actionDelete:"Delete"},dashboard:{title:"Sensitive word libraries"},deleteConfirm:{title:"Delete this library?",content:"This library cannot be recovered after deletion.",okText:"Delete",cancelText:"Cancel"},createModal:{title:"New sensitive word library",cancel:"Cancel",confirm:"Confirm",nameRequired:"Please enter the library name.",namePlaceholder:"Enter name"},message:{saveSuccess:"Saved",createSuccess:"Library created.",deleteSuccess:"Deleted",downloadTemplateFail:"Template download failed",importSuccess:"Import succeeded",importFail:"Import failed"},downloadTemplateFilename:"sensitive-words-template",editor:{maxLengthHint:"Max {{max}} characters per word",maxLengthWarning:"Max {{max}} characters per word",duplicateWarning:"Duplicate word",configTemplateHint:"Please configure template download URL",selectFileWarning:"Please select a file first",importFailRetry:"Import failed, please retry",importCountSuccess:"Imported {{count}} words",parseFail:"Parse failed. Use csv or txt format.",readFileFail:"File read failed",searchPlaceholder:"Search sensitive words",inputPlaceholder:"Enter",add:"Add",import:"Import",cancel:"Cancel",save:"Save",confirm:"Confirm",downloadTemplate:"Download template",uploadModalTitle:"Upload file",uploadModalHint:"Download template first, then upload",uploadDragText:"Click or drag file here to upload",uploadDragHint:"Single file. csv or txt.",formatCsv:"csv",formatTxt:"txt"},server:{requestError:"Request failed, please try again.",noPermission:"Insufficient permission"}},ze={toolbar:{searchPlaceholder:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u5165\u529B"},tagCell:{viewAllTitle:"\u5168{{total}}\u4EF6\u3001\u5148\u982D{{max}}\u4EF6\u3092\u8868\u793A",viewAllLink:"\u2026\u3059\u3079\u3066\u8868\u793A\uFF08+{{count}}\uFF09"},table:{label:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9",viewLabel:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u30E9\u30A4\u30D6\u30E9\u30EA",columns:{name:"\u540D\u524D",sensitiveWords:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9",createDate:"\u4F5C\u6210\u65E5",count:"\u4EF6\u6570",actions:"\u64CD\u4F5C"},toolbar:{create:"\u65B0\u898F\u30E9\u30A4\u30D6\u30E9\u30EA",searchPlaceholder:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u5165\u529B"},actionEdit:"\u7DE8\u96C6",actionDelete:"\u524A\u9664"},dashboard:{title:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u7BA1\u7406"},deleteConfirm:{title:"\u3053\u306E\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",content:"\u524A\u9664\u3059\u308B\u3068\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002",okText:"\u524A\u9664",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB"},createModal:{title:"\u65B0\u898F\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u30E9\u30A4\u30D6\u30E9\u30EA",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",confirm:"\u78BA\u8A8D",nameRequired:"\u30E9\u30A4\u30D6\u30E9\u30EA\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",namePlaceholder:"\u5165\u529B"},message:{saveSuccess:"\u4FDD\u5B58\u3057\u307E\u3057\u305F",createSuccess:"\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u4F5C\u6210\u3057\u307E\u3057\u305F\u3002",deleteSuccess:"\u524A\u9664\u3057\u307E\u3057\u305F",downloadTemplateFail:"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",importSuccess:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u307E\u3057\u305F",importFail:"\u30A4\u30F3\u30DD\u30FC\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F"},downloadTemplateFilename:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8",editor:{maxLengthHint:"1\u8A9E\u3042\u305F\u308A{{max}}\u6587\u5B57\u307E\u3067",maxLengthWarning:"1\u8A9E\u3042\u305F\u308A{{max}}\u6587\u5B57\u307E\u3067",duplicateWarning:"\u540C\u3058\u8A9E\u304C\u65E2\u306B\u3042\u308A\u307E\u3059",configTemplateHint:"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9URL\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",selectFileWarning:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",importFailRetry:"\u30A4\u30F3\u30DD\u30FC\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",importCountSuccess:"{{count}}\u8A9E\u3092\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u307E\u3057\u305F",parseFail:"\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002csv \u307E\u305F\u306F txt \u5F62\u5F0F\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",readFileFail:"\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",searchPlaceholder:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u3092\u691C\u7D22",inputPlaceholder:"\u5165\u529B",add:"\u8FFD\u52A0",import:"\u30A4\u30F3\u30DD\u30FC\u30C8",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",save:"\u4FDD\u5B58",confirm:"\u78BA\u8A8D",downloadTemplate:"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",uploadModalTitle:"\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",uploadModalHint:"\u5148\u306B\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u304B\u3089\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",uploadDragText:"\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",uploadDragHint:"1\u30D5\u30A1\u30A4\u30EB\u3002csv \u307E\u305F\u306F txt\u3002",formatCsv:"csv",formatTxt:"txt"},server:{requestError:"\u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",noPermission:"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093"}},Ne={zh:te,en:Pe,ja:ze};function We(e){return Ne[e]??te}function J(e,r){return e.replace(/\{\{(\w+)\}\}/g,(F,f)=>String(r[f]??""))}const ve=ue.createContext({locale:"zh",messages:te,getMessage:e=>{const r=e.split(".");let F=te;for(const f of r)F=F==null?void 0:F[f];return typeof F=="string"?F:e}});function ae(){return ue.useContext(ve)}function He({locale:e,messages:r,children:F}){const f=ue.useMemo(()=>{const c=We(e),i=r?{...c,...r}:c;return{locale:e,messages:i,getMessage:u=>{const A=u.split(".");let D=i;for(const I of A)D=D==null?void 0:D[I];return typeof D=="string"?D:u}}},[e,r]);return ue.createElement(ve.Provider,{value:f},F)}const{Dragger:Ue}=Ae,j=16,Re=v.div.attrs({className:"sensitive-edit-page"})`
11
+ */const he=De("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]),$e=["10014"],Me=({url:e,token:i,role:F,getMessage:f})=>{const c=(t,o)=>f?f(t):o,r=_e.create({baseURL:e,timeout:1e6});return r.interceptors.request.use(t=>{let o=i;if(!o&&!["user/login","user/kaptcha","user/regist"].some(p=>t.url.includes(p))){window.location.pathname="/login";return}return t.headers.Authorization=o||"",t.headers.userName=F==="\u672A\u767B\u5F55\u7528\u6237"?"":F,t}),r.interceptors.response.use(t=>{const o=["user/kaptcha"],l=t.data;if(o.some(g=>t.config.url&&t.config.url.includes(g))||l.size&&l.type)return l;const{success:p,errorMsg:E,errorCode:M}=l;return $e.includes(M)||p?l:(b.error(E||c("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5")),!1)},t=>{var o,l,p,E,M,g,y,N,R,q;t.message!=="canceled"&&((((l=(o=t==null?void 0:t.response)==null?void 0:o.data)==null?void 0:l.errorCode)==="30013"||((E=(p=t==null?void 0:t.response)==null?void 0:p.data)==null?void 0:E.errorCode)==="30023")&&b.error((((M=t==null?void 0:t.response)==null?void 0:M.data)||{}).errorMsg||c("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5")),((g=t==null?void 0:t.response)==null?void 0:g.status)===401&&(console.log("Error url:",(y=t==null?void 0:t.request)==null?void 0:y.responseURL),b.error((((N=t==null?void 0:t.response)==null?void 0:N.data)||{}).errorMsg||c("server.noPermission","\u6CA1\u6709\u8DB3\u591F\u6743\u9650"))),console.log("Error occurs",t),(((R=t==null?void 0:t.response)==null?void 0:R.data)||{}).errorMsg!="\u672A\u8BBE\u7F6E\u9ED8\u8BA4\u914D\u7F6E\uFF01"&&b.error((((q=t==null?void 0:t.response)==null?void 0:q.data)||{}).errorMsg||c("server.requestError","\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5")))}),{getLibraryList:async t=>{try{const o=await r.get(`/sensitive/library?${new URLSearchParams(t).toString()}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},createLibrary:async t=>{try{const o=await r.post("/sensitive/library",t),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},deleteLibrary:async t=>{try{const o=await r.delete(`/sensitive/library/${t}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},updateLibrary:async(t,o)=>{try{const l=await r.put(`/sensitive/library/${t}`,o),{success:p,data:E}=l;return p?E:!1}catch(l){return console.log("e",l),!1}},downloadTemplate:async t=>{try{const o=await r.get("/sensitive/word/downloadTemplate",{params:{fileType:t},responseType:"blob"});return o&&typeof o.size=="number"?o:!1}catch(o){return console.log("e",o),!1}},importWords:async(t,o)=>{try{const l=new FormData;l.append("file",o);const p=await r.put(`/sensitive/word/${t}/import`,l);return p&&p.success!==!1?p:!1}catch(l){return console.log("e",l),!1}},getWords:async t=>{try{const o=await r.get(`/sensitive/library/${t}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}},getLibraryData:async t=>{try{const o=await r.get(`/sensitive/library/${t}`),{success:l,data:p}=o;return l?p:!1}catch(o){return console.log("e",o),!1}}}},te={toolbar:{searchPlaceholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},tagCell:{viewAllTitle:"\u5171 {{total}} \u4E2A\uFF0C\u5F53\u524D\u4EC5\u5C55\u793A\u524D {{max}} \u4E2A",viewAllLink:"\u2026\u67E5\u770B\u5168\u90E8\uFF08+{{count}}\uFF09"},table:{label:"\u654F\u611F\u8BCD\u914D\u7F6E",viewLabel:"\u654F\u611F\u8BCD\u5E93\u5217\u8868",columns:{name:"\u540D\u79F0",sensitiveWords:"\u654F\u611F\u8BCD",createDate:"\u521B\u5EFA\u65E5\u671F",count:"\u6570\u91CF",actions:"\u64CD\u4F5C"},toolbar:{create:"\u65B0\u5EFA\u654F\u611F\u8BCD\u5E93",searchPlaceholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},actionEdit:"\u7F16\u8F91",actionDelete:"\u5220\u9664"},dashboard:{title:"\u654F\u611F\u8BCD\u5E93\u7BA1\u7406"},deleteConfirm:{title:"\u786E\u8BA4\u5220\u9664\u654F\u611F\u8BCD\u5E93\uFF1F",content:"\u5220\u9664\u540E\uFF0C\u8BE5\u654F\u611F\u8BCD\u5E93\u5C06\u65E0\u6CD5\u6062\u590D",okText:"\u5220\u9664",cancelText:"\u53D6\u6D88"},createModal:{title:"\u65B0\u5EFA\u654F\u611F\u8BCD\u5E93",cancel:"\u53D6\u6D88",confirm:"\u786E\u8BA4",nameRequired:"\u8BF7\u8F93\u5165\u654F\u611F\u8BCD\u5E93\u540D\u79F0!",namePlaceholder:"\u8BF7\u8F93\u5165"},message:{saveSuccess:"\u4FDD\u5B58\u6210\u529F",createSuccess:"\u65B0\u589E\u654F\u611F\u8BCD\u6210\u529F!",deleteSuccess:"\u5220\u9664\u6210\u529F",downloadTemplateFail:"\u6A21\u677F\u4E0B\u8F7D\u5931\u8D25",importSuccess:"\u5BFC\u5165\u6210\u529F",importFail:"\u5BFC\u5165\u5931\u8D25"},downloadTemplateFilename:"\u654F\u611F\u8BCD\u6A21\u677F",editor:{maxLengthHint:"\u654F\u611F\u8BCD\u6700\u591A\u53EF\u8F93\u5165{{max}}\u4E2A\u5B57\u7B26",maxLengthWarning:"\u654F\u611F\u8BCD\u6700\u591A\u53EF\u8F93\u5165{{max}}\u4E2A\u5B57\u7B26",duplicateWarning:"\u5DF2\u5B58\u5728\u76F8\u540C\u654F\u611F\u8BCD",configTemplateHint:"\u8BF7\u914D\u7F6E\u6A21\u677F\u4E0B\u8F7D\u5730\u5740",selectFileWarning:"\u8BF7\u5148\u9009\u62E9\u8981\u4E0A\u4F20\u7684\u6587\u4EF6",importFailRetry:"\u5BFC\u5165\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5",importCountSuccess:"\u5DF2\u5BFC\u5165 {{count}} \u4E2A\u654F\u611F\u8BCD",parseFail:"\u6587\u4EF6\u89E3\u6790\u5931\u8D25\uFF0C\u8BF7\u786E\u4FDD\u4E3A csv \u6216 txt \u683C\u5F0F",readFileFail:"\u6587\u4EF6\u8BFB\u53D6\u5931\u8D25",searchPlaceholder:"\u8BF7\u8F93\u5165\u654F\u611F\u8BCD\u641C\u7D22",inputPlaceholder:"\u8BF7\u8F93\u5165",add:"\u6DFB\u52A0",import:"\u5BFC\u5165",cancel:"\u53D6\u6D88",save:"\u4FDD\u5B58",confirm:"\u786E\u8BA4",downloadTemplate:"\u4E0B\u8F7D\u6A21\u677F",uploadModalTitle:"\u4E0A\u4F20\u6587\u4EF6",uploadModalHint:"\u5148\u4E0B\u8F7D\u6A21\u677F\u540E\u4E0A\u4F20",uploadDragText:"\u70B9\u51FB\u6216\u5C06\u6587\u4EF6\u62D6\u62FD\u5230\u6B64\u5904\u4E0A\u4F20",uploadDragHint:"\u652F\u6301\u5355\u6B21\u4E0A\u4F20\uFF0C\u652F\u6301 csv\u3001txt \u683C\u5F0F\u3002",formatCsv:"csv",formatTxt:"txt"},server:{requestError:"\u8BF7\u6C42\u51FA\u9519\uFF0C\u8BF7\u7A0D\u540E\u518D\u8BD5",noPermission:"\u6CA1\u6709\u8DB3\u591F\u6743\u9650"}},Pe={toolbar:{searchPlaceholder:"Enter keyword"},tagCell:{viewAllTitle:"{{total}} total, showing first {{max}}",viewAllLink:"\u2026View all (+{{count}})"},table:{label:"Sensitive words",viewLabel:"Sensitive word libraries",columns:{name:"Name",sensitiveWords:"Sensitive words",createDate:"Created",count:"Count",actions:"Actions"},toolbar:{create:"New library",searchPlaceholder:"Enter keyword"},actionEdit:"Edit",actionDelete:"Delete"},dashboard:{title:"Sensitive word libraries"},deleteConfirm:{title:"Delete this library?",content:"This library cannot be recovered after deletion.",okText:"Delete",cancelText:"Cancel"},createModal:{title:"New sensitive word library",cancel:"Cancel",confirm:"Confirm",nameRequired:"Please enter the library name.",namePlaceholder:"Enter name"},message:{saveSuccess:"Saved",createSuccess:"Library created.",deleteSuccess:"Deleted",downloadTemplateFail:"Template download failed",importSuccess:"Import succeeded",importFail:"Import failed"},downloadTemplateFilename:"sensitive-words-template",editor:{maxLengthHint:"Max {{max}} characters per word",maxLengthWarning:"Max {{max}} characters per word",duplicateWarning:"Duplicate word",configTemplateHint:"Please configure template download URL",selectFileWarning:"Please select a file first",importFailRetry:"Import failed, please retry",importCountSuccess:"Imported {{count}} words",parseFail:"Parse failed. Use csv or txt format.",readFileFail:"File read failed",searchPlaceholder:"Search sensitive words",inputPlaceholder:"Enter",add:"Add",import:"Import",cancel:"Cancel",save:"Save",confirm:"Confirm",downloadTemplate:"Download template",uploadModalTitle:"Upload file",uploadModalHint:"Download template first, then upload",uploadDragText:"Click or drag file here to upload",uploadDragHint:"Single file. csv or txt.",formatCsv:"csv",formatTxt:"txt"},server:{requestError:"Request failed, please try again.",noPermission:"Insufficient permission"}},ze={toolbar:{searchPlaceholder:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u5165\u529B"},tagCell:{viewAllTitle:"\u5168{{total}}\u4EF6\u3001\u5148\u982D{{max}}\u4EF6\u3092\u8868\u793A",viewAllLink:"\u2026\u3059\u3079\u3066\u8868\u793A\uFF08+{{count}}\uFF09"},table:{label:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9",viewLabel:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u30E9\u30A4\u30D6\u30E9\u30EA",columns:{name:"\u540D\u524D",sensitiveWords:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9",createDate:"\u4F5C\u6210\u65E5",count:"\u4EF6\u6570",actions:"\u64CD\u4F5C"},toolbar:{create:"\u65B0\u898F\u30E9\u30A4\u30D6\u30E9\u30EA",searchPlaceholder:"\u30AD\u30FC\u30EF\u30FC\u30C9\u3092\u5165\u529B"},actionEdit:"\u7DE8\u96C6",actionDelete:"\u524A\u9664"},dashboard:{title:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u7BA1\u7406"},deleteConfirm:{title:"\u3053\u306E\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u524A\u9664\u3057\u307E\u3059\u304B\uFF1F",content:"\u524A\u9664\u3059\u308B\u3068\u5FA9\u5143\u3067\u304D\u307E\u305B\u3093\u3002",okText:"\u524A\u9664",cancelText:"\u30AD\u30E3\u30F3\u30BB\u30EB"},createModal:{title:"\u65B0\u898F\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u30E9\u30A4\u30D6\u30E9\u30EA",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",confirm:"\u78BA\u8A8D",nameRequired:"\u30E9\u30A4\u30D6\u30E9\u30EA\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",namePlaceholder:"\u5165\u529B"},message:{saveSuccess:"\u4FDD\u5B58\u3057\u307E\u3057\u305F",createSuccess:"\u30E9\u30A4\u30D6\u30E9\u30EA\u3092\u4F5C\u6210\u3057\u307E\u3057\u305F\u3002",deleteSuccess:"\u524A\u9664\u3057\u307E\u3057\u305F",downloadTemplateFail:"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u306E\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u306B\u5931\u6557\u3057\u307E\u3057\u305F",importSuccess:"\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u307E\u3057\u305F",importFail:"\u30A4\u30F3\u30DD\u30FC\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F"},downloadTemplateFilename:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8",editor:{maxLengthHint:"1\u8A9E\u3042\u305F\u308A{{max}}\u6587\u5B57\u307E\u3067",maxLengthWarning:"1\u8A9E\u3042\u305F\u308A{{max}}\u6587\u5B57\u307E\u3067",duplicateWarning:"\u540C\u3058\u8A9E\u304C\u65E2\u306B\u3042\u308A\u307E\u3059",configTemplateHint:"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9URL\u3092\u8A2D\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044",selectFileWarning:"\u30D5\u30A1\u30A4\u30EB\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",importFailRetry:"\u30A4\u30F3\u30DD\u30FC\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044\u3002",importCountSuccess:"{{count}}\u8A9E\u3092\u30A4\u30F3\u30DD\u30FC\u30C8\u3057\u307E\u3057\u305F",parseFail:"\u89E3\u6790\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002csv \u307E\u305F\u306F txt \u5F62\u5F0F\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",readFileFail:"\u30D5\u30A1\u30A4\u30EB\u306E\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F",searchPlaceholder:"\u30BB\u30F3\u30B7\u30C6\u30A3\u30D6\u30EF\u30FC\u30C9\u3092\u691C\u7D22",inputPlaceholder:"\u5165\u529B",add:"\u8FFD\u52A0",import:"\u30A4\u30F3\u30DD\u30FC\u30C8",cancel:"\u30AD\u30E3\u30F3\u30BB\u30EB",save:"\u4FDD\u5B58",confirm:"\u78BA\u8A8D",downloadTemplate:"\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9",uploadModalTitle:"\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",uploadModalHint:"\u5148\u306B\u30C6\u30F3\u30D7\u30EC\u30FC\u30C8\u3092\u30C0\u30A6\u30F3\u30ED\u30FC\u30C9\u3057\u3066\u304B\u3089\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",uploadDragText:"\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u30C9\u30E9\u30C3\u30B0\u3057\u3066\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9",uploadDragHint:"1\u30D5\u30A1\u30A4\u30EB\u3002csv \u307E\u305F\u306F txt\u3002",formatCsv:"csv",formatTxt:"txt"},server:{requestError:"\u30EA\u30AF\u30A8\u30B9\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\u3057\u3070\u3089\u304F\u3057\u3066\u304B\u3089\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",noPermission:"\u6A29\u9650\u304C\u3042\u308A\u307E\u305B\u3093"}},Ne={zh:te,en:Pe,ja:ze};function We(e){return Ne[e]??te}function J(e,i){return e.replace(/\{\{(\w+)\}\}/g,(F,f)=>String(i[f]??""))}const ve=ue.createContext({locale:"zh",messages:te,getMessage:e=>{const i=e.split(".");let F=te;for(const f of i)F=F==null?void 0:F[f];return typeof F=="string"?F:e}});function ae(){return ue.useContext(ve)}function He({locale:e,messages:i,children:F}){const f=ue.useMemo(()=>{const c=We(e),r=i?{...c,...i}:c;return{locale:e,messages:r,getMessage:u=>{const A=u.split(".");let D=r;for(const I of A)D=D==null?void 0:D[I];return typeof D=="string"?D:u}}},[e,i]);return ue.createElement(ve.Provider,{value:f},F)}const{Dragger:Ue}=Ae,j=16,Re=v.div.attrs({className:"sensitive-edit-page"})`
12
12
  display: flex;
13
13
  flex-direction: column;
14
14
  width: 100%;
15
15
  height: 100%;
16
- background: ${({theme:e})=>{var r;return((r=e==null?void 0:e.colors)==null?void 0:r.background)??"#FFFFFF"}};
16
+ background: ${({theme:e})=>{var i;return((i=e==null?void 0:e.colors)==null?void 0:i.background)??"#FFFFFF"}};
17
17
  `,qe=v.div.attrs({className:"sensitive-edit-toolbar"})`
18
18
  flex-shrink: 0;
19
19
  display: flex;
@@ -26,8 +26,8 @@ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useS
26
26
  flex: 1;
27
27
  min-height: 0;
28
28
  overflow: auto;
29
- border: 1px solid ${({theme:e})=>{var r;return((r=e==null?void 0:e.colors)==null?void 0:r.border)??"#E5E7EB"}};
30
- background: ${({theme:e})=>{var r;return((r=e==null?void 0:e.colors)==null?void 0:r.listBackground)??"#f5f5f5"}};
29
+ border: 1px solid ${({theme:e})=>{var i;return((i=e==null?void 0:e.colors)==null?void 0:i.border)??"#E5E7EB"}};
30
+ background: ${({theme:e})=>{var i;return((i=e==null?void 0:e.colors)==null?void 0:i.listBackground)??"#f5f5f5"}};
31
31
  border-radius: 8px;
32
32
  padding: 16px;
33
33
  margin: 0 20px;
@@ -125,10 +125,10 @@ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useS
125
125
  gap: 12px;
126
126
  padding: 4px 14px;
127
127
  margin-bottom: 16px;
128
- background: ${({theme:e})=>{var r;return((r=e==null?void 0:e.colors)==null?void 0:r.tagBackground)??"#eff6ff"}};
128
+ background: ${({theme:e})=>{var i;return((i=e==null?void 0:e.colors)==null?void 0:i.tagBackground)??"#eff6ff"}};
129
129
  border-radius: 6px;
130
130
  font-size: 14px;
131
- color: ${({theme:e})=>{var r;return((r=e==null?void 0:e.colors)==null?void 0:r.text)??"#1f2937"}};
131
+ color: ${({theme:e})=>{var i;return((i=e==null?void 0:e.colors)==null?void 0:i.text)??"#1f2937"}};
132
132
  `,Ye=v.div.attrs({className:"sensitive-upload-modal-dragger-wrap"})`
133
133
  .ant-upload-drag {
134
134
  border-radius: 8px;
@@ -139,9 +139,9 @@ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useS
139
139
  border-color: #1d70f5;
140
140
  background: #f0f7ff;
141
141
  }
142
- `,Ze=({words:e,onWordsChange:r,onSave:F,onCancel:f,styles:c,onDownloadTemplate:i,onImportFile:L})=>{var G;const{messages:u}=ae(),[A,D]=_(""),[I,w]=_(!1),[x,T]=_(""),t=Ce(null),[o,l]=_(!1),[p,E]=_([]),[M,g]=_(!1),y=((G=c==null?void 0:c.theme)==null?void 0:G.colors)||Fe.colors||{},N=y.tagColor??"#1d70f5",R=y.tagAddColor??"#1d70f5",q=y.tagBackground??"#ebf6ff",oe="none";be(()=>{I&&(T(""),setTimeout(()=>{var n;return(n=t.current)==null?void 0:n.focus()},0))},[I]);const O=k(()=>{const n=x.trim();if(n){if(n.length>j){b.warning(J(u.editor.maxLengthWarning,{max:String(j)}));return}if(e.includes(n)){b.warning(u.editor.duplicateWarning);return}r([...e,n])}T(""),w(!1)},[x,e,r,u]),Y=k(n=>{r(e.filter(C=>C!==n))},[e,r]),ne=ee(()=>{const n=A.trim().toLowerCase();return n?e.filter(C=>C.toLowerCase().includes(n)):e},[e,A]),ie=k(()=>{E([]),l(!0)},[]),re=k(n=>{i?i(n):b.info(u.editor.configTemplateHint)},[i,u]),se={items:[{key:"csv",label:u.editor.formatCsv},{key:"txt",label:u.editor.formatTxt}],onClick:({key:n})=>re(n)},W=k(n=>{const C=n.replace(/\r\n/g,`
142
+ `,Ze=({words:e,onWordsChange:i,onSave:F,onCancel:f,styles:c,onDownloadTemplate:r,onImportFile:L})=>{var G;const{messages:u}=ae(),[A,D]=_(""),[I,w]=_(!1),[x,T]=_(""),t=Ce(null),[o,l]=_(!1),[p,E]=_([]),[M,g]=_(!1),y=((G=c==null?void 0:c.theme)==null?void 0:G.colors)||Fe.colors||{},N=y.tagColor??"#1d70f5",R=y.tagAddColor??"#1d70f5",q=y.tagBackground??"#ebf6ff",oe="none";be(()=>{I&&(T(""),setTimeout(()=>{var n;return(n=t.current)==null?void 0:n.focus()},0))},[I]);const O=k(()=>{const n=x.trim();if(n){if(n.length>j){b.warning(J(u.editor.maxLengthWarning,{max:String(j)}));return}if(e.includes(n)){b.warning(u.editor.duplicateWarning);return}i([...e,n])}T(""),w(!1)},[x,e,i,u]),Y=k(n=>{i(e.filter(C=>C!==n))},[e,i]),ne=ee(()=>{const n=A.trim().toLowerCase();return n?e.filter(C=>C.toLowerCase().includes(n)):e},[e,A]),re=k(()=>{E([]),l(!0)},[]),ie=k(n=>{r?r(n):b.info(u.editor.configTemplateHint)},[r,u]),se={items:[{key:"csv",label:u.editor.formatCsv},{key:"txt",label:u.editor.formatTxt}],onClick:({key:n})=>ie(n)},W=k(n=>{const C=n.replace(/\r\n/g,`
143
143
  `).replace(/\r/g,`
144
- `).split(/[\n,\t]/).map($=>$.trim()).filter(Boolean),H=new Set,P=[];for(const $ of C){const U=$.length>j?$.slice(0,j):$;H.has(U)||(H.add(U),P.push(U))}return P},[]),K=k(async()=>{var H;const n=(H=p[0])==null?void 0:H.originFileObj;if(!n){b.warning(u.editor.selectFileWarning);return}if(L){g(!0);try{await L(n),l(!1),E([])}catch{b.error(u.editor.importFailRetry)}finally{g(!1)}return}const C=new FileReader;C.onload=()=>{try{const P=C.result||"",$=W(P),U=Array.from(new Set([...e,...$]));r(U),b.success(J(u.editor.importCountSuccess,{count:String($.length)})),l(!1),E([])}catch{b.error(u.editor.parseFail)}},C.onerror=()=>b.error(u.editor.readFileFail),C.readAsText(n,"UTF-8")},[p,e,r,W,L,u]),Z=k(()=>{l(!1),E([])},[]);return B(Re,{theme:c==null?void 0:c.theme,children:[B(qe,{theme:c==null?void 0:c.theme,children:[s(z,{mode:"primary",label:u.editor.import,icon:s(Te,{size:16}),onClick:ie,styles:c}),B("span",{style:{display:"flex",alignItems:"center",gap:6,color:y.textSecondary??"#6b7280",fontSize:12},children:[s(he,{size:14}),J(u.editor.maxLengthHint,{max:String(j)})]}),s("div",{style:{flex:1,marginLeft:"auto",minWidth:200,maxWidth:320,display:"flex",alignItems:"center",gap:8},children:s(de,{placeholder:u.editor.searchPlaceholder,value:A,allowClear:!0,onChange:n=>D(n.target.value),suffix:s(xe,{size:16,style:{color:"#9ca3af"}}),style:{flex:1}})})]}),s(je,{theme:c==null?void 0:c.theme,children:B(Ve,{children:[ne.map(n=>B(Oe,{$color:N,$bg:q,$border:oe,children:[n,s("span",{className:"sensitive-edit-tag-remove",onClick:()=>Y(n),role:"button",tabIndex:0,onKeyDown:C=>C.key==="Enter"&&Y(n),children:s(Le,{size:14})})]},n)),I?s(Ge,{$focused:!0,$color:N,children:s("input",{ref:t,type:"text",className:"sensitive-edit-add-input",placeholder:u.editor.inputPlaceholder,value:x,onChange:n=>T(n.target.value),onBlur:O,onKeyDown:n=>{n.key==="Enter"&&O(),n.key==="Escape"&&(T(""),w(!1))},maxLength:j})}):B(Ke,{$color:R,onClick:()=>w(!0),role:"button",tabIndex:0,onKeyDown:n=>n.key==="Enter"&&w(!0),children:[s(Be,{size:14}),u.editor.add]})]})}),B(Xe,{theme:c==null?void 0:c.theme,children:[s(z,{mode:"default",label:u.editor.cancel,onClick:f,styles:c,style:{width:76}}),s(z,{mode:"primary",label:u.editor.save,onClick:F,styles:c,style:{width:76}})]}),B(pe,{title:u.editor.uploadModalTitle,open:o,onCancel:Z,footer:B("div",{style:{display:"flex",justifyContent:"flex-end",gap:20},children:[s(z,{mode:"default",label:u.editor.cancel,onClick:Z,styles:c,disabled:M,style:{width:76}}),s(z,{mode:"primary",label:u.editor.confirm,onClick:K,styles:c,disabled:M,style:{width:76}})]}),destroyOnClose:!0,width:650,children:[B(Je,{theme:c==null?void 0:c.theme,children:[B("span",{style:{display:"flex",alignItems:"center",gap:8},children:[s(he,{size:18,style:{color:"#1d70f5",flexShrink:0}}),u.editor.uploadModalHint]}),s(we,{menu:se,trigger:["click"],children:s("div",{style:{display:"inline-block"},children:s(z,{mode:"default",label:u.editor.downloadTemplate,styles:c})})})]}),s(Ye,{children:B(Ue,{accept:".csv,.txt",maxCount:1,fileList:p,beforeUpload:()=>!1,onChange:({fileList:n})=>E(n.slice(-1)),showUploadList:{showPreviewIcon:!1},children:[s("p",{className:"ant-upload-drag-icon",style:{marginBottom:8},children:s(Ie,{size:48,style:{color:"#1d70f5"}})}),s("p",{className:"ant-upload-text",children:u.editor.uploadDragText}),s("p",{className:"ant-upload-hint",children:u.editor.uploadDragHint})]})})]})]})},{confirm:Qe}=pe,eu={pageNo:1,pageSize:999},uu=v.div.attrs({className:"sensitive-modal-footer"})`
144
+ `).split(/[\n,\t]/).map($=>$.trim()).filter(Boolean),H=new Set,P=[];for(const $ of C){const U=$.length>j?$.slice(0,j):$;H.has(U)||(H.add(U),P.push(U))}return P},[]),K=k(async()=>{var H;const n=(H=p[0])==null?void 0:H.originFileObj;if(!n){b.warning(u.editor.selectFileWarning);return}if(L){g(!0);try{await L(n),l(!1),E([])}catch{b.error(u.editor.importFailRetry)}finally{g(!1)}return}const C=new FileReader;C.onload=()=>{try{const P=C.result||"",$=W(P),U=Array.from(new Set([...e,...$]));i(U),b.success(J(u.editor.importCountSuccess,{count:String($.length)})),l(!1),E([])}catch{b.error(u.editor.parseFail)}},C.onerror=()=>b.error(u.editor.readFileFail),C.readAsText(n,"UTF-8")},[p,e,i,W,L,u]),Z=k(()=>{l(!1),E([])},[]);return B(Re,{theme:c==null?void 0:c.theme,children:[B(qe,{theme:c==null?void 0:c.theme,children:[s(z,{mode:"primary",label:u.editor.import,icon:s(Te,{size:16}),onClick:re,styles:c}),B("span",{style:{display:"flex",alignItems:"center",gap:6,color:y.textSecondary??"#6b7280",fontSize:12},children:[s(he,{size:14}),J(u.editor.maxLengthHint,{max:String(j)})]}),s("div",{style:{flex:1,marginLeft:"auto",minWidth:200,maxWidth:320,display:"flex",alignItems:"center",gap:8},children:s(de,{placeholder:u.editor.searchPlaceholder,value:A,allowClear:!0,onChange:n=>D(n.target.value),suffix:s(xe,{size:16,style:{color:"#9ca3af"}}),style:{flex:1}})})]}),s(je,{theme:c==null?void 0:c.theme,children:B(Ve,{children:[ne.map(n=>B(Oe,{$color:N,$bg:q,$border:oe,children:[n,s("span",{className:"sensitive-edit-tag-remove",onClick:()=>Y(n),role:"button",tabIndex:0,onKeyDown:C=>C.key==="Enter"&&Y(n),children:s(Le,{size:14})})]},n)),I?s(Ge,{$focused:!0,$color:N,children:s("input",{ref:t,type:"text",className:"sensitive-edit-add-input",placeholder:u.editor.inputPlaceholder,value:x,onChange:n=>T(n.target.value),onBlur:O,onKeyDown:n=>{n.key==="Enter"&&O(),n.key==="Escape"&&(T(""),w(!1))},maxLength:j})}):B(Ke,{$color:R,onClick:()=>w(!0),role:"button",tabIndex:0,onKeyDown:n=>n.key==="Enter"&&w(!0),children:[s(Be,{size:14}),u.editor.add]})]})}),B(Xe,{theme:c==null?void 0:c.theme,children:[s(z,{mode:"default",label:u.editor.cancel,onClick:f,styles:c,style:{width:76}}),s(z,{mode:"primary",label:u.editor.save,onClick:F,styles:c,style:{width:76}})]}),B(pe,{title:u.editor.uploadModalTitle,open:o,onCancel:Z,footer:B("div",{style:{display:"flex",justifyContent:"flex-end",gap:20},children:[s(z,{mode:"default",label:u.editor.cancel,onClick:Z,styles:c,disabled:M,style:{width:76}}),s(z,{mode:"primary",label:u.editor.confirm,onClick:K,styles:c,disabled:M,style:{width:76}})]}),destroyOnClose:!0,width:650,children:[B(Je,{theme:c==null?void 0:c.theme,children:[B("span",{style:{display:"flex",alignItems:"center",gap:8},children:[s(he,{size:18,style:{color:"#1d70f5",flexShrink:0}}),u.editor.uploadModalHint]}),s(we,{menu:se,trigger:["click"],children:s("div",{style:{display:"inline-block"},children:s(z,{mode:"default",label:u.editor.downloadTemplate,styles:c})})})]}),s(Ye,{children:B(Ue,{accept:".csv,.txt",maxCount:1,fileList:p,beforeUpload:()=>!1,onChange:({fileList:n})=>E(n.slice(-1)),showUploadList:{showPreviewIcon:!1},children:[s("p",{className:"ant-upload-drag-icon",style:{marginBottom:8},children:s(Ie,{size:48,style:{color:"#1d70f5"}})}),s("p",{className:"ant-upload-text",children:u.editor.uploadDragText}),s("p",{className:"ant-upload-hint",children:u.editor.uploadDragHint})]})})]})]})},{confirm:Qe}=pe,eu={pageNo:1,pageSize:999},uu=v.div.attrs({className:"sensitive-modal-footer"})`
145
145
  width: 100%;
146
146
  display: flex;
147
147
  flex-direction: row;
@@ -151,7 +151,7 @@ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useS
151
151
  display: flex;
152
152
  align-items: center;
153
153
  min-width: 220px;
154
- `,au=({onAction:e})=>{const[r,F]=_(""),{messages:f}=ae(),c=k(()=>{const i=r.trim();e("search",{keyword:i})},[r,e]);return s(tu,{children:s(de,{placeholder:f.toolbar.searchPlaceholder,allowClear:!0,value:r,onChange:i=>F(i.target.value),onPressEnter:c,suffix:s(xe,{size:16,style:{color:"#9ca3af"}})})})},ou=v.div.attrs({className:"sensitive-tag-cell-wrap"})`
154
+ `,au=({onAction:e})=>{const[i,F]=_(""),{messages:f}=ae(),c=k(()=>{const r=i.trim();e("search",{keyword:r})},[i,e]);return s(tu,{children:s(de,{placeholder:f.toolbar.searchPlaceholder,allowClear:!0,value:i,onChange:r=>F(r.target.value),onPressEnter:c,suffix:s(xe,{size:16,style:{color:"#9ca3af"}})})})},ou=v.div.attrs({className:"sensitive-tag-cell-wrap"})`
155
155
  display: flex;
156
156
  flex-wrap: wrap;
157
157
  gap: 12px;
@@ -170,7 +170,7 @@ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useS
170
170
  white-space: nowrap;
171
171
  flex-shrink: 0;
172
172
  font-family: PingFangSC, 微软雅黑, Helvetic, sans-serif;
173
- `,Q=8,iu=v.span.attrs({className:"sensitive-tag-more"})`
173
+ `,Q=8,ru=v.span.attrs({className:"sensitive-tag-more"})`
174
174
  display: inline-block;
175
175
  color: ${e=>e.$color};
176
176
  font-size: 12px;
@@ -182,4 +182,4 @@ import{jsxs as B,jsx as s,Fragment as Ee}from"react/jsx-runtime";import ue,{useS
182
182
  &:hover {
183
183
  text-decoration: underline;
184
184
  }
185
- `;function ru({value:e,theme:r,onViewAll:F,row:f}){var o;const{messages:c}=ae(),i=(r==null?void 0:r.colors)||Fe.colors||{},L=i.tagColor??"#1d70f5",u=i.tagBackground??"#ebf6ff",A=Array.isArray(e)?e:[];if(A.length===0)return null;const D=((o=((f==null?void 0:f.data)||[]).find(l=>l.columnId==="count"))==null?void 0:o.value)||0,I=A.slice(0,Q),w=D>Q,x=w?D-Q:0,T=J(c.tagCell.viewAllTitle,{total:String(D),max:String(Q)}),t=J(c.tagCell.viewAllLink,{count:String(x)});return B(ou,{children:[I.map((l,p)=>s(nu,{$color:L,$bg:u,$border:"none",children:l},p)),w&&s(iu,{$color:L,title:T,onClick:()=>F==null?void 0:F(),children:t})]})}const su=({url:e,token:r,role:F,server:f,styles:c,eventsEmit:i,CustomComponents:L})=>{const{messages:u,locale:A,getMessage:D}=ae(),[I,w]=_({container:"ready",content:"ready"}),x=Ce(null),[T,t]=_(),[o]=ce.useForm(),[l,p]=_(!1),[E,M]=_(""),[g,y]=_({active:!1,libraryId:null,libraryName:"",words:[]}),N=ee(()=>f||Me({url:e,token:r,role:F,getMessage:D}),[f,e,r,F,D]),{getLibraryList:R,deleteLibrary:q,createLibrary:oe,updateLibrary:O,downloadTemplate:Y,importWords:ne,getWords:ie,getLibraryData:re}=N,se=k(d=>{const a=(d==null?void 0:d.data)??[],h=a.find(le=>le.columnId==="name"),m=a.find(le=>le.columnId==="sensitiveWords"),S=(h==null?void 0:h.value)??"",X=Array.isArray(m==null?void 0:m.value)?[...m.value]:[];return{name:S,words:X}},[]),W=k(async d=>{const{id:a,name:h,words:m}=await re(d.id);y({active:!0,libraryId:a,libraryName:h,words:m})},[se]),K=k(()=>{y({active:!1,libraryId:null,libraryName:"",words:[]}),C(),i==null||i("sensitive_edit_closed",{})},[i]),Z=k(async()=>{if(g.libraryId)try{await O(g.libraryId,{name:g.libraryName,words:g.words})&&(b.success(u.message.saveSuccess),K(),w(a=>({...a,content:"loading"})),C())}catch(d){console.error("[SensitiveView] \u4FDD\u5B58\u654F\u611F\u8BCD\u5931\u8D25:",d)}},[g.libraryId,g.words,O,K]),G=Se(),n=ee(()=>ge(ge({theme:Fe,mode:"light"},G||{}),c||{}),[G,c]);be(()=>{w(d=>({...d,content:"loading"})),C()},[]);const C=async d=>{try{const a={...eu},h=d??E;h&&(a.name=h);const m=await R(a);if(m){const S=H(m.records);t(S||[]),w(X=>({...X,content:"ready"}))}}catch(a){console.log("[SensitiveView] getSensitiveList error:",a)}};function H(d){return(d||[]).map(a=>({id:a.id,data:[{columnId:"name",value:a.name,type:"label"},{columnId:"sensitiveWords",value:a.words,type:"customized"},{columnId:"createDate",value:a.gmtCreate,type:"date"},{columnId:"count",value:a.count,type:"text"},{columnId:"actions",value:"edit",label:u.table.actionEdit,type:"action"},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action"}]}))}const P=A==="zh"?"zh-CN":A==="ja"?"ja-JP":"en-US",$=ee(()=>({label:u.table.label,model:null,defaultActiveId:"sensitive-table",views:[{id:"sensitive-table",label:u.table.viewLabel,type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,paginationLocale:A,columns:[{title:u.table.columns.name,id:"name",type:"label"},{title:u.table.columns.sensitiveWords,id:"sensitiveWords",type:"customized",component:ru,componentProps:({value:d,row:a})=>({value:d,theme:n==null?void 0:n.theme,row:a,onViewAll:a?()=>W(a):void 0}),fallback:null},{title:u.table.columns.createDate,id:"createDate",type:"date"},{title:u.table.columns.count,id:"count",type:"text"},{title:u.table.columns.actions,id:"actions",type:"action"}],toolbar:[{type:"button",key:"create",label:u.table.toolbar.create,btnType:"primary",icon:s(Be,{size:16})},{type:"customized",key:"search",label:u.table.toolbar.searchPlaceholder,position:"right",component:au}]}]}),[n,W,u]),U=async()=>{try{const d=await o.validateFields();if(!d)return;const a=await oe({...d,words:[]});if(a&&(x!=null&&x.current)){console.log("+++++",new Date().toLocaleString(P,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"));const h={id:a,data:[{columnId:"name",value:d.name,type:"label"},{columnId:"sensitiveWords",value:[],type:"customized"},{columnId:"createDate",value:new Date().toLocaleString(P,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"),type:"date"},{columnId:"count",value:0,type:"text"},{columnId:"actions",value:"edit",label:u.table.actionEdit,type:"action"},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action"}]};b.success(u.message.createSuccess),me("table_action_edit",{id:a},()=>{}),i==null||i("sensitive_library_created",{id:a,name:d.name})}}catch(d){console.error("[SensitiveView] \u65B0\u589E\u654F\u611F\u8BCD\u5931\u8D25:",d)}finally{p(!1),o.resetFields()}};function me(d,a,h){switch(console.log("name",d),d){case"toolbar_create":p(!0),i==null||i("sensitive_toolbar_create",a);break;case"table_action_edit":{const m=a==null?void 0:a.id,S=m&&Array.isArray(T)?T.find(X=>X.id===m):a!=null&&a.data?a:null;S&&S.data?W(S):a!=null&&a.id&&W(a),i==null||i("sensitive_table_action_edit",a);break}case"table_action_delete":{Qe({title:u.deleteConfirm.title,content:u.deleteConfirm.content,okText:u.deleteConfirm.okText,cancelText:u.deleteConfirm.cancelText,async onOk(){var m;try{await q(a.id)&&(x!=null&&x.current)&&((m=x.current.appFn)==null||m.removeItem(a.id),b.success(u.message.deleteSuccess),C(),i==null||i("sensitive_table_action_delete",a))}catch(S){console.error("[SensitiveView] \u5220\u9664\u654F\u611F\u8BCD\u5E93\u5931\u8D25",S)}}});break}case"toolbar_search_search":{const m=(a==null?void 0:a.keyword)||"";M(m),w(S=>({...S,content:"loading"})),C(m),i==null||i("sensitive_toolbar_search",a);break}default:i==null||i("sensitive_"+d,a);break}}const fe=()=>{p(!1),o.resetFields()};return s(ke,{styles:n,children:g.active?s(Ze,{libraryName:g.libraryName,words:g.words,onWordsChange:d=>y(a=>({...a,words:d})),onSave:Z,onCancel:K,styles:n,onDownloadTemplate:async d=>{const a=await Y(d);if(!a){b.error(u.message.downloadTemplateFail);return}const h=URL.createObjectURL(a),m=document.createElement("a");m.href=h,m.download=`${u.downloadTemplateFilename}.${d}`,m.click(),URL.revokeObjectURL(h)},onImportFile:async d=>{if(!g.libraryId)return;const a=await ne(g.libraryId,d);if(a&&a.success!==!1){b.success(u.message.importSuccess);const h=await ie(g.libraryId);(h==null?void 0:h.words)!=null&&y(m=>({...m,words:h==null?void 0:h.words}))}else throw b.error((a==null?void 0:a.errorMsg)||u.message.importFail),new Error("import failed")}}):B(Ee,{children:[s(ye,{dataSource:T,ref:x,eventsEmit:me,status:I,styles:n,CustomComponents:{...L},...$}),s(pe,{title:u.createModal.title,open:l,width:650,destroyOnClose:!0,onCancel:fe,footer:B(uu,{theme:n==null?void 0:n.theme,children:[s(z,{mode:"default",label:u.createModal.cancel,onClick:fe}),s(z,{mode:"primary",label:u.createModal.confirm,onClick:U})]}),children:s(ce,{form:o,children:s(ce.Item,{label:null,name:"name",rules:[{required:!0,message:u.createModal.nameRequired}],children:s(de,{placeholder:u.createModal.namePlaceholder})})})})]})})},xu=e=>{const{locale:r="zh",messages:F,...f}=e;return s(He,{locale:r,messages:F,children:s(su,{...f})})};export{ve as SensitiveI18nContext,He as SensitiveI18nProvider,xu as default,We as getSensitiveMessages,J as interpolate,ae as useSensitiveI18n};
185
+ `;function iu({value:e,theme:i,onViewAll:F,row:f}){var o;const{messages:c}=ae(),r=(i==null?void 0:i.colors)||Fe.colors||{},L=r.tagColor??"#1d70f5",u=r.tagBackground??"#ebf6ff",A=Array.isArray(e)?e:[];if(A.length===0)return null;const D=((o=((f==null?void 0:f.data)||[]).find(l=>l.columnId==="count"))==null?void 0:o.value)||0,I=A.slice(0,Q),w=D>Q,x=w?D-Q:0,T=J(c.tagCell.viewAllTitle,{total:String(D),max:String(Q)}),t=J(c.tagCell.viewAllLink,{count:String(x)});return B(ou,{children:[I.map((l,p)=>s(nu,{$color:L,$bg:u,$border:"none",children:l},p)),w&&s(ru,{$color:L,title:T,onClick:()=>F==null?void 0:F(),children:t})]})}const su=({url:e,token:i,role:F,server:f,styles:c,eventsEmit:r,CustomComponents:L})=>{const{messages:u,locale:A,getMessage:D}=ae(),[I,w]=_({container:"ready",content:"ready"}),x=Ce(null),[T,t]=_(),[o]=ce.useForm(),[l,p]=_(!1),[E,M]=_(""),[g,y]=_({active:!1,libraryId:null,libraryName:"",words:[]}),N=ee(()=>f||Me({url:e,token:i,role:F,getMessage:D}),[f,e,i,F,D]),{getLibraryList:R,deleteLibrary:q,createLibrary:oe,updateLibrary:O,downloadTemplate:Y,importWords:ne,getWords:re,getLibraryData:ie}=N,se=k(d=>{const a=(d==null?void 0:d.data)??[],h=a.find(le=>le.columnId==="name"),m=a.find(le=>le.columnId==="sensitiveWords"),S=(h==null?void 0:h.value)??"",X=Array.isArray(m==null?void 0:m.value)?[...m.value]:[];return{name:S,words:X}},[]),W=k(async d=>{const{id:a,name:h,words:m}=await ie(d.id);y({active:!0,libraryId:a,libraryName:h,words:m})},[se]),K=k(()=>{y({active:!1,libraryId:null,libraryName:"",words:[]}),C(),r==null||r("sensitive_edit_closed",{})},[r]),Z=k(async()=>{if(g.libraryId)try{await O(g.libraryId,{name:g.libraryName,words:g.words})&&(b.success(u.message.saveSuccess),K(),w(a=>({...a,content:"loading"})),C())}catch(d){console.error("[SensitiveView] \u4FDD\u5B58\u654F\u611F\u8BCD\u5931\u8D25:",d)}},[g.libraryId,g.words,O,K]),G=Se(),n=ee(()=>ge(ge({theme:Fe,mode:"light"},G||{}),c||{}),[G,c]);be(()=>{w(d=>({...d,content:"loading"})),C()},[]);const C=async d=>{try{const a={...eu},h=d??E;h&&(a.name=h);const m=await R(a);if(m){const S=H(m.records);t(S||[]),w(X=>({...X,content:"ready"}))}}catch(a){console.log("[SensitiveView] getSensitiveList error:",a)}};function H(d){return(d||[]).map(a=>({id:a.id,data:[{columnId:"name",value:a.name,type:"label"},{columnId:"sensitiveWords",value:a.words,type:"customized"},{columnId:"createDate",value:a.gmtCreate,type:"date"},{columnId:"count",value:a.count,type:"text"},{columnId:"actions",value:"edit",label:u.table.actionEdit,type:"action"},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action"}]}))}const P=A==="zh"?"zh-CN":A==="ja"?"ja-JP":"en-US",$=ee(()=>({label:u.table.label,model:null,defaultActiveId:"sensitive-table",views:[{id:"sensitive-table",label:u.table.viewLabel,type:"table",viewBehavior:"pagination",allowMultiSelect:!1,viewPageSize:10,paginationLocale:A,columns:[{title:u.table.columns.name,id:"name",type:"label"},{title:u.table.columns.sensitiveWords,id:"sensitiveWords",type:"customized",component:iu,componentProps:({value:d,row:a})=>({value:d,theme:n==null?void 0:n.theme,row:a,onViewAll:a?()=>W(a):void 0}),fallback:null},{title:u.table.columns.createDate,id:"createDate",type:"date"},{title:u.table.columns.count,id:"count",type:"text"},{title:u.table.columns.actions,id:"actions",type:"action"}],toolbar:[{type:"button",key:"create",label:u.table.toolbar.create,btnType:"primary",icon:s(Be,{size:16})},{type:"customized",key:"search",label:u.table.toolbar.searchPlaceholder,position:"right",component:au}]}]}),[n,W,u]),U=async()=>{try{const d=await o.validateFields();if(!d)return;const a=await oe({...d,words:[]});if(a&&(x!=null&&x.current)){console.log("+++++",new Date().toLocaleString(P,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"));const h={id:a,data:[{columnId:"name",value:d.name,type:"label"},{columnId:"sensitiveWords",value:[],type:"customized"},{columnId:"createDate",value:new Date().toLocaleString(P,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"}).replace(/\//g,"-"),type:"date"},{columnId:"count",value:0,type:"text"},{columnId:"actions",value:"edit",label:u.table.actionEdit,type:"action"},{columnId:"actions",value:"delete",label:u.table.actionDelete,type:"action"}]};b.success(u.message.createSuccess),me("table_action_edit",{id:a},()=>{}),r==null||r("sensitive_library_created",{id:a,name:d.name})}}catch(d){console.error("[SensitiveView] \u65B0\u589E\u654F\u611F\u8BCD\u5931\u8D25:",d)}finally{p(!1),o.resetFields()}};function me(d,a,h){switch(console.log("name",d),d){case"toolbar_create":p(!0),r==null||r("sensitive_toolbar_create",a);break;case"table_action_edit":{const m=a==null?void 0:a.id,S=m&&Array.isArray(T)?T.find(X=>X.id===m):a!=null&&a.data?a:null;S&&S.data?W(S):a!=null&&a.id&&W(a),r==null||r("sensitive_table_action_edit",a);break}case"table_action_delete":{Qe({title:u.deleteConfirm.title,content:u.deleteConfirm.content,okText:u.deleteConfirm.okText,cancelText:u.deleteConfirm.cancelText,async onOk(){var m;try{await q(a.id)&&(x!=null&&x.current)&&((m=x.current.appFn)==null||m.removeItem(a.id),b.success(u.message.deleteSuccess),C(),r==null||r("sensitive_table_action_delete",a))}catch(S){console.error("[SensitiveView] \u5220\u9664\u654F\u611F\u8BCD\u5E93\u5931\u8D25",S)}}});break}case"toolbar_search_search":{const m=(a==null?void 0:a.keyword)||"";M(m),w(S=>({...S,content:"loading"})),C(m),r==null||r("sensitive_toolbar_search",a);break}default:r==null||r("sensitive_"+d,a);break}}const fe=()=>{p(!1),o.resetFields()};return s(ke,{styles:n,children:g.active?s(Ze,{libraryName:g.libraryName,words:g.words,onWordsChange:d=>y(a=>({...a,words:d})),onSave:Z,onCancel:K,styles:n,onDownloadTemplate:async d=>{const a=await Y(d);if(!a){b.error(u.message.downloadTemplateFail);return}const h=URL.createObjectURL(a),m=document.createElement("a");m.href=h,m.download=`${u.downloadTemplateFilename}.${d}`,m.click(),URL.revokeObjectURL(h)},onImportFile:async d=>{if(!g.libraryId)return;const a=await ne(g.libraryId,d);if(a&&a.success!==!1){b.success(u.message.importSuccess);const h=await re(g.libraryId);(h==null?void 0:h.words)!=null&&y(m=>({...m,words:h==null?void 0:h.words}))}else throw b.error((a==null?void 0:a.errorMsg)||u.message.importFail),new Error("import failed")}}):B(Ee,{children:[s(ye,{dataSource:T,ref:x,eventsEmit:me,status:I,styles:n,CustomComponents:{...L},...$}),s(pe,{title:u.createModal.title,open:l,width:650,destroyOnClose:!0,onCancel:fe,footer:B(uu,{theme:n==null?void 0:n.theme,children:[s(z,{mode:"default",label:u.createModal.cancel,onClick:fe}),s(z,{mode:"primary",label:u.createModal.confirm,onClick:U})]}),children:s(ce,{form:o,children:s(ce.Item,{label:null,name:"name",rules:[{required:!0,message:u.createModal.nameRequired}],children:s(de,{placeholder:u.createModal.namePlaceholder})})})})]})})},Bu=e=>{const{locale:i="zh",messages:F,...f}=e;return s(He,{locale:i,messages:F,children:s(su,{...f})})};export{ve as SensitiveI18nContext,He as SensitiveI18nProvider,Bu as default,We as getSensitiveMessages,J as interpolate,ae as useSensitiveI18n};
package/sensitiveWords.js CHANGED
@@ -1 +1 @@
1
- import"react/jsx-runtime";import"react";import"styled-components";import"antd";import"@mxmweb/xviewer";import"@mxmweb/zui";import{SensitiveI18nContext as f,SensitiveI18nProvider as g,default as l,getSensitiveMessages as u,interpolate as x,useSensitiveI18n as C}from"./sensitive.js";/* empty css */import"./assets/plus-Cok3acFd.js";import"./assets/search-BfgWf2Me.js";import"axios";import"./assets/circle-plus-2ioHM-Sb.js";import"./assets/x-CX-iE6EL.js";export{f as SensitiveI18nContext,g as SensitiveI18nProvider,l as default,u as getSensitiveMessages,x as interpolate,C as useSensitiveI18n};
1
+ import"react/jsx-runtime";import"react";import"styled-components";import"antd";import"@mxmweb/xviewer";import"@mxmweb/zui";import{SensitiveI18nContext as g,SensitiveI18nProvider as l,default as u,getSensitiveMessages as x,interpolate as C,useSensitiveI18n as M}from"./sensitive.js";/* empty css */import"./assets/plus-B679mjyt.js";import"./assets/search-CEuIa9-_.js";import"axios";import"./assets/circle-plus-RlDPoPkb.js";import"./assets/createLucideIcon-Bj5DlX2s.js";import"./assets/x-CdZQbi--.js";export{g as SensitiveI18nContext,l as SensitiveI18nProvider,u as default,x as getSensitiveMessages,C as interpolate,M as useSensitiveI18n};
@@ -1 +1 @@
1
- import{G as a}from"./assets/GientechStreamReader-Bmx4xCIT.js";import{registerPDFWorker as s}from"@mxmweb/fviewer";import"react/jsx-runtime";import"react";import"styled-components";import"axios";import"./assets/x-CX-iE6EL.js";export{a as GientechStreamReader,s as registerPDFWorker};
1
+ import{G as f}from"./assets/GientechStreamReader-_ih9ja1B.js";import{registerPDFWorker as x}from"@mxmweb/fviewer";import"react/jsx-runtime";import"react";import"styled-components";import"axios";import"./assets/createLucideIcon-Bj5DlX2s.js";import"./assets/x-CdZQbi--.js";export{f as GientechStreamReader,x as registerPDFWorker};