Files
ragflow_python/web/src/pages/chat/model.ts

46 lines
931 B
TypeScript
Raw Normal View History

import { Effect, Reducer, Subscription } from 'umi';
2024-01-17 09:37:01 +08:00
export interface chatModelState {
2024-01-17 09:37:01 +08:00
name: string;
}
export interface chatModelType {
namespace: 'chatModel';
state: chatModelState;
2024-01-17 09:37:01 +08:00
effects: {
query: Effect;
};
reducers: {
save: Reducer<chatModelState>;
2024-01-17 09:37:01 +08:00
};
subscriptions: { setup: Subscription };
}
const Model: chatModelType = {
namespace: 'chatModel',
2024-01-17 09:37:01 +08:00
state: {
name: 'kate',
},
effects: {
*query({ payload }, { call, put }) { },
},
reducers: {
save(state, action) {
return {
...state,
...action.payload,
};
},
},
subscriptions: {
setup({ dispatch, history }) {
return history.listen((query) => {
console.log(query)
});
},
},
};
export default Model;