Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for locale aware AI #195

Merged
merged 5 commits into from
Jun 3, 2024

Conversation

jespino
Copy link
Member

@jespino jespino commented May 30, 2024

This PR adds support for locale aware AI prompts. The AI will now be able to respond in the user's preferred language.

Closes #167

Description

@jespino jespino requested a review from crspeller May 30, 2024 15:30
surePost := &model.Post{
Message: fmt.Sprintf("Sure, I will summarize this recording: %s/_redirect/pl/%s\n", *siteURL, recordingPost.Id),
Message: fmt.Sprintf(localizer.MustLocalize(&i18n.LocalizeConfig{DefaultMessage: &i18n.Message{ID: "ai.summarize_recording", Other: "Sure, I will summarize this recording: %s/_redirect/pl/%s\n"}}), *siteURL, recordingPost.Id),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if it would be better to avoid translation on the server here. We could instead send a prop or another post type that tells the client how to render the post. That way we could do all the translations on the client and the posts wouldn't get stuck in whatever language the user happened to be using at the time.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking exactly the same with that. Anyway, about getting stuck in the language of the user, that is not that bad because the message is expected to be in the user language, so if the user change the language later, what you are going to get is an inconsistent header written on english, and a reply in Spanish (because that header looks like is in the message itself).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that there are a lot of other strings that I wasn't translating, probably 10 more, passing it identifiers and generating the post type, is fine, but can be a bit weird.

@crspeller crspeller merged commit 462199f into mattermost:master Jun 3, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

💡 idea: Take into account the user locale for AI actions
2 participants