Skip to content

Conversation

@AbhishekManjunath98
Copy link

@AbhishekManjunath98 AbhishekManjunath98 commented Mar 11, 2025

Here’s an enhanced commit description with before and after sections in Markdown:

Refactor: Replace toolInvocations with parts in message rendering

Changes:

  • Replaced deprecated toolInvocations with parts in message rendering logic.
  • Ensured compatibility with the latest API from useChat.

Before:

<ScrollView style={{ flex: 1 }}>
  {messages.map(m => (
    <View key={m.id} style={{ marginVertical: 8 }}>
      <View>
        <Text style={{ fontWeight: 700 }}>{m.role}</Text>
        {m.toolInvocations ? (
          <Text>{JSON.stringify(m.toolInvocations, null, 2)}</Text>
        ) : (
          <Text>{m.content}</Text>
        )}
      </View>
    </View>
  ))}
</ScrollView>

After:

<ScrollView style={{ flex: 1 }}>
  {messages.map(m => (
    <View key={m.id} style={{ marginVertical: 8 }}>
      <View>
        <Text style={{ fontWeight: 700 }}>{m.role}</Text>
        {m.parts ? (
          <Text>{JSON.stringify(m.parts, null, 2)}</Text>
        ) : (
          <Text>{m.content}</Text>
        )}
      </View>
    </View>
  ))}
</ScrollView>

Why:

  • toolInvocations has been deprecated in favor of parts.
  • Aligns message rendering with the latest useChat API changes.

Impact:

  • Ensures compatibility with future updates.
  • Prevents breaking changes due to deprecated properties.

This keeps the commit message clear, structured, and easy to understand. 🚀

@lgrammel lgrammel changed the title updated docs from deprcated toolInvocations to parts docs: update deprecated toolInvocations to parts Mar 12, 2025
@gr2m gr2m added ai/ui documentation Improvements or additions to documentation expo labels Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/ui documentation Improvements or additions to documentation expo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants