forked from green-coding-solutions/green-metrics-tool
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-template.sh
More file actions
executable file
·38 lines (31 loc) · 1.81 KB
/
Copy pathrun-template.sh
File metadata and controls
executable file
·38 lines (31 loc) · 1.81 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
#!/usr/bin/env bash
set -euo pipefail
if [ -z "${1-}" ]; then
echo "Please supply mode as first argument. Either 'ai' or 'website'"
exit 1
fi
GMT_ROOT_DIR="$(cd "$(dirname "${0}")" && pwd)"
if [[ "$1" == "website" ]]; then
if [ -z "${2-}" ]; then
echo "Please supply the website as second argument with scheme. Example: https://www.example.com"
exit 1
fi
if [[ -n "${3-}" && "${3-}" == '--quick' ]]; then
python3 "${GMT_ROOT_DIR}/runner.py" --uri ${GMT_ROOT_DIR} --filename 'templates/website/usage_scenario.yml' --variable __GMT_VAR_PAGE__="${2}" --variable __GMT_VAR_SLEEP__=0 --dev-no-sleeps --dev-no-system-checks --dev-cache-build --skip-optimizations ${4-} ${5-} ${6-} ${7-} ${8-}
else
python3 "${GMT_ROOT_DIR}/runner.py" --uri ${GMT_ROOT_DIR} --filename 'templates/website/usage_scenario.yml' --variable __GMT_VAR_PAGE__="${2}" --variable __GMT_VAR_SLEEP__=5 ${3-} ${4-} ${5-} ${6-} ${7-} ${8-}
fi
elif [[ "$1" == "ai" ]]; then
if [ -z "${2-}" ]; then
echo "Please supply the prompt as second argument in single quotes. Example: 'How cool is the GMT?' "
exit 1
fi
if [[ -n "${3-}" && "${3-}" == '--quick' ]]; then
python3 "${GMT_ROOT_DIR}/runner.py" --uri ${GMT_ROOT_DIR} --filename 'templates/ai/usage_scenario.yml' --variable __GMT_VAR_MODEL__="gemma3:1b" --variable __GMT_VAR_PROMPT__="${2}" --dev-no-sleeps --dev-no-system-checks --dev-cache-build --skip-optimizations --allow-unsafe ${4-} ${5-} ${6-} ${7-} ${8-}
else
python3 "${GMT_ROOT_DIR}/runner.py" --uri ${GMT_ROOT_DIR} --filename 'templates/ai/usage_scenario.yml' --variable __GMT_VAR_MODEL__="gemma3:1b" --variable __GMT_VAR_PROMPT__="${2}" --allow-unsafe ${3-} ${4-} ${5-} ${6-} ${7-} ${8-}
fi
else
echo "Unknown mode ${1} - Only 'ai' and 'website' supported."
exit 1
fi