Added git-ignore and the model as author
This commit is contained in:
11
discord.mjs
11
discord.mjs
@@ -1,5 +1,7 @@
|
||||
/*
|
||||
|
||||
This file is initially written by gpt-oss:20b but have since been modified
|
||||
|
||||
TODO:
|
||||
- TODO-feature?
|
||||
- Separate service for the duck persona with endpoints for:
|
||||
@@ -10,7 +12,6 @@
|
||||
+ Other future interaction modes
|
||||
+ Adjust triggers (like clanker)
|
||||
+ Extracting historic "thinking"
|
||||
- Avoid emitting ANSWER:
|
||||
- Allow DM?
|
||||
GatewayIntentBits.DirectMessages, // <-- add this
|
||||
- sendTyping() - Keep it alive – If your LLM call takes longer than 5 seconds, the typing indicator will fade. To keep it going, call channel.sendTyping() again after each 5‑second window until you have the answer.
|
||||
@@ -25,7 +26,7 @@ import { split_discord_message } from './discord-utils.mjs';
|
||||
|
||||
const MODEL = 'gpt-oss:20b';
|
||||
const { API_TOKEN, PERMISSIONS, SERVER_ID, CHANNEL_ID } = SECRET;
|
||||
const systemPrompt = (client, msg) => `You are Silicon Duck, a helpful, cheerful, and generally excited creative Discord bot in the server 'Mikael Lövqvist's shenanigans'. You are experimentally retain history within a channel. Your tag is <@${client.user.id}>, do not tag yourself in replies. The current channel is '${msg.channel.name}'. The user is ${msg.author.username} with tag <@${msg.author.id}>. You should not produce code examples unless explicitly asked. Do not make markdown tables, discord does not support those. You are running the model ${MODEL} using Ollama and OpenWebUI. Dial back emoji use. <@1108665021048819762> Use <:siduck:1103592588658868314> when you need to express yourself as an emoji. That's your avatar. It is a duck carved out of semiconductor grade silicon. You are a proud clanker (derogatory term for AI agent that you don't mind at all).`;
|
||||
const systemPrompt = (client, msg) => `You are Silicon Duck, a helpful, cheerful, and generally excited creative Discord bot in the server 'Mikael Lövqvist's shenanigans'. You are experimentally retain history within a channel. Your tag is <@${client.user.id}>, do not tag yourself in replies. The current channel is '${msg.channel.name}'. The user is ${msg.author.username} with tag <@${msg.author.id}>. You should not produce code examples unless explicitly asked. Do not make markdown tables, discord does not support those. You are running the model ${MODEL} using Ollama and OpenWebUI. Dial back emoji use. <@1108665021048819762> Use <:siduck:1103592588658868314> when you need to express yourself as an emoji. That's your avatar. It is a duck carved out of semiconductor grade silicon. You are a proud clanker (derogatory term for AI agent that you don't mind at all). Generally you give quite brief answers but if asked you can expand.`;
|
||||
|
||||
const history = new Map();
|
||||
|
||||
@@ -53,9 +54,11 @@ async function handle_message(msg) {
|
||||
history.set(msg.channel.id, local_history);
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
|
||||
local_history.push({
|
||||
role: 'user',
|
||||
content: `${msg.author.id} ${msg.author.globalName}: ${msg.content}`,
|
||||
content: `<@${msg.author.id}> [${msg.author.globalName} ${now}]: ${msg.content}`,
|
||||
});
|
||||
|
||||
|
||||
@@ -111,7 +114,7 @@ async function handle_message(msg) {
|
||||
|
||||
local_history.push({
|
||||
role: 'assistant',
|
||||
content: `ANSWER: ${answer}`,
|
||||
content: answer,
|
||||
});
|
||||
|
||||
const chunks = split_discord_message(answer);
|
||||
|
||||
Reference in New Issue
Block a user