balibabu
commited on
Commit
·
242ee03
1
Parent(s):
ea41e57
fix: Remove kAModel #1306 (#1713)
Browse files### What problem does this PR solve?
fix: Remove kAModel #1306
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
web/src/hooks/knowledge-hooks.ts
CHANGED
@@ -236,4 +236,22 @@ export const useTestChunkRetrieval = () => {
|
|
236 |
|
237 |
return testChunk;
|
238 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
//#endregion
|
|
|
236 |
|
237 |
return testChunk;
|
238 |
};
|
239 |
+
|
240 |
+
export const useTestNextChunkRetrieval = () => {
|
241 |
+
const {
|
242 |
+
data,
|
243 |
+
isPending: loading,
|
244 |
+
mutateAsync,
|
245 |
+
} = useMutation({
|
246 |
+
mutationKey: ['testChunk'],
|
247 |
+
mutationFn: async (canvasIds: string[]) => {
|
248 |
+
const { data } = await kbService.retrieval_test({ canvasIds });
|
249 |
+
if (data.retcode === 0) {
|
250 |
+
}
|
251 |
+
return data?.data ?? [];
|
252 |
+
},
|
253 |
+
});
|
254 |
+
|
255 |
+
return { data, loading, testChunk: mutateAsync };
|
256 |
+
};
|
257 |
//#endregion
|
web/src/pages/add-knowledge/components/knowledge-sidebar/index.tsx
CHANGED
@@ -2,22 +2,24 @@ import { ReactComponent as ConfigurationIcon } from '@/assets/svg/knowledge-conf
|
|
2 |
import { ReactComponent as DatasetIcon } from '@/assets/svg/knowledge-dataset.svg';
|
3 |
import { ReactComponent as TestingIcon } from '@/assets/svg/knowledge-testing.svg';
|
4 |
import { useFetchKnowledgeBaseConfiguration } from '@/hooks/knowledge-hooks';
|
5 |
-
import {
|
|
|
|
|
|
|
6 |
import { getWidth } from '@/utils';
|
7 |
import { Avatar, Menu, MenuProps, Space } from 'antd';
|
8 |
import classNames from 'classnames';
|
9 |
import { useCallback, useEffect, useMemo, useState } from 'react';
|
10 |
import { useTranslation } from 'react-i18next';
|
11 |
-
import { useNavigate
|
12 |
import { KnowledgeRouteKey } from '../../constant';
|
13 |
|
14 |
import styles from './index.less';
|
15 |
|
16 |
const KnowledgeSidebar = () => {
|
17 |
-
const kAModel = useSelector((state: any) => state.kAModel);
|
18 |
-
const { id } = kAModel;
|
19 |
let navigate = useNavigate();
|
20 |
const activeKey = useSecondPathName();
|
|
|
21 |
|
22 |
const [windowWidth, setWindowWidth] = useState(getWidth());
|
23 |
const [collapsed, setCollapsed] = useState(false);
|
@@ -25,7 +27,7 @@ const KnowledgeSidebar = () => {
|
|
25 |
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
|
26 |
|
27 |
const handleSelect: MenuProps['onSelect'] = (e) => {
|
28 |
-
navigate(`/knowledge/${e.key}?id=${
|
29 |
};
|
30 |
|
31 |
type MenuItem = Required<MenuProps>['items'][number];
|
|
|
2 |
import { ReactComponent as DatasetIcon } from '@/assets/svg/knowledge-dataset.svg';
|
3 |
import { ReactComponent as TestingIcon } from '@/assets/svg/knowledge-testing.svg';
|
4 |
import { useFetchKnowledgeBaseConfiguration } from '@/hooks/knowledge-hooks';
|
5 |
+
import {
|
6 |
+
useGetKnowledgeSearchParams,
|
7 |
+
useSecondPathName,
|
8 |
+
} from '@/hooks/route-hook';
|
9 |
import { getWidth } from '@/utils';
|
10 |
import { Avatar, Menu, MenuProps, Space } from 'antd';
|
11 |
import classNames from 'classnames';
|
12 |
import { useCallback, useEffect, useMemo, useState } from 'react';
|
13 |
import { useTranslation } from 'react-i18next';
|
14 |
+
import { useNavigate } from 'umi';
|
15 |
import { KnowledgeRouteKey } from '../../constant';
|
16 |
|
17 |
import styles from './index.less';
|
18 |
|
19 |
const KnowledgeSidebar = () => {
|
|
|
|
|
20 |
let navigate = useNavigate();
|
21 |
const activeKey = useSecondPathName();
|
22 |
+
const { knowledgeId } = useGetKnowledgeSearchParams();
|
23 |
|
24 |
const [windowWidth, setWindowWidth] = useState(getWidth());
|
25 |
const [collapsed, setCollapsed] = useState(false);
|
|
|
27 |
const { data: knowledgeDetails } = useFetchKnowledgeBaseConfiguration();
|
28 |
|
29 |
const handleSelect: MenuProps['onSelect'] = (e) => {
|
30 |
+
navigate(`/knowledge/${e.key}?id=${knowledgeId}`);
|
31 |
};
|
32 |
|
33 |
type MenuItem = Required<MenuProps>['items'][number];
|
web/src/pages/add-knowledge/model.ts
DELETED
@@ -1,32 +0,0 @@
|
|
1 |
-
import { DvaModel } from 'umi';
|
2 |
-
export interface kAModelState {
|
3 |
-
isShowPSwModal: boolean;
|
4 |
-
tenantIfo: any;
|
5 |
-
id: string;
|
6 |
-
doc_id: string;
|
7 |
-
}
|
8 |
-
|
9 |
-
const model: DvaModel<kAModelState> = {
|
10 |
-
namespace: 'kAModel',
|
11 |
-
state: {
|
12 |
-
isShowPSwModal: false,
|
13 |
-
tenantIfo: {},
|
14 |
-
id: '',
|
15 |
-
doc_id: '',
|
16 |
-
},
|
17 |
-
reducers: {
|
18 |
-
updateState(state, { payload }) {
|
19 |
-
return {
|
20 |
-
...state,
|
21 |
-
...payload,
|
22 |
-
};
|
23 |
-
},
|
24 |
-
},
|
25 |
-
subscriptions: {
|
26 |
-
setup({ dispatch, history }) {
|
27 |
-
history.listen((location) => {});
|
28 |
-
},
|
29 |
-
},
|
30 |
-
effects: {},
|
31 |
-
};
|
32 |
-
export default model;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
web/typings.d.ts
CHANGED
@@ -1,7 +1,6 @@
|
|
1 |
import { ChunkModelState } from '@/pages/add-knowledge/components/knowledge-chunk/model';
|
2 |
import { KFModelState } from '@/pages/add-knowledge/components/knowledge-file/model';
|
3 |
import { TestingModelState } from '@/pages/add-knowledge/components/knowledge-testing/model';
|
4 |
-
import { kAModelState } from '@/pages/add-knowledge/model';
|
5 |
import { ChatModelState } from '@/pages/chat/model';
|
6 |
|
7 |
declare module 'lodash';
|
@@ -14,7 +13,6 @@ function useSelector<TState = RootState, TSelected = unknown>(
|
|
14 |
export interface RootState {
|
15 |
chatModel: ChatModelState;
|
16 |
kFModel: KFModelState;
|
17 |
-
kAModel: kAModelState;
|
18 |
chunkModel: ChunkModelState;
|
19 |
testingModel: TestingModelState;
|
20 |
}
|
|
|
1 |
import { ChunkModelState } from '@/pages/add-knowledge/components/knowledge-chunk/model';
|
2 |
import { KFModelState } from '@/pages/add-knowledge/components/knowledge-file/model';
|
3 |
import { TestingModelState } from '@/pages/add-knowledge/components/knowledge-testing/model';
|
|
|
4 |
import { ChatModelState } from '@/pages/chat/model';
|
5 |
|
6 |
declare module 'lodash';
|
|
|
13 |
export interface RootState {
|
14 |
chatModel: ChatModelState;
|
15 |
kFModel: KFModelState;
|
|
|
16 |
chunkModel: ChunkModelState;
|
17 |
testingModel: TestingModelState;
|
18 |
}
|