mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 17:00:15 +01:00
fix: add text to global state
This commit is contained in:
parent
79bb54db9c
commit
d6fdf41011
5 changed files with 19 additions and 15 deletions
|
|
@ -6,7 +6,6 @@ import BingStyles from './BingStyles';
|
||||||
import ModelMenu from './Models/ModelMenu';
|
import ModelMenu from './Models/ModelMenu';
|
||||||
import Footer from './Footer';
|
import Footer from './Footer';
|
||||||
import TextareaAutosize from 'react-textarea-autosize';
|
import TextareaAutosize from 'react-textarea-autosize';
|
||||||
import createPayload from '~/utils/createPayload';
|
|
||||||
import RegenerateIcon from '../svg/RegenerateIcon';
|
import RegenerateIcon from '../svg/RegenerateIcon';
|
||||||
import StopGeneratingIcon from '../svg/StopGeneratingIcon';
|
import StopGeneratingIcon from '../svg/StopGeneratingIcon';
|
||||||
import { useMessageHandler } from '../../utils/handleSubmit';
|
import { useMessageHandler } from '../../utils/handleSubmit';
|
||||||
|
|
@ -20,13 +19,14 @@ export default function TextChat({ isSearchView = false }) {
|
||||||
const conversation = useRecoilValue(store.conversation);
|
const conversation = useRecoilValue(store.conversation);
|
||||||
const latestMessage = useRecoilValue(store.latestMessage);
|
const latestMessage = useRecoilValue(store.latestMessage);
|
||||||
const messages = useRecoilValue(store.messages);
|
const messages = useRecoilValue(store.messages);
|
||||||
|
const [text, setText] = useRecoilState(store.text);
|
||||||
|
// const [text, setText] = useState('');
|
||||||
|
|
||||||
const isSubmitting = useRecoilValue(store.isSubmitting);
|
const isSubmitting = useRecoilValue(store.isSubmitting);
|
||||||
|
|
||||||
// TODO: do we need this?
|
// TODO: do we need this?
|
||||||
const disabled = false;
|
const disabled = false;
|
||||||
|
|
||||||
const [text, setText] = useState('');
|
|
||||||
const { ask, regenerate, stopGenerating } = useMessageHandler();
|
const { ask, regenerate, stopGenerating } = useMessageHandler();
|
||||||
|
|
||||||
const bingStylesRef = useRef(null);
|
const bingStylesRef = useRef(null);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue, useSetRecoilState } from 'recoil';
|
||||||
import useDocumentTitle from '~/hooks/useDocumentTitle';
|
import useDocumentTitle from '~/hooks/useDocumentTitle';
|
||||||
import Templates from '../Prompts/Templates';
|
import Templates from '../Prompts/Templates';
|
||||||
import SunIcon from '../svg/SunIcon';
|
import SunIcon from '../svg/SunIcon';
|
||||||
|
|
@ -11,6 +11,7 @@ import store from '~/store';
|
||||||
|
|
||||||
export default function Landing() {
|
export default function Landing() {
|
||||||
const [showingTemplates, setShowingTemplates] = useState(false);
|
const [showingTemplates, setShowingTemplates] = useState(false);
|
||||||
|
const setText = useSetRecoilState(store.text);
|
||||||
const conversation = useRecoilValue(store.conversation);
|
const conversation = useRecoilValue(store.conversation);
|
||||||
const { title = 'New Chat' } = conversation || {};
|
const { title = 'New Chat' } = conversation || {};
|
||||||
|
|
||||||
|
|
@ -20,7 +21,7 @@ export default function Landing() {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const { innerText } = e.target;
|
const { innerText } = e.target;
|
||||||
const quote = innerText.split('"')[1].trim();
|
const quote = innerText.split('"')[1].trim();
|
||||||
// dispatch(setText(quote));
|
setText(quote);
|
||||||
};
|
};
|
||||||
|
|
||||||
const showTemplates = e => {
|
const showTemplates = e => {
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import conversation from './conversation';
|
||||||
import conversations from './conversations';
|
import conversations from './conversations';
|
||||||
import models from './models';
|
import models from './models';
|
||||||
import user from './user';
|
import user from './user';
|
||||||
|
import text from './text';
|
||||||
import submission from './submission';
|
import submission from './submission';
|
||||||
import search from './search';
|
import search from './search';
|
||||||
|
|
||||||
|
|
@ -10,6 +11,7 @@ export default {
|
||||||
...conversations,
|
...conversations,
|
||||||
...models,
|
...models,
|
||||||
...user,
|
...user,
|
||||||
|
text,
|
||||||
...submission,
|
...submission,
|
||||||
...search
|
...search
|
||||||
};
|
};
|
||||||
|
|
|
||||||
8
client/src/store/text.js
Normal file
8
client/src/store/text.js
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
import { atom } from 'recoil';
|
||||||
|
|
||||||
|
const text = atom({
|
||||||
|
key: 'text',
|
||||||
|
default: ''
|
||||||
|
});
|
||||||
|
|
||||||
|
export default text;
|
||||||
|
|
@ -1,17 +1,10 @@
|
||||||
import React from "react";
|
import { atom } from 'recoil';
|
||||||
import {
|
|
||||||
RecoilRoot,
|
|
||||||
atom,
|
|
||||||
selector,
|
|
||||||
useRecoilState,
|
|
||||||
useRecoilValue,
|
|
||||||
} from "recoil";
|
|
||||||
|
|
||||||
const user = atom({
|
const user = atom({
|
||||||
key: "user",
|
key: 'user',
|
||||||
default: null,
|
default: null
|
||||||
});
|
});
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
user,
|
user
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue