mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: remove memo chat components (#2073)
This commit is contained in:
@ -115,22 +115,6 @@ const Header = () => {
|
||||
|
||||
{!isVisitorMode && (
|
||||
<>
|
||||
{globalStore.isDev() && (
|
||||
<NavLink
|
||||
to="/memo-chat"
|
||||
id="header-memo-chat"
|
||||
className={({ isActive }) =>
|
||||
classNames(
|
||||
"px-4 pr-5 py-2 rounded-full border flex flex-row items-center text-lg text-gray-800 dark:text-gray-300 hover:bg-white hover:border-gray-200 dark:hover:border-zinc-600 dark:hover:bg-zinc-700",
|
||||
isActive ? "bg-white dark:bg-zinc-700 border-gray-200 dark:border-zinc-600" : "border-transparent"
|
||||
)
|
||||
}
|
||||
>
|
||||
<>
|
||||
<Icon.Bot className="mr-3 w-6 h-auto opacity-70" /> {t("memo-chat.title")}
|
||||
</>
|
||||
</NavLink>
|
||||
)}
|
||||
<NavLink
|
||||
to="/archived"
|
||||
id="header-archived"
|
||||
|
@ -1,37 +0,0 @@
|
||||
import Textarea from "@mui/joy/Textarea/Textarea";
|
||||
import Icon from "@/components/Icon";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
|
||||
interface Props {
|
||||
question: string;
|
||||
handleQuestionTextareaChange: any;
|
||||
setIsInIME: any;
|
||||
handleKeyDown: any;
|
||||
handleSendQuestionButtonClick: any;
|
||||
}
|
||||
|
||||
const ChatInput = ({ question, handleQuestionTextareaChange, setIsInIME, handleKeyDown, handleSendQuestionButtonClick }: Props) => {
|
||||
const t = useTranslate();
|
||||
|
||||
return (
|
||||
<div className="w-full relative mt-4">
|
||||
<Textarea
|
||||
className="w-full"
|
||||
placeholder={t("memo-chat.placeholder")}
|
||||
value={question}
|
||||
minRows={1}
|
||||
maxRows={5}
|
||||
onChange={handleQuestionTextareaChange}
|
||||
onCompositionStart={() => setIsInIME(true)}
|
||||
onCompositionEnd={() => setIsInIME(false)}
|
||||
onKeyDown={handleKeyDown}
|
||||
/>
|
||||
<Icon.Send
|
||||
className="cursor-pointer w-7 p-1 h-auto rounded-md bg-gray-100 dark:bg-zinc-800 absolute right-2 bottom-1.5 shadow hover:opacity-80"
|
||||
onClick={handleSendQuestionButtonClick}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChatInput;
|
@ -1,60 +0,0 @@
|
||||
import toast from "react-hot-toast";
|
||||
import Icon from "@/components/Icon";
|
||||
import { marked } from "@/labs/marked";
|
||||
import { useMemoStore } from "@/store/module";
|
||||
import { Message } from "@/store/v1/message";
|
||||
import { useTranslate } from "@/utils/i18n";
|
||||
import Dropdown from "../kit/Dropdown";
|
||||
|
||||
interface MessageProps {
|
||||
index: number;
|
||||
message: Message;
|
||||
}
|
||||
|
||||
const ChatMessage = ({ index, message }: MessageProps) => {
|
||||
const memoStore = useMemoStore();
|
||||
const t = useTranslate();
|
||||
|
||||
const handleSaveAsMemos = async () => {
|
||||
await memoStore.createMemo({
|
||||
content: message.content,
|
||||
visibility: "PRIVATE",
|
||||
resourceIdList: [],
|
||||
relationList: [],
|
||||
});
|
||||
toast.success(t("memo-chat.save-as-memo-success"));
|
||||
};
|
||||
|
||||
return (
|
||||
<div key={index} className="w-full flex flex-col justify-start items-start space-y-2">
|
||||
{message.role === "user" ? (
|
||||
<div className="w-full flex flex-row justify-end items-start pl-6">
|
||||
<span className="word-break shadow rounded-lg rounded-tr-none px-3 py-2 opacity-80 bg-white dark:bg-zinc-800">
|
||||
{message.content}
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full flex flex-row justify-start items-start pr-8 space-x-2">
|
||||
<Icon.Bot className="mt-2 shrink-0 mr-1 w-6 h-auto opacity-80" />
|
||||
<div className="memo-content-wrapper !w-auto flex flex-col justify-start items-start shadow rounded-lg rounded-tl-none px-3 py-2 bg-white dark:bg-zinc-800">
|
||||
<div className="memo-content-text">{marked(message.content)}</div>
|
||||
</div>
|
||||
<Dropdown
|
||||
actions={
|
||||
<>
|
||||
<button
|
||||
className="w-full m-auto text-left text-sm whitespace-nowrap leading-6 py-1 px-3 cursor-pointer rounded hover:bg-gray-100 dark:hover:bg-zinc-600"
|
||||
onClick={() => handleSaveAsMemos()}
|
||||
>
|
||||
{t("memo-chat.save-as-memo")}
|
||||
</button>
|
||||
</>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ChatMessage;
|
@ -1,33 +0,0 @@
|
||||
import Icon from "@/components/Icon";
|
||||
import { Conversation } from "@/store/v1/conversation";
|
||||
|
||||
interface ConversationTabProps {
|
||||
item: Conversation;
|
||||
selectedConversationId: string;
|
||||
setSelectedConversationId: (id: string) => void;
|
||||
closeConversation: (e: any) => void;
|
||||
}
|
||||
|
||||
const ConversationTab = ({ item, selectedConversationId, setSelectedConversationId, closeConversation }: ConversationTabProps) => {
|
||||
return (
|
||||
<div
|
||||
className={`flex rounded-lg h-8 px-3 cursor-pointer border dark:border-zinc-600 ${
|
||||
selectedConversationId === item.messageStorageId ? "bg-white dark:bg-zinc-700" : "bg-gray-200 dark:bg-zinc-800 opacity-60"
|
||||
}`}
|
||||
key={item.messageStorageId}
|
||||
onClick={() => {
|
||||
setSelectedConversationId(item.messageStorageId);
|
||||
}}
|
||||
>
|
||||
<div className="truncate m-auto">{item.name}</div>
|
||||
<Icon.X
|
||||
className="ml-1 w-4 h-auto m-auto cursor-pointer opacity-60"
|
||||
onClick={(e: any) => {
|
||||
closeConversation(e);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default ConversationTab;
|
Reference in New Issue
Block a user