Files
Migu2.0/MiGu.Server/wwwroot/assets/SystemConfigView-4Mxf2af4.js
T
zhaowei.huangandCursor 7382e85598 feat(platform): 部署配置向导 + 地图管理,地图编辑器接入统一存取与 AI 助手
- 配置向导:登录按 deployment 画像引导平台选型(导航方式/模块/场景),未完成则路由守卫强制进入 /wizard;选型驱动菜单按需裁剪,并联动 SimpleLite 写 plugins/active-scenes.json + 透传 --scenes 选择性加载导航场景插件
- 地图管理页:服务器地图列表/使用/重命名/删除、地图合并、多地图连接管理
- 地图编辑器:项目存取改为存入地图管理统一目录(同名替换确认),支持 ?map=/?new= 进入,新增右侧可停靠 AI 助手面板
- 集成 PTL 拣选模块;新增车队分配面板(运维总览/筛选联动)
- SimpleLiteBuildSync 同步运行时依赖 DLL;重新构建前端静态资源

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-03 09:37:07 +08:00

3 lines
9.2 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{aI as P,by as F,bh as A,b9 as c,aE as x,aB as p,aH as l,x as K,bJ as t,ai as U,bj as B,aC as k,N as $,bt as v,aj as G,O as j,z as R,bq as h,r as D,aG as u,b4 as W,ad as H,aD as M,ax as J,aP as q,X as _,y as X,ak as L,b7 as Y,bg as Z,t as Q,S as ee,H as le,a4 as te,Z as oe,a8 as ae,R as ne,h as se}from"./index-368apsQG.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{C as ie}from"./ConfigPageBase-CT6BdvCe.js";/* empty css *//* empty css */import{a as O,m as me}from"./mapEdit-BiAzHHno.js";/* empty css */import"./PermissionGuard-DUg2FNrM.js";/* empty css */import"./reflection-C0K7EJ_N.js";import"./monitorConfigCache-BtW5W6GI.js";const de={class:"theme-customizer"},re={class:"tc-title-row"},ue={class:"tc-name"},pe={class:"tc-panel"},ce={class:"tc-picker-row"},fe={class:"tc-hex"},_e={class:"tc-field-hint"},ge={class:"tc-actions"},be={class:"tc-footer"},ve=P({__name:"ThemeCustomizer",setup(N){const o=F(),V=A(o.themeId),w=["#7c3aed","#8b5cf6","#c4b5fd","#5b21b6","#4c1d95","#6366f1","#a855f7","#9333ea","#1565c0","#00796b","#b71c1c","#455a64","#e65100"],S=J(()=>o.availableThemes.some(d=>C(d.id)));function C(d){const n=o.themeOverrides[d];return!!n&&Object.keys(n).length>0}function r(d){const n=o.getMergedTheme(q(d));return{background:`linear-gradient(135deg, ${n.preview} 0%, ${n.previewAccent} 100%)`}}function a(d,n,g){g&&(o.setThemeColor(d,n,g),d===o.themeId&&_.success("已应用当前主题配色"))}function f(d){o.clearThemeOverrides(d),_.info("已恢复该主题默认配色")}function i(){o.clearAllThemeOverrides(),_.info("已恢复全部主题默认配色")}return(d,n)=>{const g=H,z=R,b=j,E=$,y=D,T=X,I=K;return c(),x("div",de,[n[6]||(n[6]=p("p",{class:"tc-hint"}," 为各主题单独调色;修改后立即预览。当前生效主题会同步应用到全站。保存系统配置时一并写入本地。 ",-1)),l(I,{modelValue:V.value,"onUpdate:modelValue":n[0]||(n[0]=e=>V.value=e),accordion:""},{default:t(()=>[(c(!0),x(U,null,B(v(o).availableThemes,e=>(c(),k(T,{key:e.id,name:e.id},{title:t(()=>[p("div",re,[p("span",{class:"tc-swatch",style:W(r(e.id))},null,4),p("span",ue,h(e.name),1),C(e.id)?(c(),k(g,{key:0,size:"small",type:"warning",effect:"plain"},{default:t(()=>[...n[1]||(n[1]=[u("已自定义",-1)])]),_:1})):M("",!0),e.id===v(o).themeId?(c(),k(g,{key:1,size:"small",type:"success",effect:"plain"},{default:t(()=>[...n[2]||(n[2]=[u("当前",-1)])]),_:1})):M("",!0)])]),default:t(()=>[p("div",pe,[l(E,{"label-width":"100px",class:"tc-form"},{default:t(()=>[(c(!0),x(U,null,B(v(G),m=>(c(),k(b,{key:m.key,label:m.label},{default:t(()=>[p("div",ce,[l(z,{"model-value":v(o).getThemeColor(e.id,m.key),"color-format":"hex",predefine:w,"onUpdate:modelValue":s=>a(e.id,m.key,s)},null,8,["model-value","onUpdate:modelValue"]),p("span",fe,h(v(o).getThemeColor(e.id,m.key)),1),p("span",_e,h(m.hint),1)])]),_:2},1032,["label"]))),128))]),_:2},1024),p("div",ge,[l(y,{size:"small",onClick:m=>v(o).setThemeId(e.id)},{default:t(()=>[...n[3]||(n[3]=[u("切换到此主题",-1)])]),_:1},8,["onClick"]),l(y,{size:"small",disabled:!C(e.id),onClick:m=>f(e.id)},{default:t(()=>[...n[4]||(n[4]=[u("恢复默认",-1)])]),_:1},8,["disabled","onClick"])])])]),_:2},1032,["name"]))),128))]),_:1},8,["modelValue"]),p("div",be,[l(y,{size:"small",type:"warning",plain:"",disabled:!S.value,onClick:i},{default:t(()=>[...n[5]||(n[5]=[u(" 重置全部主题配色 ",-1)])]),_:1},8,["disabled"])])])}}}),Ve=L(ve,[["__scopeId","data-v-8a725bd2"]]),ye=P({__name:"SystemConfigView",setup(N){const o=Z({endpoint:"https://api.openai.com/v1/chat/completions",apiKey:"",model:"gpt-4o-mini",systemPrompt:"你是一个 AGV 路网设计师。",temperature:.4,maxTokens:4096,timeoutSec:60,configured:!1}),V=A(!1),w=A(!1);Y(async()=>{try{const r=await O.get();Object.assign(o,r)}catch(r){_.warning(`无法读取 AI 配置:${r.message}`)}});async function S(){try{V.value=!0,await O.save({...o}),_.success("AI 配置已保存"),o.configured=!!o.apiKey}catch(r){_.error(`保存失败:${r.message}`)}finally{V.value=!1}}async function C(){try{w.value=!0;const r=await me.aiMapGenerate({prompt:'测试连通:仅返回 "ok",不要生成任何站点或路径。',mode:"sites",bounds:[0,0,0,0]});_.success(`AI 服务连通正常:返回工具调用 ${r.usedTools} 次`)}catch(r){_.error(`连通失败:${r.message}`)}finally{w.value=!1}}return(r,a)=>{const f=ee,i=j,d=le,n=oe,g=te,z=ae,b=ne,E=$,y=H,T=D,I=Q;return c(),x(U,null,[l(ie,{section:"system",title:"系统级配置",description:"运行参数、日志策略、安全策略(对齐 SystemConfig",defaults:v(se)},{default:t(({payload:e,update:m})=>[l(E,{"label-width":"160px",model:e},{default:t(()=>[l(i,{label:"调度循环 (Hz)"},{default:t(()=>[l(f,{"model-value":e.dispatchLoopHz,min:1,max:200,"onUpdate:modelValue":s=>m({...e,dispatchLoopHz:s??0})},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024),l(d,{"content-position":"left"},{default:t(()=>[...a[7]||(a[7]=[u("日志策略",-1)])]),_:1}),l(i,{label:"日志级别"},{default:t(()=>[l(g,{"model-value":e.log.level,"onUpdate:modelValue":s=>m({...e,log:{...e.log,level:s}})},{default:t(()=>[(c(),x(U,null,B(["trace","debug","info","warn","error"],s=>l(n,{key:s,label:s,value:s},null,8,["label","value"])),64))]),_:1},8,["model-value","onUpdate:modelValue"])]),_:2},1024),l(i,{label:"日志保留 (天)"},{default:t(()=>[l(f,{"model-value":e.log.rollDays,min:1,max:365,"onUpdate:modelValue":s=>m({...e,log:{...e.log,rollDays:s??0}})},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024),l(i,{label:"单文件上限 (MB)"},{default:t(()=>[l(f,{"model-value":e.log.maxSizeMB,min:1,max:4096,"onUpdate:modelValue":s=>m({...e,log:{...e.log,maxSizeMB:s??0}})},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024),l(d,{"content-position":"left"},{default:t(()=>[...a[8]||(a[8]=[u("安全策略",-1)])]),_:1}),l(i,{label:"JWT 过期 (分钟)"},{default:t(()=>[l(f,{"model-value":e.security.jwtExpireMin,min:5,max:43200,"onUpdate:modelValue":s=>m({...e,security:{...e.security,jwtExpireMin:s??0}})},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024),l(i,{label:"启用 Swagger"},{default:t(()=>[l(z,{"model-value":e.security.enableSwagger,"onUpdate:modelValue":s=>m({...e,security:{...e.security,enableSwagger:!!s}})},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024),l(i,{label:"CORS 白名单"},{default:t(()=>[l(b,{type:"textarea",rows:3,"model-value":e.security.corsWhitelist.join(`
`),"onUpdate:modelValue":s=>m({...e,security:{...e.security,corsWhitelist:s.split(/\s+/).filter(Boolean)}})},null,8,["model-value","onUpdate:modelValue"])]),_:2},1024),l(d,{"content-position":"left"},{default:t(()=>[...a[9]||(a[9]=[u("界面主题配色",-1)])]),_:1}),l(i,{label:"主题取色盘"},{default:t(()=>[l(Ve)]),_:1})]),_:2},1032,["model"])]),_:1},8,["defaults"]),l(I,{class:"ai-service-card",shadow:"never"},{header:t(()=>[a[12]||(a[12]=p("span",null,"AI 服务(地图编辑器「AI 生图」依赖)",-1)),o.configured?(c(),k(y,{key:0,type:"success",size:"small",effect:"dark",class:"ml-8"},{default:t(()=>[...a[10]||(a[10]=[u("已配置",-1)])]),_:1})):(c(),k(y,{key:1,type:"warning",size:"small",effect:"dark",class:"ml-8"},{default:t(()=>[...a[11]||(a[11]=[u("未配置",-1)])]),_:1}))]),default:t(()=>[l(E,{"label-width":"140px",size:"default"},{default:t(()=>[l(i,{label:"Endpoint"},{default:t(()=>[l(b,{modelValue:o.endpoint,"onUpdate:modelValue":a[0]||(a[0]=e=>o.endpoint=e),placeholder:"https://api.openai.com/v1/chat/completions"},null,8,["modelValue"])]),_:1}),l(i,{label:"API Key"},{default:t(()=>[l(b,{modelValue:o.apiKey,"onUpdate:modelValue":a[1]||(a[1]=e=>o.apiKey=e),type:"password","show-password":"",placeholder:"sk-..."},null,8,["modelValue"])]),_:1}),l(i,{label:"模型"},{default:t(()=>[l(b,{modelValue:o.model,"onUpdate:modelValue":a[2]||(a[2]=e=>o.model=e),placeholder:"gpt-4o-mini"},null,8,["modelValue"])]),_:1}),l(i,{label:"System Prompt"},{default:t(()=>[l(b,{modelValue:o.systemPrompt,"onUpdate:modelValue":a[3]||(a[3]=e=>o.systemPrompt=e),type:"textarea",rows:4},null,8,["modelValue"])]),_:1}),l(i,{label:"Temperature"},{default:t(()=>[l(f,{modelValue:o.temperature,"onUpdate:modelValue":a[4]||(a[4]=e=>o.temperature=e),min:0,max:2,step:.1},null,8,["modelValue"])]),_:1}),l(i,{label:"Max Tokens"},{default:t(()=>[l(f,{modelValue:o.maxTokens,"onUpdate:modelValue":a[5]||(a[5]=e=>o.maxTokens=e),min:64,max:32e3,step:64},null,8,["modelValue"])]),_:1}),l(i,{label:"超时 (秒)"},{default:t(()=>[l(f,{modelValue:o.timeoutSec,"onUpdate:modelValue":a[6]||(a[6]=e=>o.timeoutSec=e),min:5,max:600},null,8,["modelValue"])]),_:1}),l(i,null,{default:t(()=>[l(T,{type:"primary",loading:V.value,onClick:S},{default:t(()=>[...a[13]||(a[13]=[u("保存 AI 配置",-1)])]),_:1},8,["loading"]),l(T,{loading:w.value,onClick:C},{default:t(()=>[...a[14]||(a[14]=[u("测试连通",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1})],64)}}}),Fe=L(ye,[["__scopeId","data-v-b66101c5"]]);export{Fe as default};