Files
Migu2.0/MiGu.Server/wwwroot/assets/SystemConfigView-ByKpKyii.js
T
zhaowei.huangandCursor 42978930ca feat: 迁入 MiGu.Server、平台前端与车辆列表 reflection 回退
从 Simple-FR 拆出 Platform.Server 并重命名为 MiGu.Server;frontends 源码与构建脚本迁入本仓库。地图监控在 projection/cars 失败或为空时回退 reflection 车辆列表;Simple 仓库已移除旧 Platform.Server。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-29 18:16:34 +08:00

3 lines
9.1 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{aG as P,br as N,bb as h,b3 as c,aC as x,az as p,aF as l,y as H,bB as t,ai as U,bd as B,aA as k,O as $,bm as v,aj as G,P as j,A as W,bj as I,s as L,aE as u,a_ as R,ad as D,aB as M,av as Y,aL as J,Y as _,z as q,al as F,b1 as Q,i as X,ba as Z,u as ee,T as le,I as te,a4 as oe,_ as ae,a8 as ne,S as se}from"./index-DrvLDslf.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-CPF7i-FB.js";/* empty css *//* empty css */import{a as O,m as me}from"./mapEdit-DghrYjHu.js";/* empty css */import"./PermissionGuard-BxagL6-4.js";import"./reflection-Dr3WM5Rz.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"},be={class:"tc-actions"},ge={class:"tc-footer"},ve=P({__name:"ThemeCustomizer",setup(K){const o=N(),V=h(o.themeId),w=["#7c3aed","#8b5cf6","#c4b5fd","#5b21b6","#4c1d95","#6366f1","#a855f7","#9333ea","#1565c0","#00796b","#b71c1c","#455a64","#e65100"],S=Y(()=>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(J(d));return{background:`linear-gradient(135deg, ${n.preview} 0%, ${n.previewAccent} 100%)`}}function a(d,n,b){b&&(o.setThemeColor(d,n,b),d===o.themeId&&_.success("已应用当前主题配色"))}function f(d){o.clearThemeOverrides(d),_.info("已恢复该主题默认配色")}function i(){o.clearAllThemeOverrides(),_.info("已恢复全部主题默认配色")}return(d,n)=>{const b=D,z=W,g=j,T=$,y=L,E=q,A=H;return c(),x("div",de,[n[6]||(n[6]=p("p",{class:"tc-hint"}," 为各主题单独调色;修改后立即预览。当前生效主题会同步应用到全站。保存系统配置时一并写入本地。 ",-1)),l(A,{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(E,{key:e.id,name:e.id},{title:t(()=>[p("div",re,[p("span",{class:"tc-swatch",style:R(r(e.id))},null,4),p("span",ue,I(e.name),1),C(e.id)?(c(),k(b,{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(b,{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(T,{"label-width":"100px",class:"tc-form"},{default:t(()=>[(c(!0),x(U,null,B(v(G),m=>(c(),k(g,{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,I(v(o).getThemeColor(e.id,m.key)),1),p("span",_e,I(m.hint),1)])]),_:2},1032,["label"]))),128))]),_:2},1024),p("div",be,[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",ge,[l(y,{size:"small",type:"warning",plain:"",disabled:!S.value,onClick:i},{default:t(()=>[...n[5]||(n[5]=[u(" 重置全部主题配色 ",-1)])]),_:1},8,["disabled"])])])}}}),Ve=F(ve,[["__scopeId","data-v-8a725bd2"]]),ye=P({__name:"SystemConfigView",setup(K){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=h(!1),w=h(!1);Q(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=le,i=j,d=te,n=ae,b=oe,z=ne,g=se,T=$,y=D,E=L,A=ee;return c(),x(U,null,[l(ie,{section:"system",title:"系统级配置",description:"运行参数、日志策略、安全策略(对齐 SystemConfig",defaults:v(X)},{default:t(({payload:e,update:m})=>[l(T,{"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(b,{"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(g,{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(A,{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(T,{"label-width":"140px",size:"default"},{default:t(()=>[l(i,{label:"Endpoint"},{default:t(()=>[l(g,{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(g,{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(g,{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(g,{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(E,{type:"primary",loading:V.value,onClick:S},{default:t(()=>[...a[13]||(a[13]=[u("保存 AI 配置",-1)])]),_:1},8,["loading"]),l(E,{loading:w.value,onClick:C},{default:t(()=>[...a[14]||(a[14]=[u("测试连通",-1)])]),_:1},8,["loading"])]),_:1})]),_:1})]),_:1})],64)}}}),Fe=F(ye,[["__scopeId","data-v-b66101c5"]]);export{Fe as default};