feat: rename conversation and delete conversation and preview reference image and fetch file thumbnails (#79)

* feat: fetch file thumbnails

* feat: preview reference image

* feat: delete conversation

* feat: rename conversation
This commit is contained in:
balibabu
2024-02-28 16:28:33 +08:00
committed by GitHub
parent 22da1b1bfe
commit 01ab5b5db1
14 changed files with 487 additions and 92 deletions

View File

@@ -16,6 +16,7 @@ export interface KFModelState extends BaseState {
data: IKnowledgeFile[];
total: number;
currentRecord: Nullable<IKnowledgeFile>;
fileThumbnails: Record<string, string>;
}
const model: DvaModel<KFModelState> = {
@@ -34,6 +35,7 @@ const model: DvaModel<KFModelState> = {
current: 1,
pageSize: 10,
},
fileThumbnails: {} as Record<string, string>,
},
reducers: {
updateState(state, { payload }) {
@@ -54,6 +56,9 @@ const model: DvaModel<KFModelState> = {
setPagination(state, { payload }) {
return { ...state, pagination: { ...state.pagination, ...payload } };
},
setFileThumbnails(state, { payload }) {
return { ...state, fileThumbnails: payload };
},
},
effects: {
*createKf({ payload = {} }, { call }) {
@@ -201,6 +206,12 @@ const model: DvaModel<KFModelState> = {
}
return retcode;
},
*fetch_document_thumbnails({ payload = {} }, { call, put }) {
const { data } = yield call(kbService.document_thumbnails, payload);
if (data.retcode === 0) {
yield put({ type: 'setFileThumbnails', payload: data.data });
}
},
},
};
export default model;