mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-01-01 16:18:51 +01:00
feat(askOpenAI.js): add abort endpoint to cancel requests feat(MessageHandler): add abort functionality to cancel requests feat(submission.js): add lastResponse and source atoms to store feat(handleSubmit.js): add stopGenerating function to cancel requests
49 lines
968 B
JavaScript
49 lines
968 B
JavaScript
import React from "react";
|
|
import { useNavigate } from "react-router-dom";
|
|
import {
|
|
RecoilRoot,
|
|
atom,
|
|
selector,
|
|
useRecoilState,
|
|
useRecoilValue,
|
|
useSetRecoilState,
|
|
} from "recoil";
|
|
import buildTree from "~/utils/buildTree";
|
|
|
|
// 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({
|
|
key: "submission",
|
|
default: null,
|
|
});
|
|
|
|
const isSubmitting = atom({
|
|
key: "isSubmitting",
|
|
default: false,
|
|
});
|
|
|
|
const lastResponse = atom({
|
|
key: "lastResponse",
|
|
default: '',
|
|
});
|
|
|
|
const source = atom({
|
|
key: "source",
|
|
default: null,
|
|
});
|
|
|
|
export default {
|
|
submission,
|
|
isSubmitting,
|
|
lastResponse,
|
|
source,
|
|
};
|