wujingjing
2024-08-12 4df2f8b18bca292d3cc4d147a8e844c9610bef3b
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
// observable 创建被监测的对象,对象中的属性会被转换为响应式数据
// action 函数用来显式的定义 action 方法
import { observable, action } from 'mobx-miniprogram'
 
export type QuestionConfig = {
  /** 是否直接调用大模型(通义千问)回答 */
  isAnswerByLLM: boolean;
}
export type ChatRoomItem = {
  id: string;
  isInitial: boolean,
  title: string;
  createTime?: string;
};
 
export const questionConfigStore = observable({
  // 定义响应式数据
  isAnswerByLLM: false,
  chatRoom: null,
 
  setChatRoom: action(function (chatRoom: ChatRoomItem) {
    this.chatRoom = chatRoom
  }),
 
  setIsAnswerByLLM: action(function (isAnswerByLLM: boolean) {
    this.isAnswerByLLM = isAnswerByLLM
  })
})