修复会话结束后,最后一个思考可能还会显示思考中
This commit is contained in:
@@ -9,10 +9,12 @@ import { Message, MessageContent } from "@/components/ai-elements/message"
|
||||
|
||||
interface LiveMessageBlockProps {
|
||||
message: LiveMessage
|
||||
isStreaming?: boolean
|
||||
}
|
||||
|
||||
export const LiveMessageBlock = memo(function LiveMessageBlock({
|
||||
message,
|
||||
isStreaming = true,
|
||||
}: LiveMessageBlockProps) {
|
||||
const t = useTranslations("Folder.chat.liveMessageBlock")
|
||||
const sharedT = useTranslations("Folder.chat.shared")
|
||||
@@ -20,10 +22,11 @@ export const LiveMessageBlock = memo(function LiveMessageBlock({
|
||||
const adapted = useMemo(
|
||||
() =>
|
||||
adaptLiveMessageFromAcp(message, {
|
||||
isLiveStreaming: isStreaming,
|
||||
toolCallFailedText: sharedT("toolCallFailed"),
|
||||
planUpdatedText: sharedT("planUpdated"),
|
||||
}),
|
||||
[message, sharedT]
|
||||
[message, isStreaming, sharedT]
|
||||
)
|
||||
|
||||
return (
|
||||
|
||||
@@ -97,6 +97,7 @@ type WelcomeThreadItem =
|
||||
key: string
|
||||
kind: "live"
|
||||
message: LiveMessage
|
||||
isStreaming: boolean
|
||||
}
|
||||
|
||||
const WelcomeHistoryMessage = memo(function WelcomeHistoryMessage({
|
||||
@@ -811,14 +812,20 @@ export function WelcomeInputPanel({
|
||||
key: `live-${conn.liveMessage.id}`,
|
||||
kind: "live",
|
||||
message: conn.liveMessage,
|
||||
isStreaming: connStatus === "prompting",
|
||||
})
|
||||
}
|
||||
return items
|
||||
}, [history, showLive, conn.liveMessage])
|
||||
}, [history, showLive, conn.liveMessage, connStatus])
|
||||
|
||||
const renderThreadItem = useCallback((item: WelcomeThreadItem) => {
|
||||
if (item.kind === "live") {
|
||||
return <LiveMessageBlock message={item.message} />
|
||||
return (
|
||||
<LiveMessageBlock
|
||||
message={item.message}
|
||||
isStreaming={item.isStreaming}
|
||||
/>
|
||||
)
|
||||
}
|
||||
return <WelcomeHistoryMessage message={item.message} />
|
||||
}, [])
|
||||
|
||||
@@ -66,6 +66,7 @@ type ThreadRenderItem =
|
||||
key: string
|
||||
kind: "live"
|
||||
message: LiveMessage
|
||||
isStreaming: boolean
|
||||
}
|
||||
|
||||
function fallbackExtractUserResources(
|
||||
@@ -315,11 +316,18 @@ export function MessageListView({
|
||||
key: `live-${liveMessage.id}`,
|
||||
kind: "live",
|
||||
message: liveMessage,
|
||||
isStreaming: connStatus === "prompting",
|
||||
})
|
||||
}
|
||||
|
||||
return items
|
||||
}, [resolvedGroups, resolvedPendingGroups, showLiveMessage, liveMessage])
|
||||
}, [
|
||||
resolvedGroups,
|
||||
resolvedPendingGroups,
|
||||
showLiveMessage,
|
||||
liveMessage,
|
||||
connStatus,
|
||||
])
|
||||
|
||||
const renderThreadItem = useCallback((item: ThreadRenderItem) => {
|
||||
switch (item.kind) {
|
||||
@@ -330,7 +338,12 @@ export function MessageListView({
|
||||
case "typing":
|
||||
return <PendingTypingIndicator />
|
||||
case "live":
|
||||
return <LiveMessageBlock message={item.message} />
|
||||
return (
|
||||
<LiveMessageBlock
|
||||
message={item.message}
|
||||
isStreaming={item.isStreaming}
|
||||
/>
|
||||
)
|
||||
default:
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user