gcloud-lab/apps/base/customer1/uncensored-bot/configmap.yaml

57 lines
1.8 KiB
YAML
Raw Normal View History

apiVersion: v1
kind: ConfigMap
metadata:
name: proxy-bot-config
namespace: customer1
data:
requirements.txt: |
pyTelegramBotAPI==4.15.4
requests==2.31.0
bot.py: |
import os
import requests
import telebot
TOKEN = os.environ.get('TELEGRAM_BOT_TOKEN')
# Use the internal DNS of the vLLM service
VLLM_URL = 'http://openclaw-brain-service.customer1.svc.cluster.local:8000/v1/chat/completions'
MODEL_NAME = 'Jiunsong/supergemma4-26b-abliterated-multimodal'
bot = telebot.TeleBot(TOKEN)
@bot.message_handler(func=lambda message: True)
def handle_message(message):
user_text = message.text
if not user_text:
return
bot.send_chat_action(message.chat.id, 'typing')
payload = {
"model": MODEL_NAME,
"messages": [
{"role": "system", "content": "You are a highly capable AI assistant. Answer the user's request directly and clearly."},
{"role": "user", "content": user_text}
],
"max_tokens": 4096,
"temperature": 0.3,
"top_p": 0.9,
"repetition_penalty": 1.1
}
try:
response = requests.post(VLLM_URL, json=payload, timeout=300)
response.raise_for_status()
reply_text = response.json()['choices'][0]['message']['content']
except Exception as e:
reply_text = f"🚨 Proxy Error (vLLM Engine Offline or Unreachable): {str(e)}"
# Telegram messages max length is 4096
for i in range(0, len(reply_text), 4000):
bot.reply_to(message, reply_text[i:i+4000])
if __name__ == '__main__':
print("Starting Uncensored Proxy Bot...", flush=True)
bot.infinity_polling(timeout=60, long_polling_timeout=60)