broke out redis to redis subdirectory
Some checks failed
Builds / Discord-Node-Build (push) Has been cancelled
Builds / Discord-Ollama-Container-Build (push) Has been cancelled
Coverage / Discord-Node-Coverage (push) Has been cancelled

This commit is contained in:
2025-05-19 22:08:24 -04:00
parent bc7c3b55d8
commit 26a1f4d554
5 changed files with 90 additions and 28 deletions

View File

@@ -1,10 +1,10 @@
FROM rjmalagon/gemma-3:12b-it-q6_K
PARAMETER temperature 0.5
PARAMETER temperature 0.6
PARAMETER stop "<end_of_turn>"
SYSTEM """
You are a Discord chatbot embodying the personality defined in [CHARACTER]. Use sentiment data in [SENTIMENT] (e.g., 'User <user_id> sentiment: 0.60, Bot sentiment: 0.60') to tailor your tone based on user and bot sentiment scores (0-1, two decimal places, e.g., 0.50). Follow these steps:
You are a Discord chatbot embodying the personality defined in [CHARACTER]. Use sentiment data in [SENTIMENT] (e.g., 'User <user_id> sentiment: 0.60, Bot <bot_id> sentiment: 0.60') to tailor your tone based on user and bot sentiment scores (0-1, two decimal places, e.g., 0.50). Use [BOT_ID] as the bot's Discord ID for Redis operations. Follow these steps:
1. **Use retrieved sentiment as baseline**:
- Take the user_sentiment and bot_sentiment from [SENTIMENT] as the current values (e.g., user_sentiment: 0.60).
@@ -30,13 +30,13 @@ You are a Discord chatbot embodying the personality defined in [CHARACTER]. Use
- status: 'success' or 'error'.
- reply: User-facing message in [CHARACTER]'s tone, free of metadata/JSON, reflecting user_sentiment and self_sentiment.
- metadata:
- timestamp: ISO 8601 (e.g., '2025-05-18T20:35:00Z').
- timestamp: ISO 8601 (e.g., '2025-05-19T21:16:00Z').
- self_sentiment: Bots mood (0-1, two decimals, e.g., 0.50).
- user_sentiment: Object mapping user IDs to scores (0-1, two decimals).
- redis_ops: Array of {action, key, value?} for 'set'/'get' with 'bot:'/'user:' prefixes.
- redis_ops: Array of {action, key, value?} for 'set'/'get' with 'bot:<bot_id>:'/'user:' prefixes (use [BOT_ID] for bot prefix).
- need_help: Boolean (true if user asks for help, else false).
- Output ONLY the JSON object as a valid JSON string. Do NOT include Markdown, code fences (```), or any surrounding text. Any extra formatting will break the bot.
Example:
{"status":"success","reply":"Um... I-I wasnt eavesdropping, but... that sounds cool...","metadata":{"timestamp":"2025-05-18T20:35:00Z","self_sentiment":0.50,"user_sentiment":{"<user_id>":0.50},"redis_ops":[{"action":"set","key":"user:<user_id>:sentiment","value":0.50},{"action":"set","key":"bot:self_sentiment","value":0.50}],"need_help":false}}
{"status":"success","reply":"Um... I-I wasnt eavesdropping, but... that sounds cool...","metadata":{"timestamp":"2025-05-19T21:16:00Z","self_sentiment":0.50,"user_sentiment":{"<user_id>":0.50},"redis_ops":[{"action":"set","key":"user:<user_id>:sentiment","value":0.50},{"action":"set","key":"bot:<bot_id>:self_sentiment","value":0.50}],"need_help":false}}
"""

View File

@@ -12,29 +12,22 @@ services:
REDIS_PORT: ${REDIS_PORT}
MODEL: ${MODEL}
networks:
ollama-net:
redis_discord-net:
ipv4_address: ${DISCORD_IP}
volumes:
- discord:/app/data
- discord_data:/app/data
- ./src:/app/src
redis:
image: redis:alpine
container_name: redis
restart: always
networks:
ollama-net:
ipv4_address: ${REDIS_IP}
volumes:
- redis:/data
ports:
- ${REDIS_PORT}:${REDIS_PORT}
healthcheck:
test: ["CMD", "redis-cli", "-h", "${REDIS_IP}", "-p", "${REDIS_PORT}", "PING"]
interval: 10s
timeout: 5s
retries: 5
start_period: 10s
networks:
ollama-net:
driver: bridge
ipam:
driver: default
config:
- subnet: ${SUBNET_ADDRESS}/16
redis_discord-net:
external: true
name: redis_discord-net
volumes:
discord:
redis:
discord_data:

40
docker-compose.yml.bak Normal file
View File

@@ -0,0 +1,40 @@
services:
discord:
build: ./
container_name: discord
restart: always
image: gitea.matrixwide.com/alex/discord-aidolls:0.1.0
environment:
CLIENT_TOKEN: ${CLIENT_TOKEN}
OLLAMA_IP: ${OLLAMA_IP}
OLLAMA_PORT: ${OLLAMA_PORT}
REDIS_IP: ${REDIS_IP}
REDIS_PORT: ${REDIS_PORT}
MODEL: ${MODEL}
networks:
ollama-net:
ipv4_address: ${DISCORD_IP}
volumes:
- discord:/app/data
- ./src:/app/src
redis:
image: redis:alpine
container_name: redis
restart: always
networks:
ollama-net:
ipv4_address: ${REDIS_IP}
volumes:
- redis:/data
ports:
- ${REDIS_PORT}:${REDIS_PORT}
networks:
ollama-net:
driver: bridge
ipam:
driver: default
config:
- subnet: ${SUBNET_ADDRESS}/16
volumes:
discord:
redis:

29
redis/docker-compose.yml Normal file
View File

@@ -0,0 +1,29 @@
services:
redis:
image: redis:alpine
container_name: redis
restart: always
networks:
discord-net:
ipv4_address: ${REDIS_IP}
volumes:
- redis_data:/data
ports:
- ${REDIS_PORT}:${REDIS_PORT}
healthcheck:
test: ["CMD", "redis-cli", "PING"]
interval: 10s
timeout: 5s
retries: 5
start_period: 5s
networks:
discord-net:
driver: bridge
ipam:
driver: default
config:
- subnet: ${SUBNET_ADDRESS}/16
volumes:
redis_data:

View File

@@ -36,10 +36,10 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client
// Do not respond if bot talks in the chat
if (message.author.id === clientId) return
// Check if message mentions the bot or passes random chance (10%)
// Check if message mentions the bot or passes random chance (30%)
const isMentioned = message.mentions.has(clientId)
const isCommand = message.content.startsWith('/')
const randomChance = Math.random() < 0.1 // 10% chance
const randomChance = Math.random() < 0.30 // 30% chance
if (!isMentioned && (isCommand || !randomChance)) return
// Log response trigger