@docupace/pipeline 1.0.40 → 1.0.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -e
3
-
4
- TARGET_BRANCH=master
5
- TEMPERATURE=${TEMPERATURE:-1}
6
- MAX_TOKENS=${MAX_TOKENS:-512}
7
- MODEL=${MODEL:-"gemma3:27b"}
8
- INTRO=${INTRO:-"Below are some commit messages. Write a one sentence summary of them."}
9
-
10
- LLM_ENDPOINT=${LLM_ENDPOINT:-"http://10.10.22.111:11434/v1/completions"} # Ollama or LocalAI
11
-
12
- function num_commits {
13
- git log origin/$TARGET_BRANCH --oneline | wc -l
14
- }
15
-
16
- function single_commit_title {
17
- git log origin/$TARGET_BRANCH --format='%s' | head -1
18
- }
19
-
20
- function multi_commit_title {
21
- prompt="$(
22
- echo "$INTRO"
23
- git log origin/$TARGET_BRANCH --format='%B'
24
- )"
25
-
26
- payload=$(jq -n \
27
- --arg model "$MODEL" \
28
- --arg prompt "$prompt" \
29
- --argjson temp "$TEMPERATURE" \
30
- --argjson tokens "$MAX_TOKENS" \
31
- '{
32
- model: $model,
33
- prompt: $prompt,
34
- temperature: $temp,
35
- max_tokens: $tokens
36
- }')
37
-
38
- response=$(curl -s -X POST "$LLM_ENDPOINT" \
39
- -H "Content-Type: application/json" \
40
- -d "$payload")
41
-
42
- echo "$payload" | jq . > /tmp/llama-title.json
43
- echo "$response" | jq . >> /tmp/llama-title.json
44
-
45
- error_message=$(echo "$response" | jq -r '.error.message // empty')
46
- if [[ -n "$error_message" ]]; then
47
- echo "LLM API error: $error_message"
48
- exit 1
49
- fi
50
-
51
- echo "$response" | jq -r '.choices[0].text' | sed '/./,$!d' | head -1
52
- }
53
-
54
- function main {
55
- if [ "$(num_commits)" -eq 0 ]; then
56
- echo "Error: No commits found on branch origin/$TARGET_BRANCH."
57
- exit 1
58
- fi
59
- if [ "$(num_commits)" -eq 1 ]; then
60
- single_commit_title
61
- else
62
- multi_commit_title
63
- fi
64
- }
65
-
66
- main