mirror of
https://github.com/open-webui/pipelines
synced 2025-05-13 09:00:53 +00:00
fix: respect to pipelines dir environment variable in start.sh
This commit is contained in:
parent
1136b83d7f
commit
5c0440ac3f
15
start.sh
15
start.sh
@ -8,13 +8,13 @@ PIPELINES_DIR=${PIPELINES_DIR:-./pipelines}
|
|||||||
reset_pipelines_dir() {
|
reset_pipelines_dir() {
|
||||||
if [ "$RESET_PIPELINES_DIR" = true ]; then
|
if [ "$RESET_PIPELINES_DIR" = true ]; then
|
||||||
echo "Resetting pipelines directory: $PIPELINES_DIR"
|
echo "Resetting pipelines directory: $PIPELINES_DIR"
|
||||||
|
|
||||||
# Check if the directory exists
|
# Check if the directory exists
|
||||||
if [ -d "$PIPELINES_DIR" ]; then
|
if [ -d "$PIPELINES_DIR" ]; then
|
||||||
# Remove all contents of the directory
|
# Remove all contents of the directory
|
||||||
rm -rf "${PIPELINES_DIR:?}"/*
|
rm -rf "${PIPELINES_DIR:?}"/*
|
||||||
echo "All contents in $PIPELINES_DIR have been removed."
|
echo "All contents in $PIPELINES_DIR have been removed."
|
||||||
|
|
||||||
# Optionally recreate the directory if needed
|
# Optionally recreate the directory if needed
|
||||||
mkdir -p "$PIPELINES_DIR"
|
mkdir -p "$PIPELINES_DIR"
|
||||||
echo "$PIPELINES_DIR has been recreated."
|
echo "$PIPELINES_DIR has been recreated."
|
||||||
@ -87,14 +87,14 @@ install_frontmatter_requirements() {
|
|||||||
local file_content=$(cat "$1")
|
local file_content=$(cat "$1")
|
||||||
# Extract the first triple-quoted block
|
# Extract the first triple-quoted block
|
||||||
local first_block=$(echo "$file_content" | awk '/"""/{flag=!flag; if(flag) count++; if(count == 2) {exit}} flag' )
|
local first_block=$(echo "$file_content" | awk '/"""/{flag=!flag; if(flag) count++; if(count == 2) {exit}} flag' )
|
||||||
|
|
||||||
# Check if the block contains requirements
|
# Check if the block contains requirements
|
||||||
local requirements=$(echo "$first_block" | grep -i 'requirements:')
|
local requirements=$(echo "$first_block" | grep -i 'requirements:')
|
||||||
|
|
||||||
if [ -n "$requirements" ]; then
|
if [ -n "$requirements" ]; then
|
||||||
# Extract the requirements list
|
# Extract the requirements list
|
||||||
requirements=$(echo "$requirements" | awk -F': ' '{print $2}' | tr ',' ' ' | tr -d '\r')
|
requirements=$(echo "$requirements" | awk -F': ' '{print $2}' | tr ',' ' ' | tr -d '\r')
|
||||||
|
|
||||||
# Construct and echo the pip install command
|
# Construct and echo the pip install command
|
||||||
local pip_command="pip install $requirements"
|
local pip_command="pip install $requirements"
|
||||||
echo "$pip_command"
|
echo "$pip_command"
|
||||||
@ -108,8 +108,9 @@ install_frontmatter_requirements() {
|
|||||||
|
|
||||||
# Check if PIPELINES_URLS environment variable is set and non-empty
|
# Check if PIPELINES_URLS environment variable is set and non-empty
|
||||||
if [[ -n "$PIPELINES_URLS" ]]; then
|
if [[ -n "$PIPELINES_URLS" ]]; then
|
||||||
pipelines_dir="./pipelines"
|
if [ ! -d "$PIPELINES_DIR" ]; then
|
||||||
mkdir -p "$pipelines_dir"
|
mkdir -p "$PIPELINES_DIR"
|
||||||
|
fi
|
||||||
|
|
||||||
# Split PIPELINES_URLS by ';' and iterate over each path
|
# Split PIPELINES_URLS by ';' and iterate over each path
|
||||||
IFS=';' read -ra ADDR <<< "$PIPELINES_URLS"
|
IFS=';' read -ra ADDR <<< "$PIPELINES_URLS"
|
||||||
|
Loading…
Reference in New Issue
Block a user