-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
53 lines (46 loc) · 1.49 KB
/
entrypoint.sh
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
#!/bin/sh -l
# Start Ollama
nohup bash -c "ollama serve &"
wait4x http http://127.0.0.1:11434
# An OK response from the server is not quite enough to know that it is ready to accept requests.
# https://github.com/ollama/ollama/issues/1378
max_retries=10
retry_count=0
until ollama --version && ollama ps; do
retry_count=$((retry_count + 1))
if [ $retry_count -ge $max_retries ]; then
echo "Command failed after $retry_count attempts."
exit 1
fi
echo "Command failed. Retrying... ($retry_count/$max_retries)"
sleep 1 # Wait for 1 second before retrying
done
# If the models are not baked into the Docker image, pull them down
ollama pull "$1"
ollama pull "$2"
# List the available models
ollama list
# Run SecondBrain CLI. Note the context window needs to be be reasonably small,
# as the hosted GitHub runners only have around 18GB of memory free.
java \
-Dsb.tools.force=GitHubDiffs \
-Dsb.ollama.url=http://127.0.0.1:11434 \
-Dsb.ollama.gitdiffmodel="$2" \
-Dsb.ollama.toolmodel=llama3.2:3b \
-Dsb.ollama.model="$1" \
-Dsb.ollama.summarizeindividualdiffs="$3" \
-Dsb.ollama.contextwindow=8192 \
-Dsb.ollama.diffcontextwindow=8192 \
-Dsb.github.accesstoken="$4" \
-Dsb.github.owner="$5" \
-Dsb.github.repo="$6" \
-Dsb.github.sha="$7" \
-jar /usr/local/bin/secondbrain-cli.jar "$8" >> /tmp/secondbrain-cli.log
cat /tmp/secondbrain-cli.log
if [ -n "$GITHUB_OUTPUT" ]; then
{
echo 'response<<EOF'
cat /tmp/secondbrain-cli.log
echo EOF
} >> "$GITHUB_OUTPUT"
fi