Skip to content

An AI-powered search engine with a generative UI

refactor: update ChatMessagesProps to use sections and clean up unused code

Yoshiki Miura29b01504be36
diff --git a/components/chat-messages.tsx b/components/chat-messages.tsx
index 38cb8797..b2b14e4a 100644
--- a/components/chat-messages.tsx
+++ b/components/chat-messages.tsx
@@ -17,7 +17,7 @@ interface ChatSection {
interface ChatMessagesProps {
sections: ChatSection[] // Changed from messages to sections
onQuerySelect: (query: string) => void
- status: UseChatHelpers['status'] // isLoadingの代わりにstatusを使用
+ status: UseChatHelpers['status']
chatId?: string
addToolResult?: (params: { toolCallId: string; result: any }) => void
/** Ref for the scroll container */
@@ -29,7 +29,7 @@ interface ChatMessagesProps {
export function ChatMessages({
sections,
onQuerySelect,
- status, // isLoadingの代わりにstatusを使用
+ status,
chatId,
addToolResult,
scrollContainerRef,
@@ -38,7 +38,7 @@ export function ChatMessages({
}: ChatMessagesProps) {
const [openStates, setOpenStates] = useState<Record<string, boolean>>({})
const manualToolCallId = 'manual-tool-call'
- const isLoading = status === 'submitted' || status === 'streaming' // statusからisLoadingを導出
+ const isLoading = status === 'submitted' || status === 'streaming'
useEffect(() => {
// Open manual tool call when the last section is a user message
diff --git a/components/chat.tsx b/components/chat.tsx
index 21366855..4b87dd84 100644
--- a/components/chat.tsx
+++ b/components/chat.tsx
@@ -142,10 +142,6 @@ export function Chat({
}
}, [sections, messages])
- // useEffect(() => {
- // setMessages(savedMessages)
- // }, [id])
-
const onQuerySelect = (query: string) => {
append({
role: 'user',
diff --git a/lib/actions/chat-db.ts b/lib/actions/chat-db.ts
index a2d4f27e..270f2308 100644
--- a/lib/actions/chat-db.ts
+++ b/lib/actions/chat-db.ts
@@ -142,14 +142,6 @@ interface ClientNewMessageInput {
parts: DBMessage['parts']
}
-// Interface for single message save - This will be effectively replaced by UIMessage type
-// interface SaveMessageInput {
-// id?: string
-// chatId: string
-// role: string
-// parts: any
-// }
-
// Save a single message
export async function saveSingleMessage(
chatId: string,