diff --git a/src/components/Main.astro b/src/components/Main.astro
index d027d0eb..339d62f5 100644
--- a/src/components/Main.astro
+++ b/src/components/Main.astro
@@ -12,7 +12,7 @@ import Conversation from './main/Conversation'
-
+
diff --git a/src/components/Markdown.tsx b/src/components/Markdown.tsx
index e8ae73be..d85abc24 100644
--- a/src/components/Markdown.tsx
+++ b/src/components/Markdown.tsx
@@ -11,6 +11,7 @@ import 'katex/dist/katex.min.css'
interface Props {
class?: string
text: string
+ showRawCode?: boolean
}
const parseMarkdown = (raw: string) => {
@@ -27,11 +28,11 @@ const parseMarkdown = (raw: string) => {
}
export default (props: Props) => {
- const htmlString = () => parseMarkdown(props.text)
+ const htmlString = () => props.showRawCode ? props.text : parseMarkdown(props.text)
return (
)
diff --git a/src/components/StreamableText.tsx b/src/components/StreamableText.tsx
index 7abd1f1d..02a4bec6 100644
--- a/src/components/StreamableText.tsx
+++ b/src/components/StreamableText.tsx
@@ -7,6 +7,7 @@ import Markdown from './Markdown'
interface Props {
class?: string
text: string
+ showRawCode?: boolean
streamInfo?: () => {
conversationId: string
messageId: string
@@ -47,6 +48,7 @@ export default (props: Props) => {
)
}
diff --git a/src/components/main/MessageItem.tsx b/src/components/main/MessageItem.tsx
index 7f53cab7..f3e58c16 100644
--- a/src/components/main/MessageItem.tsx
+++ b/src/components/main/MessageItem.tsx
@@ -1,6 +1,9 @@
import { For } from 'solid-js/web'
+import { createSignal } from 'solid-js'
+import { useClipboardCopy } from '@/hooks'
+import { deleteMessageByConversationId } from '@/stores/messages'
import StreamableText from '../StreamableText'
-import { DropDownMenu, Tooltip } from '../ui/base'
+import { Tooltip } from '../ui/base'
import type { MenuItem } from '../ui/base'
import type { MessageInstance } from '@/types/message'
@@ -18,18 +21,29 @@ export default (props: Props) => {
assistant: 'bg-gradient-to-b from-[#fccb90] to-[#d57eeb]',
}
- const handleCopyMessage = () => {
+ const [copied, copy] = useClipboardCopy(props.message.content)
+ const [showRawCode, setShowRawCode] = createSignal(false)
+ const handleDeleteMessageItem = () => {
+ deleteMessageByConversationId(props.conversationId, props.message)
}
- const menuList: MenuItem[] = [
- { id: 'retry', label: 'Retry message', icon: 'i-ion:refresh-outline' },
- { id: 'show', label: 'Show raw code', icon: 'i-carbon-code' },
- { id: 'share', label: 'Share message', icon: 'i-ion:ios-share-alt' },
- { id: 'edit', label: 'Edit message', icon: 'i-ion:md-create' },
- { id: 'copy', label: 'Copy message', icon: 'i-carbon-copy' },
- { id: 'delete', label: 'Delete message', icon: 'i-carbon-trash-can' },
- ]
+ const [menuList, setMenuList] = createSignal