feat: show model at the top of conversation messages.

This commit is contained in:
Wentao Lyu 2023-03-16 21:59:20 +08:00
parent c27554ed2e
commit e3b0cb7db7

View file

@ -8,10 +8,14 @@ import { useSelector } from 'react-redux';
const Messages = ({ messages, messageTree }) => {
const [currentEditId, setCurrentEditId] = useState(-1);
const { conversationId } = useSelector((state) => state.convo);
const { model, customModel, chatGptLabel } = useSelector((state) => state.submit);
const { models } = useSelector((state) => state.models);
const [showScrollButton, setShowScrollButton] = useState(false);
const scrollableRef = useRef(null);
const messagesEndRef = useRef(null);
const modelName = models.find(element => element.model==model)?.name
useEffect(() => {
const timeoutId = setTimeout(() => {
const scrollable = scrollableRef.current;
@ -60,6 +64,9 @@ const Messages = ({ messages, messageTree }) => {
>
{/* <div className="flex-1 overflow-hidden"> */}
<div className="dark:gpt-dark-gray h-full">
<div className="flex w-full items-center justify-center gap-1 border-b border-black/10 bg-gray-50 p-3 text-gray-500 dark:border-gray-900/50 dark:bg-gray-700 dark:text-gray-300 text-sm">
Model: {modelName} {customModel?`(${customModel})`:null}
</div>
<div className="dark:gpt-dark-gray flex h-full flex-col items-center text-sm">
{messageTree.length === 0 ? (
<Spinner />