修改前端架构到Electron ,增加llm_api页面,增加chat SSE渲染,修改若安按钮,卡片名称修改等小功能,增加agent-core,增加SQlite,增加llm UDS Pipe websocke

This commit is contained in:
mark
2026-09-27 14:18:57 +08:00
parent b064c0cbca
commit c800a503da
3427 changed files with 1290962 additions and 32816 deletions
+62
View File
@@ -0,0 +1,62 @@
// 测试 agent-core WebSocket 通信
import WebSocket from 'ws'
const ws = new WebSocket('ws://localhost:8787')
ws.on('open', () => {
console.log('[测试] 已连接')
// 测试 1: 保存 LLM 配置
ws.send(JSON.stringify({
type: 'llm:save',
data: {
name: '文心千帆测试',
provider: 'qianfan_v2',
config: {
baseUrl: 'https://qianfan.baidubce.com/v2/chat/completions',
authorization: 'Bearer test-token',
model: 'ernie-4.0',
temperature: 0.7
}
},
id: '1'
}))
})
ws.on('message', (data) => {
const msg = JSON.parse(data.toString())
console.log('[收到]', JSON.stringify(msg, null, 2))
// 收到保存响应后,测试获取列表
if (msg.type === 'llm:saved') {
ws.send(JSON.stringify({ type: 'llm:list', id: '2' }))
}
if (msg.type === 'llm:list') {
// 测试设置激活
if (msg.data && msg.data[0]) {
ws.send(JSON.stringify({ type: 'llm:setActive', data: { id: msg.data[0].id }, id: '3' }))
}
}
if (msg.type === 'llm:activeSet') {
// 测试获取激活
ws.send(JSON.stringify({ type: 'llm:getActive', id: '4' }))
}
if (msg.type === 'llm:active') {
console.log('\n=== 所有测试完成 ===')
ws.close()
process.exit(0)
}
})
ws.on('error', (err) => {
console.error('[错误]', err.message)
process.exit(1)
})
setTimeout(() => {
console.log('超时退出')
process.exit(1)
}, 10000)