24 lines
969 B
Bash
24 lines
969 B
Bash
#!/bin/sh
|
|
# PUBLIC DOMAIN - NO LICENSE, NO WARRANTY
|
|
# Copyright 2025 TimeHexOn & foxhop & russell@unturf
|
|
# https://www.permacomputer.com
|
|
|
|
# Use second discovered model (or first if only one)
|
|
if [ -f /tmp/model_1.txt ] && [ -f /tmp/endpoint_1.txt ]; then
|
|
model=$(cat /tmp/model_1.txt)
|
|
endpoint=$(cat /tmp/endpoint_1.txt)
|
|
elif [ -f /tmp/model_0.txt ] && [ -f /tmp/endpoint_0.txt ]; then
|
|
model=$(cat /tmp/model_0.txt)
|
|
endpoint=$(cat /tmp/endpoint_0.txt)
|
|
else
|
|
echo "ERROR: No models discovered"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Using model: $model"
|
|
echo "Endpoint: $endpoint"
|
|
|
|
curl -s "${endpoint}/chat/completions" \
|
|
-H 'Content-Type: application/json' \
|
|
-d "{\"model\":\"$model\",\"messages\":[{\"role\":\"system\",\"content\":\"You are Qwen, a coding assistant specialized in software development.\"},{\"role\":\"user\",\"content\":\"Write a hello world function in COBOL.\"}],\"max_tokens\":200}" \
|
|
2>/dev/null | grep -o '"content":"[^"]*"' | head -1 | cut -d'"' -f4
|