style updates

This commit is contained in:
Jing Hua 2023-03-04 11:39:02 +08:00
parent 3abf98c89d
commit 60401a491e
3 changed files with 13 additions and 14 deletions

View file

@ -7,12 +7,6 @@ import ChatTitle from './ChatTitle';
import Message from './Message'; import Message from './Message';
import NewMessageButton from './Message/NewMessageButton'; import NewMessageButton from './Message/NewMessageButton';
import { getChatCompletionStream as getChatCompletionStreamFree } from '@api/freeApi';
import { getChatCompletionStream as getChatCompletionStreamCustom } from '@api/customApi';
import { parseEventSource } from '@api/helper';
import RefreshIcon from '@icon/RefreshIcon';
import { MessageInterface } from '@type/chat';
import useSubmit from '@hooks/useSubmit'; import useSubmit from '@hooks/useSubmit';
const ChatContent = () => { const ChatContent = () => {

View file

@ -6,11 +6,12 @@ import MessageContent from './MessageContent';
import { Role } from '@type/chat'; import { Role } from '@type/chat';
import RoleSelector from './RoleSelector'; import RoleSelector from './RoleSelector';
const backgroundStyle: { [role in Role]: string } = { // const backgroundStyle: { [role in Role]: string } = {
user: 'dark:bg-gray-800', // user: 'dark:bg-gray-800',
assistant: 'bg-gray-50 dark:bg-[#444654]', // assistant: 'bg-gray-50 dark:bg-[#444654]',
system: 'bg-gray-50 dark:bg-[#444654]', // system: 'bg-gray-50 dark:bg-[#444654]',
}; // };
const backgroundStyle = ['dark:bg-gray-800', 'bg-gray-50 dark:bg-[#444654]'];
const Message = ({ const Message = ({
role, role,
@ -25,7 +26,9 @@ const Message = ({
}) => { }) => {
return ( return (
<div <div
className={`w-full border-b border-black/10 dark:border-gray-900/50 text-gray-800 dark:text-gray-100 group ${backgroundStyle[role]}`} className={`w-full border-b border-black/10 dark:border-gray-900/50 text-gray-800 dark:text-gray-100 group ${
backgroundStyle[messageIndex % 2]
}`}
key={ key={
messageIndex !== -1 messageIndex !== -1
? `${messageIndex}-${content}` ? `${messageIndex}-${content}`

View file

@ -300,13 +300,15 @@ const EditView = ({
<> <>
<textarea <textarea
ref={textareaRef} ref={textareaRef}
className='m-0 resize-none rounded-lg bg-transparent overflow-y-hidden focus:ring-0 focus-visible:ring-0 focus:outline-none leading-7' className={`m-0 resize-none rounded-lg bg-transparent overflow-y-hidden focus:ring-0 focus-visible:ring-0 leading-7 ${
sticky ? 'border border-gray-400/30 px-2 py-1' : 'focus:outline-none'
}`}
onChange={(e) => { onChange={(e) => {
_setContent(e.target.value); _setContent(e.target.value);
}} }}
value={_content} value={_content}
onInput={handleInput} onInput={handleInput}
rows={1} rows={sticky ? 10 : 1}
></textarea> ></textarea>
<div className='text-center mt-2 flex justify-center'> <div className='text-center mt-2 flex justify-center'>
<button <button