Files
mai-bot/dashboard/dist/assets/index-DYRlR_zV.js

2 lines
22 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import{j as e,r}from"./router-zNjPR4CY.js";import{D as G,i as K,j as U,k as W,l as Y,a5 as Q,L as v,g as $,a3 as Z,B as m,E as L,I as _,X as Fe,Y as Ie,A as xe,n as me,o as ue,q as je,r as ge,s as fe,t as ve,v as pe,S as Pe}from"./index-CuOHsLf7.js";import{c as Be,b as Le,E as Me,d as Re,g as Je,e as He,f as Ve,h as qe,i as $e,j as Xe}from"./expression-reviewer-HNWlEaz6.js";import{S as ee,a as se,b as te,c as ae,d as D}from"./select-DGqIoF9r.js";import{S as ne}from"./switch-Kc2EZ0Ga.js";import{o as Ge,ad as Ke,e as Ue,z as de,f as We,ai as Ye,au as oe,a0 as he,v as X,ap as Qe,G as Ze,y as es,aq as ss,n as ts,a8 as as,w as ls,S as is}from"./icons-DTcdLw9j.js";import{C as q}from"./checkbox-DWiVrbnx.js";import{T as cs,a as rs,b as B,c as T,d as ns,e as w}from"./table-DFeDhBY_.js";import"./misc-BwRzHX8c.js";import"./radix-C-ZuImoP.js";import"./utils-DjBw3JGv.js";import"./badge-CDs67obV.js";import"./pagination-DX-kWu7G.js";function ds({expression:t,open:i,onOpenChange:d,chatNameMap:h}){if(!t)return null;const o=x=>x?new Date(x*1e3).toLocaleString("zh-CN"):"-",l=()=>t.chat_name||h.get(t.chat_id)||t.chat_id;return e.jsx(G,{open:i,onOpenChange:d,children:e.jsxs(K,{className:"max-w-2xl",confirmOnEnter:!0,children:[e.jsxs(U,{children:[e.jsx(W,{children:"表达方式详情"}),e.jsx(Y,{children:"查看表达方式的完整信息"})]}),e.jsx(Q,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsx(A,{label:"情境",value:t.situation}),e.jsx(A,{label:"风格",value:t.style}),e.jsx(A,{label:"聊天",value:l()}),e.jsx(A,{icon:Ge,label:"记录ID",value:t.id.toString(),mono:!0})]}),e.jsx("div",{className:"grid grid-cols-2 gap-4",children:e.jsx(A,{icon:Ke,label:"创建时间",value:o(t.create_date)})}),e.jsxs("div",{className:"rounded-lg border bg-muted/50 p-4",children:[e.jsx(v,{className:"text-xs text-muted-foreground mb-3 block",children:"状态标记"}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:$("flex h-8 w-8 items-center justify-center rounded-full",t.checked?"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:t.checked?e.jsx(Ue,{className:"h-5 w-5"}):e.jsx(de,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.checked?"已通过审核":"未审核"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:$("flex h-8 w-8 items-center justify-center rounded-full",t.rejected?"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400":"bg-gray-100 text-gray-400 dark:bg-gray-800 dark:text-gray-600"),children:t.rejected?e.jsx(We,{className:"h-5 w-5"}):e.jsx(de,{className:"h-5 w-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t.rejected?"不会被使用":"正常"})]})]})]})]})]})}),e.jsx(Z,{children:e.jsx(m,{onClick:()=>d(!1),children:"关闭"})})]})})}function A({icon:t,label:i,value:d,mono:h=!1}){return e.jsxs("div",{className:"space-y-1",children:[e.jsxs(v,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[t&&e.jsx(t,{className:"h-3 w-3"}),i]}),e.jsx("div",{className:$("text-sm",h&&"font-mono",!d&&"text-muted-foreground"),children:d||"-"})]})}function os({open:t,onOpenChange:i,chatList:d,onSuccess:h}){const[o,l]=r.useState({situation:"",style:"",chat_id:""}),[x,j]=r.useState(!1),{toast:u}=L(),f=async()=>{if(!o.situation||!o.style||!o.chat_id){u({title:"验证失败",description:"请填写必填字段:情境、风格和聚天",variant:"destructive"});return}try{j(!0);const c=await Be(o);c.success?(u({title:"创建成功",description:"表达方式已创建"}),l({situation:"",style:"",chat_id:""}),h()):u({title:"创建失败",description:c.error,variant:"destructive"})}catch(c){u({title:"创建失败",description:c instanceof Error?c.message:"无法创建表达方式",variant:"destructive"})}finally{j(!1)}};return e.jsx(G,{open:t,onOpenChange:i,children:e.jsxs(K,{className:"max-w-2xl",confirmOnEnter:!0,children:[e.jsxs(U,{children:[e.jsx(W,{children:"新增表达方式"}),e.jsx(Y,{children:"创建新的表达方式记录"})]}),e.jsx(Q,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{htmlFor:"situation",children:["情境 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(_,{id:"situation",value:o.situation,onChange:c=>l({...o,situation:c.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{htmlFor:"style",children:["风格 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(_,{id:"style",value:o.style,onChange:c=>l({...o,style:c.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(v,{htmlFor:"chat_id",children:["聊天 ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsxs(ee,{value:o.chat_id,onValueChange:c=>l({...o,chat_id:c}),children:[e.jsx(se,{children:e.jsx(te,{placeholder:"选择关联的聊天"})}),e.jsx(ae,{children:d.map(c=>e.jsx(D,{value:c.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[c.chat_name,c.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},c.chat_id))})]})]})]})}),e.jsxs(Z,{children:[e.jsx(m,{variant:"outline",onClick:()=>i(!1),children:"取消"}),e.jsx(m,{"data-dialog-action":"confirm",onClick:f,disabled:x,children:x?"创建中...":"创建"})]})]})})}function hs({expression:t,open:i,onOpenChange:d,chatList:h,onSuccess:o}){const[l,x]=r.useState({}),[j,u]=r.useState(!1),{toast:f}=L();r.useEffect(()=>{t&&x({situation:t.situation,style:t.style,chat_id:t.chat_id,checked:t.checked,rejected:t.rejected})},[t]);const c=async()=>{if(t)try{u(!0);const n=await Le(t.id,l);n.success?(f({title:"保存成功",description:"表达方式已更新"}),o()):f({title:"保存失败",description:n.error,variant:"destructive"})}catch(n){f({title:"保存失败",description:n instanceof Error?n.message:"无法更新表达方式",variant:"destructive"})}finally{u(!1)}};return t?e.jsx(G,{open:i,onOpenChange:d,children:e.jsxs(K,{className:"max-w-2xl",confirmOnEnter:!0,children:[e.jsxs(U,{children:[e.jsx(W,{children:"编辑表达方式"}),e.jsx(Y,{children:"修改表达方式的信息"})]}),e.jsx(Q,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"edit_situation",children:"情境"}),e.jsx(_,{id:"edit_situation",value:l.situation||"",onChange:n=>x({...l,situation:n.target.value}),placeholder:"描述使用场景"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"edit_style",children:"风格"}),e.jsx(_,{id:"edit_style",value:l.style||"",onChange:n=>x({...l,style:n.target.value}),placeholder:"描述表达风格"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"edit_chat_id",children:"聊天"}),e.jsxs(ee,{value:l.chat_id||"",onValueChange:n=>x({...l,chat_id:n}),children:[e.jsx(se,{children:e.jsx(te,{placeholder:"选择关联的聊天"})}),e.jsx(ae,{children:h.map(n=>e.jsx(D,{value:n.chat_id,children:e.jsxs("span",{className:"truncate",style:{wordBreak:"keep-all"},children:[n.chat_name,n.is_group&&e.jsx("span",{className:"text-muted-foreground ml-1",children:"(群聊)"})]})},n.chat_id))})]})]}),e.jsxs(Fe,{children:[e.jsx(Ye,{className:"h-4 w-4"}),e.jsx(Ie,{className:"text-xs",children:e.jsxs("div",{className:"space-y-1",children:[e.jsx("p",{children:e.jsx("strong",{children:"状态标记说明:"})}),e.jsx("p",{children:"• 已检查表示该表达方式已通过审核可由AI自动检查或人工审核"}),e.jsx("p",{children:"• 已拒绝:表示该表达方式被标记为不合适,将永远不会被使用"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['根据配置中"仅使用已审核通过的表达方式"设置:',e.jsx("br",{}),"• 开启时:只有通过审核(已检查)的项目会被使用",e.jsx("br",{}),"• 关闭时:未审核的项目也会被使用"]})]})})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"edit_checked",className:"text-sm font-medium",children:"已检查"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"已通过审核"})]}),e.jsx(ne,{id:"edit_checked",checked:l.checked??!1,onCheckedChange:n=>x({...l,checked:n})})]}),e.jsxs("div",{className:"flex items-center justify-between space-x-2 rounded-lg border p-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(v,{htmlFor:"edit_rejected",className:"text-sm font-medium",children:"已拒绝"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"不会被使用"})]}),e.jsx(ne,{id:"edit_rejected",checked:l.rejected??!1,onCheckedChange:n=>x({...l,rejected:n})})]})]})]})}),e.jsxs(Z,{children:[e.jsx(m,{variant:"outline",onClick:()=>d(!1),children:"取消"}),e.jsx(m,{"data-dialog-action":"confirm",onClick:c,disabled:j,children:j?"保存中...":"保存"})]})]})}):null}function xs({open:t,onOpenChange:i,onConfirm:d,count:h}){return e.jsx(xe,{open:t,onOpenChange:i,children:e.jsxs(me,{children:[e.jsxs(ue,{children:[e.jsx(je,{children:"确认批量删除"}),e.jsxs(ge,{children:["您即将删除 ",h," 个表达方式,此操作无法撤销。确定要继续吗?"]})]}),e.jsxs(fe,{children:[e.jsx(ve,{children:"取消"}),e.jsx(pe,{onClick:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"确认删除"})]})]})})}function ms({expression:t,open:i,onOpenChange:d,onConfirm:h}){return e.jsx(xe,{open:i,onOpenChange:d,children:e.jsxs(me,{children:[e.jsxs(ue,{children:[e.jsx(je,{children:"确认删除"}),e.jsxs(ge,{children:['确定要删除表达方式 "',t?.situation,'" 吗? 此操作不可撤销。']})]}),e.jsxs(fe,{children:[e.jsx(ve,{children:"取消"}),e.jsx(pe,{onClick:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"删除"})]})]})})}function us({expressions:t,loading:i,total:d,page:h,pageSize:o,selectedIds:l,chatNameMap:x,onEdit:j,onViewDetail:u,onDelete:f,onToggleSelect:c,onToggleSelectAll:n,onPageChange:O,onJumpToPage:F}){const{toast:M}=L(),y=a=>a.chat_name||x.get(a.chat_id)||a.chat_id,I=Math.ceil(d/o),E=a=>{const b=parseInt(a);b>=1&&b<=I?F(a):M({title:"无效的页码",description:`请输入1-${I}之间的页码`,variant:"destructive"})};return e.jsxs("div",{className:"rounded-lg border bg-card",children:[e.jsx("div",{className:"hidden md:block",children:e.jsxs(cs,{"aria-label":"表达方式列表",children:[e.jsx(rs,{children:e.jsxs(B,{children:[e.jsx(T,{className:"w-12",children:e.jsx(q,{checked:l.size===t.length&&t.length>0,onCheckedChange:n})}),e.jsx(T,{children:"情境"}),e.jsx(T,{children:"风格"}),e.jsx(T,{children:"聊天"}),e.jsx(T,{className:"text-right",children:"操作"})]})}),e.jsx(ns,{children:i?e.jsx(B,{children:e.jsx(w,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"加载中..."})}):t.length===0?e.jsx(B,{children:e.jsx(w,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"暂无数据"})}):t.map(a=>e.jsxs(B,{children:[e.jsx(w,{children:e.jsx(q,{checked:l.has(a.id),onCheckedChange:()=>c(a.id)})}),e.jsx(w,{className:"font-medium max-w-xs truncate",children:a.situation}),e.jsx(w,{className:"max-w-xs truncate",children:a.style}),e.jsx(w,{className:"max-w-[200px] truncate",title:y(a),style:{wordBreak:"keep-all"},children:e.jsx("span",{className:"whitespace-nowrap overflow-hidden text-ellipsis block",children:y(a)})}),e.jsx(w,{className:"text-right",children:e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsxs(m,{variant:"default",size:"sm",onClick:()=>j(a),children:[e.jsx(oe,{className:"h-4 w-4 mr-1"}),"编辑"]}),e.jsx(m,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>u(a),title:"查看详情",children:e.jsx(he,{className:"h-4 w-4"})}),e.jsxs(m,{size:"sm",onClick:()=>f(a),className:"bg-red-600 hover:bg-red-700 text-white",children:[e.jsx(X,{className:"h-4 w-4 mr-1"}),"删除"]})]})})]},a.id))})]})}),e.jsx("div",{className:"md:hidden space-y-3 p-4",children:i?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"加载中..."}):t.length===0?e.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"暂无数据"}):t.map(a=>e.jsxs("div",{className:"rounded-lg border bg-card p-4 space-y-3 overflow-hidden",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(q,{checked:l.has(a.id),onCheckedChange:()=>c(a.id),className:"mt-1"}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden space-y-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"情境"}),e.jsx("h3",{className:"font-semibold text-sm line-clamp-2 w-full break-all",title:a.situation,children:a.situation})]}),e.jsxs("div",{children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"风格"}),e.jsx("p",{className:"text-sm line-clamp-2 w-full break-all",title:a.style,children:a.style})]})]})]}),e.jsxs("div",{className:"text-sm",children:[e.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"聊天"}),e.jsx("p",{className:"text-sm truncate",title:y(a),style:{wordBreak:"keep-all"},children:y(a)})]}),e.jsxs("div",{className:"flex flex-wrap gap-1 pt-2 border-t overflow-hidden",children:[e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>j(a),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:[e.jsx(oe,{className:"h-3 w-3 mr-1"}),"编辑"]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>u(a),className:"text-xs px-2 py-1 h-auto flex-shrink-0",children:e.jsx(he,{className:"h-3 w-3"})}),e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>f(a),className:"text-xs px-2 py-1 h-auto flex-shrink-0 text-destructive hover:text-destructive",children:[e.jsx(X,{className:"h-3 w-3 mr-1"}),"删除"]})]})]},a.id))}),d>0&&e.jsx(js,{total:d,page:h,pageSize:o,onPageChange:O,onJumpToPage:E})]})}function js({total:t,page:i,pageSize:d,onPageChange:h,onJumpToPage:o}){const[l,x]=r.useState(""),j=Math.ceil(t/d),u=()=>{l&&(o(l),x(""))};return e.jsxs("div",{className:"flex flex-col sm:flex-row items-center justify-between gap-4 px-4 py-3 border-t",children:[e.jsxs("div",{className:"text-sm text-muted-foreground",children:["共 ",t," 条记录,第 ",i," / ",j," 页"]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m,{variant:"outline",size:"sm",onClick:()=>h(1),disabled:i===1,className:"hidden sm:flex",children:e.jsx(Qe,{className:"h-4 w-4"})}),e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>h(i-1),disabled:i===1,children:[e.jsx(Ze,{className:"h-4 w-4 sm:mr-1"}),e.jsx("span",{className:"hidden sm:inline",children:"上一页"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(_,{type:"number",value:l,onChange:f=>x(f.target.value),onKeyDown:f=>f.key==="Enter"&&u(),placeholder:i.toString(),className:"w-16 h-8 text-center",min:1,max:j}),e.jsx(m,{variant:"outline",size:"sm",onClick:u,disabled:!l,className:"h-8",children:"跳转"})]}),e.jsxs(m,{variant:"outline",size:"sm",onClick:()=>h(i+1),disabled:i>=j,children:[e.jsx("span",{className:"hidden sm:inline",children:"下一页"}),e.jsx(es,{className:"h-4 w-4 sm:ml-1"})]}),e.jsx(m,{variant:"outline",size:"sm",onClick:()=>h(j),disabled:i>=j,className:"hidden sm:flex",children:e.jsx(ss,{className:"h-4 w-4"})})]})]})}function Es(){const[t,i]=r.useState([]),[d,h]=r.useState(!0),[o,l]=r.useState(0),[x,j]=r.useState(1),[u,f]=r.useState(20),[c,n]=r.useState(""),[O,F]=r.useState(null),[M,y]=r.useState(!1),[I,E]=r.useState(!1),[a,b]=r.useState(!1),[z,R]=r.useState(null),[N,C]=r.useState(new Set),[Ne,J]=r.useState(!1),[H,ye]=r.useState({total:0,recent_7days:0,chat_count:0,top_chats:{}}),[le,we]=r.useState([]),[ie,be]=r.useState(new Map),[Ce,ce]=r.useState(!1),[V,ke]=r.useState(0),{toast:p}=L(),k=async()=>{try{h(!0);const s=await Re({page:x,page_size:u,search:c||void 0});s.success?(i(s.data.data),l(s.data.total)):p({title:"加载失败",description:s.error,variant:"destructive"})}catch(s){p({title:"加载失败",description:s instanceof Error?s.message:"无法加载表达方式",variant:"destructive"})}finally{h(!1)}},S=async()=>{try{const s=await He();s.success?ye(s.data):console.error("加载统计数据失败:",s.error)}catch(s){console.error("加载统计数据失败:",s)}},re=async()=>{try{const s=await Je();s.success&&ke(s.data.unchecked)}catch(s){console.error("加载审核统计失败:",s)}},Se=async()=>{try{const s=await Ve();if(s.success){we(s.data);const g=new Map;s.data.forEach(P=>{g.set(P.chat_id,P.chat_name)}),be(g)}}catch(s){console.error("加载聚天列表失败:",s)}};r.useEffect(()=>{k(),re(),S(),Se()},[x,u,c]);const De=async s=>{try{const g=await qe(s.id);g.success?(F(g.data),y(!0)):p({title:"加载详情失败",description:g.error,variant:"destructive"})}catch(g){p({title:"加载详情失败",description:g instanceof Error?g.message:"无法加载表达方式详情",variant:"destructive"})}},_e=s=>{F(s),E(!0)},Ee=async()=>{if(z)try{const s=await $e(z.id);s.success?(p({title:"删除成功",description:`已删除表达方式: ${z.situation}`}),R(null),k(),S()):p({title:"删除失败",description:s.error,variant:"destructive"})}catch(s){p({title:"删除失败",description:s instanceof Error?s.message:"无法删除表达方式",variant:"destructive"})}},ze=s=>{const g=new Set(N);g.has(s)?g.delete(s):g.add(s),C(g)},Te=()=>{N.size===t.length&&t.length>0?C(new Set):C(new Set(t.map(s=>s.id)))},Ae=async()=>{try{const s=await Xe(Array.from(N));s.success?(p({title:"批量删除成功",description:`已删除 ${N.size} 个表达方式`}),C(new Set),J(!1),k(),S()):p({title:"批量删除失败",description:s.error,variant:"destructive"})}catch(s){p({title:"批量删除失败",description:s instanceof Error?s.message:"无法批量删除表达方式",variant:"destructive"})}},Oe=s=>{const g=parseInt(s),P=Math.ceil(o/u);g>=1&&g<=P&&j(g)};return e.jsxs("div",{className:"h-[calc(100vh-4rem)] flex flex-col p-4 sm:p-6",children:[e.jsx("div",{className:"mb-4 sm:mb-6",children:e.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold flex items-center gap-2",children:[e.jsx(ts,{className:"h-8 w-8",strokeWidth:2}),"表达方式"]}),e.jsx("p",{className:"text-muted-foreground mt-1 text-sm sm:text-base",children:"管理麦麦的表达方式和话术模板"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(m,{variant:"outline",onClick:()=>ce(!0),className:"gap-2",children:[e.jsx(as,{className:"h-4 w-4"}),"人工审核",V>0&&e.jsx("span",{className:"ml-1 px-1.5 py-0.5 text-xs rounded-full bg-orange-500 text-white",children:V>99?"99+":V})]}),e.jsxs(m,{onClick:()=>b(!0),className:"gap-2",children:[e.jsx(ls,{className:"h-4 w-4"}),"新增表达方式"]})]})]})}),e.jsx(Pe,{className:"flex-1",children:e.jsxs("div",{className:"space-y-4 sm:space-y-6 pr-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"总数量"}),e.jsx("div",{className:"text-2xl font-bold mt-1",children:H.total})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"近7天新增"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-green-600",children:H.recent_7days})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"关联聊天数"}),e.jsx("div",{className:"text-2xl font-bold mt-1 text-blue-600",children:H.chat_count})]})]}),e.jsxs("div",{className:"rounded-lg border bg-card p-4",children:[e.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-end",children:[e.jsxs("div",{className:"flex-1",children:[e.jsx(v,{htmlFor:"search",children:"搜索"}),e.jsxs("div",{className:"relative mt-1.5",children:[e.jsx(is,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),e.jsx(_,{id:"search",placeholder:"搜索情境、风格或上下文...",value:c,onChange:s=>n(s.target.value),className:"pl-9"})]})]}),e.jsxs("div",{className:"flex items-center gap-2 sm:pb-0.5",children:[e.jsx(v,{htmlFor:"page-size",className:"text-sm whitespace-nowrap",children:"每页显示"}),e.jsxs(ee,{value:u.toString(),onValueChange:s=>{f(parseInt(s)),j(1),C(new Set)},children:[e.jsx(se,{id:"page-size",className:"w-20",children:e.jsx(te,{})}),e.jsxs(ae,{children:[e.jsx(D,{value:"10",children:"10"}),e.jsx(D,{value:"20",children:"20"}),e.jsx(D,{value:"50",children:"50"}),e.jsx(D,{value:"100",children:"100"})]})]})]})]}),e.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 mt-4 pt-4 border-t",children:[e.jsx("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:N.size>0&&e.jsxs("span",{children:["已选择 ",N.size," 个表达方式"]})}),e.jsx("div",{className:"flex items-center gap-2",children:N.size>0&&e.jsxs(e.Fragment,{children:[e.jsx(m,{variant:"outline",size:"sm",onClick:()=>C(new Set),children:"取消选择"}),e.jsxs(m,{variant:"destructive",size:"sm",onClick:()=>J(!0),children:[e.jsx(X,{className:"h-4 w-4 mr-1"}),"批量删除"]})]})})]})]}),e.jsx(us,{expressions:t,loading:d,total:o,page:x,pageSize:u,selectedIds:N,chatNameMap:ie,onEdit:_e,onViewDetail:De,onDelete:s=>R(s),onToggleSelect:ze,onToggleSelectAll:Te,onPageChange:j,onJumpToPage:Oe})]})}),e.jsx(ds,{expression:O,open:M,onOpenChange:y,chatNameMap:ie}),e.jsx(os,{open:a,onOpenChange:b,chatList:le,onSuccess:()=>{k(),S(),b(!1)}}),e.jsx(hs,{expression:O,open:I,onOpenChange:E,chatList:le,onSuccess:()=>{k(),S(),E(!1)}}),e.jsx(ms,{expression:z,open:!!z,onOpenChange:()=>R(null),onConfirm:Ee}),e.jsx(xs,{open:Ne,onOpenChange:J,onConfirm:Ae,count:N.size}),e.jsx(Me,{open:Ce,onOpenChange:s=>{ce(s),s||(k(),S(),re())}})]})}export{Es as ExpressionManagementPage};