Gucvii commented on code in PR #847:
URL: https://github.com/apache/dubbo-go-samples/pull/847#discussion_r2108668779
##########
llm/start_servers.sh:
##########
@@ -0,0 +1,87 @@
+#!/bin/bash
+
+# Check if .env file exists
+if [ ! -f .env ]; then
+ echo "Error: .env file not found"
+ exit 1
+fi
+
+# Default values
+START_PORT=20020
+INSTANCES_PER_MODEL=2
+
+# Parse command line arguments
+while [[ $# -gt 0 ]]; do
+ case $1 in
+ --instances)
+ INSTANCES_PER_MODEL=$2
+ shift 2
+ ;;
+ --start-port)
+ START_PORT=$2
+ shift 2
+ ;;
+ *)
+ echo "Unknown parameter: $1"
+ exit 1
+ ;;
+ esac
+done
+
+# Function to read value from .env file and clean it
+get_env_value() {
+ local key=$1
+ # Read the line containing the key, extract everything after the first =
+ local value=$(grep "^[[:space:]]*$key[[:space:]]*=" .env | sed
's/^[^=]*=[[:space:]]*//')
+ # Remove leading/trailing whitespace and quotes
+ value=$(echo "$value" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
-e 's/^["\x27]//' -e 's/["\x27]$//')
+ echo "$value"
+}
+
+# Get models from .env file
+OLLAMA_MODELS=$(get_env_value "OLLAMA_MODELS")
+
+# Check if OLLAMA_MODELS is empty
+if [ -z "$OLLAMA_MODELS" ]; then
+ echo "Error: OLLAMA_MODELS not found in .env file"
+ echo "Please make sure .env file contains a line like: OLLAMA_MODELS =
llava:7b, qwen2.5:7b"
Review Comment:
This program can parse configuration files with spaces, and I will not
accept this suggestion
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]