@chatbi-v/mocks 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Mock 数据模块
3
+ * @description 提供前端开发所需的模拟数据适配器和工具
4
+ */
5
+ export * from './adapter';
6
+ export * from './generator';
7
+ export * from './interceptor';
8
+ export * from './strategies';
9
+ export * from './types';
10
+ export * from './utils';
11
+ /**
12
+ * 模拟用户数据
13
+ */
14
+ export declare const MOCK_USER: {
15
+ id: string;
16
+ name: string;
17
+ avatar: string;
18
+ role: string;
19
+ };
20
+ export declare const MOCK_SESSIONS: {
21
+ id: string;
22
+ title: string;
23
+ date: string;
24
+ lastMessage: string;
25
+ }[];
26
+ export declare const MOCK_FAVORITES: {
27
+ id: string;
28
+ title: string;
29
+ date: string;
30
+ }[];
31
+ export declare const MOCK_SCENES: {
32
+ id: string;
33
+ name: string;
34
+ description: string;
35
+ code: string;
36
+ creator: string;
37
+ createTime: string;
38
+ tableCount: number;
39
+ kbCount: number;
40
+ qaCount: number;
41
+ cover: string;
42
+ }[];
43
+ export declare const generateMockMessages: (sessionId: string) => {
44
+ key: string;
45
+ role: string;
46
+ content: string;
47
+ time: string;
48
+ }[];
49
+ export declare const mockData: {
50
+ user: {
51
+ id: string;
52
+ name: string;
53
+ avatar: string;
54
+ role: string;
55
+ };
56
+ sessions: {
57
+ id: string;
58
+ title: string;
59
+ date: string;
60
+ lastMessage: string;
61
+ }[];
62
+ favorites: {
63
+ id: string;
64
+ title: string;
65
+ date: string;
66
+ }[];
67
+ scenes: {
68
+ id: string;
69
+ name: string;
70
+ description: string;
71
+ code: string;
72
+ creator: string;
73
+ createTime: string;
74
+ tableCount: number;
75
+ kbCount: number;
76
+ qaCount: number;
77
+ cover: string;
78
+ }[];
79
+ favoritesList: {
80
+ id: string;
81
+ title: string;
82
+ date: string;
83
+ }[];
84
+ };
package/dist/index.js ADDED
@@ -0,0 +1,86 @@
1
+ import { dateUtils } from '@chatbi-v/core';
2
+ /**
3
+ * Mock 数据模块
4
+ * @description 提供前端开发所需的模拟数据适配器和工具
5
+ */
6
+ export * from './adapter';
7
+ export * from './generator';
8
+ export * from './interceptor';
9
+ export * from './strategies';
10
+ export * from './types';
11
+ export * from './utils';
12
+ /**
13
+ * 模拟用户数据
14
+ */
15
+ export const MOCK_USER = {
16
+ id: 'u_001',
17
+ name: 'Admin User',
18
+ avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=Admin',
19
+ role: 'admin',
20
+ };
21
+ // 保留原有的静态数据导出,以兼容可能直接引用的地方,但建议使用 adapter 自动生成
22
+ export const MOCK_SESSIONS = [
23
+ { id: 's_001', title: '2024 Q1 销售分析', date: '2024-03-15', lastMessage: '好的,正在为您分析 Q1 销售数据...' },
24
+ { id: 's_002', title: '用户增长趋势', date: '2024-03-10', lastMessage: '用户增长曲线显示...' },
25
+ { id: 's_003', title: '竞品分析报告', date: '2024-03-08', lastMessage: '主要竞品 A 的市场份额...' },
26
+ { id: 's_004', title: '营销活动复盘', date: '2024-03-05', lastMessage: 'ROI 提升了 15%...' },
27
+ { id: 's_005', title: '财务报表审计', date: '2024-03-01', lastMessage: '请确认以下财务指标...' },
28
+ ];
29
+ export const MOCK_FAVORITES = [
30
+ { id: 'fav-1', title: '季度销售总结', date: '2025/12/15' },
31
+ { id: 'fav-2', title: '年度预算规划', date: '2025/12/10' },
32
+ { id: 'fav-3', title: '核心指标监控', date: '2025/11/20' },
33
+ ];
34
+ export const MOCK_SCENES = [
35
+ {
36
+ id: '1',
37
+ name: '销售数据分析',
38
+ description: '全方位分析销售业绩,包括区域、产品、时间维度',
39
+ code: 'SALES_001',
40
+ creator: '管理员',
41
+ createTime: '2023-01-01',
42
+ tableCount: 5,
43
+ kbCount: 2,
44
+ qaCount: 10,
45
+ cover: 'https://images.unsplash.com/photo-1551288049-bebda4e38f71?w=800&q=80',
46
+ },
47
+ {
48
+ id: '2',
49
+ name: '人力资源概览',
50
+ description: '员工入职、离职、绩效分布与培训情况分析',
51
+ code: 'HR_001',
52
+ creator: 'HR 经理',
53
+ createTime: '2023-02-15',
54
+ tableCount: 3,
55
+ kbCount: 1,
56
+ qaCount: 5,
57
+ cover: 'https://images.unsplash.com/photo-1460925895917-afdab827c52f?w=800&q=80',
58
+ },
59
+ {
60
+ id: '3',
61
+ name: '供应链优化',
62
+ description: '库存周转、物流成本与供应商绩效评估',
63
+ code: 'SCM_001',
64
+ creator: '供应链总监',
65
+ createTime: '2023-03-20',
66
+ tableCount: 8,
67
+ kbCount: 0,
68
+ qaCount: 15,
69
+ cover: 'https://images.unsplash.com/photo-1586528116311-ad8dd3c8310d?w=800&q=80',
70
+ },
71
+ ];
72
+ export const generateMockMessages = (sessionId) => [
73
+ {
74
+ key: `msg_${sessionId}_1`,
75
+ role: 'assistant',
76
+ content: `您好!我是您的智能助手。当前会话 ID: ${sessionId}。请问有什么可以帮您?`,
77
+ time: dateUtils.dayjs(dateUtils.now() - 10000).toISOString(),
78
+ },
79
+ ];
80
+ export const mockData = {
81
+ user: MOCK_USER,
82
+ sessions: MOCK_SESSIONS,
83
+ favorites: MOCK_FAVORITES,
84
+ scenes: MOCK_SCENES,
85
+ favoritesList: MOCK_FAVORITES, // Alias for compatibility if needed
86
+ };