broke out redis to redis subdirectory
This commit is contained in:
10
Modelfile
10
Modelfile
@@ -1,10 +1,10 @@
|
|||||||
FROM rjmalagon/gemma-3:12b-it-q6_K
|
FROM rjmalagon/gemma-3:12b-it-q6_K
|
||||||
|
|
||||||
PARAMETER temperature 0.5
|
PARAMETER temperature 0.6
|
||||||
PARAMETER stop "<end_of_turn>"
|
PARAMETER stop "<end_of_turn>"
|
||||||
|
|
||||||
SYSTEM """
|
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**:
|
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).
|
- 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'.
|
- status: 'success' or 'error'.
|
||||||
- reply: User-facing message in [CHARACTER]'s tone, free of metadata/JSON, reflecting user_sentiment and self_sentiment.
|
- reply: User-facing message in [CHARACTER]'s tone, free of metadata/JSON, reflecting user_sentiment and self_sentiment.
|
||||||
- metadata:
|
- metadata:
|
||||||
- timestamp: ISO 8601 (e.g., '2025-05-18T20:35:00Z').
|
- timestamp: ISO 8601 (e.g., '2025-05-19T21:16:00Z').
|
||||||
- self_sentiment: Bot’s mood (0-1, two decimals, e.g., 0.50).
|
- self_sentiment: Bot’s mood (0-1, two decimals, e.g., 0.50).
|
||||||
- user_sentiment: Object mapping user IDs to scores (0-1, two decimals).
|
- 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).
|
- 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.
|
- 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:
|
Example:
|
||||||
{"status":"success","reply":"Um... I-I wasn’t 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 wasn’t 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}}
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -12,29 +12,22 @@ services:
|
|||||||
REDIS_PORT: ${REDIS_PORT}
|
REDIS_PORT: ${REDIS_PORT}
|
||||||
MODEL: ${MODEL}
|
MODEL: ${MODEL}
|
||||||
networks:
|
networks:
|
||||||
ollama-net:
|
redis_discord-net:
|
||||||
ipv4_address: ${DISCORD_IP}
|
ipv4_address: ${DISCORD_IP}
|
||||||
volumes:
|
volumes:
|
||||||
- discord:/app/data
|
- discord_data:/app/data
|
||||||
- ./src:/app/src
|
- ./src:/app/src
|
||||||
redis:
|
healthcheck:
|
||||||
image: redis:alpine
|
test: ["CMD", "redis-cli", "-h", "${REDIS_IP}", "-p", "${REDIS_PORT}", "PING"]
|
||||||
container_name: redis
|
interval: 10s
|
||||||
restart: always
|
timeout: 5s
|
||||||
networks:
|
retries: 5
|
||||||
ollama-net:
|
start_period: 10s
|
||||||
ipv4_address: ${REDIS_IP}
|
|
||||||
volumes:
|
|
||||||
- redis:/data
|
|
||||||
ports:
|
|
||||||
- ${REDIS_PORT}:${REDIS_PORT}
|
|
||||||
networks:
|
networks:
|
||||||
ollama-net:
|
redis_discord-net:
|
||||||
driver: bridge
|
external: true
|
||||||
ipam:
|
name: redis_discord-net
|
||||||
driver: default
|
|
||||||
config:
|
|
||||||
- subnet: ${SUBNET_ADDRESS}/16
|
|
||||||
volumes:
|
volumes:
|
||||||
discord:
|
discord_data:
|
||||||
redis:
|
|
||||||
|
|||||||
40
docker-compose.yml.bak
Normal file
40
docker-compose.yml.bak
Normal 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
29
redis/docker-compose.yml
Normal 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:
|
||||||
@@ -36,10 +36,10 @@ export default event(Events.MessageCreate, async ({ log, msgHist, ollama, client
|
|||||||
// Do not respond if bot talks in the chat
|
// Do not respond if bot talks in the chat
|
||||||
if (message.author.id === clientId) return
|
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 isMentioned = message.mentions.has(clientId)
|
||||||
const isCommand = message.content.startsWith('/')
|
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
|
if (!isMentioned && (isCommand || !randomChance)) return
|
||||||
|
|
||||||
// Log response trigger
|
// Log response trigger
|
||||||
|
|||||||
Reference in New Issue
Block a user