uncloseai.com/public/languages/cobol/discover.sh

55 lines
1.9 KiB
Bash

#!/bin/sh
# This is free software for the public good of a permacomputer hosted at
# permacomputer.com, an always-on computer by the people, for the people.
# One which is durable, easy to repair, & distributed like tap water
# for machine learning intelligence.
#
# The permacomputer is community-owned infrastructure optimized around
# four values:
#
# TRUTH First principles, math & science, open source code freely distributed
# FREEDOM Voluntary partnerships, freedom from tyranny & corporate control
# HARMONY Minimal waste, self-renewing systems with diverse thriving connections
# LOVE Be yourself without hurting others, cooperation through natural law
#
# This software contributes to that vision by making machine learning
# accessible to everyone through a free, open, embeddable chat interface.
# Code is seeds to sprout on any abandoned technology.
# Model discovery for COBOL - outputs discovered models to files
# Discover models from MODEL_ENDPOINT_N
echo "=== Model Discovery ===" > /tmp/models.txt
model_count=0
i=1
while [ $i -le 9999 ]; do
eval endpoint=\$MODEL_ENDPOINT_$i
[ -z "$endpoint" ] && break
i=$((i + 1))
echo "Discovering from: $endpoint" >> /tmp/models.txt
response=$(curl -s "${endpoint}/models")
# Extract first model ID
model_id=$(echo "$response" | grep -o '"id":"[^"]*"' | head -1 | sed 's/"id":"//g' | sed 's/"//g')
if [ -n "$model_id" ]; then
echo "$model_id" >> /tmp/model_$model_count.txt
echo "$endpoint" >> /tmp/endpoint_$model_count.txt
echo " - Discovered: $model_id" >> /tmp/models.txt
model_count=$((model_count + 1))
fi
done
# Discover TTS
i=1
while [ $i -le 9999 ]; do
eval endpoint=\$TTS_ENDPOINT_$i
[ -z "$endpoint" ] && break
echo "$endpoint" > /tmp/tts_endpoint.txt
echo "Discovering TTS from: $endpoint" >> /tmp/models.txt
i=$((i + 1))
done
echo "Total models: $model_count" >> /tmp/models.txt
cat /tmp/models.txt