-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqb
executable file
·44 lines (39 loc) · 1.22 KB
/
qb
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
#!/bin/bash
#
# qb
#
# script that uses chewie to implement a bash-specific chat bot.
#
if [ "$CHEWIE_API" == "ollama" ]; then
QB_MODEL="codellama:7b-instruct"
elif [ "$CHEWIE_API" == "openai" ]; then
QB_MODEL="gpt-3.5-turbo"
elif [ "$CHEWIE_API" == "groq" ]; then
QB_MODEL="llama3-8b-8192"
else
CHEWIE_API="ollama"
fi
QB_CONTEXT_PATH=~/.cache/chewie
QB_CONTEXT=$QB_CONTEXT_PATH/qb-context.json
if [ ! -f $QB_CONTEXT ]; then
init_context()
fi
if [ "$1" == "-h" ] ; then
echo "Usage: qb [options]"
echo "Options:"
echo " -h Display this help message."
echo " -s Setup (or reset) qb."
exit 0
fi
if [ "$1" == "-s" ] ; then
echo "Setting up chewie... "
echo "Using API \"$CHEWIE_API\""
echo "Using model \"$QB_MODEL\""
echo "Using context file \"$QB_CONTEXT\""
mkdir -p $QB_CONTEXT_PATH
chewie r u ctx="$QB_CONTEXT" > /dev/null
chewie r u ctx="$QB_CONTEXT" mdl="$QB_MODEL" sys="You are an intelligent assistant helping me use bash on Linux. All of your responses should be in the context of using bash on Linux. If you do not know the answer to a question, just say \"I don\'t know\"." > /dev/null
echo "done!"
exit 0
fi
printf "%q" "$@" | chewie ctx="$QB_CONTEXT" mdl="$QB_MODEL"