commit 50b8881ac6247a8b6b1a18132f0a86b649835b97 parent bdb5c09d1ad64dcf8a2db0266ae04f4b065defc2 Author: Oliver Lowe <o@olowe.co> Date: Fri, 11 Oct 2024 20:13:22 +1100 import confluence and llm summary scripts From "work" lol Diffstat:
| A | bin/confl | | | 20 | ++++++++++++++++++++ |
| A | bin/precis | | | 30 | ++++++++++++++++++++++++++++++ |
2 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/bin/confl b/bin/confl @@ -0,0 +1,20 @@ +#!/bin/sh + +auth=`sed 1q $home/.config/atlassian/basicauth` + +usage='usage: confl url' + +if test $# -eq 1 +then + echo $usage + exit 1 +fi + +dir=`dirname $1` +id=`basename $dir` + +host=`echo $1 | sed 's!^https?://!!' | awk -F / '{print $1}'` + +url=https://$host/wiki/rest/api/content/$id?expand=body.view + +curl -s -u $auth $url | jq -r .body.view.value diff --git a/bin/precis b/bin/precis @@ -0,0 +1,30 @@ +#!/bin/sh + +# https://www.llama.com/docs/model-cards-and-prompt-formats/llama3_2 + +sys='<|start_header_id|>system<|end_header_id|> +You summarise text provided by the user. Reply only with the summary text.<|eot_id|> +<|start_header_id|>user<|end_header_id|>' + +tmp=`mktemp` +echo "$sys" > $tmp +cat >> $tmp +echo '<|eot_id|>' >> $tmp +echo -n '<|start_header_id|>assistant<|end_header_id|>' >> $tmp + +usage="usage: precis [model]" +if test $# -gt 1 +then + echo $usage + exit 2 +fi + +model=$HOME/llama-3.2-3b-instruct-q4_k_m.gguf +if test $1 != "" +then + model=$1 +fi + +llama-cli -m --no-display-prompt -c 8192 -f $tmp 2>/dev/null + +rm $tmp