resolve conflict

This commit is contained in:
dakai
2023-04-03 12:43:21 +08:00
12 changed files with 82 additions and 50 deletions

View File

@@ -452,7 +452,7 @@ export function Chat(props: {}) {
role: "user",
content: userInput,
date: new Date().toLocaleString(),
preview: false,
preview: true,
},
]
: [],
@@ -460,6 +460,12 @@ export function Chat(props: {}) {
const [showPromptModal, setShowPromptModal] = useState(false);
// Auto focus
useEffect(() => {
if (sidebarCollapse && isMobileScreen()) return;
inputRef.current?.focus();
}, [sidebarCollapse]);
return (
<div className={styles.chat} key={session.id}>
<div className={styles["window-header"]}>
@@ -525,6 +531,7 @@ export function Chat(props: {}) {
className={styles["chat-body"]}
ref={scrollRef}
onScroll={(e) => onChatBodyScroll(e.currentTarget)}
onTouchStart={() => inputRef.current?.blur()}
>
{messages.map((message, i) => {
const isUser = message.role === "user";
@@ -545,10 +552,7 @@ export function Chat(props: {}) {
{Locale.Chat.Typing}
</div>
)}
<div
className={styles["chat-message-item"]}
onMouseOver={() => inputRef.current?.blur()}
>
<div className={styles["chat-message-item"]}>
{!isUser &&
!(message.preview || message.content.length === 0) && (
<div className={styles["chat-message-top-actions"]}>
@@ -588,6 +592,7 @@ export function Chat(props: {}) {
if (!isMobileScreen()) return;
setUserInput(message.content);
}}
onMouseOver={() => inputRef.current?.blur()}
>
<Markdown content={message.content} />
</div>
@@ -622,6 +627,9 @@ export function Chat(props: {}) {
setAutoScroll(false);
setTimeout(() => setPromptHints([]), 500);
}}
onMouseOver={() => {
inputRef.current?.focus();
}}
autoFocus={sidebarCollapse}
/>
<IconButton

View File

@@ -449,6 +449,7 @@
.chat-input-panel {
width: 100%;
padding: 20px;
padding-top: 5px;
box-sizing: border-box;
flex-direction: column;
}

View File

@@ -59,7 +59,7 @@ export function Markdown(props: { content: string }) {
[
RehypeHighlight,
{
detect: true,
detect: false,
ignoreMissing: true,
},
],

View File

@@ -128,6 +128,8 @@
justify-content: center;
.toast-content {
max-width: 80vw;
word-break: break-all;
font-size: 14px;
background-color: var(--white);
box-shadow: var(--card-shadow);