From e39433e49c6abcb48983fa37ae518d44656c5c3d Mon Sep 17 00:00:00 2001 From: Kven <2955163637@qq.com> Date: Sun, 4 May 2025 22:39:29 +0800 Subject: [PATCH] =?UTF-8?q?feat(@vben/web-antd):=20=E9=9B=86=E6=88=90=20An?= =?UTF-8?q?t=20Design=20=E7=BB=84=E4=BB=B6=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在项目中引入 Antd 组件库和样式 - 优化聊天流接口调用,支持获取聊天列表 - 新增 PPT模板生成相关功能和界面- 调整静态资源代理配置,支持 PPT 文件加载 --- apps/web-antd/src/api/core/chatflow.ts | 24 +++++++++++++++++++++--- apps/web-antd/src/bootstrap.ts | 5 ++++- apps/web-antd/src/views/ppt/index.vue | 4 ++-- apps/web-antd/vite.config.mts | 3 +-- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/apps/web-antd/src/api/core/chatflow.ts b/apps/web-antd/src/api/core/chatflow.ts index a5112bd..239b8bd 100644 --- a/apps/web-antd/src/api/core/chatflow.ts +++ b/apps/web-antd/src/api/core/chatflow.ts @@ -22,21 +22,39 @@ export namespace ChatflowApi { limit: string; content?: string | undefined; } + + export interface ChatListResult { + id: string; + name: string; + inputs: { + [key: string]: any; + }; + status: string; + introduction: string; + createAt: string; + updatedAt: string; + } } // 聊天流 -export function sendChatflow( +export async function sendChatflow( params: ChatflowApi.ChatParams, data: ChatflowApi.CompletionsBody, ) { return requestClient.post(`/v1/chat/completions/${params.appid}`, data); } -export function getChatList( +export async function getChatList( params: ChatflowApi.ChatParams, data: ChatflowApi.ChatListBody, ) { - return requestClient.post(`/v1/chat/conversations/${params.appid}`, data); + const url = params.appid + ? `/v1/chat/conversations/${params.appid}` + : '/v1/chat/conversations/'; + return requestClient.request(url, { + data, + method: 'POST', + }); } // export function stopChatflow(data){ diff --git a/apps/web-antd/src/bootstrap.ts b/apps/web-antd/src/bootstrap.ts index e4aaf40..07eb176 100644 --- a/apps/web-antd/src/bootstrap.ts +++ b/apps/web-antd/src/bootstrap.ts @@ -8,6 +8,7 @@ import '@vben/styles'; import '@vben/styles/antd'; import { useTitle } from '@vueuse/core'; +import Antd from 'ant-design-vue'; import { $t, setupI18n } from '#/locales'; @@ -15,6 +16,8 @@ import { initComponentAdapter } from './adapter/component'; import App from './app.vue'; import { router } from './router'; +import 'ant-design-vue/dist/reset.css'; + async function bootstrap(namespace: string) { // 初始化组件适配器 await initComponentAdapter(); @@ -66,7 +69,7 @@ async function bootstrap(namespace: string) { } }); - app.mount('#app'); + app.use(Antd).mount('#app'); } export { bootstrap }; diff --git a/apps/web-antd/src/views/ppt/index.vue b/apps/web-antd/src/views/ppt/index.vue index 4d797de..db7d226 100644 --- a/apps/web-antd/src/views/ppt/index.vue +++ b/apps/web-antd/src/views/ppt/index.vue @@ -267,7 +267,7 @@ const [agent] = useXAgent({ appid: 'baca08c1-e92b-4dc9-a445-3584803f54d4', }, { - userId: '1562', + userId: '1563', conversationId: '', files: [], inputs: { @@ -385,7 +385,7 @@ const getConversationList = async () => { appid: '363b9580-ae60-4a40-ae7d-ec434e86e326', }, { - userId: '1562', + userId: '1563', lastId: '4dfa17e1-364a-4c98-af5d-1109c8f28212', sortBy: '', limit: '5', diff --git a/apps/web-antd/vite.config.mts b/apps/web-antd/vite.config.mts index cfcfdc3..cc8e423 100644 --- a/apps/web-antd/vite.config.mts +++ b/apps/web-antd/vite.config.mts @@ -17,9 +17,8 @@ export default defineConfig(async () => { target: 'http://localhost:8081/v1', rewrite: (path) => path.replace(/^\/v1/, ''), changeOrigin: true, - ws: true, }, - '/static/*.pptx': { + '/static': { target: 'http://47.112.173.8:6802', changeOrigin: true, },