fix: website crash when typing / followed with non prompt name (#262)
* fix: froward slash crash * added the rounded corners when editing folder/chat
This commit is contained in:
parent
cd49445491
commit
a70ae8799d
|
@ -107,11 +107,13 @@ export const ChatInput: FC<Props> = ({
|
||||||
|
|
||||||
const handleInitModal = () => {
|
const handleInitModal = () => {
|
||||||
const selectedPrompt = filteredPrompts[activePromptIndex];
|
const selectedPrompt = filteredPrompts[activePromptIndex];
|
||||||
setContent((prevContent) => {
|
if (selectedPrompt) {
|
||||||
const newContent = prevContent?.replace(/\/\w*$/, selectedPrompt.content);
|
setContent((prevContent) => {
|
||||||
return newContent;
|
const newContent = prevContent?.replace(/\/\w*$/, selectedPrompt.content);
|
||||||
});
|
return newContent;
|
||||||
handlePromptSelect(selectedPrompt);
|
});
|
||||||
|
handlePromptSelect(selectedPrompt);
|
||||||
|
}
|
||||||
setShowPromptList(false);
|
setShowPromptList(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -209,9 +211,8 @@ export const ChatInput: FC<Props> = ({
|
||||||
if (textareaRef && textareaRef.current) {
|
if (textareaRef && textareaRef.current) {
|
||||||
textareaRef.current.style.height = 'inherit';
|
textareaRef.current.style.height = 'inherit';
|
||||||
textareaRef.current.style.height = `${textareaRef.current?.scrollHeight}px`;
|
textareaRef.current.style.height = `${textareaRef.current?.scrollHeight}px`;
|
||||||
textareaRef.current.style.overflow = `${
|
textareaRef.current.style.overflow = `${textareaRef?.current?.scrollHeight > 400 ? 'auto' : 'hidden'
|
||||||
textareaRef?.current?.scrollHeight > 400 ? 'auto' : 'hidden'
|
}`;
|
||||||
}`;
|
|
||||||
}
|
}
|
||||||
}, [content]);
|
}, [content]);
|
||||||
|
|
||||||
|
@ -261,11 +262,10 @@ export const ChatInput: FC<Props> = ({
|
||||||
resize: 'none',
|
resize: 'none',
|
||||||
bottom: `${textareaRef?.current?.scrollHeight}px`,
|
bottom: `${textareaRef?.current?.scrollHeight}px`,
|
||||||
maxHeight: '400px',
|
maxHeight: '400px',
|
||||||
overflow: `${
|
overflow: `${textareaRef.current && textareaRef.current.scrollHeight > 400
|
||||||
textareaRef.current && textareaRef.current.scrollHeight > 400
|
? 'auto'
|
||||||
? 'auto'
|
: 'hidden'
|
||||||
: 'hidden'
|
}`,
|
||||||
}`,
|
|
||||||
}}
|
}}
|
||||||
placeholder={
|
placeholder={
|
||||||
t('Type a message or type "/" to select a prompt...') || ''
|
t('Type a message or type "/" to select a prompt...') || ''
|
||||||
|
|
|
@ -68,7 +68,7 @@ export const ConversationComponent: FC<Props> = ({
|
||||||
return (
|
return (
|
||||||
<div className="relative flex items-center">
|
<div className="relative flex items-center">
|
||||||
{isRenaming && selectedConversation.id === conversation.id ? (
|
{isRenaming && selectedConversation.id === conversation.id ? (
|
||||||
<div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3">
|
<div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3 rounded-lg">
|
||||||
<IconMessage size={18} />
|
<IconMessage size={18} />
|
||||||
<input
|
<input
|
||||||
className="mr-12 flex-1 overflow-hidden overflow-ellipsis border-neutral-400 bg-transparent text-left text-[12.5px] leading-3 text-white outline-none focus:border-neutral-100"
|
className="mr-12 flex-1 overflow-hidden overflow-ellipsis border-neutral-400 bg-transparent text-left text-[12.5px] leading-3 text-white outline-none focus:border-neutral-100"
|
||||||
|
|
|
@ -103,7 +103,7 @@ export const ChatFolder: FC<Props> = ({
|
||||||
<>
|
<>
|
||||||
<div className="relative flex items-center">
|
<div className="relative flex items-center">
|
||||||
{isRenaming ? (
|
{isRenaming ? (
|
||||||
<div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3">
|
<div className="flex w-full items-center gap-3 bg-[#343541]/90 p-3 rounded-lg">
|
||||||
{isOpen ? (
|
{isOpen ? (
|
||||||
<IconCaretDown size={18} />
|
<IconCaretDown size={18} />
|
||||||
) : (
|
) : (
|
||||||
|
@ -199,21 +199,21 @@ export const ChatFolder: FC<Props> = ({
|
||||||
|
|
||||||
{isOpen
|
{isOpen
|
||||||
? conversations.map((conversation, index) => {
|
? conversations.map((conversation, index) => {
|
||||||
if (conversation.folderId === currentFolder.id) {
|
if (conversation.folderId === currentFolder.id) {
|
||||||
return (
|
return (
|
||||||
<div key={index} className="ml-5 gap-2 border-l pl-2">
|
<div key={index} className="ml-5 gap-2 border-l pl-2">
|
||||||
<ConversationComponent
|
<ConversationComponent
|
||||||
selectedConversation={selectedConversation}
|
selectedConversation={selectedConversation}
|
||||||
conversation={conversation}
|
conversation={conversation}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
onSelectConversation={onSelectConversation}
|
onSelectConversation={onSelectConversation}
|
||||||
onDeleteConversation={onDeleteConversation}
|
onDeleteConversation={onDeleteConversation}
|
||||||
onUpdateConversation={onUpdateConversation}
|
onUpdateConversation={onUpdateConversation}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
: null}
|
: null}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue