feat(@vben/web-antd): 集成 Ant Design 组件库

- 在项目中引入 Antd 组件库和样式
- 优化聊天流接口调用,支持获取聊天列表
- 新增 PPT模板生成相关功能和界面- 调整静态资源代理配置,支持 PPT 文件加载
This commit is contained in:
Kven 2025-05-04 22:39:29 +08:00
parent 7020672e57
commit e39433e49c
4 changed files with 28 additions and 8 deletions

View File

@ -22,21 +22,39 @@ export namespace ChatflowApi {
limit: string; limit: string;
content?: string | undefined; 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, params: ChatflowApi.ChatParams,
data: ChatflowApi.CompletionsBody, data: ChatflowApi.CompletionsBody,
) { ) {
return requestClient.post(`/v1/chat/completions/${params.appid}`, data); return requestClient.post(`/v1/chat/completions/${params.appid}`, data);
} }
export function getChatList( export async function getChatList(
params: ChatflowApi.ChatParams, params: ChatflowApi.ChatParams,
data: ChatflowApi.ChatListBody, 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<ChatflowApi.ChatListResult[]>(url, {
data,
method: 'POST',
});
} }
// export function stopChatflow(data){ // export function stopChatflow(data){

View File

@ -8,6 +8,7 @@ import '@vben/styles';
import '@vben/styles/antd'; import '@vben/styles/antd';
import { useTitle } from '@vueuse/core'; import { useTitle } from '@vueuse/core';
import Antd from 'ant-design-vue';
import { $t, setupI18n } from '#/locales'; import { $t, setupI18n } from '#/locales';
@ -15,6 +16,8 @@ import { initComponentAdapter } from './adapter/component';
import App from './app.vue'; import App from './app.vue';
import { router } from './router'; import { router } from './router';
import 'ant-design-vue/dist/reset.css';
async function bootstrap(namespace: string) { async function bootstrap(namespace: string) {
// 初始化组件适配器 // 初始化组件适配器
await initComponentAdapter(); await initComponentAdapter();
@ -66,7 +69,7 @@ async function bootstrap(namespace: string) {
} }
}); });
app.mount('#app'); app.use(Antd).mount('#app');
} }
export { bootstrap }; export { bootstrap };

View File

@ -267,7 +267,7 @@ const [agent] = useXAgent({
appid: 'baca08c1-e92b-4dc9-a445-3584803f54d4', appid: 'baca08c1-e92b-4dc9-a445-3584803f54d4',
}, },
{ {
userId: '1562', userId: '1563',
conversationId: '', conversationId: '',
files: [], files: [],
inputs: { inputs: {
@ -385,7 +385,7 @@ const getConversationList = async () => {
appid: '363b9580-ae60-4a40-ae7d-ec434e86e326', appid: '363b9580-ae60-4a40-ae7d-ec434e86e326',
}, },
{ {
userId: '1562', userId: '1563',
lastId: '4dfa17e1-364a-4c98-af5d-1109c8f28212', lastId: '4dfa17e1-364a-4c98-af5d-1109c8f28212',
sortBy: '', sortBy: '',
limit: '5', limit: '5',

View File

@ -17,9 +17,8 @@ export default defineConfig(async () => {
target: 'http://localhost:8081/v1', target: 'http://localhost:8081/v1',
rewrite: (path) => path.replace(/^\/v1/, ''), rewrite: (path) => path.replace(/^\/v1/, ''),
changeOrigin: true, changeOrigin: true,
ws: true,
}, },
'/static/*.pptx': { '/static': {
target: 'http://47.112.173.8:6802', target: 'http://47.112.173.8:6802',
changeOrigin: true, changeOrigin: true,
}, },