mirror of
https://github.com/open-webui/pipelines
synced 2025-06-26 18:15:58 +00:00
Merge pull request #303 from 1995parham/main
Respect to `PIPELINES_DIR` in start.sh
This commit is contained in:
commit
372350b57e
17
start.sh
17
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,13 +108,14 @@ 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"
|
||||||
for path in "${ADDR[@]}"; do
|
for path in "${ADDR[@]}"; do
|
||||||
download_pipelines "$path" "$pipelines_dir"
|
download_pipelines "$path" "$PIPELINES_DIR"
|
||||||
done
|
done
|
||||||
|
|
||||||
for file in "$pipelines_dir"/*; do
|
for file in "$pipelines_dir"/*; do
|
||||||
|
Loading…
Reference in New Issue
Block a user