Skip to content

Instantly share code, notes, and snippets.

@saxxi
Last active October 31, 2024 10:59
Show Gist options
  • Save saxxi/58adecf6c81d17cf433912e227cfbf39 to your computer and use it in GitHub Desktop.
Save saxxi/58adecf6c81d17cf433912e227cfbf39 to your computer and use it in GitHub Desktop.
Setup DevBox

Tribe

Setup JedAI local ENV

echo "JEDAI_DEVENV_NAME=adit-saxena" >> .env
touch tmp/restart.txt
sudo service tribe-sidekiq restart

Run websocket pub/sub subscription

while true; do bundle exec rails ai:stream_jedai_responses; sleep 2; done

Create JedAI chatbot

bundle exec rails ai:create_ai_chat_bots

or manually

organization = Organization.find_by_subdomain('intellum'); nil
bot ||=  ChatBots::AiChatBot.new(key: "intellum-ai-bot-#{organization.id}", organization: organization, is_public: false, metadata: { name: "JedAI - Learning Profile", jedai_options: { model: "learnning_profile_and_plan" } })
bot.save
bot.avatar ||= Documents::Image.create(attachment: URI.open('https://vignette.wikia.nocookie.net/simpsons/images/6/64/LinguoInfo.png'))

Fix Organization subdomain

Organization.all.each { |o| o.update(exceed_account_domain: "exceed.adit-saxena.dev.intellum.com")}

Exceed

Setup JedAI local ENV

echo "JEDAI_DEVENV_NAME=adit-saxena" >> .env
touch tmp/restart.txt
sudo service exceed-sidekiq restart

Fix issues running component tests

sudo su postgres
psql -c "ALTER USER ubuntu with superuser"
exit

Enable FF and labs

Account.all.each { |a| 
  a.enable_feature!('ai_el_profesor') 
  a.enable_feature!('ai_content_evaluators_beta')  
  a.enable_feature!('labs_module')
  params = { features: Core::Labs::Records::LabsFeature.all.pluck(:code).map {|code| {code: code, enabled: true}} }
  Core::Labs::Api.update_labs_features(account_id: a.id, updated_by: "SetupLabs", params: params)
}

Add the embed JS and button trigger by adding:

<%# Render Chatbot to build the learner profile %>
<% if !neeman? %>
    <button data-tribechat-ai="true" data-tribechat-ai-model="learner_profile">CLICK ME</button>
    <%= render "/shared/embed_tribe",
      detail: {
        tribeDomain: tribe_base_url,
        isAiChat: true,
        aiModel: "learner_profile",
        exceedUserId: current_user&.id,
        exceedUri: request&.base_url,
      }
    %>
<% end %>

in the file

app/views/profiles/show.html.erb

Exceed

Enable labs

Account.find_each { |a| a.enable_feature!('labs') }

Enable all labs

labs_features = Core::Labs::Records::LabsFeature.all
labs_features.each { |lf| lf.update!(is_coming_soon: false) }
Account.find_each { |a|
    labs_features.each { |lf|
        Core::Labs::Records::AccountsLabsFeature.where(labs_feature_id: lf.id, account_id: a.id).first || 
        Core::Labs::Records::AccountsLabsFeature.create!(labs_feature_id: lf.id, account_id: a.id, updated_by: 'DevBox Setup')
    }
}
# Forked from https://gist.github.com/andresbravog/6af9d0c0b8f8baf1b22fce9499bf5c27
aliases="
alias ga='git add'
alias gb='git branch'
alias gd='git diff'
alias gm='git merge'
alias gpu='git pull'
alias gp='git push'
alias gc='git checkout'
alias gs='git status'
alias b='bundle exec'
alias r='bundle exec rubocop'
alias t='bundle exec rails test'
"
if ! grep -q "alias ga='git add'" ~/.bashrc; then
echo "$aliases" >> ~/.bashrc
echo "Aliases added to ~/.bashrc."
else
echo "Aliases already exist in ~/.bashrc."
fi
git config --global core.editor "vim"
git config --global user.name "aditsaxena"
git config --global user.email "[email protected]"
git branch -r | grep -v '\->' | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g" | while read remote; do git branch --track "${remote#origin/}" "$remote"; done
cd ~
git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1
echo "GIT_PROMPT_ONLY_IN_REPO=1" >> .bashrc
echo "source ~/.bash-git-prompt/gitprompt.sh" >> .bashrc
source .bashrc
cd ~/exceed
git fetch --all
git pull --all

Installation

# Paste these in ~/.zshrc
alias currpodweb='kubectl get pod | grep "exceed-webapp.*Running" | awk '\''{print $1}'\'
alias qashell='kubectl exec -ti $(currpodweb) -- bash'
alias qalogs='kubectl logs -f $(currpodweb)'

Usage

Use:

aws sso login
kubens qa-env-24
qashell
# RAILS_ENV=staging bundle exec rails c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment