balibabu commited on
Commit
f1ced48
·
1 Parent(s): 7e26e0d

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

Browse files

* feat: fixed the issue where gif images could not be uploaded on the configuration page

* feat: remove loading from document table

web/src/pages/add-knowledge/components/knowledge-file/index.tsx CHANGED
@@ -227,14 +227,6 @@ const KnowledgeFile = () => {
227
  return parserList.find((x) => x.value === text)?.label;
228
  },
229
  },
230
- {
231
- title: 'Parsing Status',
232
- dataIndex: 'run',
233
- key: 'run',
234
- render: (text, record) => {
235
- return <ParsingStatusCell record={record}></ParsingStatusCell>;
236
- },
237
- },
238
  {
239
  title: 'Enabled',
240
  key: 'status',
@@ -250,6 +242,14 @@ const KnowledgeFile = () => {
250
  </>
251
  ),
252
  },
 
 
 
 
 
 
 
 
253
  {
254
  title: 'Action',
255
  key: 'action',
@@ -301,7 +301,7 @@ const KnowledgeFile = () => {
301
  rowKey="id"
302
  columns={finalColumns}
303
  dataSource={data}
304
- loading={loading}
305
  pagination={pagination}
306
  scroll={{ scrollToFirstRowOnChange: true, x: 1300, y: 'fill' }}
307
  />
 
227
  return parserList.find((x) => x.value === text)?.label;
228
  },
229
  },
 
 
 
 
 
 
 
 
230
  {
231
  title: 'Enabled',
232
  key: 'status',
 
242
  </>
243
  ),
244
  },
245
+ {
246
+ title: 'Parsing Status',
247
+ dataIndex: 'run',
248
+ key: 'run',
249
+ render: (text, record) => {
250
+ return <ParsingStatusCell record={record}></ParsingStatusCell>;
251
+ },
252
+ },
253
  {
254
  title: 'Action',
255
  key: 'action',
 
301
  rowKey="id"
302
  columns={finalColumns}
303
  dataSource={data}
304
+ // loading={loading}
305
  pagination={pagination}
306
  scroll={{ scrollToFirstRowOnChange: true, x: 1300, y: 'fill' }}
307
  />
web/src/pages/add-knowledge/components/knowledge-setting/configuration.tsx CHANGED
@@ -55,7 +55,7 @@ const Configuration = () => {
55
  const embeddingModelOptions = useSelectLlmOptions();
56
 
57
  const onFinish = async (values: any) => {
58
- const avatar = getBase64FromUploadFileList(values.avatar);
59
  dispatch({
60
  type: 'kSModel/updateKb',
61
  payload: {
@@ -123,6 +123,7 @@ const Configuration = () => {
123
  <Upload
124
  listType="picture-card"
125
  maxCount={1}
 
126
  showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
127
  >
128
  <button style={{ border: 0, background: 'none' }} type="button">
@@ -184,7 +185,7 @@ const Configuration = () => {
184
  {({ getFieldValue }) => {
185
  const parserId = getFieldValue('parser_id');
186
 
187
- if (parserId === 'general') {
188
  return (
189
  <Form.Item label="Chunk token number" tooltip="xxx">
190
  <Flex gap={20} align="center">
 
55
  const embeddingModelOptions = useSelectLlmOptions();
56
 
57
  const onFinish = async (values: any) => {
58
+ const avatar = await getBase64FromUploadFileList(values.avatar);
59
  dispatch({
60
  type: 'kSModel/updateKb',
61
  payload: {
 
123
  <Upload
124
  listType="picture-card"
125
  maxCount={1}
126
+ beforeUpload={() => false}
127
  showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
128
  >
129
  <button style={{ border: 0, background: 'none' }} type="button">
 
185
  {({ getFieldValue }) => {
186
  const parserId = getFieldValue('parser_id');
187
 
188
+ if (parserId === 'naive') {
189
  return (
190
  <Form.Item label="Chunk token number" tooltip="xxx">
191
  <Flex gap={20} align="center">
web/src/pages/chat/chat-configuration-modal/model-setting.tsx CHANGED
@@ -18,18 +18,12 @@ const ModelSetting = ({ show, form }: ISegmentedContentProps) => {
18
  value: x,
19
  }));
20
 
21
- const parameters: ModelVariableType = Form.useWatch('parameters', form);
22
-
23
  const modelOptions = useSelectLlmOptions();
24
 
25
  const handleParametersChange = (value: ModelVariableType) => {
26
- console.info(value);
27
- };
28
-
29
- useEffect(() => {
30
- const variable = settledModelVariableMap[parameters];
31
  form.setFieldsValue({ llm_setting: variable });
32
- }, [parameters, form]);
33
 
34
  useEffect(() => {
35
  const values = Object.keys(variableEnabledFieldMap).reduce<
 
18
  value: x,
19
  }));
20
 
 
 
21
  const modelOptions = useSelectLlmOptions();
22
 
23
  const handleParametersChange = (value: ModelVariableType) => {
24
+ const variable = settledModelVariableMap[value];
 
 
 
 
25
  form.setFieldsValue({ llm_setting: variable });
26
+ };
27
 
28
  useEffect(() => {
29
  const values = Object.keys(variableEnabledFieldMap).reduce<
web/src/pages/chat/chat-container/index.less CHANGED
@@ -27,6 +27,7 @@
27
  .messageText {
28
  padding: 0 14px;
29
  background-color: rgba(249, 250, 251, 1);
 
30
  }
31
  .messageEmpty {
32
  width: 300px;
 
27
  .messageText {
28
  padding: 0 14px;
29
  background-color: rgba(249, 250, 251, 1);
30
+ word-break: break-all;
31
  }
32
  .messageEmpty {
33
  width: 300px;
web/src/pages/user-setting/setting-profile/index.tsx CHANGED
@@ -45,8 +45,8 @@ const UserSettingProfile = () => {
45
  const loading = useGetUserInfoLoading();
46
  const { form, submittable } = useValidateSubmittable();
47
 
48
- const onFinish = (values: any) => {
49
- const avatar = getBase64FromUploadFileList(values.avatar);
50
  saveSetting({ ...values, avatar });
51
  };
52
 
@@ -112,6 +112,10 @@ const UserSettingProfile = () => {
112
  <Upload
113
  listType="picture-card"
114
  maxCount={1}
 
 
 
 
115
  showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
116
  >
117
  <button style={{ border: 0, background: 'none' }} type="button">
 
45
  const loading = useGetUserInfoLoading();
46
  const { form, submittable } = useValidateSubmittable();
47
 
48
+ const onFinish = async (values: any) => {
49
+ const avatar = await getBase64FromUploadFileList(values.avatar);
50
  saveSetting({ ...values, avatar });
51
  };
52
 
 
112
  <Upload
113
  listType="picture-card"
114
  maxCount={1}
115
+ accept="image/*"
116
+ beforeUpload={() => {
117
+ return false;
118
+ }}
119
  showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
120
  >
121
  <button style={{ border: 0, background: 'none' }} type="button">
web/src/utils/fileUtil.ts CHANGED
@@ -46,9 +46,11 @@ export const getUploadFileListFromBase64 = (avatar: string) => {
46
  return fileList;
47
  };
48
 
49
- export const getBase64FromUploadFileList = (fileList?: UploadFile[]) => {
50
  if (Array.isArray(fileList) && fileList.length > 0) {
51
- return fileList[0].thumbUrl;
 
 
52
  }
53
 
54
  return '';
 
46
  return fileList;
47
  };
48
 
49
+ export const getBase64FromUploadFileList = async (fileList?: UploadFile[]) => {
50
  if (Array.isArray(fileList) && fileList.length > 0) {
51
+ const base64 = await transformFile2Base64(fileList[0].originFileObj);
52
+ return base64;
53
+ // return fileList[0].thumbUrl; TODO: Even JPG files will be converted to base64 parameters in png format
54
  }
55
 
56
  return '';