File size: 1,369 Bytes
6b8fc2c
362ec6c
 
6b8fc2c
362ec6c
fad2ec7
 
362ec6c
fad2ec7
362ec6c
 
6b8fc2c
 
 
 
362ec6c
 
 
 
 
 
 
 
 
6b8fc2c
 
 
362ec6c
 
6b8fc2c
 
362ec6c
 
 
6b8fc2c
 
 
362ec6c
6b8fc2c
362ec6c
 
 
6b8fc2c
 
 
 
362ec6c
 
 
 
6b8fc2c
 
 
362ec6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import kbService from '@/services/kbService';
import { message } from 'antd';
import { DvaModel } from 'umi';

export interface KSModelState {
  isShowPSwModal: boolean;
  isShowTntModal: boolean;
  tenantIfo: any;
}

const model: DvaModel<KSModelState> = {
  namespace: 'kSModel',
  state: {
    isShowPSwModal: false,
    isShowTntModal: false,
    tenantIfo: {},
  },
  reducers: {
    updateState(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
  subscriptions: {
    setup({ dispatch, history }) {
      history.listen((location) => {});
    },
  },
  effects: {
    *createKb({ payload = {} }, { call, put }) {
      const { data } = yield call(kbService.createKb, payload);
      const { retcode } = data;
      if (retcode === 0) {
        message.success('创建知识库成功!');
      }
      return retcode;
    },
    *updateKb({ payload = {} }, { call, put }) {
      const { data } = yield call(kbService.updateKb, payload);
      const { retcode, data: res, retmsg } = data;
      if (retcode === 0) {
        message.success('更新知识库成功!');
      }
    },
    *getKbDetail({ payload = {} }, { call, put }) {
      const { data } = yield call(kbService.get_kb_detail, payload);

      return data;
    },
  },
};
export default model;