diff --git a/package.json b/package.json index 5f28272..8082532 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "update": "^0.7.4", "vue": "^3.2.45", "vue-cropper": "^1.1.4", + "vue-draggable-next": "^2.2.1", "vue-draggable-plus": "^0.6.0", "vue-echarts": "^7.0.3", "vue-router": "^4.1.6", diff --git a/src/api/all/agent.ts b/src/api/all/agent.ts index 69be57a..b258e45 100644 --- a/src/api/all/agent.ts +++ b/src/api/all/agent.ts @@ -1,6 +1,28 @@ -// 投放账号计划 import Http from '@/api'; // 获取聊天智能体 export const getChatAgent = (id: number) => { return Http.get(`/v1/agent/getChatAgent/${id}`); }; + +// 获取历史聊天 +export const getHistoryChat = (params: any) => { + return Http.get(`/v1/agent/getConversations`, { params }); +}; +// 获取智能体分类 +export const getCategoriesMenus = () => { + return Http.get(`/v1/agent/getCategoriesMenus`); +}; + +export const getAgentList = () => { + return Http.get(`/v1/agent/getAgentList`); +}; + +// 获取工作流详情 +export const getWorkFlowInfo = (id: number) => { + return Http.get(`/v1/agent/getWorkFlowInfo/${id}`); +}; + +// 执行工作流 +export const executeWorkFlow = (params: any) => { + return Http.post(`/v1/agent/executeWorkFlow`, params); +}; diff --git a/src/components/_base/navbar/index.vue b/src/components/_base/navbar/index.vue index 333167b..87412b6 100644 --- a/src/components/_base/navbar/index.vue +++ b/src/components/_base/navbar/index.vue @@ -10,7 +10,7 @@ import router from '@/router'; // import { useRoute } from 'vue-router'; import ExitAccountModal from '@/components/_base/exit-account-modal/index.vue'; // import { appRoutes } from '@/router/routes'; -// import { MENU_LIST } from './constants'; +// import { MENU_LIST } from './AgentConstants.ts'; const sidebarStore = useSidebarStore(); // const enterpriseStore = useEnterpriseStore(); diff --git a/src/router/constants.ts b/src/router/constants.ts index 6fc8bef..1b17254 100644 --- a/src/router/constants.ts +++ b/src/router/constants.ts @@ -26,4 +26,5 @@ export const MENU_GROUP_IDS = { MANAGEMENT_ID: -1, // 管理中心 PROPERTY_ID: 10, // 资产营销平台 WORK_BENCH_ID: -99, // 工作台 + AGENT: 2, // 智能体 }; diff --git a/src/router/routes/modules/agent.ts b/src/router/routes/modules/agent.ts index feef729..f36fcb4 100644 --- a/src/router/routes/modules/agent.ts +++ b/src/router/routes/modules/agent.ts @@ -1,7 +1,3 @@ -/** - * 智能体应用 - */ - import type { AppRouteRecordRaw } from '../types'; import { MENU_GROUP_IDS } from '@/router/constants'; @@ -12,16 +8,46 @@ const COMPONENTS: AppRouteRecordRaw[] = [ path: '/agent', name: 'Agent', redirect: 'agent/listData', - component: () => import('@/views/Agent/Chat/index.vue'), meta: { locale: '扣子智能体', icon: IconRepository, requiresAuth: true, requireLogin: true, roles: ['*'], - id: MENU_GROUP_IDS.PROPERTY_ID, + id: MENU_GROUP_IDS.AGENT, }, - children: [], + children: [ + { + path: 'index', + name: 'AgentListData', + component: () => import('@/views/agent/index'), + meta: { + locale: '智能体列表', + requiresAuth: false, + requireLogin: true, + }, + }, + { + path: 'chat', + name: 'Chat', + component: () => import('@/views/agent/chat'), + meta: { + hideSidebar: true, + requiresAuth: false, + requireLogin: true, + }, + }, + { + path: 'workFlow', + name: 'AgentWorkFlow', + component: () => import('@/views/agent/work-flow'), + meta: { + hideSidebar: true, + requiresAuth: false, + requireLogin: true, + }, + }, + ], }, ]; diff --git a/src/views/Agent/AgentConstants.ts b/src/views/Agent/AgentConstants.ts new file mode 100644 index 0000000..b5dfbe5 --- /dev/null +++ b/src/views/Agent/AgentConstants.ts @@ -0,0 +1,4 @@ +export enum AGENT_TYPE { + AGENT = 1, // 智能体 + WORKFLLOW = 2, // 工作流 +} diff --git a/src/views/Agent/Chat/components/CozeChat.vue b/src/views/Agent/Chat/components/CozeChat.vue index c5c559c..66d02e2 100644 --- a/src/views/Agent/Chat/components/CozeChat.vue +++ b/src/views/Agent/Chat/components/CozeChat.vue @@ -116,7 +116,6 @@ export default { } }; - // 重试机制 const retry = async () => { error.value = false; loading.value = true; @@ -130,7 +129,6 @@ export default { } }; - // 组件挂载时初始化 onMounted(async () => { try { await loadSDK(); @@ -142,13 +140,11 @@ export default { } }); - // 组件卸载时清理 onBeforeUnmount(() => { if (chatClient && typeof chatClient.destroy === 'function') { chatClient.destroy(); } - // 移除我们添加的脚本 if (scriptLoaded) { const scripts = document.querySelectorAll('script[src*="coze.cn"]'); scripts.forEach((script) => script.remove()); diff --git a/src/views/Agent/Chat/components/HistoryChat.vue b/src/views/Agent/Chat/components/HistoryChat.vue index cee070a..af7802e 100644 --- a/src/views/Agent/Chat/components/HistoryChat.vue +++ b/src/views/Agent/Chat/components/HistoryChat.vue @@ -1,12 +1,13 @@ + + + + diff --git a/src/views/Agent/Chat/style.scss b/src/views/Agent/Chat/style.scss new file mode 100644 index 0000000..5e867e7 --- /dev/null +++ b/src/views/Agent/Chat/style.scss @@ -0,0 +1,27 @@ +.chat-wrap { + .chat-contain { + font-family: Avenir, Helvetica, Arial, sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #2c3e50; + margin-top: 24px; + + .span-back { + color: var(--Text-2, #3C4043); + font-size: 14px; + font-family: Alibaba PuHuiTi; + font-weight: 400; + line-height: 62px; + word-wrap: break-word + } + } + + .span-back { + color: var(--Text-2, #3C4043); + font-size: 14px; + font-family: Alibaba PuHuiTi; + font-weight: 400; + line-height: 22px; + word-wrap: break-word + } +} diff --git a/src/views/Agent/Index/index.vue b/src/views/Agent/Index/index.vue new file mode 100644 index 0000000..d5bd328 --- /dev/null +++ b/src/views/Agent/Index/index.vue @@ -0,0 +1,68 @@ + + + + + diff --git a/src/views/Agent/Index/style.scss b/src/views/Agent/Index/style.scss new file mode 100644 index 0000000..93b3f24 --- /dev/null +++ b/src/views/Agent/Index/style.scss @@ -0,0 +1,20 @@ +.agent-wrap { + padding: 24px; + background: #fff; + border-radius: 4px; + + .ant-card-cover img { + height: 150px; + object-fit: cover; + } + + .span-title { + color: var(--Text-2, #3C4043); + font-size: 16px; + font-family: Alibaba PuHuiTi; + font-weight: 400; + line-height: 44px; + word-wrap: break-word; + padding-bottom: 20px; + } +} diff --git a/src/views/Agent/work-flow/components/DynamicForm.vue b/src/views/Agent/work-flow/components/DynamicForm.vue new file mode 100644 index 0000000..6fc406c --- /dev/null +++ b/src/views/Agent/work-flow/components/DynamicForm.vue @@ -0,0 +1,73 @@ + + + + diff --git a/src/views/Agent/work-flow/components/HistoryChat.vue b/src/views/Agent/work-flow/components/HistoryChat.vue new file mode 100644 index 0000000..5f138d7 --- /dev/null +++ b/src/views/Agent/work-flow/components/HistoryChat.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/views/Agent/work-flow/components/WorkFlow.vue b/src/views/Agent/work-flow/components/WorkFlow.vue new file mode 100644 index 0000000..66d02e2 --- /dev/null +++ b/src/views/Agent/work-flow/components/WorkFlow.vue @@ -0,0 +1,217 @@ + + + + + diff --git a/src/views/Agent/work-flow/form/FormFieldRenderer.vue b/src/views/Agent/work-flow/form/FormFieldRenderer.vue new file mode 100644 index 0000000..563d2c9 --- /dev/null +++ b/src/views/Agent/work-flow/form/FormFieldRenderer.vue @@ -0,0 +1,37 @@ + + + diff --git a/src/views/Agent/work-flow/form/InputField.vue b/src/views/Agent/work-flow/form/InputField.vue new file mode 100644 index 0000000..b4a9616 --- /dev/null +++ b/src/views/Agent/work-flow/form/InputField.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/views/Agent/work-flow/form/SelectField.vue b/src/views/Agent/work-flow/form/SelectField.vue new file mode 100644 index 0000000..0896a55 --- /dev/null +++ b/src/views/Agent/work-flow/form/SelectField.vue @@ -0,0 +1,31 @@ + + + diff --git a/src/views/Agent/work-flow/index.vue b/src/views/Agent/work-flow/index.vue new file mode 100644 index 0000000..689e663 --- /dev/null +++ b/src/views/Agent/work-flow/index.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/views/Agent/work-flow/style.scss b/src/views/Agent/work-flow/style.scss new file mode 100644 index 0000000..203353e --- /dev/null +++ b/src/views/Agent/work-flow/style.scss @@ -0,0 +1,41 @@ +.chat-wrap { + .chat-contain { + font-family: Avenir, Helvetica, Arial, sans-serif; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + color: #2c3e50; + margin-top: 24px; + + .span-back { + color: var(--Text-2, #3C4043); + font-size: 14px; + font-family: Alibaba PuHuiTi; + font-weight: 400; + line-height: 62px; + word-wrap: break-word + } + } + + .span-back { + color: var(--Text-2, #3C4043); + font-size: 14px; + font-family: Alibaba PuHuiTi; + line-height: 22px; + word-wrap: break-word + } + + .content-container { + width: 40%; + background-color: #fff; + } + + .work-res-span { + padding: 24px; + line-height: 34px; + } + + .layout-sider{ + border-radius: 6px; + margin-left: 20px; + } +}