Repository navigation
Expand file tree
/
Copy pathinstall-quant-tool.sh
More file actions
executable file
Β·68 lines (59 loc) Β· 3.44 KB
/
Copy pathinstall-quant-tool.sh
File metadata and controls
executable file
Β·68 lines (59 loc) Β· 3.44 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
#!/usr/bin/env bash
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# install-quant-tool.sh
# Installs the Quant AI Tool into Open WebUI
# Usage: ./install-quant-tool.sh <email> <password>
# βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
set -e
WEBUI_URL="http://localhost:3000"
TOOL_FILE="$(dirname "$0")/quant_tool.py"
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: ./install-quant-tool.sh <email> <password>"
echo "Example: ./install-quant-tool.sh admin@example.com mypassword"
exit 1
fi
EMAIL="$1"
PASSWORD="$2"
echo "β³ Logging in to Open WebUI..."
TOKEN=$(curl -s -X POST "$WEBUI_URL/api/v1/auths/signin" \
-H "Content-Type: application/json" \
-d "{\"email\":\"$EMAIL\",\"password\":\"$PASSWORD\"}" \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('token',''))" 2>/dev/null)
if [ -z "$TOKEN" ]; then
echo "β Login failed. Check your email and password."
exit 1
fi
echo "β
Logged in successfully"
echo "β³ Installing Quant AI Tool..."
TOOL_CONTENT=$(cat "$TOOL_FILE")
RESULT=$(curl -s -X POST "$WEBUI_URL/api/v1/tools/create" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"id\": \"quant_ai\",
\"name\": \"Quant AI Tool\",
\"meta\": {
\"description\": \"Stock quotes, technical indicators, risk metrics, backtesting, earnings analysis, portfolio risk, and vector memory\"
},
\"content\": $(python3 -c "import json; print(json.dumps(open('$TOOL_FILE').read()))")
}" 2>/dev/null)
if echo "$RESULT" | python3 -c "import sys,json; d=json.load(sys.stdin); exit(0 if d.get('id') else 1)" 2>/dev/null; then
echo "β
Quant AI Tool installed!"
else
echo "β οΈ Tool may already exist or there was an error. Response: $(echo $RESULT | head -c 200)"
fi
echo ""
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "β π¦ Quant AI Tool Installed! β"
echo "β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£"
echo "β In Open WebUI chat: β"
echo "β 1. Click the β¨ sparkle icon β"
echo "β 2. Click Tools β enable Quant AI Tool β"
echo "β β"
echo "β Example prompts: β"
echo "β β’ 'Get me a quote for NVDA' β"
echo "β β’ 'Show technical indicators for AAPL' β"
echo "β β’ 'Backtest SMA crossover on TSLA since 2022' β"
echo "β β’ 'Analyze portfolio risk for AAPL,MSFT,NVDA' β"
echo "β β’ 'What are AMZN earnings and analyst targets?' β"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"