(ui) fix build command

This commit is contained in:
ishaan-jaff 2024-02-21 21:02:46 -08:00
parent 15e0d3c1d8
commit d07846646c
7 changed files with 96 additions and 19 deletions

View file

@ -35,6 +35,9 @@ RUN pip wheel --no-cache-dir --wheel-dir=/wheels/ -r requirements.txt
# install semantic-cache [Experimental]- we need this here and not in requirements.txt because redisvl pins to pydantic 1.0
RUN pip install redisvl==0.0.7 --no-deps
# Build Admin UI
RUN chmod +x build_admin_ui.sh && ./build_admin_ui.sh
# Runtime stage
FROM $LITELLM_RUNTIME_IMAGE as runtime

62
build_admin_ui.sh Executable file
View file

@ -0,0 +1,62 @@
#!/bin/bash
# # try except this script
# set -e
# print current dir
echo
pwd
# only run this step for litellm enterprise, we run this if enterprise/enterprise_ui/_enterprise.json exists
if [ ! -f "enterprise/enterprise_ui/_enterprise_colors.json" ]; then
echo "Admin UI - using default LiteLLM UI"
exit 0
fi
echo "Building Custom Admin UI..."
# Install dependencies
# Check if we are on macOS
if [[ "$(uname)" == "Darwin" ]]; then
# Install dependencies using Homebrew
if ! command -v brew &> /dev/null; then
echo "Error: Homebrew not found. Please install Homebrew and try again."
exit 1
fi
brew update
brew install curl
else
# Assume Linux, try using apt-get
if command -v apt-get &> /dev/null; then
apt-get update
apt-get install -y curl
elif command -v apk &> /dev/null; then
# Try using apk if apt-get is not available
apk update
apk add curl
else
echo "Error: Unsupported package manager. Cannot install dependencies."
exit 1
fi
fi
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
source ~/.nvm/nvm.sh
nvm install v18.17.0
nvm use v18.17.0
npm install -g npm
# copy ui_colors.json from this directory to /ui/litellm-dashboard, replace any existing ui_colors.json
cp enterprise/enterprise_ui/_enterprise.json ui/litellm-dashboard/ui_colors.json
# cd in to /ui/litellm-dashboard
cd ui/litellm-dashboard
# ensure have access to build_ui.sh
chmod +x ./build_ui.sh
# run ./build_ui.sh
./build_ui.sh
# return to root directory
cd ../..

View file

@ -0,0 +1,5 @@
## Admin UI
Customize the Admin UI to your companies branding / logo
## Usage

View file

@ -0,0 +1,11 @@
{
"brand": {
"DEFAULT": "teal",
"faint": "teal",
"muted": "teal",
"subtle": "teal",
"emphasis": "teal",
"inverted": "teal"
}
}

View file

@ -15,18 +15,6 @@ model_list:
litellm_params:
model: sagemaker/berri-benchmarking-Llama-2-70b-chat-hf-4
input_cost_per_second: 0.000420
- model_name: gpt-4
litellm_params:
model: azure/gpt-turbo
api_key: os.environ/AZURE_FRANCE_API_KEY
api_base: https://openai-france-1234.openai.azure.com/
rpm: 100
- model_name: gpt-4
litellm_params:
model: azure/gpt-35-turbo
api_key: os.environ/AZURE_EUROPE_API_KEY
api_base: https://my-endpoint-europe-berri-992.openai.azure.com
rpm: 10
- model_name: text-embedding-ada-002
litellm_params:
model: azure/azure-embedding-model

View file

@ -19,6 +19,10 @@ if [ $? -ne 0 ]; then
exit 1
fi
# print contents of ui_colors.json
echo "Contents of ui_colors.json:"
cat ui_colors.json
# Run npm build
npm run build
@ -26,8 +30,12 @@ npm run build
if [ $? -eq 0 ]; then
echo "Build successful. Copying files..."
# echo current dir
echo
pwd
# Specify the destination directory
destination_dir="../../litellm/proxy/experimental"
destination_dir="../../litellm/proxy/_experimental/out"
# Remove existing files in the destination directory
rm -rf "$destination_dir"/*

View file

@ -1,11 +1,11 @@
{
"brand": {
"DEFAULT": "red",
"faint": "red",
"muted": "red",
"subtle": "red",
"emphasis": "red",
"inverted": "red"
"DEFAULT": "#6366f1",
"faint": "#6c6fed",
"muted": "#8688ef",
"subtle": "#8e91eb",
"emphasis": "#5558eb",
"inverted": "indigo"
}
}