update knowledge_kb (#34)
* update typescript * add chunk api * remove useless code
This commit is contained in:
@@ -1,19 +1,15 @@
|
||||
import React, { FC } from 'react';
|
||||
import { IndexModelState, ConnectProps, Loading, connect } from 'umi';
|
||||
import React from 'react';
|
||||
import { connect, Dispatch } from 'umi';
|
||||
import type { chatModelState } from './model'
|
||||
|
||||
interface PageProps extends ConnectProps {
|
||||
index: IndexModelState;
|
||||
loading: boolean;
|
||||
interface chatProps {
|
||||
chatModel: chatModelState;
|
||||
dispatch: Dispatch
|
||||
}
|
||||
|
||||
const IndexPage: FC<PageProps> = ({ index, dispatch }) => {
|
||||
const { name } = index;
|
||||
return <div>chat: {name}</div>;
|
||||
const View: React.FC<chatProps> = ({ chatModel, dispatch }) => {
|
||||
const { name } = chatModel;
|
||||
return <div>chat:{name} </div>;
|
||||
};
|
||||
|
||||
export default connect(
|
||||
({ index, loading }: { index: IndexModelState; loading: Loading }) => ({
|
||||
index,
|
||||
loading: loading.models.index,
|
||||
}),
|
||||
)(IndexPage);
|
||||
export default connect(({ chatModel, loading }) => ({ chatModel, loading }))(View);
|
||||
@@ -1,25 +1,23 @@
|
||||
import { Effect, ImmerReducer, Reducer, Subscription } from 'umi';
|
||||
import { Effect, Reducer, Subscription } from 'umi';
|
||||
|
||||
export interface IndexModelState {
|
||||
export interface chatModelState {
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IndexModelType {
|
||||
namespace: 'index';
|
||||
state: IndexModelState;
|
||||
export interface chatModelType {
|
||||
namespace: 'chatModel';
|
||||
state: chatModelState;
|
||||
effects: {
|
||||
query: Effect;
|
||||
};
|
||||
reducers: {
|
||||
save: Reducer<IndexModelState>;
|
||||
// 启用 immer 之后
|
||||
// save: ImmerReducer<IndexModelState>;
|
||||
save: Reducer<chatModelState>;
|
||||
};
|
||||
subscriptions: { setup: Subscription };
|
||||
}
|
||||
|
||||
const IndexModel: IndexModelType = {
|
||||
namespace: 'index',
|
||||
const Model: chatModelType = {
|
||||
namespace: 'chatModel',
|
||||
state: {
|
||||
name: 'kate',
|
||||
},
|
||||
@@ -34,10 +32,6 @@ const IndexModel: IndexModelType = {
|
||||
...action.payload,
|
||||
};
|
||||
},
|
||||
// 启用 immer 之后
|
||||
// save(state, action) {
|
||||
// state.name = action.payload;
|
||||
// },
|
||||
},
|
||||
subscriptions: {
|
||||
setup({ dispatch, history }) {
|
||||
@@ -49,4 +43,4 @@ const IndexModel: IndexModelType = {
|
||||
},
|
||||
};
|
||||
|
||||
export default IndexModel;
|
||||
export default Model;
|
||||
Reference in New Issue
Block a user