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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
|
| 3 |
+
# DeepDiver Multi-Agent System CLI Demo Runner
|
| 4 |
+
# This script makes it easier to run the CLI demo with different options
|
| 5 |
+
|
| 6 |
+
set -e
|
| 7 |
+
|
| 8 |
+
# Colors for output
|
| 9 |
+
RED='\033[0;31m'
|
| 10 |
+
GREEN='\033[0;32m'
|
| 11 |
+
YELLOW='\033[1;33m'
|
| 12 |
+
BLUE='\033[0;34m'
|
| 13 |
+
NC='\033[0m' # No Color
|
| 14 |
+
|
| 15 |
+
# Function to print colored output
|
| 16 |
+
print_status() {
|
| 17 |
+
echo -e "${GREEN}[INFO]${NC} $1"
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
print_warning() {
|
| 21 |
+
echo -e "${YELLOW}[WARNING]${NC} $1"
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
print_error() {
|
| 25 |
+
echo -e "${RED}[ERROR]${NC} $1"
|
| 26 |
+
}
|
| 27 |
+
|
| 28 |
+
# Get script directory
|
| 29 |
+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
| 30 |
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
| 31 |
+
|
| 32 |
+
# Function to show help
|
| 33 |
+
show_help() {
|
| 34 |
+
echo "DeepDiver Multi-Agent System CLI Demo Runner"
|
| 35 |
+
echo ""
|
| 36 |
+
echo "Usage: $0 [OPTIONS] [QUERY]"
|
| 37 |
+
echo ""
|
| 38 |
+
echo "Options:"
|
| 39 |
+
echo " -h, --help Show this help message"
|
| 40 |
+
echo " -i, --interactive Start interactive mode (default)"
|
| 41 |
+
echo " -c, --config-only Show configuration and exit"
|
| 42 |
+
echo " -e, --create-env Create sample .env file from template"
|
| 43 |
+
echo " -q, --query \"QUERY\" Execute a specific query"
|
| 44 |
+
echo " -d, --debug Enable debug mode with verbose logging"
|
| 45 |
+
echo " --quiet Suppress all non-essential output"
|
| 46 |
+
echo " --setup Install dependencies and setup"
|
| 47 |
+
echo ""
|
| 48 |
+
echo "Examples:"
|
| 49 |
+
echo " $0 --interactive"
|
| 50 |
+
echo " $0 --query \"Research the latest trends in AI\""
|
| 51 |
+
echo " $0 --config-only"
|
| 52 |
+
echo " $0 --debug --query \"Debug a specific query\""
|
| 53 |
+
echo " $0 --quiet --query \"Run quietly\""
|
| 54 |
+
echo " $0 --setup"
|
| 55 |
+
echo ""
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
# Function to setup the demo
|
| 59 |
+
setup_demo() {
|
| 60 |
+
print_status "Setting up DeepDiver CLI Demo..."
|
| 61 |
+
|
| 62 |
+
# Check if we're in the right directory
|
| 63 |
+
if [ ! -f "$PROJECT_ROOT/cli/demo.py" ]; then
|
| 64 |
+
print_error "Cannot find demo.py. Please run this script from the CLI directory or project root."
|
| 65 |
+
exit 1
|
| 66 |
+
fi
|
| 67 |
+
|
| 68 |
+
# Install dependencies
|
| 69 |
+
print_status "Installing Python dependencies..."
|
| 70 |
+
cd "$PROJECT_ROOT"
|
| 71 |
+
|
| 72 |
+
if [ -f "cli/requirements.txt" ]; then
|
| 73 |
+
pip install -r cli/requirements.txt
|
| 74 |
+
print_status "Dependencies installed successfully"
|
| 75 |
+
else
|
| 76 |
+
print_warning "requirements.txt not found, skipping dependency installation"
|
| 77 |
+
fi
|
| 78 |
+
|
| 79 |
+
# Check for .env file
|
| 80 |
+
if [ ! -f "config/.env" ]; then
|
| 81 |
+
print_warning "No .env file found in config/ directory"
|
| 82 |
+
print_status "Creating sample .env file from template..."
|
| 83 |
+
|
| 84 |
+
if [ -f "env.template" ]; then
|
| 85 |
+
cp env.template config/.env
|
| 86 |
+
print_status "Sample .env file created at config/.env"
|
| 87 |
+
print_warning "Please edit config/.env with your actual configuration values"
|
| 88 |
+
else
|
| 89 |
+
print_error "No env.template found. Please create config/.env manually"
|
| 90 |
+
fi
|
| 91 |
+
else
|
| 92 |
+
print_status ".env file found at config/.env"
|
| 93 |
+
fi
|
| 94 |
+
|
| 95 |
+
# Make demo script executable
|
| 96 |
+
chmod +x "$PROJECT_ROOT/cli/demo.py"
|
| 97 |
+
print_status "Made demo.py executable"
|
| 98 |
+
|
| 99 |
+
print_status "Setup complete! You can now run the demo with:"
|
| 100 |
+
echo " $0 --interactive"
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
# Function to run the demo
|
| 104 |
+
run_demo() {
|
| 105 |
+
local args=("$@")
|
| 106 |
+
|
| 107 |
+
# Change to project root
|
| 108 |
+
cd "$PROJECT_ROOT"
|
| 109 |
+
|
| 110 |
+
print_status "Starting DeepDiver CLI Demo..."
|
| 111 |
+
python cli/demo.py "${args[@]}"
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
# Parse command line arguments
|
| 115 |
+
DEMO_ARGS=()
|
| 116 |
+
|
| 117 |
+
while [[ $# -gt 0 ]]; do
|
| 118 |
+
case $1 in
|
| 119 |
+
-h|--help)
|
| 120 |
+
show_help
|
| 121 |
+
exit 0
|
| 122 |
+
;;
|
| 123 |
+
--setup)
|
| 124 |
+
setup_demo
|
| 125 |
+
exit 0
|
| 126 |
+
;;
|
| 127 |
+
-c|--config-only)
|
| 128 |
+
DEMO_ARGS+=("--config-only")
|
| 129 |
+
shift
|
| 130 |
+
;;
|
| 131 |
+
-e|--create-env)
|
| 132 |
+
DEMO_ARGS+=("--create-env")
|
| 133 |
+
shift
|
| 134 |
+
;;
|
| 135 |
+
-q|--query)
|
| 136 |
+
if [ -z "${2:-}" ]; then
|
| 137 |
+
print_error "Query argument is required with --query option"
|
| 138 |
+
show_help
|
| 139 |
+
exit 1
|
| 140 |
+
fi
|
| 141 |
+
DEMO_ARGS+=("--query" "$2")
|
| 142 |
+
shift 2
|
| 143 |
+
;;
|
| 144 |
+
-d|--debug)
|
| 145 |
+
DEMO_ARGS+=("--debug")
|
| 146 |
+
shift
|
| 147 |
+
;;
|
| 148 |
+
--quiet)
|
| 149 |
+
DEMO_ARGS+=("--quiet")
|
| 150 |
+
shift
|
| 151 |
+
;;
|
| 152 |
+
-i|--interactive)
|
| 153 |
+
# Interactive is default, no need to add args
|
| 154 |
+
shift
|
| 155 |
+
;;
|
| 156 |
+
*)
|
| 157 |
+
# If it's not a flag, treat it as a query
|
| 158 |
+
if [[ "$1" != -* ]]; then
|
| 159 |
+
DEMO_ARGS+=("--query" "$1")
|
| 160 |
+
shift
|
| 161 |
+
else
|
| 162 |
+
print_error "Unknown option: $1"
|
| 163 |
+
show_help
|
| 164 |
+
exit 1
|
| 165 |
+
fi
|
| 166 |
+
;;
|
| 167 |
+
esac
|
| 168 |
+
done
|
| 169 |
+
|
| 170 |
+
# Run the demo with collected arguments
|
| 171 |
+
run_demo "${DEMO_ARGS[@]}"
|