🧠 Generating commit message with Ollama (deepseek-r1:1.5b)...
⚠️ Ollama message doesn't look like a conventional commit. Prepending 'chore: '.
chore: <think>
Alright, I need to generate a Conventional Commit message for the git diff provided in the Nix configuration repository. The focus is on the commit message itself.
First, looking at the git diff, it's an edit file, so the changes are in scripts/edit-os. The subject line should be concise and descriptive. Since the change involves generating a commit message using Ollama, I'll use 'feat' for that as it indicates a new feature addition.
Next, the scope is determined by the type of change. Here, it's about modifying the commit message generation process, so 'fix' makes sense because we're correcting or updating an existing function.
The subject line should be "Fix: Generate Commit Message with Ollama
This commit is contained in:
parent
709e94f5a0
commit
73a9a14d3f
@ -132,17 +132,33 @@ EOF
|
|||||||
)
|
)
|
||||||
|
|
||||||
echo "🧠 Generating commit message with Ollama ($OLLAMA_MODEL)..."
|
echo "🧠 Generating commit message with Ollama ($OLLAMA_MODEL)..."
|
||||||
local ollama_response
|
local json_payload
|
||||||
ollama_response=$(curl -s --fail "$OLLAMA_HOST/api/generate" -d '{
|
json_payload=$(jq -n \
|
||||||
"model": "'"$OLLAMA_MODEL"'",
|
--arg model "$OLLAMA_MODEL" \
|
||||||
"prompt": "'"${prompt//\"/\\\"}"'",
|
--arg prompt "$prompt" \
|
||||||
"stream": false,
|
'{
|
||||||
"options": {
|
model: $model,
|
||||||
"temperature": 0.3,
|
prompt: $prompt,
|
||||||
"num_predict": 150
|
stream: false,
|
||||||
|
options: {
|
||||||
|
temperature: 0.3,
|
||||||
|
num_predict: 150
|
||||||
}
|
}
|
||||||
}')
|
}')
|
||||||
|
|
||||||
|
# Check if jq failed (e.g., if variables were not set properly for jq)
|
||||||
|
if [ -z "$json_payload" ]; then
|
||||||
|
echo "Error: Failed to create JSON payload with jq." >&2
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local ollama_response
|
||||||
|
ollama_response=$(curl -s --fail \
|
||||||
|
-X POST \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
--data "$json_payload" \
|
||||||
|
"$OLLAMA_HOST/api/generate")
|
||||||
|
|
||||||
if [ -z "$ollama_response" ]; then
|
if [ -z "$ollama_response" ]; then
|
||||||
echo "❌ Ollama request failed or returned empty. Using default commit message."
|
echo "❌ Ollama request failed or returned empty. Using default commit message."
|
||||||
echo "chore: Automated Nix config update $(date +'%Y-%m-%d %H:%M:%S')"
|
echo "chore: Automated Nix config update $(date +'%Y-%m-%d %H:%M:%S')"
|
||||||
@ -247,5 +263,3 @@ echo "-----------------------------------------------------"
|
|||||||
|
|
||||||
_cleanup # Call cleanup function
|
_cleanup # Call cleanup function
|
||||||
echo "🎉 All done!"
|
echo "🎉 All done!"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user