|
@@ -25,6 +25,11 @@ const projects=query.has('empty')?[]:[
|
|
|
{id:'project-b',name:'内容运营',description:'',memberIds:agents.slice(0,3).map(a=>a.id),groupIds:['group-b'],revision:1,archived:false,createdAt:1,updatedAt:1},
|
|
{id:'project-b',name:'内容运营',description:'',memberIds:agents.slice(0,3).map(a=>a.id),groupIds:['group-b'],revision:1,archived:false,createdAt:1,updatedAt:1},
|
|
|
]
|
|
]
|
|
|
const identity={serverId:'00000000-0000-4000-8000-000000000099',name:'我的工作空间',displayName:'我的工作空间',revision:1}
|
|
const identity={serverId:'00000000-0000-4000-8000-000000000099',name:'我的工作空间',displayName:'我的工作空间',revision:1}
|
|
|
|
|
+const desktopHosts=[
|
|
|
|
|
+ {id:'f184922a-713c-4190-9c46-6e200e6c4c01',name:'LSamienacStudio',displayName:'',enabled:true,online:false,createdAt:Date.parse('2026-09-10T09:30:00+08:00')},
|
|
|
|
|
+ {id:'c791ba30-f185-4734-8e72-549bc02e7e02',name:'LSamienacStudio',displayName:'',enabled:true,online:true,createdAt:Date.parse('2026-09-19T18:05:00+08:00')},
|
|
|
|
|
+]
|
|
|
|
|
+let localComputerName=''
|
|
|
const realFetch=window.fetch.bind(window)
|
|
const realFetch=window.fetch.bind(window)
|
|
|
window.fetch=async(input,init)=>{
|
|
window.fetch=async(input,init)=>{
|
|
|
const url=new URL(typeof input==='string'?input:input instanceof URL?input.href:input.url,location.href)
|
|
const url=new URL(typeof input==='string'?input:input instanceof URL?input.href:input.url,location.href)
|
|
@@ -49,6 +54,17 @@ window.fetch=async(input,init)=>{
|
|
|
else if(url.pathname.includes('/memories'))data={memories:[]}
|
|
else if(url.pathname.includes('/memories'))data={memories:[]}
|
|
|
else if(url.pathname.includes('server-identity'))data=identity
|
|
else if(url.pathname.includes('server-identity'))data=identity
|
|
|
else if(url.pathname==='/api/app/computers')data={computers:[]}
|
|
else if(url.pathname==='/api/app/computers')data={computers:[]}
|
|
|
|
|
+ else if(url.pathname==='/api/app/settings/host-tools')data={approvalPolicy:'allow',scriptMachine:true,serverComputer:true,vm:true,cloud:true,...body}
|
|
|
|
|
+ else if(url.pathname==='/api/app/admin/desktop-hosts')data={hosts:desktopHosts,localName:localComputerName}
|
|
|
|
|
+ else if(url.pathname.startsWith('/api/app/admin/desktop-hosts/')){
|
|
|
|
|
+ const id=url.pathname.split('/')[5]
|
|
|
|
|
+ const host=desktopHosts.find(item=>item.id===id)
|
|
|
|
|
+ if(init?.method==='PUT'&&url.pathname.endsWith('/name')){
|
|
|
|
|
+ if(id==='local')localComputerName=body.name
|
|
|
|
|
+ else if(host)host.displayName=body.name
|
|
|
|
|
+ }else if(init?.method==='DELETE'&&host)host.enabled=false
|
|
|
|
|
+ data={ok:true}
|
|
|
|
|
+ }
|
|
|
else if(url.pathname==='/api/app/admin/local-vm')data={configured:true,enabled:true,mode:'shared',maxInstances:2,idleStopMinutes:0,runtime:'docker',daemonUp:true,image:true,images:[{key:'standard',ready:true},{key:'cursor',ready:true}],instances:[]}
|
|
else if(url.pathname==='/api/app/admin/local-vm')data={configured:true,enabled:true,mode:'shared',maxInstances:2,idleStopMinutes:0,runtime:'docker',daemonUp:true,image:true,images:[{key:'standard',ready:true},{key:'cursor',ready:true}],instances:[]}
|
|
|
else return new Response(JSON.stringify({error:{message:'此预览没有连接服务'}}),{status:404,headers:{'content-type':'application/json'}})
|
|
else return new Response(JSON.stringify({error:{message:'此预览没有连接服务'}}),{status:404,headers:{'content-type':'application/json'}})
|
|
|
return new Response(JSON.stringify(data),{headers:{'content-type':'application/json'}})
|
|
return new Response(JSON.stringify(data),{headers:{'content-type':'application/json'}})
|
|
@@ -65,7 +81,7 @@ const App=defineComponent({setup(){
|
|
|
h('div',{style:'display:flex;gap:12px;align-items:center;font:13px var(--font-ui)'},[
|
|
h('div',{style:'display:flex;gap:12px;align-items:center;font:13px var(--font-ui)'},[
|
|
|
h('span','界面验证 · 示例数据'),h('button',{onClick:()=>opened.value='bot'},'Bot 设置'),h('button',{onClick:()=>opened.value='personal'},'我的设置'),h('button',{onClick:()=>opened.value='editor'},'编辑资料'),
|
|
h('span','界面验证 · 示例数据'),h('button',{onClick:()=>opened.value='bot'},'Bot 设置'),h('button',{onClick:()=>opened.value='personal'},'我的设置'),h('button',{onClick:()=>opened.value='editor'},'编辑资料'),
|
|
|
]),
|
|
]),
|
|
|
- opened.value==='bot'?h(BotSettingsDialog,{isAdmin:!query.has('member'),onClose:()=>opened.value=null}):null,
|
|
|
|
|
|
|
+ opened.value==='bot'?h(BotSettingsDialog,{isAdmin:!query.has('member'),initialPage:query.get('view')==='computers'?'computers':'projects',onClose:()=>opened.value=null}):null,
|
|
|
opened.value==='editor'?h(BotProfileDialog,{agent:agents[0],draft:{...agents[0],source:'["local","default"]'},sources:[{nodeId:'local',profile:'default',name:'丫头'}],profiles:[{name:'default',agentName:'丫头',isDefault:true}],agents,conversations,conversationId:'fixture-chat',isAdmin:!query.has('member'),knowledgeEnabled:true,onClose:()=>opened.value=null,onSave:()=>opened.value=null} as never):null,
|
|
opened.value==='editor'?h(BotProfileDialog,{agent:agents[0],draft:{...agents[0],source:'["local","default"]'},sources:[{nodeId:'local',profile:'default',name:'丫头'}],profiles:[{name:'default',agentName:'丫头',isDefault:true}],agents,conversations,conversationId:'fixture-chat',isAdmin:!query.has('member'),knowledgeEnabled:true,onClose:()=>opened.value=null,onSave:()=>opened.value=null} as never):null,
|
|
|
h(SettingsCenterDialog,{open:opened.value==='personal',initialPage:query.get('view')==='desktop-mode'?'desktop-mode':query.get('view')==='profile'?'account-profile':'appearance',isAdmin:!query.has('member'),botMode:true,userName:'samien',theme:theme.value==='dark'?'dark':'light',themePreference:theme.value,profiles:[{name:'default',agentName:'默认机器人',isDefault:true}],activeProfile:{name:'default',agentName:'默认机器人',isDefault:true},onClose:()=>opened.value=null,'onSet-theme':setTheme}),
|
|
h(SettingsCenterDialog,{open:opened.value==='personal',initialPage:query.get('view')==='desktop-mode'?'desktop-mode':query.get('view')==='profile'?'account-profile':'appearance',isAdmin:!query.has('member'),botMode:true,userName:'samien',theme:theme.value==='dark'?'dark':'light',themePreference:theme.value,profiles:[{name:'default',agentName:'默认机器人',isDefault:true}],activeProfile:{name:'default',agentName:'默认机器人',isDefault:true},onClose:()=>opened.value=null,'onSet-theme':setTheme}),
|
|
|
])
|
|
])
|