2023-04-11 03:29:54 +08:00
|
|
|
import React from 'react';
|
|
|
|
|
import { useNavigate } from 'react-router-dom';
|
2023-05-18 11:09:31 -07:00
|
|
|
import {
|
|
|
|
|
RecoilRoot,
|
|
|
|
|
atom,
|
|
|
|
|
selector,
|
|
|
|
|
useRecoilState,
|
|
|
|
|
useRecoilValue,
|
|
|
|
|
useSetRecoilState
|
|
|
|
|
} from 'recoil';
|
2023-04-11 03:29:54 +08:00
|
|
|
import buildTree from '~/utils/buildTree';
|
2023-03-28 20:36:21 +08:00
|
|
|
|
|
|
|
|
// current submission
|
|
|
|
|
// submit any new value to this state will cause new message to be send.
|
|
|
|
|
// set to null to give up any submission
|
|
|
|
|
// {
|
|
|
|
|
// conversation, // target submission, must have: model, chatGptLabel, promptPrefix
|
|
|
|
|
// messages, // old messages
|
|
|
|
|
// message, // request message
|
|
|
|
|
// initialResponse, // response message
|
|
|
|
|
// isRegenerate=false, // isRegenerate?
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
const submission = atom({
|
2023-04-11 03:29:54 +08:00
|
|
|
key: 'submission',
|
|
|
|
|
default: null
|
2023-03-28 20:36:21 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const isSubmitting = atom({
|
2023-04-11 03:29:54 +08:00
|
|
|
key: 'isSubmitting',
|
|
|
|
|
default: false
|
2023-04-08 23:19:29 -04:00
|
|
|
});
|
|
|
|
|
|
2023-03-28 20:36:21 +08:00
|
|
|
export default {
|
|
|
|
|
submission,
|
2023-04-11 03:29:54 +08:00
|
|
|
isSubmitting
|
2023-03-28 20:36:21 +08:00
|
|
|
};
|