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