@gientech/modual 1.4.7 → 1.5.2

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.
Files changed (65) hide show
  1. package/dist/assets/GientechStreamReader-KtCNi1G3.js +447 -0
  2. package/dist/assets/Input-CNqIA41v.js +236 -0
  3. package/dist/assets/index-Bof0D4vl.js +1088 -0
  4. package/dist/assets/{index-BVENTW1Q.js → index-C5RhLYRh.js} +1 -1
  5. package/dist/assets/index-COcmK9my.js +1 -0
  6. package/dist/assets/index-CysDmrpo.js +1798 -0
  7. package/dist/assets/{index-7rZAt9P3.js → index-DP8Ki8qW.js} +1 -1
  8. package/dist/assets/index-pybYlMAT.js +11 -0
  9. package/dist/assets/{plus-CrtEUXaQ.js → plus-CzbYbK8K.js} +1 -1
  10. package/dist/assets/style3.css +1 -1
  11. package/dist/assets/worker-BbpylX7l.js +13 -0
  12. package/dist/assets/{x-Dr3EBTzJ.js → x-DdRafKQU.js} +1 -1
  13. package/dist/chat.d.ts +17 -0
  14. package/dist/chat.js +2539 -52
  15. package/dist/database.js +2 -2
  16. package/dist/databaseId.js +1 -11
  17. package/dist/databaseTable.js +2 -2
  18. package/dist/index.d.ts +4 -0
  19. package/dist/index.js +1 -14
  20. package/dist/modelManage.js +1 -1
  21. package/dist/package.json +1 -1
  22. package/dist/sensitive.js +1 -1
  23. package/dist/streamFilesReader.js +1 -1
  24. package/dist/worker/pdf.worker1.min.js +23 -0
  25. package/package.json +6 -6
  26. package/public/worker/pdf.worker1.min.js +23 -0
  27. package/scripts/README.md +133 -133
  28. package/scripts/build-demo.js +88 -88
  29. package/scripts/demo-selector.js +216 -216
  30. package/scripts/preview-demo.js +130 -130
  31. package/scripts/run-demo.bat +34 -34
  32. package/src/assets/img/close.png +0 -0
  33. package/src/assets/img/database.png +0 -0
  34. package/src/assets/img/downLoad.png +0 -0
  35. package/src/assets/img/graphIcon.png +0 -0
  36. package/src/assets/img/pdf.png +0 -0
  37. package/src/assets/img/singleQa.png +0 -0
  38. package/src/assets/img/webSearch.png +0 -0
  39. package/src/examples/chat/index.tsx +5 -29
  40. package/src/main.tsx.backup +5 -5
  41. package/src/modules/chat/ReferenceBar.tsx +522 -0
  42. package/src/modules/chat/constants.tsx +29 -6
  43. package/src/modules/chat/index.tsx +118 -4
  44. package/src/modules/chat/referenceCom/DeleteModal.tsx +75 -0
  45. package/src/modules/chat/referenceCom/DrawerContent.tsx +136 -0
  46. package/src/modules/chat/referenceCom/DrawerDatabase.tsx +110 -0
  47. package/src/modules/chat/referenceCom/DrawerGraphPreview.tsx +86 -0
  48. package/src/modules/chat/referenceCom/DrawerPreview.tsx +73 -0
  49. package/src/modules/chat/referenceCom/DrawerTitle.tsx +26 -0
  50. package/src/modules/chat/referenceCom/RenameModal.tsx +86 -0
  51. package/src/modules/chat/referenceCom/TagCom.tsx +30 -0
  52. package/src/modules/chat/style.css +3 -0
  53. package/src/modules/chat/utils/index.ts +326 -0
  54. package/src/utils/gientechCommon/components/Messages/GientechNewChatWelcome.tsx +231 -18
  55. package/src/utils/testconfigs/index.ts +1 -1
  56. package/stats.html +1 -1
  57. package/dist/assets/AppLoading-mci3gLZt.js +0 -414
  58. package/dist/assets/GientechStreamReader-4496nAm0.js +0 -446
  59. package/dist/assets/index-Bb8_WB-l.js +0 -1
  60. package/dist/assets/index-BpJ9Bm5x.js +0 -21
  61. package/dist/assets/index-CNxDI4h-.js +0 -1078
  62. package/dist/assets/index-CWzpBU29.js +0 -1
  63. package/dist/assets/index-D1m34Ij7.js +0 -1429
  64. package/dist/assets/index-_gBtdXQV.js +0 -585
  65. package/dist/assets/style4.css +0 -1
@@ -1,216 +1,216 @@
1
- #!/usr/bin/env node
2
-
3
- import inquirer from 'inquirer';
4
- import fs from 'fs-extra';
5
- import path from 'path';
6
- import { fileURLToPath } from 'url';
7
-
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = path.dirname(__filename);
10
-
11
- // 检测操作系统
12
- const isWindows = process.platform === 'win32';
13
-
14
- // 调试信息
15
- console.log('🔧 调试信息:');
16
- console.log(' Node.js 版本:', process.version);
17
- console.log(' 操作系统:', process.platform);
18
- console.log(' 当前工作目录:', process.cwd());
19
- console.log(' 脚本目录:', __dirname);
20
- console.log(' Windows 模式:', isWindows);
21
- console.log('');
22
-
23
- // 项目根目录
24
- const PROJECT_ROOT = path.resolve(__dirname, '..');
25
- const SRC_DIR = path.join(PROJECT_ROOT, 'src');
26
- const MAIN_TEMPLATE = path.join(PROJECT_ROOT, 'src/main.template.tsx');
27
- const MAIN_FILE = path.join(PROJECT_ROOT, 'src/main.tsx');
28
-
29
- /**
30
- * 扫描示例文件
31
- * 支持两种模式:
32
- * 1. src/Example_XXXX.tsx (单文件模式)
33
- * 2. src/examples/XXXX/XXXX.tsx 或 src/examples/XXXX/index.tsx (文件夹模式)
34
- */
35
- function scanExampleFiles() {
36
- const examples = [];
37
-
38
- try {
39
- // 扫描单文件模式: Example_XXXX.tsx
40
- const files = fs.readdirSync(SRC_DIR);
41
- files.forEach(file => {
42
- if (file.startsWith('Example_') && file.endsWith('.tsx')) {
43
- const name = file.replace('Example_', '').replace('.tsx', '');
44
- examples.push({
45
- name: `${name} (单文件)`,
46
- value: file,
47
- type: 'single',
48
- path: path.join(SRC_DIR, file)
49
- });
50
- }
51
- });
52
-
53
- // 扫描文件夹模式: examples/XXXX/
54
- const examplesDir = path.join(SRC_DIR, 'examples');
55
- if (fs.existsSync(examplesDir)) {
56
- const exampleDirs = fs.readdirSync(examplesDir);
57
- exampleDirs.forEach(dir => {
58
- const dirPath = path.join(examplesDir, dir);
59
- if (fs.statSync(dirPath).isDirectory()) {
60
- // 检查是否有 index.tsx 或 同名.tsx 文件
61
- const indexFile = path.join(dirPath, 'index.tsx');
62
- const namedFile = path.join(dirPath, `${dir}.tsx`);
63
-
64
- if (fs.existsSync(indexFile)) {
65
- examples.push({
66
- name: `${dir} (文件夹 - index.tsx)`,
67
- value: `examples/${dir}/index.tsx`,
68
- type: 'folder',
69
- path: indexFile
70
- });
71
- } else if (fs.existsSync(namedFile)) {
72
- examples.push({
73
- name: `${dir} (文件夹 - ${dir}.tsx)`,
74
- value: `examples/${dir}/${dir}.tsx`,
75
- type: 'folder',
76
- path: namedFile
77
- });
78
- }
79
- }
80
- });
81
- }
82
- } catch (error) {
83
- console.error('扫描示例文件时出错:', error);
84
- }
85
-
86
- return examples;
87
- }
88
-
89
- /**
90
- * 生成临时的 main.tsx 文件
91
- */
92
- function generateMainFile(selectedExample) {
93
- // 统一去掉扩展名,确保导入路径无后缀
94
- const normalizedImportPath = selectedExample.replace(/\.(t|j)sx?$/, '');
95
-
96
- // 智能解析组件名称,且确保不包含扩展名或非法标识符字符
97
- let componentName;
98
- if (selectedExample.includes('examples/')) {
99
- // 文件夹模式:使用文件夹名称作为组件名
100
- const folderName = selectedExample.split('/')[1]; // 获取 examples/Form/ 中的 Form
101
- componentName = folderName.charAt(0).toUpperCase() + folderName.slice(1); // 首字母大写
102
- } else {
103
- // 单文件模式:使用文件名作为组件名
104
- componentName = path.basename(normalizedImportPath);
105
- }
106
- // 清理可能的无效字符并确保首字符为字母/下划线
107
- componentName = componentName.replace(/\.(t|j)sx?$/i, '').replace(/[^\w$]/g, '');
108
- if (!/^[A-Za-z_$]/.test(componentName)) {
109
- componentName = '_' + componentName;
110
- }
111
-
112
- const mainContent = `import React from 'react';
113
- import ReactDOM from 'react-dom/client';
114
- import ${componentName} from './${normalizedImportPath}';
115
-
116
- ReactDOM.createRoot(document.getElementById('root')!).render(<${componentName} />);
117
- `;
118
-
119
- try {
120
- // 备份原始 main.tsx 文件
121
- if (fs.existsSync(MAIN_FILE)) {
122
- fs.copyFileSync(MAIN_FILE, MAIN_FILE + '.backup');
123
- }
124
-
125
- // 写入新的 main.tsx
126
- fs.writeFileSync(MAIN_FILE, mainContent);
127
- console.log(`✅ 已生成临时 main.tsx,导入示例: ${selectedExample}`);
128
-
129
- return true;
130
- } catch (error) {
131
- console.error('生成 main.tsx 文件时出错:', error);
132
- return false;
133
- }
134
- }
135
-
136
- /**
137
- * 恢复原始的 main.tsx 文件
138
- */
139
- function restoreMainFile() {
140
- try {
141
- if (fs.existsSync(MAIN_FILE + '.backup')) {
142
- fs.copyFileSync(MAIN_FILE + '.backup', MAIN_FILE);
143
- fs.removeSync(MAIN_FILE + '.backup');
144
- console.log('✅ 已恢复原始 main.tsx 文件');
145
- }
146
- } catch (error) {
147
- console.error('恢复 main.tsx 文件时出错:', error);
148
- }
149
- }
150
-
151
- /**
152
- * 主函数
153
- */
154
- async function main() {
155
- console.log('🔍 正在扫描示例文件...\n');
156
-
157
- const examples = scanExampleFiles();
158
-
159
- if (examples.length === 0) {
160
- console.log('❌ 未找到任何示例文件');
161
- console.log('请确保有以下格式的文件:');
162
- console.log(' - src/Example_XXXX.tsx');
163
- console.log(' - src/examples/XXXX/XXXX.tsx');
164
- console.log(' - src/examples/XXXX/index.tsx');
165
- process.exit(1);
166
- }
167
-
168
- console.log(`📁 找到 ${examples.length} 个示例文件:\n`);
169
-
170
- const { selectedExample } = await inquirer.prompt([
171
- {
172
- type: 'list',
173
- name: 'selectedExample',
174
- message: '请选择要运行的示例:',
175
- choices: examples,
176
- pageSize: 10
177
- }
178
- ]);
179
-
180
- console.log(`\n🎯 已选择: ${selectedExample}`);
181
-
182
- // 生成临时 main.tsx
183
- if (generateMainFile(selectedExample)) {
184
- console.log('\n🚀 示例文件已准备就绪!');
185
- console.log('现在可以运行以下命令:');
186
- console.log(' - 开发模式: pnpm run dev:demo');
187
- console.log(' - 打包模式: pnpm run build:demo');
188
- console.log('\n💡 提示: 运行完成后会自动恢复原始 main.tsx 文件');
189
- } else {
190
- console.error('❌ 准备示例文件失败');
191
- process.exit(1);
192
- }
193
- }
194
-
195
- // 处理进程退出,确保恢复原始文件
196
- process.on('SIGINT', () => {
197
- console.log('\n\n🔄 正在清理...');
198
- restoreMainFile();
199
- process.exit(0);
200
- });
201
-
202
- process.on('SIGTERM', () => {
203
- console.log('\n\n🔄 正在清理...');
204
- restoreMainFile();
205
- process.exit(0);
206
- });
207
-
208
- // 如果直接运行此脚本
209
- if (import.meta.url === `file://${process.argv[1]}`) {
210
- main().catch(error => {
211
- console.error('❌ 脚本执行失败:', error);
212
- process.exit(1);
213
- });
214
- }
215
-
216
- export { main, generateMainFile, restoreMainFile, scanExampleFiles };
1
+ #!/usr/bin/env node
2
+
3
+ import inquirer from 'inquirer';
4
+ import fs from 'fs-extra';
5
+ import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+
8
+ const __filename = fileURLToPath(import.meta.url);
9
+ const __dirname = path.dirname(__filename);
10
+
11
+ // 检测操作系统
12
+ const isWindows = process.platform === 'win32';
13
+
14
+ // 调试信息
15
+ console.log('🔧 调试信息:');
16
+ console.log(' Node.js 版本:', process.version);
17
+ console.log(' 操作系统:', process.platform);
18
+ console.log(' 当前工作目录:', process.cwd());
19
+ console.log(' 脚本目录:', __dirname);
20
+ console.log(' Windows 模式:', isWindows);
21
+ console.log('');
22
+
23
+ // 项目根目录
24
+ const PROJECT_ROOT = path.resolve(__dirname, '..');
25
+ const SRC_DIR = path.join(PROJECT_ROOT, 'src');
26
+ const MAIN_TEMPLATE = path.join(PROJECT_ROOT, 'src/main.template.tsx');
27
+ const MAIN_FILE = path.join(PROJECT_ROOT, 'src/main.tsx');
28
+
29
+ /**
30
+ * 扫描示例文件
31
+ * 支持两种模式:
32
+ * 1. src/Example_XXXX.tsx (单文件模式)
33
+ * 2. src/examples/XXXX/XXXX.tsx 或 src/examples/XXXX/index.tsx (文件夹模式)
34
+ */
35
+ function scanExampleFiles() {
36
+ const examples = [];
37
+
38
+ try {
39
+ // 扫描单文件模式: Example_XXXX.tsx
40
+ const files = fs.readdirSync(SRC_DIR);
41
+ files.forEach(file => {
42
+ if (file.startsWith('Example_') && file.endsWith('.tsx')) {
43
+ const name = file.replace('Example_', '').replace('.tsx', '');
44
+ examples.push({
45
+ name: `${name} (单文件)`,
46
+ value: file,
47
+ type: 'single',
48
+ path: path.join(SRC_DIR, file)
49
+ });
50
+ }
51
+ });
52
+
53
+ // 扫描文件夹模式: examples/XXXX/
54
+ const examplesDir = path.join(SRC_DIR, 'examples');
55
+ if (fs.existsSync(examplesDir)) {
56
+ const exampleDirs = fs.readdirSync(examplesDir);
57
+ exampleDirs.forEach(dir => {
58
+ const dirPath = path.join(examplesDir, dir);
59
+ if (fs.statSync(dirPath).isDirectory()) {
60
+ // 检查是否有 index.tsx 或 同名.tsx 文件
61
+ const indexFile = path.join(dirPath, 'index.tsx');
62
+ const namedFile = path.join(dirPath, `${dir}.tsx`);
63
+
64
+ if (fs.existsSync(indexFile)) {
65
+ examples.push({
66
+ name: `${dir} (文件夹 - index.tsx)`,
67
+ value: `examples/${dir}/index.tsx`,
68
+ type: 'folder',
69
+ path: indexFile
70
+ });
71
+ } else if (fs.existsSync(namedFile)) {
72
+ examples.push({
73
+ name: `${dir} (文件夹 - ${dir}.tsx)`,
74
+ value: `examples/${dir}/${dir}.tsx`,
75
+ type: 'folder',
76
+ path: namedFile
77
+ });
78
+ }
79
+ }
80
+ });
81
+ }
82
+ } catch (error) {
83
+ console.error('扫描示例文件时出错:', error);
84
+ }
85
+
86
+ return examples;
87
+ }
88
+
89
+ /**
90
+ * 生成临时的 main.tsx 文件
91
+ */
92
+ function generateMainFile(selectedExample) {
93
+ // 统一去掉扩展名,确保导入路径无后缀
94
+ const normalizedImportPath = selectedExample.replace(/\.(t|j)sx?$/, '');
95
+
96
+ // 智能解析组件名称,且确保不包含扩展名或非法标识符字符
97
+ let componentName;
98
+ if (selectedExample.includes('examples/')) {
99
+ // 文件夹模式:使用文件夹名称作为组件名
100
+ const folderName = selectedExample.split('/')[1]; // 获取 examples/Form/ 中的 Form
101
+ componentName = folderName.charAt(0).toUpperCase() + folderName.slice(1); // 首字母大写
102
+ } else {
103
+ // 单文件模式:使用文件名作为组件名
104
+ componentName = path.basename(normalizedImportPath);
105
+ }
106
+ // 清理可能的无效字符并确保首字符为字母/下划线
107
+ componentName = componentName.replace(/\.(t|j)sx?$/i, '').replace(/[^\w$]/g, '');
108
+ if (!/^[A-Za-z_$]/.test(componentName)) {
109
+ componentName = '_' + componentName;
110
+ }
111
+
112
+ const mainContent = `import React from 'react';
113
+ import ReactDOM from 'react-dom/client';
114
+ import ${componentName} from './${normalizedImportPath}';
115
+
116
+ ReactDOM.createRoot(document.getElementById('root')!).render(<${componentName} />);
117
+ `;
118
+
119
+ try {
120
+ // 备份原始 main.tsx 文件
121
+ if (fs.existsSync(MAIN_FILE)) {
122
+ fs.copyFileSync(MAIN_FILE, MAIN_FILE + '.backup');
123
+ }
124
+
125
+ // 写入新的 main.tsx
126
+ fs.writeFileSync(MAIN_FILE, mainContent);
127
+ console.log(`✅ 已生成临时 main.tsx,导入示例: ${selectedExample}`);
128
+
129
+ return true;
130
+ } catch (error) {
131
+ console.error('生成 main.tsx 文件时出错:', error);
132
+ return false;
133
+ }
134
+ }
135
+
136
+ /**
137
+ * 恢复原始的 main.tsx 文件
138
+ */
139
+ function restoreMainFile() {
140
+ try {
141
+ if (fs.existsSync(MAIN_FILE + '.backup')) {
142
+ fs.copyFileSync(MAIN_FILE + '.backup', MAIN_FILE);
143
+ fs.removeSync(MAIN_FILE + '.backup');
144
+ console.log('✅ 已恢复原始 main.tsx 文件');
145
+ }
146
+ } catch (error) {
147
+ console.error('恢复 main.tsx 文件时出错:', error);
148
+ }
149
+ }
150
+
151
+ /**
152
+ * 主函数
153
+ */
154
+ async function main() {
155
+ console.log('🔍 正在扫描示例文件...\n');
156
+
157
+ const examples = scanExampleFiles();
158
+
159
+ if (examples.length === 0) {
160
+ console.log('❌ 未找到任何示例文件');
161
+ console.log('请确保有以下格式的文件:');
162
+ console.log(' - src/Example_XXXX.tsx');
163
+ console.log(' - src/examples/XXXX/XXXX.tsx');
164
+ console.log(' - src/examples/XXXX/index.tsx');
165
+ process.exit(1);
166
+ }
167
+
168
+ console.log(`📁 找到 ${examples.length} 个示例文件:\n`);
169
+
170
+ const { selectedExample } = await inquirer.prompt([
171
+ {
172
+ type: 'list',
173
+ name: 'selectedExample',
174
+ message: '请选择要运行的示例:',
175
+ choices: examples,
176
+ pageSize: 10
177
+ }
178
+ ]);
179
+
180
+ console.log(`\n🎯 已选择: ${selectedExample}`);
181
+
182
+ // 生成临时 main.tsx
183
+ if (generateMainFile(selectedExample)) {
184
+ console.log('\n🚀 示例文件已准备就绪!');
185
+ console.log('现在可以运行以下命令:');
186
+ console.log(' - 开发模式: pnpm run dev:demo');
187
+ console.log(' - 打包模式: pnpm run build:demo');
188
+ console.log('\n💡 提示: 运行完成后会自动恢复原始 main.tsx 文件');
189
+ } else {
190
+ console.error('❌ 准备示例文件失败');
191
+ process.exit(1);
192
+ }
193
+ }
194
+
195
+ // 处理进程退出,确保恢复原始文件
196
+ process.on('SIGINT', () => {
197
+ console.log('\n\n🔄 正在清理...');
198
+ restoreMainFile();
199
+ process.exit(0);
200
+ });
201
+
202
+ process.on('SIGTERM', () => {
203
+ console.log('\n\n🔄 正在清理...');
204
+ restoreMainFile();
205
+ process.exit(0);
206
+ });
207
+
208
+ // 如果直接运行此脚本
209
+ if (import.meta.url === `file://${process.argv[1]}`) {
210
+ main().catch(error => {
211
+ console.error('❌ 脚本执行失败:', error);
212
+ process.exit(1);
213
+ });
214
+ }
215
+
216
+ export { main, generateMainFile, restoreMainFile, scanExampleFiles };