Skip to content

Commit 926e1bc

Browse files
committed
Remove unused stuff
1 parent c44c91b commit 926e1bc

21 files changed

+14
-1020
lines changed

webview-ui/src/components/ui/chat/ChatAnnotations.tsx

Lines changed: 0 additions & 75 deletions
This file was deleted.

webview-ui/src/components/ui/chat/ChatMessage.tsx

Lines changed: 8 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Fragment, useMemo } from "react"
1+
import { useMemo } from "react"
22
import { CopyIcon, CheckIcon } from "@radix-ui/react-icons"
33
import { BrainCircuit, CircleUserRound } from "lucide-react"
44

@@ -9,15 +9,7 @@ import { Badge } from "@/components/ui"
99
import { BadgeData, ChatHandler, Message, MessageAnnotationType } from "./types"
1010
import { ChatMessageProvider } from "./ChatMessageProvider"
1111
import { useChatMessage } from "./useChatMessage"
12-
import {
13-
EventAnnotations,
14-
AgentEventAnnotations,
15-
ImageAnnotations,
16-
MarkdownAnnotations,
17-
DocumentFileAnnotations,
18-
SourceAnnotations,
19-
SuggestedQuestionsAnnotations,
20-
} from "./ChatAnnotations"
12+
import { Markdown } from "./markdown"
2113

2214
/**
2315
* ChatMessage
@@ -100,82 +92,18 @@ function ChatMessageAvatar() {
10092
* ChatMessageContent
10193
*/
10294

103-
export enum ContentPosition {
104-
TOP = -9999,
105-
CHAT_EVENTS = 0,
106-
AFTER_EVENTS = 1,
107-
CHAT_AGENT_EVENTS = 2,
108-
AFTER_AGENT_EVENTS = 3,
109-
CHAT_IMAGE = 4,
110-
AFTER_IMAGE = 5,
111-
BEFORE_MARKDOWN = 6,
112-
MARKDOWN = 7,
113-
AFTER_MARKDOWN = 8,
114-
CHAT_DOCUMENT_FILES = 9,
115-
AFTER_DOCUMENT_FILES = 10,
116-
CHAT_SOURCES = 11,
117-
AFTER_SOURCES = 12,
118-
SUGGESTED_QUESTIONS = 13,
119-
AFTER_SUGGESTED_QUESTIONS = 14,
120-
BOTTOM = 9999,
121-
}
122-
123-
type ContentDisplayConfig = {
124-
position: ContentPosition
125-
component: React.ReactNode | null
126-
}
127-
12895
interface ChatMessageContentProps {
12996
isHeaderVisible: boolean
130-
isLoading?: boolean
131-
content?: ContentDisplayConfig[]
132-
append?: ChatHandler["append"]
13397
}
13498

135-
function ChatMessageContent({ isHeaderVisible, isLoading, content, append }: ChatMessageContentProps) {
136-
const { message, isLast } = useChatMessage()
137-
138-
const contents = useMemo<ContentDisplayConfig[]>(() => {
139-
const displayMap: {
140-
[key in ContentPosition]?: React.ReactNode | null
141-
} = {
142-
[ContentPosition.CHAT_EVENTS]: (
143-
<EventAnnotations message={message} showLoading={(isLast && isLoading) ?? false} />
144-
),
145-
[ContentPosition.CHAT_AGENT_EVENTS]: <AgentEventAnnotations message={message} />,
146-
[ContentPosition.CHAT_IMAGE]: <ImageAnnotations message={message} />,
147-
[ContentPosition.MARKDOWN]: <MarkdownAnnotations message={message} />,
148-
[ContentPosition.CHAT_DOCUMENT_FILES]: <DocumentFileAnnotations message={message} />,
149-
[ContentPosition.CHAT_SOURCES]: <SourceAnnotations message={message} />,
150-
...(isLast &&
151-
append && {
152-
[ContentPosition.SUGGESTED_QUESTIONS]: (
153-
<SuggestedQuestionsAnnotations message={message} append={append} />
154-
),
155-
}),
156-
}
157-
158-
// Override the default display map with the custom content.
159-
content?.forEach((content) => {
160-
displayMap[content.position] = content.component
161-
})
162-
163-
return Object.entries(displayMap).map(([position, component]) => ({
164-
position: parseInt(position),
165-
component,
166-
}))
167-
}, [isLast, isLoading, content, append, message])
99+
function ChatMessageContent({ isHeaderVisible }: ChatMessageContentProps) {
100+
const {
101+
message: { content },
102+
} = useChatMessage()
168103

169104
return (
170-
<div
171-
className={cn("flex flex-col gap-4 flex-1 min-w-0 px-4 pb-6", {
172-
"pt-4": isHeaderVisible,
173-
})}>
174-
{contents
175-
.sort((a, b) => a.position - b.position)
176-
.map(({ component }, index) => (
177-
<Fragment key={index}>{component}</Fragment>
178-
))}
105+
<div className={cn("flex flex-col gap-4 flex-1 min-w-0 px-4 pb-6", { "pt-4": isHeaderVisible })}>
106+
<Markdown content={content} />
179107
</div>
180108
)
181109
}

webview-ui/src/components/ui/chat/annotations/ChatAgentEvents.tsx

Lines changed: 0 additions & 204 deletions
This file was deleted.

0 commit comments

Comments
 (0)