优化Local Ai Agent列表页操作列模板

This commit is contained in:
jingrow 2025-11-01 16:02:31 +08:00
parent ed261da974
commit 1543ce0be2

View File

@ -15,6 +15,14 @@
>
<i :class="executing ? 'fa fa-spinner fa-spin' : 'fa fa-play'"></i>
</button>
<!-- 流程编排按钮 -->
<button
class="action-btn flow-builder-btn"
@click.stop="handleFlowBuilder"
:title="context.t('Flow Builder')"
>
<i class="fa fa-sitemap"></i>
</button>
<button class="action-btn delete-btn" @click.stop="context.deleteRecord(context.row.name)" :title="context.t('Delete')">
<i class="fa fa-trash"></i>
</button>
@ -67,6 +75,24 @@ async function handleExecute() {
executing.value = false
}
}
async function handleFlowBuilder() {
try {
const raw = props.context.row.agent_flow ?? {}
let flowData: any = raw
if (typeof raw === 'string') {
try { flowData = JSON.parse(raw) } catch { flowData = {} }
}
const agentId = props.context.row.name
const { useFlowBuilderStore } = await import('@/shared/stores/flowBuilder')
const flowBuilderStore = useFlowBuilderStore()
flowBuilderStore.activateFlowBuilder(flowData, agentId)
props.context.router.push({ name: 'FlowBuilder', query: { agentId } })
} catch (_) {}
}
</script>
<style scoped>
@ -86,6 +112,7 @@ async function handleExecute() {
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
/* 默认按钮(查看、编辑)使用更普通的颜色 */
.action-btn:hover {
background: #3b82f6;
color: white;
@ -96,11 +123,19 @@ async function handleExecute() {
cursor: not-allowed;
}
/* 流程编排按钮使用蓝色,与详情页保持一致 */
.flow-builder-btn:hover {
background: #3b82f6;
color: white;
}
/* 执行按钮使用绿色 */
.execute-btn:hover {
background: #10b981;
color: white;
}
/* 删除按钮使用红色 */
.delete-btn:hover {
background: #ef4444;
color: white;