@gientech/modual 1.5.6 → 1.5.8

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.
package/dist/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "license": "MIT",
4
4
  "style": "assets/style.css",
5
5
  "private": false,
6
- "version": "1.5.6",
6
+ "version": "1.5.8",
7
7
  "author": "hanfeng_Zhang",
8
8
  "type": "module",
9
9
  "main": "index.js",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gientech/modual",
3
3
  "private": false,
4
4
  "author": "hanfeng_Zhang",
5
- "version": "1.5.6",
5
+ "version": "1.5.8",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "types": "dist/index.d.ts",
@@ -1,10 +1,14 @@
1
1
  import React, { useState } from 'react';
2
2
  import { GientechStreamReader } from '../../modules/streamFilesReader';
3
3
  import { AppTheme } from '@mxmweb/zui';
4
- import type { Annotation, MDAnnotation, TableAnnotation } from '../../../../apps/FViewer/dist/core/types';
4
+ import type {
5
+ Annotation,
6
+ MDAnnotation,
7
+ TableAnnotation,
8
+ } from '../../../../apps/FViewer/dist/core/types';
5
9
  import { rag_dev_server } from '../../utils/testconfigs';
6
- import { registerPDFWorker } from '@mxmweb/fviewer'; // 或从 @gientech/modual re-export 的同名方法
7
- registerPDFWorker('/worker/pdf.worker.min.js');
10
+ // import { registerPDFWorker } from '@mxmweb/fviewer'; // 或从 @gientech/modual re-export 的同名方法
11
+ // registerPDFWorker('/worker/pdf.worker.min.js');
8
12
 
9
13
  // 自定义Loading组件示例
10
14
  const CustomLoadingComponent: React.FC<{
@@ -200,168 +204,168 @@ const CustomErrorComponent: React.FC<{
200
204
  };
201
205
 
202
206
  // 测试标注数据
203
- export const streamAnnotations: Annotation[] =[
207
+ export const streamAnnotations: Annotation[] = [
204
208
  {
205
- "id": "f4b6f9516e0",
206
- "pageNumber": 1,
207
- "x": 0.4047,
208
- "y": 0.481,
209
- "width": 0.1898,
210
- "height": 0.0172,
211
- "content": "",
212
- "color": "#C3F74F"
209
+ id: 'f4b6f9516e0',
210
+ pageNumber: 1,
211
+ x: 0.4047,
212
+ y: 0.481,
213
+ width: 0.1898,
214
+ height: 0.0172,
215
+ content: '',
216
+ color: '#C3F74F',
213
217
  },
214
218
  {
215
- "id": "4b6f9516e0d",
216
- "pageNumber": 1,
217
- "x": 0.1495,
218
- "y": 0.5243,
219
- "width": 0.7003,
220
- "height": 0.0534,
221
- "content": "",
222
- "color": "#C3F74F"
219
+ id: '4b6f9516e0d',
220
+ pageNumber: 1,
221
+ x: 0.1495,
222
+ y: 0.5243,
223
+ width: 0.7003,
224
+ height: 0.0534,
225
+ content: '',
226
+ color: '#C3F74F',
223
227
  },
224
228
  {
225
- "id": "b6f9516e0d3",
226
- "pageNumber": 1,
227
- "x": 0.1495,
228
- "y": 0.6057,
229
- "width": 0.1763,
230
- "height": 0.016,
231
- "content": "",
232
- "color": "#4FC3F7"
229
+ id: 'b6f9516e0d3',
230
+ pageNumber: 1,
231
+ x: 0.1495,
232
+ y: 0.6057,
233
+ width: 0.1763,
234
+ height: 0.016,
235
+ content: '',
236
+ color: '#4FC3F7',
233
237
  },
234
238
  {
235
- "id": "6f9516e0d32",
236
- "pageNumber": 3,
237
- "x": 0.1822,
238
- "y": 0.1473,
239
- "width": 0.4509,
240
- "height": 0.0374,
241
- "content": "",
242
- "color": "#C3F74F"
239
+ id: '6f9516e0d32',
240
+ pageNumber: 3,
241
+ x: 0.1822,
242
+ y: 0.1473,
243
+ width: 0.4509,
244
+ height: 0.0374,
245
+ content: '',
246
+ color: '#C3F74F',
243
247
  },
244
248
  {
245
- "id": "f9516e0d32b",
246
- "pageNumber": 3,
247
- "x": 0.2275,
248
- "y": 0.5825,
249
- "width": 0.3762,
250
- "height": 0.0214,
251
- "content": "",
252
- "color": "#4FC3F7"
249
+ id: 'f9516e0d32b',
250
+ pageNumber: 3,
251
+ x: 0.2275,
252
+ y: 0.5825,
253
+ width: 0.3762,
254
+ height: 0.0214,
255
+ content: '',
256
+ color: '#4FC3F7',
253
257
  },
254
258
  {
255
- "id": "9516e0d32b4",
256
- "pageNumber": 4,
257
- "x": 0.6902,
258
- "y": 0.1467,
259
- "width": 0.0311,
260
- "height": 0.2179,
261
- "content": "",
262
- "color": "#4FC3F7"
259
+ id: '9516e0d32b4',
260
+ pageNumber: 4,
261
+ x: 0.6902,
262
+ y: 0.1467,
263
+ width: 0.0311,
264
+ height: 0.2179,
265
+ content: '',
266
+ color: '#4FC3F7',
263
267
  },
264
268
  {
265
- "id": "516e0d32b44",
266
- "pageNumber": 4,
267
- "x": 0.1478,
268
- "y": 0.7922,
269
- "width": 0.7019,
270
- "height": 0.0689,
271
- "content": "",
272
- "color": "#4FC3F7"
269
+ id: '516e0d32b44',
270
+ pageNumber: 4,
271
+ x: 0.1478,
272
+ y: 0.7922,
273
+ width: 0.7019,
274
+ height: 0.0689,
275
+ content: '',
276
+ color: '#4FC3F7',
273
277
  },
274
278
  {
275
- "id": "16e0d32b442",
276
- "pageNumber": 5,
277
- "x": 0.1495,
278
- "y": 0.5137,
279
- "width": 0.7003,
280
- "height": 0.0695,
281
- "content": "",
282
- "color": "#4FC3F7"
279
+ id: '16e0d32b442',
280
+ pageNumber: 5,
281
+ x: 0.1495,
282
+ y: 0.5137,
283
+ width: 0.7003,
284
+ height: 0.0695,
285
+ content: '',
286
+ color: '#4FC3F7',
283
287
  },
284
288
  {
285
- "id": "6e0d32b442a",
286
- "pageNumber": 6,
287
- "x": 0.1495,
288
- "y": 0.6805,
289
- "width": 0.6952,
290
- "height": 0.0315,
291
- "content": "",
292
- "color": "#4FC3F7"
289
+ id: '6e0d32b442a',
290
+ pageNumber: 6,
291
+ x: 0.1495,
292
+ y: 0.6805,
293
+ width: 0.6952,
294
+ height: 0.0315,
295
+ content: '',
296
+ color: '#4FC3F7',
293
297
  },
294
298
  {
295
- "id": "e0d32b442a4",
296
- "pageNumber": 6,
297
- "x": 0.1478,
298
- "y": 0.7173,
299
- "width": 0.7019,
300
- "height": 0.0315,
301
- "content": "",
302
- "color": "#4FC3F7"
299
+ id: 'e0d32b442a4',
300
+ pageNumber: 6,
301
+ x: 0.1478,
302
+ y: 0.7173,
303
+ width: 0.7019,
304
+ height: 0.0315,
305
+ content: '',
306
+ color: '#4FC3F7',
303
307
  },
304
308
  {
305
- "id": "0d32b442a43",
306
- "pageNumber": 6,
307
- "x": 0.1495,
308
- "y": 0.7548,
309
- "width": 0.7003,
310
- "height": 0.0315,
311
- "content": "",
312
- "color": "#4FC3F7"
309
+ id: '0d32b442a43',
310
+ pageNumber: 6,
311
+ x: 0.1495,
312
+ y: 0.7548,
313
+ width: 0.7003,
314
+ height: 0.0315,
315
+ content: '',
316
+ color: '#4FC3F7',
313
317
  },
314
318
  {
315
- "id": "d32b442a43b",
316
- "pageNumber": 6,
317
- "x": 0.1495,
318
- "y": 0.8165,
319
- "width": 0.7003,
320
- "height": 0.0315,
321
- "content": "",
322
- "color": "#4FC3F7"
319
+ id: 'd32b442a43b',
320
+ pageNumber: 6,
321
+ x: 0.1495,
322
+ y: 0.8165,
323
+ width: 0.7003,
324
+ height: 0.0315,
325
+ content: '',
326
+ color: '#4FC3F7',
323
327
  },
324
328
  {
325
- "id": "32b442a43b6",
326
- "pageNumber": 6,
327
- "x": 0.1495,
328
- "y": 0.8539,
329
- "width": 0.7003,
330
- "height": 0.0315,
331
- "content": "",
332
- "color": "#4FC3F7"
329
+ id: '32b442a43b6',
330
+ pageNumber: 6,
331
+ x: 0.1495,
332
+ y: 0.8539,
333
+ width: 0.7003,
334
+ height: 0.0315,
335
+ content: '',
336
+ color: '#4FC3F7',
333
337
  },
334
338
  {
335
- "id": "2b442a43b6e",
336
- "pageNumber": 6,
337
- "x": 0.2301,
338
- "y": 0.8913,
339
- "width": 0.6062,
340
- "height": 0.0125,
341
- "content": "",
342
- "color": "#4FC3F7"
339
+ id: '2b442a43b6e',
340
+ pageNumber: 6,
341
+ x: 0.2301,
342
+ y: 0.8913,
343
+ width: 0.6062,
344
+ height: 0.0125,
345
+ content: '',
346
+ color: '#4FC3F7',
343
347
  },
344
348
  {
345
- "id": "b442a43b6e3",
346
- "pageNumber": 7,
347
- "x": 0.1478,
348
- "y": 0.0879,
349
- "width": 0.2343,
350
- "height": 0.0119,
351
- "content": "",
352
- "color": "#4FC3F7"
349
+ id: 'b442a43b6e3',
350
+ pageNumber: 7,
351
+ x: 0.1478,
352
+ y: 0.0879,
353
+ width: 0.2343,
354
+ height: 0.0119,
355
+ content: '',
356
+ color: '#4FC3F7',
353
357
  },
354
358
  {
355
- "id": "442a43b6e3f",
356
- "pageNumber": 7,
357
- "x": 0.1495,
358
- "y": 0.1069,
359
- "width": 0.6994,
360
- "height": 0.0303,
361
- "content": "",
362
- "color": "#4FC3F7"
363
- }
364
- ]
359
+ id: '442a43b6e3f',
360
+ pageNumber: 7,
361
+ x: 0.1495,
362
+ y: 0.1069,
363
+ width: 0.6994,
364
+ height: 0.0303,
365
+ content: '',
366
+ color: '#4FC3F7',
367
+ },
368
+ ];
365
369
 
366
370
  // 测试Markdown标注数据
367
371
  export const streamMDAnnotations: MDAnnotation[] = [
@@ -384,68 +388,23 @@ export const streamMDAnnotations: MDAnnotation[] = [
384
388
  // 测试表格标注数据
385
389
  export const streamTableAnnotations: TableAnnotation[] = [
386
390
  {
387
- "id": "2bd1e2b0fed",
388
- "offsets": [
389
- [
390
- 0,
391
- 0
392
- ],
393
- [
394
- 0,
395
- 1
396
- ],
397
- [
398
- 0,
399
- 2
400
- ],
401
- [
402
- 1,
403
- 0
404
- ],
405
- [
406
- 1,
407
- 1
408
- ],
409
- [
410
- 1,
411
- 2
412
- ],
413
- [
414
- 2,
415
- 0
416
- ],
417
- [
418
- 2,
419
- 1
420
- ],
421
- [
422
- 2,
423
- 2
424
- ],
425
- [
426
- 3,
427
- 0
428
- ],
429
- [
430
- 3,
431
- 1
432
- ],
433
- [
434
- 3,
435
- 2
436
- ],
437
- [
438
- 4,
439
- 0
440
- ],
441
- [
442
- 4,
443
- 1
444
- ],
445
- [
446
- 4,
447
- 2
448
- ]
391
+ id: '2bd1e2b0fed',
392
+ offsets: [
393
+ [0, 0],
394
+ [0, 1],
395
+ [0, 2],
396
+ [1, 0],
397
+ [1, 1],
398
+ [1, 2],
399
+ [2, 0],
400
+ [2, 1],
401
+ [2, 2],
402
+ [3, 0],
403
+ [3, 1],
404
+ [3, 2],
405
+ [4, 0],
406
+ [4, 1],
407
+ [4, 2],
449
408
  ],
450
409
  content: '这是表格标注',
451
410
  color: '#FFEB3B',
@@ -456,7 +415,9 @@ export default function StreamPreview() {
456
415
  const [isVisible, setIsVisible] = useState(false);
457
416
 
458
417
  // 可配置的参数
459
- const [fileType, setFileType] = useState<'pdf'|'pdf_slides' | 'markdown' | 'markdown_table' | 'image' | 'html' | 'text'>('pdf');
418
+ const [fileType, setFileType] = useState<
419
+ 'pdf' | 'pdf_slides' | 'markdown' | 'markdown_table' | 'image' | 'html' | 'text'
420
+ >('pdf');
460
421
 
461
422
  // 统一的标注状态
462
423
  const [annotations, setAnnotations] = useState<(Annotation | MDAnnotation | TableAnnotation)[]>([
@@ -472,17 +433,15 @@ export default function StreamPreview() {
472
433
  const [convertedFilePath, setConvertedFilePath] = useState(
473
434
  'http://10.15.12.13:9000/dev-rag-data/合肥晶合演示JBB/一般_山地自行车的组装1.pdf/V0/一般_山地自行车的组装1.pdf'
474
435
  );
475
- const [fileName, setFileName] = useState('VR设备专题:Pancake迎来渗透加速,产业链受益硬件升级2023-02-02行业研报.pdf');
436
+ const [fileName, setFileName] = useState(
437
+ 'VR设备专题:Pancake迎来渗透加速,产业链受益硬件升级2023-02-02行业研报.pdf'
438
+ );
476
439
  const [totalPages, setTotalPages] = useState(29); // 根据响应头更新为实际总页数
477
440
  const [initialPage, setInitialPage] = useState(1);
478
441
  const [pageO, setPageO] = useState(1);
479
- const [initialZoom, setInitialZoom] = useState(1.5);
480
- const [authorization, setAuthorization] = useState(
481
- rag_dev_server.token
482
- );
483
- const [streamApiUrl, setStreamApiUrl] = useState(
484
- '/proxy/index/knowledgeBase/file/stream'
485
- );
442
+ const [initialZoom, setInitialZoom] = useState(1.5);
443
+ const [authorization, setAuthorization] = useState(rag_dev_server.token);
444
+ const [streamApiUrl, setStreamApiUrl] = useState('/proxy/index/knowledgeBase/file/stream');
486
445
  const [pageSize, setPageSize] = useState(5); // 修改为5,与网络请求一致
487
446
 
488
447
  const handleEventsEmit = (name: string, data?: any, innerFn?: any) => {
@@ -535,15 +494,15 @@ const [initialZoom, setInitialZoom] = useState(1.5);
535
494
  ? 'Markdown'
536
495
  : fileType === 'pdf_slides'
537
496
  ? 'PDF幻灯片'
538
- : fileType === 'markdown_table'
539
- ? 'Markdown表格'
540
- : fileType === 'html'
541
- ? 'HTML'
542
- : fileType === 'image'
543
- ? '图片'
544
- : fileType === 'text'
545
- ? '文本'
546
- : 'PDF'}{' '}
497
+ : fileType === 'markdown_table'
498
+ ? 'Markdown表格'
499
+ : fileType === 'html'
500
+ ? 'HTML'
501
+ : fileType === 'image'
502
+ ? '图片'
503
+ : fileType === 'text'
504
+ ? '文本'
505
+ : 'PDF'}{' '}
547
506
  模式
548
507
  </h1>
549
508
 
@@ -567,7 +526,14 @@ const [initialZoom, setInitialZoom] = useState(1.5);
567
526
  <select
568
527
  value={fileType}
569
528
  onChange={e => {
570
- const newFileType = e.target.value as 'pdf' | 'pdf_slides' | 'markdown' | 'markdown_table' | 'image' | 'html' | 'text';
529
+ const newFileType = e.target.value as
530
+ | 'pdf'
531
+ | 'pdf_slides'
532
+ | 'markdown'
533
+ | 'markdown_table'
534
+ | 'image'
535
+ | 'html'
536
+ | 'text';
571
537
  setFileType(newFileType);
572
538
  }}
573
539
  style={{
@@ -625,9 +591,13 @@ const [initialZoom, setInitialZoom] = useState(1.5);
625
591
 
626
592
  <div>
627
593
  <label style={{ display: 'block', marginBottom: '5px', fontWeight: 'bold' }}>
628
- {fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'
629
- ? '总块数 (totalPages) - 仅用于显示:'
630
- : '总页数 (totalPages):'}
594
+ {fileType === 'markdown' ||
595
+ fileType === 'markdown_table' ||
596
+ fileType === 'image' ||
597
+ fileType === 'html' ||
598
+ fileType === 'text'
599
+ ? '总块数 (totalPages) - 仅用于显示:'
600
+ : '总页数 (totalPages):'}
631
601
  </label>
632
602
  <input
633
603
  type="number"
@@ -641,19 +611,33 @@ const [initialZoom, setInitialZoom] = useState(1.5);
641
611
  borderRadius: '4px',
642
612
  }}
643
613
  placeholder={
644
- fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'
614
+ fileType === 'markdown' ||
615
+ fileType === 'markdown_table' ||
616
+ fileType === 'image' ||
617
+ fileType === 'html' ||
618
+ fileType === 'text'
645
619
  ? '仅用于显示'
646
620
  : '输入总页数'
647
621
  }
648
- disabled={fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'}
622
+ disabled={
623
+ fileType === 'markdown' ||
624
+ fileType === 'markdown_table' ||
625
+ fileType === 'image' ||
626
+ fileType === 'html' ||
627
+ fileType === 'text'
628
+ }
649
629
  />
650
630
  </div>
651
631
 
652
632
  <div>
653
633
  <label style={{ display: 'block', marginBottom: '5px', fontWeight: 'bold' }}>
654
- {fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'
655
- ? '初始块 (initialPage) - 仅用于显示:'
656
- : '初始页面 (initialPage):'}
634
+ {fileType === 'markdown' ||
635
+ fileType === 'markdown_table' ||
636
+ fileType === 'image' ||
637
+ fileType === 'html' ||
638
+ fileType === 'text'
639
+ ? '初始块 (initialPage) - 仅用于显示:'
640
+ : '初始页面 (initialPage):'}
657
641
  </label>
658
642
  <input
659
643
  type="number"
@@ -667,11 +651,21 @@ const [initialZoom, setInitialZoom] = useState(1.5);
667
651
  borderRadius: '4px',
668
652
  }}
669
653
  placeholder={
670
- fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'
654
+ fileType === 'markdown' ||
655
+ fileType === 'markdown_table' ||
656
+ fileType === 'image' ||
657
+ fileType === 'html' ||
658
+ fileType === 'text'
671
659
  ? '仅用于显示'
672
660
  : '输入初始页面号'
673
661
  }
674
- disabled={fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'}
662
+ disabled={
663
+ fileType === 'markdown' ||
664
+ fileType === 'markdown_table' ||
665
+ fileType === 'image' ||
666
+ fileType === 'html' ||
667
+ fileType === 'text'
668
+ }
675
669
  />
676
670
  </div>
677
671
 
@@ -713,7 +707,11 @@ const [initialZoom, setInitialZoom] = useState(1.5);
713
707
 
714
708
  <div>
715
709
  <label style={{ display: 'block', marginBottom: '5px', fontWeight: 'bold' }}>
716
- {fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'
710
+ {fileType === 'markdown' ||
711
+ fileType === 'markdown_table' ||
712
+ fileType === 'image' ||
713
+ fileType === 'html' ||
714
+ fileType === 'text'
717
715
  ? '页面大小 (pageSize) - 仅PDF使用:'
718
716
  : '页面大小 (pageSize):'}
719
717
  </label>
@@ -729,11 +727,21 @@ const [initialZoom, setInitialZoom] = useState(1.5);
729
727
  borderRadius: '4px',
730
728
  }}
731
729
  placeholder={
732
- fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'
730
+ fileType === 'markdown' ||
731
+ fileType === 'markdown_table' ||
732
+ fileType === 'image' ||
733
+ fileType === 'html' ||
734
+ fileType === 'text'
733
735
  ? '仅PDF使用'
734
736
  : '输入页面大小'
735
737
  }
736
- disabled={fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'}
738
+ disabled={
739
+ fileType === 'markdown' ||
740
+ fileType === 'markdown_table' ||
741
+ fileType === 'image' ||
742
+ fileType === 'html' ||
743
+ fileType === 'text'
744
+ }
737
745
  />
738
746
  </div>
739
747
 
@@ -813,7 +821,8 @@ const [initialZoom, setInitialZoom] = useState(1.5);
813
821
  ? 'Markdown表格'
814
822
  : fileType === 'html'
815
823
  ? 'HTML'
816
- : 'Markdown'}推荐配置:
824
+ : 'Markdown'}
825
+ 推荐配置:
817
826
  </strong>
818
827
  <br />
819
828
  文件路径:
@@ -823,11 +832,13 @@ const [initialZoom, setInitialZoom] = useState(1.5);
823
832
  <br />
824
833
  总块数: 10 (仅用于显示,实际获取完整文件)
825
834
  <br />
826
- 注意: {fileType === 'markdown_table'
835
+ 注意:{' '}
836
+ {fileType === 'markdown_table'
827
837
  ? 'Markdown表格'
828
838
  : fileType === 'html'
829
839
  ? 'HTML'
830
- : 'Markdown'}文件会获取完整内容,不支持分块加载
840
+ : 'Markdown'}
841
+ 文件会获取完整内容,不支持分块加载
831
842
  </p>
832
843
  </div>
833
844
  )}
@@ -844,7 +855,8 @@ const [initialZoom, setInitialZoom] = useState(1.5);
844
855
  <p style={{ margin: '0', fontSize: '14px' }}>
845
856
  <strong>图片推荐配置:</strong>
846
857
  <br />
847
- 文件路径: 例如 http://10.15.12.13:9000/dev-rag-data/demo/示例图片.png/V0/示例图片.png
858
+ 文件路径: 例如
859
+ http://10.15.12.13:9000/dev-rag-data/demo/示例图片.png/V0/示例图片.png
848
860
  <br />
849
861
  图片将以相同的接口请求方式获取(POST convertedFilePath),支持缩放与旋转
850
862
  </p>
@@ -883,7 +895,8 @@ const [initialZoom, setInitialZoom] = useState(1.5);
883
895
  <p style={{ margin: '0', fontSize: '14px' }}>
884
896
  <strong>文本文件推荐配置:</strong>
885
897
  <br />
886
- 文件路径: 例如 http://10.15.12.13:9000/dev-rag-data/测试南自/测试文档.txt/V0/测试文档.txt
898
+ 文件路径: 例如
899
+ http://10.15.12.13:9000/dev-rag-data/测试南自/测试文档.txt/V0/测试文档.txt
887
900
  <br />
888
901
  文本文件会获取完整内容,支持缩放,不支持分页
889
902
  </p>
@@ -912,14 +925,13 @@ const [initialZoom, setInitialZoom] = useState(1.5);
912
925
  ? [] // HTML不需要标注
913
926
  : streamAnnotations
914
927
  }
915
-
916
928
  authorization={authorization}
917
929
  csrfToken={'csrfToken'}
918
930
  streamApiUrl={streamApiUrl}
919
931
  pageSize={fileType === 'pdf' ? pageSize : undefined} // 只有PDF模式才传递pageSize
920
932
  eventsEmit={handleEventsEmit}
921
933
  tools={{
922
- close: true
934
+ close: true,
923
935
  }}
924
936
  customComponents={{
925
937
  LoadingComponent: CustomLoadingComponent,
@@ -938,13 +950,29 @@ const [initialZoom, setInitialZoom] = useState(1.5);
938
950
  borderRadius: '4px',
939
951
  }}
940
952
  placeholder={
941
- fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'
953
+ fileType === 'markdown' ||
954
+ fileType === 'markdown_table' ||
955
+ fileType === 'image' ||
956
+ fileType === 'html' ||
957
+ fileType === 'text'
942
958
  ? '仅用于显示'
943
959
  : '输入初始页面号'
944
960
  }
945
- disabled={fileType === 'markdown' || fileType === 'markdown_table' || fileType === 'image' || fileType === 'html' || fileType === 'text'}
961
+ disabled={
962
+ fileType === 'markdown' ||
963
+ fileType === 'markdown_table' ||
964
+ fileType === 'image' ||
965
+ fileType === 'html' ||
966
+ fileType === 'text'
967
+ }
946
968
  />
947
- <button onClick={()=>{setInitialPage(pageO)}}>跳转</button>
969
+ <button
970
+ onClick={() => {
971
+ setInitialPage(pageO);
972
+ }}
973
+ >
974
+ 跳转
975
+ </button>
948
976
  </div>
949
977
  );
950
978
  }
@@ -1,20 +1,20 @@
1
- import React, { useState, useMemo, useEffect } from "react";
2
- import { ConfigProvider, Drawer } from "antd";
3
- import { CaretRightOutlined, CaretDownOutlined } from "@ant-design/icons";
4
- import { uid } from "uid";
1
+ import React, { useState, useMemo, useEffect } from 'react';
2
+ import { ConfigProvider, Drawer } from 'antd';
3
+ import { CaretRightOutlined, CaretDownOutlined } from '@ant-design/icons';
4
+ import { uid } from 'uid';
5
5
 
6
- import { WithPlate } from "./Editor/ChatViewEditor";
6
+ import { WithPlate } from './Editor/ChatViewEditor';
7
7
 
8
- import { FILEIMG } from "./FileList";
9
- import IconRobot from "../assets/icon-robot.svg";
10
- import IconSubTitle from "../assets/icon-sub-title.svg";
11
- import Genera from "../assets/genera.gif";
12
- import { dealMinioUrl, fileViewTypes } from "../utils.ts";
13
- import { StatusType } from "../type.ts";
14
- import "../style.less";
8
+ import { FILEIMG } from './FileList';
9
+ import IconRobot from '../assets/icon-robot.svg';
10
+ import IconSubTitle from '../assets/icon-sub-title.svg';
11
+ import Genera from '../assets/genera.gif';
12
+ import { dealMinioUrl, fileViewTypes } from '../utils.ts';
13
+ import { StatusType } from '../type.ts';
14
+ import '../style.less';
15
15
 
16
- import FileViewer, { registerPDFWorker } from "@mxmweb/file-viewer";
17
- registerPDFWorker("/worker/pdf.worker.min.js");
16
+ import FileViewer, { registerPDFWorker } from '@mxmweb/file-viewer';
17
+ // registerPDFWorker('/worker/pdf.worker.min.js');
18
18
 
19
19
  interface ResultContentProps {
20
20
  answer: any;
@@ -35,15 +35,13 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
35
35
  isHistoryHide,
36
36
  fileList,
37
37
  historyHideHandler,
38
- clearSelect
38
+ clearSelect,
39
39
  }) => {
40
40
  const [isShowFile, setIsShowFile] = useState<boolean>(false);
41
41
  const [isOpenAnswer, setIsOpenAnswer] = useState<boolean>(false);
42
42
  const curFile = useMemo(() => {
43
43
  const _item =
44
- selectFile && fileList.length
45
- ? fileList.find((f: any) => f.url === selectFile)
46
- : {};
44
+ selectFile && fileList.length ? fileList.find((f: any) => f.url === selectFile) : {};
47
45
  const { list, fileName, fileExtension, url } = _item;
48
46
  return fileName
49
47
  ? Object.assign({}, _item, {
@@ -52,24 +50,23 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
52
50
  fileName: fileName,
53
51
  file_source: url,
54
52
  fullWidth: true,
55
- pdfPages:
56
- list && list.length && list[0].pdfPages ? list[0].pdfPages : 0
53
+ pdfPages: list && list.length && list[0].pdfPages ? list[0].pdfPages : 0,
57
54
  })
58
55
  : {};
59
56
  }, [fileList, selectFile]);
60
57
 
61
58
  const fileName = useMemo(() => {
62
59
  if (!curFile) {
63
- return "";
60
+ return '';
64
61
  }
65
62
  if (curFile.fileName) return curFile.fileName;
66
63
  const source = curFile?.file_source;
67
64
  if (source) {
68
- const arr = source.split("/");
69
- if (!arr.length) return "";
65
+ const arr = source.split('/');
66
+ if (!arr.length) return '';
70
67
  return arr[arr.length - 1];
71
68
  } else {
72
- return "";
69
+ return '';
73
70
  }
74
71
  }, [curFile]);
75
72
 
@@ -85,7 +82,7 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
85
82
  const [total, setTotal] = useState(0);
86
83
  const [origin_paper_size, setOriginPaperSize] = useState({
87
84
  width: 1191,
88
- height: 1684
85
+ height: 1684,
89
86
  });
90
87
 
91
88
  const hideHistoryHandler = () => {
@@ -107,13 +104,13 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
107
104
  const item = list[0].metadata || {};
108
105
  const { page_size } = item;
109
106
  let _page_size = page_size as any;
110
- if (Object.prototype.toString.call(_page_size) === "[object String]") {
107
+ if (Object.prototype.toString.call(_page_size) === '[object String]') {
111
108
  _page_size = JSON.parse(_page_size);
112
109
  }
113
110
  if (_page_size && _page_size.length) {
114
111
  setOriginPaperSize({
115
112
  width: _page_size[0][0],
116
- height: _page_size[0][1]
113
+ height: _page_size[0][1],
117
114
  });
118
115
  }
119
116
  }
@@ -139,12 +136,8 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
139
136
  <img src={IconRobot} className="icon-robot" />
140
137
  <img src={IconSubTitle} className="icon-title" />
141
138
  </div>
142
- <div
143
- className={`${isOpenAnswer ? "open-btn" : "close-btn"} opener-btn`}
144
- >
145
- <span onClick={changeOpenSta}>
146
- {isOpenAnswer ? "收起" : "展开更多"}
147
- </span>
139
+ <div className={`${isOpenAnswer ? 'open-btn' : 'close-btn'} opener-btn`}>
140
+ <span onClick={changeOpenSta}>{isOpenAnswer ? '收起' : '展开更多'}</span>
148
141
  {isOpenAnswer ? <CaretDownOutlined /> : <CaretRightOutlined />}
149
142
  </div>
150
143
  {status === StatusType.Process ? (
@@ -155,9 +148,9 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
155
148
  ) : null}
156
149
  <div
157
150
  style={{
158
- height: isOpenAnswer ? "auto" : "96px",
159
- overflow: "hidden",
160
- minHeight: "90px"
151
+ height: isOpenAnswer ? 'auto' : '96px',
152
+ overflow: 'hidden',
153
+ minHeight: '90px',
161
154
  }}
162
155
  >
163
156
  <WithPlate
@@ -173,15 +166,15 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
173
166
  drawer={{
174
167
  styles: {
175
168
  body: { padding: 0 },
176
- header: { display: "none" }
177
- }
169
+ header: { display: 'none' },
170
+ },
178
171
  }}
179
172
  >
180
173
  <Drawer
181
174
  title={
182
175
  <div className="file-title-wrap select-none">
183
176
  <img
184
- src={FILEIMG[curFile.fileExtension] || FILEIMG["doc"]}
177
+ src={FILEIMG[curFile.fileExtension] || FILEIMG['doc']}
185
178
  width={16}
186
179
  height={16}
187
180
  className="absolute -left-2 top-[3px]"
@@ -198,7 +191,7 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
198
191
  size="large"
199
192
  // width="50%"
200
193
  styles={{
201
- body: { padding: "8px" }
194
+ body: { padding: '8px' },
202
195
  }}
203
196
  footer={null}
204
197
  >
@@ -207,8 +200,7 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
207
200
  <FileViewer
208
201
  fileName={fileName}
209
202
  content={
210
- !curFile?.fileSuffix ||
211
- fileViewTypes.includes(curFile.fileSuffix)
203
+ !curFile?.fileSuffix || fileViewTypes.includes(curFile.fileSuffix)
212
204
  ? dealMinioUrl(curFile?.url)
213
205
  : (dealMinioUrl(curFile?.url) as any)
214
206
  }
@@ -216,7 +208,7 @@ const ResultContentNew: React.FC<ResultContentProps> = ({
216
208
  tools={{
217
209
  annotation: false,
218
210
  download: false,
219
- close: true
211
+ close: true,
220
212
  }}
221
213
  headerClass="bg-white"
222
214
  contentClass="bg-gray-50 p-[12px] md:p-[12px]"
package/vite.config.ts CHANGED
@@ -60,10 +60,10 @@ export default ({ mode }: { mode: string }) => {
60
60
  : {
61
61
  react: '>=18',
62
62
  'react-dom': '>=18',
63
- '@mxmweb/fviewer': '^1.5.1',
64
- '@mxmweb/rtext': '^1.1.53',
63
+ '@mxmweb/fviewer': '^1.5.2',
64
+ '@mxmweb/rtext': '^1.2.1',
65
65
  '@mxmweb/zui': '^1.3.9',
66
- '@mxmweb/aichat': '^1.8.0',
66
+ '@mxmweb/aichat': '^1.9.0',
67
67
  '@mxmweb/xviewer': '^1.1.42',
68
68
  antd: '^5.18.0',
69
69
  axios: '^1.7.2',
@@ -147,26 +147,21 @@ export default ({ mode }: { mode: string }) => {
147
147
  outDir: 'dist',
148
148
  rollupOptions: {
149
149
  preserveEntrySignatures: 'strict',
150
- external: inline
151
- ? [
152
- 'react',
153
- 'react-dom',
154
- 'react/jsx-runtime',
155
- 'react/jsx-dev-runtime',
156
- ]
157
- : [
158
- 'react',
159
- 'react-dom',
160
- 'react/jsx-runtime',
161
- 'react/jsx-dev-runtime',
162
- 'antd',
163
- 'axios',
164
- '@mxmweb/xviewer',
165
- '@mxmweb/fviewer',
166
- '@mxmweb/rtext',
167
- '@mxmweb/zui',
168
- '@mxmweb/aichat',
169
- ],
150
+ external: inline
151
+ ? ['react', 'react-dom', 'react/jsx-runtime', 'react/jsx-dev-runtime']
152
+ : [
153
+ 'react',
154
+ 'react-dom',
155
+ 'react/jsx-runtime',
156
+ 'react/jsx-dev-runtime',
157
+ 'antd',
158
+ 'axios',
159
+ '@mxmweb/xviewer',
160
+ '@mxmweb/fviewer',
161
+ '@mxmweb/rtext',
162
+ '@mxmweb/zui',
163
+ '@mxmweb/aichat',
164
+ ],
170
165
  input: {
171
166
  index: path.resolve(__dirname, 'src/lib_enter.ts'),
172
167
  chat: path.resolve(__dirname, 'src/modules/chat/index.tsx'),