-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1716 from tommygonzaleza/development
Add user auth context to rigobot
- Loading branch information
Showing
5 changed files
with
24 additions
and
5 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export const generateUserContext = (user) => { | ||
const { first_name, last_name, date_joined, roles, settings } = user; | ||
let ai_context = ''; | ||
|
||
if (first_name) ai_context += "The user's first name is " + first_name + '. '; | ||
if (last_name) ai_context += "The user's last name is " + last_name + '. '; | ||
if (date_joined) ai_context += 'The user joined on ' + date_joined + '. '; | ||
if (roles) roles.forEach((role) => ai_context += 'The user has the role of ' + role.role + ' in the academy of ' + role.academy.name + '. '); | ||
if (settings) ai_context += 'The user has the following settings: Default language: ' + settings.lang + '.'; | ||
|
||
return ai_context; | ||
}; |