feat:历史记录关于user_id限制

This commit is contained in:
liailing1026
2026-03-09 10:28:07 +08:00
parent 8926480e62
commit 14b79bc282
6 changed files with 69 additions and 19 deletions

View File

@@ -15,6 +15,12 @@ const agentsStore = useAgentsStore()
// 如果agentsStore.agents不存在就读取默认配置的json文件
onMounted(async () => {
// 先调用 getAgents检查是否需要生成 user_id
const res = await api.getAgents()
if (res && res.user_id) {
console.log('[AgentRepo] 获取到 user_id:', res.user_id)
}
if (!agentsStore.agents.length) {
const res = await readConfig<Agent[]>('agent.json')
agentsStore.setAgents(res)

View File

@@ -115,9 +115,10 @@ const historyUpdatedHandler = () => {
const fetchPlans = async () => {
loading.value = true
const reqId = generateRequestId()
const userId = localStorage.getItem('user_id')
try {
const result = await websocket.send('get_plans', { id: reqId })
const result = await websocket.send('get_plans', { id: reqId, user_id: userId })
plans.value = (result.data || []) as PlanInfo[]
} catch (error) {
console.error('获取任务列表失败:', error)