mirror of
https://github.com/open-webui/pipelines
synced 2025-05-11 08:01:08 +00:00
fix: start script
This commit is contained in:
parent
2bb329a574
commit
2059c7d05e
26
start.sh
26
start.sh
@ -54,17 +54,20 @@ download_pipelines() {
|
||||
# Function to parse and install requirements from frontmatter
|
||||
install_frontmatter_requirements() {
|
||||
local file=$1
|
||||
|
||||
echo "Checking $file for requirements in frontmatter..."
|
||||
|
||||
# Extract the frontmatter if it exists
|
||||
frontmatter=$(sed -n '/^---$/,/^---$/p' "$file")
|
||||
|
||||
if echo "$frontmatter" | grep -q "requirements:"; then
|
||||
# Extract lines starting from "requirements:" to the end of the block or until another top-level key is found
|
||||
requirements=$(echo "$frontmatter" | sed -n '/^requirements:/,/^[a-zA-Z\-]*:/p' | sed -e '1d' -e '$d' | tr -d ',\n')
|
||||
requirements=$(echo "$requirements" | awk '{$1=$1};1')
|
||||
echo "Installing requirements: $requirements"
|
||||
local file_content=$(cat "$1")
|
||||
# Extract the first triple-quoted block
|
||||
local first_block=$(echo "$file_content" | awk '/"""/{flag=!flag; if(flag) count++; if(count == 2) {exit}} flag' )
|
||||
|
||||
# Check if the block contains requirements
|
||||
local requirements=$(echo "$first_block" | grep -i 'requirements:')
|
||||
|
||||
if [ -n "$requirements" ]; then
|
||||
# Extract the requirements list
|
||||
requirements=$(echo "$requirements" | awk -F': ' '{print $2}' | tr ',' ' ' | tr -d '\r')
|
||||
|
||||
# Construct and echo the pip install command
|
||||
local pip_command="pip install $requirements"
|
||||
echo "$pip_command"
|
||||
pip install $requirements
|
||||
else
|
||||
echo "No requirements found in frontmatter of $file."
|
||||
@ -72,6 +75,7 @@ install_frontmatter_requirements() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
# Check if PIPELINES_URLS environment variable is set and non-empty
|
||||
if [[ -n "$PIPELINES_URLS" ]]; then
|
||||
pipelines_dir="./pipelines"
|
||||
|
Loading…
Reference in New Issue
Block a user