-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.sh
More file actions
executable file
·143 lines (123 loc) · 4.23 KB
/
start.sh
File metadata and controls
executable file
·143 lines (123 loc) · 4.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!/bin/bash
# QuestMaster AI
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}🌟 QuestMaster AI - Agentic AI for Interactive Storytelling${NC}"
echo "================================================================"
# Check if .env file exists
if [ ! -f ".env" ]; then
echo -e "${YELLOW}⚠️ .env file not found. Creating from template...${NC}"
if [ -f ".env.template" ]; then
cp .env.template .env
echo -e "${YELLOW}📝 Please edit .env file with your OpenAI API key and run again.${NC}"
exit 1
else
echo -e "${RED}❌ .env.template not found. Please create .env file manually.${NC}"
exit 1
fi
fi
# Load environment variables
echo -e "${BLUE}📋 Loading environment variables...${NC}"
set -a
source .env
set +a
# Check if virtual environment exists
if [ ! -d ".venv" ]; then
echo -e "${YELLOW}📦 Creating virtual environment...${NC}"
python3 -m venv .venv
fi
# Activate virtual environment
echo -e "${BLUE}🔄 Activating virtual environment...${NC}"
source .venv/bin/activate
# Install/upgrade dependencies
echo -e "${BLUE}📚 Installing dependencies...${NC}"
pip install --upgrade pip
pip install -e .
# Check if Fast Downward exists
FAST_DOWNWARD_DIR="fast-downward-24.06.1"
if [ ! -d "$FAST_DOWNWARD_DIR" ]; then
echo -e "${YELLOW}⚠️ Fast Downward not found. Please download and extract it to $FAST_DOWNWARD_DIR${NC}"
echo -e "${YELLOW}💡 Download from: https://www.fast-downward.org/releases/24.06/fast-downward-24.06.1.tar.gz${NC}"
echo -e "${YELLOW}📂 Extract to: $(pwd)/$FAST_DOWNWARD_DIR${NC}"
exit 1
fi
# Check if Fast Downward is built
if [ ! -f "$FAST_DOWNWARD_DIR/builds/release/bin/downward" ]; then
echo -e "${YELLOW}🔨 Building Fast Downward...${NC}"
cd "$FAST_DOWNWARD_DIR"
python build.py
cd ..
fi
# Check requirements
echo -e "${BLUE}🔍 Checking system requirements...${NC}"
python -c "
import sys
sys.path.insert(0, 'src')
from questmaster.app import QuestMasterApp
from questmaster.core.logging import setup_logging
setup_logging(log_level='ERROR')
app = QuestMasterApp()
if not app.check_requirements():
sys.exit(1)
"
if [ $? -ne 0 ]; then
echo -e "${RED}❌ Requirements check failed. Please fix the issues above.${NC}"
exit 1
fi
echo -e "${GREEN}✅ All requirements satisfied!${NC}"
# Interactive menu loop
while true; do
echo ""
echo "What would you like to do?"
echo "1) Run full pipeline (Phase 1 + Phase 2)"
echo "2) Run Phase 1 only (PDDL generation)"
echo "3) Run Phase 2 only (Story generation)"
echo "4) Start frontend (if already generated)"
echo "5) Check requirements only"
echo "6) Exit"
read -p "Enter your choice (1-6): " choice
case $choice in
1)
echo -e "${GREEN}🚀 Running full QuestMaster pipeline...${NC}"
python -m questmaster.cli run
echo -e "${GREEN}✅ Full pipeline completed!${NC}"
;;
2)
echo -e "${GREEN}📝 Running Phase 1: PDDL Generation...${NC}"
python -m questmaster.cli phase1
echo -e "${GREEN}✅ Phase 1 completed!${NC}"
;;
3)
echo -e "${GREEN}🎮 Running Phase 2: Story Generation...${NC}"
python -m questmaster.cli phase2
echo -e "${GREEN}✅ Phase 2 completed!${NC}"
;;
4)
echo -e "${GREEN}🌐 Starting Streamlit frontend...${NC}"
echo -e "${YELLOW}⚠️ Frontend will run in the background. Use Ctrl+C to stop it and return to menu.${NC}"
python -m questmaster.cli frontend &
FRONTEND_PID=$!
wait $FRONTEND_PID
echo -e "${GREEN}✅ Frontend stopped!${NC}"
;;
5)
echo -e "${GREEN}🔍 Checking requirements...${NC}"
python -m questmaster.cli check
echo -e "${GREEN}✅ Requirements check completed!${NC}"
;;
6)
echo -e "${GREEN}👋 Goodbye!${NC}"
exit 0
;;
*)
echo -e "${RED}❌ Invalid choice. Please select 1-6.${NC}"
;;
esac
echo ""
echo -e "${BLUE}Press Enter to continue...${NC}"
read
done