balibabu commited on
Commit
6aa5abc
·
1 Parent(s): 023bf92

fix: thumbnails are too large in the chat box #818 (#819)

Browse files

### What problem does this PR solve?

fix: thumbnails are too large in the chat box #818

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

web/src/components/chunk-method-modal/index.tsx CHANGED
@@ -15,7 +15,6 @@ import {
15
  Modal,
16
  Select,
17
  Space,
18
- Switch,
19
  Tooltip,
20
  } from 'antd';
21
  import omit from 'lodash/omit';
@@ -23,6 +22,7 @@ import React, { useEffect, useMemo } from 'react';
23
  import { useFetchParserListOnMount } from './hooks';
24
 
25
  import { useTranslate } from '@/hooks/commonHooks';
 
26
  import styles from './index.less';
27
 
28
  interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
@@ -228,17 +228,7 @@ const ChunkMethodModal: React.FC<IProps> = ({
228
  </Form.List>
229
  </>
230
  )}
231
- {showOne && (
232
- <Form.Item
233
- name={['parser_config', 'layout_recognize']}
234
- label={t('layoutRecognize')}
235
- initialValue={true}
236
- valuePropName="checked"
237
- tooltip={t('layoutRecognizeTip')}
238
- >
239
- <Switch />
240
- </Form.Item>
241
- )}
242
  {showPages && (
243
  <Form.Item
244
  noStyle
 
15
  Modal,
16
  Select,
17
  Space,
 
18
  Tooltip,
19
  } from 'antd';
20
  import omit from 'lodash/omit';
 
22
  import { useFetchParserListOnMount } from './hooks';
23
 
24
  import { useTranslate } from '@/hooks/commonHooks';
25
+ import LayoutRecognize from '../layout-recognize';
26
  import styles from './index.less';
27
 
28
  interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
 
228
  </Form.List>
229
  </>
230
  )}
231
+ {showOne && <LayoutRecognize></LayoutRecognize>}
 
 
 
 
 
 
 
 
 
 
232
  {showPages && (
233
  <Form.Item
234
  noStyle
web/src/components/layout-recognize.tsx ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { useTranslate } from '@/hooks/commonHooks';
2
+ import { Form, Switch } from 'antd';
3
+
4
+ const LayoutRecognize = () => {
5
+ const { t } = useTranslate('knowledgeDetails');
6
+ return (
7
+ <Form.Item
8
+ name={['parser_config', 'layout_recognize']}
9
+ label={t('layoutRecognize')}
10
+ initialValue={true}
11
+ valuePropName="checked"
12
+ tooltip={t('layoutRecognizeTip')}
13
+ >
14
+ <Switch />
15
+ </Form.Item>
16
+ );
17
+ };
18
+
19
+ export default LayoutRecognize;
web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx CHANGED
@@ -6,6 +6,7 @@ import {
6
  useSubmitKnowledgeConfiguration,
7
  } from './hooks';
8
 
 
9
  import MaxTokenNumber from '@/components/max-token-number';
10
  import { useTranslate } from '@/hooks/commonHooks';
11
  import { FormInstance } from 'antd/lib';
@@ -99,11 +100,17 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
99
  const parserId = getFieldValue('parser_id');
100
 
101
  if (parserId === 'naive') {
102
- return <MaxTokenNumber></MaxTokenNumber>;
 
 
 
 
 
103
  }
104
  return null;
105
  }}
106
  </Form.Item>
 
107
  <Form.Item>
108
  <div className={styles.buttonWrapper}>
109
  <Space>
 
6
  useSubmitKnowledgeConfiguration,
7
  } from './hooks';
8
 
9
+ import LayoutRecognize from '@/components/layout-recognize';
10
  import MaxTokenNumber from '@/components/max-token-number';
11
  import { useTranslate } from '@/hooks/commonHooks';
12
  import { FormInstance } from 'antd/lib';
 
100
  const parserId = getFieldValue('parser_id');
101
 
102
  if (parserId === 'naive') {
103
+ return (
104
+ <>
105
+ <MaxTokenNumber></MaxTokenNumber>
106
+ <LayoutRecognize></LayoutRecognize>
107
+ </>
108
+ );
109
  }
110
  return null;
111
  }}
112
  </Form.Item>
113
+
114
  <Form.Item>
115
  <div className={styles.buttonWrapper}>
116
  <Space>
web/src/pages/chat/chat-container/index.less CHANGED
@@ -36,6 +36,9 @@
36
  // .referenceIcon {
37
  // padding: 0 6px;
38
  // }
 
 
 
39
  }
40
 
41
  .messageItemLeft {
 
36
  // .referenceIcon {
37
  // padding: 0 6px;
38
  // }
39
+ .thumbnailImg {
40
+ max-width: 20px;
41
+ }
42
  }
43
 
44
  .messageItemLeft {
web/src/pages/chat/chat-container/index.tsx CHANGED
@@ -105,7 +105,10 @@ const MessageItem = ({
105
  <List.Item>
106
  <Flex gap={'small'} align="center">
107
  {fileThumbnail ? (
108
- <img src={fileThumbnail}></img>
 
 
 
109
  ) : (
110
  <SvgIcon
111
  name={`file-icon/${fileExtension}`}
 
105
  <List.Item>
106
  <Flex gap={'small'} align="center">
107
  {fileThumbnail ? (
108
+ <img
109
+ src={fileThumbnail}
110
+ className={styles.thumbnailImg}
111
+ ></img>
112
  ) : (
113
  <SvgIcon
114
  name={`file-icon/${fileExtension}`}
web/src/pages/chat/share/index.less CHANGED
@@ -39,6 +39,9 @@
39
  .messageEmpty {
40
  width: 300px;
41
  }
 
 
 
42
  }
43
 
44
  .messageItemLeft {
 
39
  .messageEmpty {
40
  width: 300px;
41
  }
42
+ .thumbnailImg {
43
+ max-width: 20px;
44
+ }
45
  }
46
 
47
  .messageItemLeft {
web/src/pages/chat/share/large.tsx CHANGED
@@ -94,7 +94,10 @@ const MessageItem = ({
94
  <List.Item>
95
  <Flex gap={'small'} align="center">
96
  {fileThumbnail ? (
97
- <img src={fileThumbnail}></img>
 
 
 
98
  ) : (
99
  <SvgIcon
100
  name={`file-icon/${fileExtension}`}
 
94
  <List.Item>
95
  <Flex gap={'small'} align="center">
96
  {fileThumbnail ? (
97
+ <img
98
+ src={fileThumbnail}
99
+ className={styles.thumbnailImg}
100
+ ></img>
101
  ) : (
102
  <SvgIcon
103
  name={`file-icon/${fileExtension}`}