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

feat: remove loading from document table and fixed the issue where gif images could not be uploaded on the configuration page #122

Merged
merged 2 commits into from
Mar 14, 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
18 changes: 9 additions & 9 deletions web/src/pages/add-knowledge/components/knowledge-file/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@ const KnowledgeFile = () => {
return parserList.find((x) => x.value === text)?.label;
},
},
{
title: 'Parsing Status',
dataIndex: 'run',
key: 'run',
render: (text, record) => {
return <ParsingStatusCell record={record}></ParsingStatusCell>;
},
},
{
title: 'Enabled',
key: 'status',
Expand All @@ -250,6 +242,14 @@ const KnowledgeFile = () => {
</>
),
},
{
title: 'Parsing Status',
dataIndex: 'run',
key: 'run',
render: (text, record) => {
return <ParsingStatusCell record={record}></ParsingStatusCell>;
},
},
{
title: 'Action',
key: 'action',
Expand Down Expand Up @@ -301,7 +301,7 @@ const KnowledgeFile = () => {
rowKey="id"
columns={finalColumns}
dataSource={data}
loading={loading}
// loading={loading}
pagination={pagination}
scroll={{ scrollToFirstRowOnChange: true, x: 1300, y: 'fill' }}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const Configuration = () => {
const embeddingModelOptions = useSelectLlmOptions();

const onFinish = async (values: any) => {
const avatar = getBase64FromUploadFileList(values.avatar);
const avatar = await getBase64FromUploadFileList(values.avatar);
dispatch({
type: 'kSModel/updateKb',
payload: {
Expand Down Expand Up @@ -123,6 +123,7 @@ const Configuration = () => {
<Upload
listType="picture-card"
maxCount={1}
beforeUpload={() => false}
showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
>
<button style={{ border: 0, background: 'none' }} type="button">
Expand Down Expand Up @@ -184,7 +185,7 @@ const Configuration = () => {
{({ getFieldValue }) => {
const parserId = getFieldValue('parser_id');

if (parserId === 'general') {
if (parserId === 'naive') {
return (
<Form.Item label="Chunk token number" tooltip="xxx">
<Flex gap={20} align="center">
Expand Down
10 changes: 2 additions & 8 deletions web/src/pages/chat/chat-configuration-modal/model-setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,12 @@ const ModelSetting = ({ show, form }: ISegmentedContentProps) => {
value: x,
}));

const parameters: ModelVariableType = Form.useWatch('parameters', form);

const modelOptions = useSelectLlmOptions();

const handleParametersChange = (value: ModelVariableType) => {
console.info(value);
};

useEffect(() => {
const variable = settledModelVariableMap[parameters];
const variable = settledModelVariableMap[value];
form.setFieldsValue({ llm_setting: variable });
}, [parameters, form]);
};

useEffect(() => {
const values = Object.keys(variableEnabledFieldMap).reduce<
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/chat/chat-container/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
.messageText {
padding: 0 14px;
background-color: rgba(249, 250, 251, 1);
word-break: break-all;
}
.messageEmpty {
width: 300px;
Expand Down
8 changes: 6 additions & 2 deletions web/src/pages/user-setting/setting-profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ const UserSettingProfile = () => {
const loading = useGetUserInfoLoading();
const { form, submittable } = useValidateSubmittable();

const onFinish = (values: any) => {
const avatar = getBase64FromUploadFileList(values.avatar);
const onFinish = async (values: any) => {
const avatar = await getBase64FromUploadFileList(values.avatar);
saveSetting({ ...values, avatar });
};

Expand Down Expand Up @@ -112,6 +112,10 @@ const UserSettingProfile = () => {
<Upload
listType="picture-card"
maxCount={1}
accept="image/*"
beforeUpload={() => {
return false;
}}
showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
>
<button style={{ border: 0, background: 'none' }} type="button">
Expand Down
6 changes: 4 additions & 2 deletions web/src/utils/fileUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ export const getUploadFileListFromBase64 = (avatar: string) => {
return fileList;
};

export const getBase64FromUploadFileList = (fileList?: UploadFile[]) => {
export const getBase64FromUploadFileList = async (fileList?: UploadFile[]) => {
if (Array.isArray(fileList) && fileList.length > 0) {
return fileList[0].thumbUrl;
const base64 = await transformFile2Base64(fileList[0].originFileObj);
return base64;
// return fileList[0].thumbUrl; TODO: Even JPG files will be converted to base64 parameters in png format
}

return '';
Expand Down