Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions web/src/components/chunk-method-modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ import {
Modal,
Select,
Space,
Switch,
Tooltip,
} from 'antd';
import omit from 'lodash/omit';
import React, { useEffect, useMemo } from 'react';
import { useFetchParserListOnMount } from './hooks';

import { useTranslate } from '@/hooks/commonHooks';
import LayoutRecognize from '../layout-recognize';
import styles from './index.less';

interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
Expand Down Expand Up @@ -228,17 +228,7 @@ const ChunkMethodModal: React.FC<IProps> = ({
</Form.List>
</>
)}
{showOne && (
<Form.Item
name={['parser_config', 'layout_recognize']}
label={t('layoutRecognize')}
initialValue={true}
valuePropName="checked"
tooltip={t('layoutRecognizeTip')}
>
<Switch />
</Form.Item>
)}
{showOne && <LayoutRecognize></LayoutRecognize>}
{showPages && (
<Form.Item
noStyle
Expand Down
19 changes: 19 additions & 0 deletions web/src/components/layout-recognize.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { useTranslate } from '@/hooks/commonHooks';
import { Form, Switch } from 'antd';

const LayoutRecognize = () => {
const { t } = useTranslate('knowledgeDetails');
return (
<Form.Item
name={['parser_config', 'layout_recognize']}
label={t('layoutRecognize')}
initialValue={true}
valuePropName="checked"
tooltip={t('layoutRecognizeTip')}
>
<Switch />
</Form.Item>
);
};

export default LayoutRecognize;
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
useSubmitKnowledgeConfiguration,
} from './hooks';

import LayoutRecognize from '@/components/layout-recognize';
import MaxTokenNumber from '@/components/max-token-number';
import { useTranslate } from '@/hooks/commonHooks';
import { FormInstance } from 'antd/lib';
Expand Down Expand Up @@ -99,11 +100,17 @@ const ConfigurationForm = ({ form }: { form: FormInstance }) => {
const parserId = getFieldValue('parser_id');

if (parserId === 'naive') {
return <MaxTokenNumber></MaxTokenNumber>;
return (
<>
<MaxTokenNumber></MaxTokenNumber>
<LayoutRecognize></LayoutRecognize>
</>
);
}
return null;
}}
</Form.Item>

<Form.Item>
<div className={styles.buttonWrapper}>
<Space>
Expand Down
3 changes: 3 additions & 0 deletions web/src/pages/chat/chat-container/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
// .referenceIcon {
// padding: 0 6px;
// }
.thumbnailImg {
max-width: 20px;
}
}

.messageItemLeft {
Expand Down
5 changes: 4 additions & 1 deletion web/src/pages/chat/chat-container/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ const MessageItem = ({
<List.Item>
<Flex gap={'small'} align="center">
{fileThumbnail ? (
<img src={fileThumbnail}></img>
<img
src={fileThumbnail}
className={styles.thumbnailImg}
></img>
) : (
<SvgIcon
name={`file-icon/${fileExtension}`}
Expand Down
3 changes: 3 additions & 0 deletions web/src/pages/chat/share/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
.messageEmpty {
width: 300px;
}
.thumbnailImg {
max-width: 20px;
}
}

.messageItemLeft {
Expand Down
5 changes: 4 additions & 1 deletion web/src/pages/chat/share/large.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,10 @@ const MessageItem = ({
<List.Item>
<Flex gap={'small'} align="center">
{fileThumbnail ? (
<img src={fileThumbnail}></img>
<img
src={fileThumbnail}
className={styles.thumbnailImg}
></img>
) : (
<SvgIcon
name={`file-icon/${fileExtension}`}
Expand Down