♻️ Refactor the thought insight to support new API

This commit is contained in:
2025-11-15 16:59:22 +08:00
parent ea8e7ead2d
commit 645a6dca93
8 changed files with 1397 additions and 124 deletions

View File

@@ -211,8 +211,13 @@ class ThoughtItem extends StatelessWidget {
(!isStreaming && thought!.role == ThinkingThoughtRole.assistant);
final List<Map<String, String>> proposals =
!isStreaming && thought!.content != null
? _extractProposals(thought!.content!)
!isStreaming
? _extractProposals(
thought!.parts
.where((p) => p.type == ThinkingMessagePartType.text)
.map((p) => p.text ?? '')
.join(''),
)
: [];
return Container(
@@ -251,10 +256,10 @@ class ThoughtItem extends StatelessWidget {
// Function calls
if (streamingFunctionCalls.isNotEmpty ||
(thought?.chunks.isNotEmpty ?? false) &&
thought!.chunks.any(
(chunk) =>
chunk.type == ThinkingChunkType.functionCall,
(thought?.parts.isNotEmpty ?? false) &&
thought!.parts.any(
(part) =>
part.type == ThinkingMessagePartType.functionCall,
))
FunctionCallsSection(
isStreaming: isStreaming,