feat: 完善企业场景多线路由与执行稳定性
补齐平台模板与场景 DSL、预算控制、执行看板和企业场景脚本,增强 Windows 启动/迁移与前端代理和聊天会话记忆,修复执行创建阶段 500 与异步链路排障体验。 Made-with: Cursor
This commit is contained in:
@@ -181,6 +181,24 @@ const messagesContainer = ref<HTMLElement>()
|
||||
let pollingInterval: any = null
|
||||
let replyAdded = false // 标志位:防止重复添加回复
|
||||
|
||||
/** 会话记忆需稳定 user_id(见 agent记忆实现方案.md);预览区按 Agent 维度持久化,对应 Cache 键 user_memory_* */
|
||||
function getPreviewSessionUserId(agentId: string): string {
|
||||
const key = `agent_preview_uid_${agentId}`
|
||||
try {
|
||||
let id = localStorage.getItem(key)
|
||||
if (!id) {
|
||||
id =
|
||||
typeof crypto !== 'undefined' && crypto.randomUUID
|
||||
? `preview_${crypto.randomUUID().replace(/-/g, '').slice(0, 16)}`
|
||||
: `preview_${Date.now()}_${Math.random().toString(36).slice(2, 12)}`
|
||||
localStorage.setItem(key, id)
|
||||
}
|
||||
return id
|
||||
} catch {
|
||||
return `preview_${agentId}_${Date.now()}`
|
||||
}
|
||||
}
|
||||
|
||||
// 发送消息
|
||||
const handleSendMessage = async () => {
|
||||
if (!inputMessage.value.trim() || loading.value || !props.agentId) return
|
||||
@@ -205,7 +223,8 @@ const handleSendMessage = async () => {
|
||||
agent_id: props.agentId,
|
||||
input_data: {
|
||||
USER_INPUT: userMessage,
|
||||
query: userMessage
|
||||
query: userMessage,
|
||||
user_id: getPreviewSessionUserId(props.agentId)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -19,6 +19,10 @@
|
||||
:ellipsis="false"
|
||||
@select="handleMenuSelect"
|
||||
>
|
||||
<el-menu-item index="console" @click="router.push('/console')">
|
||||
<el-icon><Grid /></el-icon>
|
||||
<span>主控台</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="workflows">
|
||||
<el-icon><Document /></el-icon>
|
||||
<span>工作流管理</span>
|
||||
@@ -76,7 +80,7 @@
|
||||
import { computed } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { Document, User, List, Connection, Setting, Star, Lock, Monitor, Bell } from '@element-plus/icons-vue'
|
||||
import { Document, User, List, Connection, Setting, Star, Lock, Monitor, Bell, Grid } from '@element-plus/icons-vue'
|
||||
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
@@ -84,6 +88,8 @@ const userStore = useUserStore()
|
||||
|
||||
// 当前激活的菜单
|
||||
const activeMenu = computed(() => {
|
||||
if (route.path === '/console') return 'console'
|
||||
if (route.path === '/execution-board') return 'console'
|
||||
if (route.path === '/' || route.path === '/workflow' || route.path.startsWith('/workflow/')) return 'workflows'
|
||||
if (route.path === '/agents' || route.path.startsWith('/agents/')) return 'agents'
|
||||
if (route.path === '/executions' || route.path.startsWith('/executions/')) return 'executions'
|
||||
@@ -99,7 +105,9 @@ const activeMenu = computed(() => {
|
||||
|
||||
// 菜单选择
|
||||
const handleMenuSelect = (key: string) => {
|
||||
if (key === 'workflows') {
|
||||
if (key === 'console') {
|
||||
router.push('/console')
|
||||
} else if (key === 'workflows') {
|
||||
router.push('/')
|
||||
} else if (key === 'agents') {
|
||||
router.push('/agents')
|
||||
|
||||
Reference in New Issue
Block a user