Repository navigation
feat(ai-components): AI translations via the chat SDK, AI sample on the agents router - #3921
Open
isekovanic wants to merge 1 commit into
Open
isekovanic wants to merge 1 commit into
isekovanic wants to merge 1 commit into
Conversation
Contributor
SDK Size
|
2 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket: https://linear.app/stream/issue/RN-485
Stacked on #3920.
🎯 Goal
Groundwork for the agent conversation views: strings that follow the chat's language, and an AI sample that talks to a real agent backend, so the next PRs have reasoning and tool-call steps to show.
🛠 Implementation details
Translations
useAITranslation()reads the chat SDK'sTranslationContext. Inside<Chat>it returns the chat'st. Without one, it falls back to English with{{ name }}placeholders filled.useTranslationContext()because ours throws outside a provider, which would crash AI-only apps.defaultTranslatorFunctionmoved fromStreami18n.tstoutils/i18n/utils.ts, soTranslationContext.tsxno longer importsStreami18n(i18next and every locale).Streami18nstill re-exports it, and the public API is unchanged.TranslationContext.tsx,isTestEnvironment.tsandutils/i18n/utils.tsare on the AI entry's allowlist. The AI entry gains plaindayjsand nothing else.TranslationProvideris re-exported from/ai-componentsfor apps without<Chat>.ExpoChatGPTSample
@stream-io/calypsoand no longer uses the old Heroku demo backend.agentchannel. Questions go throughsession.responses.create, with photos sent as data URIs. Stop goes throughsession.interrupt().agentchannels. A conversation that was never asked anything is deleted when you leave it.ai_*steps are hidden through theUnsupportedAttachmentslot until their views land..env.local, and.env.exampledocuments it. The README covers running the router.crypto.randomUUID, so the sample polyfills it with stream-chat-js'sgenerateUUIDv4.<Channel>and<MessageList>are stand-ins untilAIConversationexists. After that the sample reads the low-level client directly, the same way React's Juno sample does.🎨 UI Changes
No SDK UI. The sample now shows real agent replies.
🧪 Testing
<Chat>, a realStreami18ninstance (a French string with a placeholder) and the override provider.yarn lint,yarn typecheck,yarn buildandyarn test:unitpass.☑️ Checklist
developbranch (stacked on feat(ai-components): parse agent reply steps from message attachments #3920)