PageSourceSearch

https://nickz.ai/assets/js/index-CPdHnpzd.js

js nickz.ai collected 2026-10-05 14:20:27 UTC 15,169 bytes, 1 lines download raw bytes

1import{r as e,j as s}from"./vendor-react-DejgYtBM.js";import{u as t,Y as r,Z as a,A as i,s as l,w as n}from"./index-BeIIFw6E.js";import{i as o,j as d,B as c,m as u,y as p,E as h,J as x,K as g,W as f,l as m,o as y,f as b,T as j,a as v,z as k,M as w,v as _,D as S}from"./vendor-semi-D8d7bTtM.js";import{m as K}from"./marked.esm-B28mcIGu.js";import{p as N}from"./purify.es-Bm-lHtoJ.js";import{H as C}from"./vendor-highlight-CaHTjBxz.js";import{be as T,bf as I,aT as L,bg as z,bh as D,bi as O,bj as R,al as q,bk as A,bl as M,b as H,bm as P,aa as $,aL as B,bn as E,bo as F,bp as W,bq as G,e as V,aj as Z,I as J,k as U,br as X,E as Y,X as Q}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";function ee(e){return[{icon:T,title:e("粗体"),prefix:"**",suffix:"**",placeholder:e("粗体文本")},{icon:I,title:e("斜体"),prefix:"*",suffix:"*",placeholder:e("斜体文本")},{icon:L,title:e("删除线"),prefix:"~~",suffix:"~~",placeholder:e("删除线文本")},{icon:z,title:e("高亮"),prefix:"<mark>",suffix:"</mark>",placeholder:e("高亮文本")},{type:"divider"},{icon:D,title:e("一级标题"),prefix:"# ",suffix:"",placeholder:e("标题"),isLine:!0},{icon:O,title:e("二级标题"),prefix:"## ",suffix:"",placeholder:e("标题"),isLine:!0},{icon:R,title:e("三级标题"),prefix:"### ",suffix:"",placeholder:e("标题"),isLine:!0},{type:"divider"},{icon:q,title:e("无序列表"),prefix:"- ",suffix:"",placeholder:e("列表项"),isLine:!0},{icon:A,title:e("有序列表"),prefix:"1. ",suffix:"",placeholder:e("列表项"),isLine:!0},{icon:M,title:e("引用"),prefix:"> ",suffix:"",placeholder:e("引用文本"),isLine:!0},{icon:H,title:e("代码块"),prefix:"```\n",suffix:"\n```",placeholder:e("代码"),isBlock:!0},{type:"divider"},{icon:P,title:e("链接"),prefix:"[",suffix:"](url)",placeholder:e("链接文本")},{icon:$,title:e("图片"),prefix:"![",suffix:"](url)",placeholder:e("图片描述")},{icon:B,title:e("分割线"),prefix:"\n---\n",suffix:"",placeholder:"",isInsert:!0},{icon:E,title:e("表格"),prefix:"\n| 列1 | 列2 | 列3 |\n| --- | --- | --- |\n| ",suffix:" | 内容 | 内容 |\n",placeholder:e("内容"),isInsert:!0},{type:"divider"},{icon:F,title:e("上标"),prefix:"<sup>",suffix:"</sup>",placeholder:e("上标")},{icon:W,title:e("下标"),prefix:"<sub>",suffix:"</sub>",placeholder:e("下标")},{icon:G,title:e("键盘键"),prefix:"<kbd>",suffix:"</kbd>",placeholder:"Ctrl"},{icon:V,title:e("折叠区域"),prefix:"<details>\n<summary>点击展开</summary>\n\n",suffix:"\n\n</details>",placeholder:e("折叠内容")},{type:"divider"},{icon:Z,title:e("警告提示"),prefix:"\n> ⚠️ **警告:** ",suffix:"",placeholder:e("警告内容"),isLine:!0},{icon:J,title:e("信息提示"),prefix:"\n> ℹ️ **提示:** ",suffix:"",placeholder:e("提示内容"),isLine:!0},{icon:U,title:e("成功提示"),prefix:"\n> ✅ **成功:** ",suffix:"",placeholder:e("成功内容"),isLine:!0}]}K.setOptions({gfm:!0,breaks:!0,smartypants:!1,highlight(e,s){if(s&&C.getLanguage(s))try{return C.highlight(e,{language:s}).value}catch{}try{return C.highlightAuto(e).value}catch{}return e}});const se={ADD_TAGS:["iframe","video","audio","source","details","summary","mark","kbd","abbr","sup","sub","dl","dt","dd","ins","ruby","rt","rp"],ADD_ATTR:["target","allowfullscreen","frameborder","scrolling","controls","autoplay","loop","muted","poster","preload","open","title","start","type","media"]},{Text:te,Title:re}=b,ae=[{value:"quota_push",labelKey:"余额不足预警"},{value:"sale_push",labelKey:"促销活动通知"},{value:"back_push",labelKey:"防失联-定期通知"},{value:"system_push",labelKey:"系统公告通知"},{value:"price_push",labelKey:"模型调价通知"},{value:"token_warning_push",labelKey:"令牌余额不足预警"},{value:"token_exhaust_push",labelKey:"令牌余额不足"}],ie=[{value:"email",labelKey:"邮件通知"},{value:"webhook",labelKey:"Webhook通知"},{value:"wxpusher",labelKey:"WxPusher通知"},{value:"dingtalk",labelKey:"钉钉群机器人通知"},{value:"wecom",labelKey:"企业微信群机器人通知"},{value:"telegram",labelKey:"Telegram机器人通知"},{value:"feishu",labelKey:"飞书机器人通知"}],le={pending:"amber",pushing:"blue",done:"green",failed:"red"},ne=()=>{const{t:b}=t(),C=e=>{const s=ae.find(s=>
1s.value===e);return s?b(s.labelKey):e},[T,I]=e.useState(!1),[L,z]=e.useState([]),[D,O]=e.useState(0),[R,q]=e.useState(1),[A,M]=e.useState({keyword:"",status:""}),[H,P]=e.useState(!1),[$,B]=e.useState(null),[E,F]=e.useState(null),[W,G]=e.useState(""),[V,Z]=e.useState("edit"),J=e.useRef(),U=e.useRef(),ne=e.useRef(),[oe,de]=e.useState(null),[ce,ue]=e.useState([]),[pe,he]=e.useState(!1),xe=async(e,s,t)=>{I(!0);try{const r=new URLSearchParams({p:String(e),page_size:String(s)});t.keyword?.trim()&&r.set("keyword",t.keyword.trim()),""!==t.status&&void 0!==t.status&&null!==t.status&&r.set("status",t.status);const a=await i.get(`/api/push-message?${r.toString()}`),{success:n,data:o,total:d,message:c}=a.data;n?(z(o||[]),O(d||0),q(e)):l(c||b("加载失败"))}catch(r){l(r.message)}finally{I(!1)}};e.useEffect(()=>{xe(1,a,{keyword:"",status:""})},[]);const ge=()=>{xe(R,a,A)},fe=e.useCallback(e=>{const s=ne.current;if(!s)return;const t=s.selectionStart,r=s.selectionEnd,a=W.substring(t,r);let i,l;if(e.isInsert)i=W.substring(0,t)+e.prefix+e.suffix+W.substring(r),l=t+e.prefix.length+e.suffix.length;else{if(!a)return i=W.substring(0,t)+e.prefix+e.placeholder+e.suffix+W.substring(r),l=t+e.prefix.length,setTimeout(()=>{s.focus(),s.setSelectionRange(t+e.prefix.length,t+e.prefix.length+e.placeholder.length)},0),void G(i);i=W.substring(0,t)+e.prefix+a+e.suffix+W.substring(r),l=t+e.prefix.length+a.length+e.suffix.length}G(i),setTimeout(()=>{s.focus(),s.setSelectionRange(l,l)},0)},[W]),me=e.useCallback(e=>{if("Tab"===e.key){e.preventDefault();const s=ne.current,t=s.selectionStart,r=s.selectionEnd,a=W.substring(0,t)+"  "+W.substring(r);G(a),setTimeout(()=>{s.setSelectionRange(t+2,t+2)},0)}},[W]),ye=e=>{if(!e)return s.jsx("div",{className:"text-center text-gray-400 py-20",children:b("暂无内容,请在编辑器中输入 Markdown 文本")});try{const t=N.sanitize(K.parse(e),se);return s.jsx("div",{className:"article-markdown-body prose prose-slate dark:prose-invert max-w-none\n            prose-headings:font-semibold\n            prose-h1:text-2xl prose-h2:text-xl prose-h3:text-lg\n            prose-p:text-base prose-p:leading-7\n            prose-a:text-blue-600 prose-a:no-underline hover:prose-a:underline\n            prose-img:rounded-lg prose-img:shadow-md\n            prose-code:bg-gray-100 dark:prose-code:bg-gray-800 prose-code:px-1.5 prose-code:py-0.5 prose-code:rounded\n            prose-pre:bg-gray-900 prose-pre:text-gray-100\n            prose-blockquote:border-l-blue-500 prose-blockquote:bg-blue-50 dark:prose-blockquote:bg-blue-900/20 prose-blockquote:py-1\n            prose-table:border-collapse\n            prose-th:border prose-th:border-gray-300 prose-th:px-3 prose-th:py-2 prose-th:bg-gray-50\n            prose-td:border prose-td:border-gray-300 prose-td:px-3 prose-td:py-2",dangerouslySetInnerHTML:{__html:t}})}catch{return s.jsx("div",{className:"text-red-500",children:b("Markdown 解析错误")})}},be=async()=>{try{const e=await i.post(`/api/push-message/${oe.id}/execute`,{channels:ce});202===e.status||e.data?.success?(n(e.data?.message||b("已开始后台推送")),he(!1),ge()):l(e.data?.message||b("操作失败"))}catch(e){const s=e.response?.data?.message||e.message;l(s)}},je=[{title:"ID",dataIndex:"id",width:80},{title:b("标题"),dataIndex:"title",ellipsis:!0},{title:b("事件类型"),dataIndex:"event_type",width:160,render:e=>C(e)},{title:b("状态"),dataIndex:"status",width:120,render:e=>s.jsx(o,{color:le[e]||"grey",children:b(`push_status_${e}`)})},{title:b("创建时间"),dataIndex:"created_at",width:180,render:e=>r(e)},{title:b("操作"),key:"action",fixed:"right",width:220,render:(e,t)=>s.jsxs(d,{children:[s.jsx(c,{theme:"borderless",type:"primary",onClick:()=>(e=>{F(e)})(t),children:b("详情")}),"pending"===t.status&&s.jsxs(s.Fragment,{children:[s.jsx(c,{theme:"borderless",type:"primary",onClick:()=>(e=>{B(e),G(e.content||""),Z("edit"),P(!0),setTimeout(()=>{J.current?.setValues({title:e.title,event_type:e.event_type})},0)})(t),children:b("编辑")}),s.jsx(c,{theme:"borderless",type:"primary",onClick:()=>(e=>{de(e),ue([]),he(!0)})(t),children:b("推送")}),s.jsx(c,{theme:"borderless",type:"danger",onClick:()=>(e=>{w.confirm({title:b("确认删除"),content:b("确定删除该推送草稿吗ï¼
1Ÿ"),onOk:async()=>{try{const s=await i.delete(`/api/push-message/${e.id}`);s.data.success?(n(b("删除成功")),ge()):l(s.data.message)}catch(s){l(s.message)}}})})(t),children:b("删除")})]})]})}];return s.jsxs("div",{className:"px-2",children:[s.jsx(u,{className:"!rounded-2xl",title:s.jsxs("div",{className:"flex flex-col w-full",children:[s.jsxs("div",{className:"flex items-center justify-between mb-4",children:[s.jsx(re,{heading:3,children:b("推送管理")}),s.jsx(c,{theme:"solid",type:"primary",onClick:()=>{B(null),G(""),Z("edit"),P(!0),setTimeout(()=>{J.current?.setValues({title:"",event_type:"system_push"})},0)},children:b("新建推送")})]}),s.jsx(S,{margin:"12px"}),s.jsx("div",{className:"mb-4",children:s.jsx(y,{ref:U,layout:"horizontal",labelPosition:"left",onSubmit:e=>{const s={keyword:e.keyword||"",status:void 0===e.status||null===e.status?"":e.status};M(s),xe(1,a,s)},className:"w-full",children:s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3 w-full",children:[s.jsx("div",{className:"w-full md:w-48",children:s.jsx(y.Input,{field:"keyword",placeholder:b("搜索推送标题"),showClear:!0,pure:!0,prefix:s.jsx(Q,{size:16})})}),s.jsx("div",{className:"w-full md:w-48",children:s.jsxs(y.Select,{field:"status",placeholder:b("选择状态"),style:{width:"100%"},pure:!0,children:[s.jsx(y.Select.Option,{value:"",children:b("全部状态")}),s.jsx(y.Select.Option,{value:"pending",children:b("push_status_pending")}),s.jsx(y.Select.Option,{value:"pushing",children:b("push_status_pushing")}),s.jsx(y.Select.Option,{value:"done",children:b("push_status_done")}),s.jsx(y.Select.Option,{value:"failed",children:b("push_status_failed")})]})}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(c,{type:"primary",htmlType:"submit",children:b("搜索")}),s.jsx(c,{type:"tertiary",onClick:()=>{U.current?.formApi?.reset();const e={keyword:"",status:""};M(e),xe(1,a,e)},children:b("重置")})]})]})})})]}),shadows:"always",bordered:!1,children:s.jsx(p,{columns:je,dataSource:L,scroll:{x:"max-content"},pagination:{currentPage:R,pageSize:a,total:D,onPageChange:e=>{xe(e,a,A)}},loading:T,empty:s.jsx(h,{image:s.jsx(g,{style:{width:150,height:150}}),darkModeImage:s.jsx(x,{style:{width:150,height:150}}),description:b("暂无推送"),style:{padding:30}})})}),s.jsx(f,{title:b($?"编辑推送":"新建推送"),visible:H,onCancel:()=>P(!1),width:900,footer:s.jsxs("div",{style:{display:"flex",justifyContent:"flex-end"},children:[s.jsx(c,{style:{marginRight:8},onClick:()=>P(!1),children:b("取消")}),s.jsx(c,{theme:"solid",onClick:()=>J.current?.submitForm(),loading:T,children:b("保存")})]}),children:s.jsx(m,{spinning:T,children:s.jsxs(y,{getFormApi:e=>{J.current=e},onSubmit:async e=>{I(!0);try{const s={title:e.title,content:W,event_type:e.event_type};let t;t=$?await i.put(`/api/push-message/${$.id}`,s):await i.post("/api/push-message",s);const{success:r,message:a}=t.data;r?(n(b($?"更新成功":"创建成功")),P(!1),ge()):l(a||b("操作失败"))}catch(s){l(s.message)}finally{I(!1)}},labelPosition:"top",children:[s.jsx(y.Input,{field:"title",label:b("标题"),rules:[{required:!0,message:b("请输入标题")}]}),s.jsx(y.Select,{field:"event_type",label:b("订阅事件"),rules:[{required:!0}],optionList:ae.map(e=>({value:e.value,label:b(e.labelKey)}))}),s.jsxs("div",{style:{marginBottom:16},children:[s.jsxs(te,{strong:!0,style:{display:"block",marginBottom:8},children:[b("内容")," ",s.jsxs(te,{type:"tertiary",size:14,children:["(",b("支持 Markdown 格式"),")"]})]}),s.jsxs(j,{activeKey:V,onChange:Z,size:14,style:{marginBottom:0},children:[s.jsxs(v,{tab:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(X,{size:14})," ",b("编辑")]}),itemKey:"edit",children:[s.jsx("div",{className:"flex items-center gap-0.5 p-1.5 bg-gray-50 dark:bg-gray-800 border border-b-0 border-gray-200 dark:border-gray-600 rounded-t-lg flex-wrap",children:ee(b).map((e,t)=>{if("divider"===e.type)return s.jsx("div",{className:"w-px h-5 bg-gray-300 dark:bg-gray-600 mx-1"},t);const r=e.icon;return s.jsx(k,{content:e.title,position:"top",children:s.jsx("button",{type:"button",onClick:()=>fe(e),className:"p-1.5 rounded hover:bg-gray-200 dark:hover:bg-gray-700 text-gray-600 dark:text-gray-300 transition-colors",children:s.jsx(r,{size:16})})},t)})}),s.jsx("textarea",{ref:ne,value:W,onChange:e=>G(e.target.value),onKeyDown:me,placeholder:b("请输入 Markdown 格式的文章内容...\n\n# 标题\n\n正文内容...\n\n## 二级标题\n\n- 列表项1\n- 列表项2"),className:"w-full border border-gray-200 dark:border-gray-600 rounded-b-lg p-4 font-mono text-sm leading-relaxed resize-none bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",style:{height:420,minHeight:300}})]}),s.jsx(v,{tab:s.jsxs("span",{className:"flex items-center gap-1",children:[s.jsx(Y,{size:14})," ",b("预览")]}),itemKey:"preview",children:s.jsx("div",{className:"border border-gray-200 dark:border-gray-600 rounded-lg p-6 bg-white dark:bg-gray-900 overflow-auto",style:{height:460,minHeight:300},children:ye(W)})})]})]})]})})}),s.jsx(f,{title:b("推送详情"),visible:!!E,onCancel:()=>F(null),width:720,children:E&&s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{children:[s.jsx(te,{type:"secondary",children:"ID"})," ",E.id]}),s.jsxs("div",{children:[s.jsx(te,{type:"secondary",children:b("标题")})," ",E.title]}),s.jsxs("div",{children:[s.jsx(te,{type:"secondary",children:b("事件类型")})," ",C(E.event_type)]}),s.jsxs("div",{children:[s.jsx(te,{type:"secondary",children:b("状态")})," ",s.jsx(o,{color:le[E.status],children:b(`push_status_${E.status}`)})]}),E.error_message?s.jsxs("div",{children:[s.jsx(te,{type:"secondary",children:b("错误")})," ",E.error_message]}
1):null,s.jsx("div",{children:s.jsx(te,{type:"secondary",children:b("正文")})}),s.jsx("div",{className:"border border-gray-200 dark:border-gray-600 rounded-lg p-6 bg-white dark:bg-gray-900 overflow-auto",style:{minHeight:200,maxHeight:460},children:ye(E.content)})]})}),s.jsx(w,{title:b("选择推送渠道"),visible:pe,onCancel:()=>he(!1),onOk:()=>{ce.length?(he(!1),w.confirm({title:b("确认推送"),content:b("将向已订阅该事件且通知方式匹配的主站用户发送,是否继续?"),onOk:be})):l(b("请至少选择一种推送渠道"))},okText:b("确认推送"),children:s.jsx(_.Group,{value:ce,onChange:e=>ue(e),direction:"vertical","aria-label":"channels",children:ie.map(e=>s.jsx(_,{value:e.value,children:b(e.labelKey)},e.value))})})]})};export{ne as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.