Added git-ignore and the model as author

This commit is contained in:
2026-02-12 00:17:06 +01:00
parent aaedf7fc15
commit eddbfdf41d
3 changed files with 10 additions and 5 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
node_modules/
package-lock.json

View File

@@ -1,4 +1,4 @@
// Function written by gpt-oss:20b
export function split_discord_message(text) {
const MAX = 1900; // maximum payload size
const MIN = 100; // avoid tiny chunks

View File

@@ -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 5seconds, the typing indicator will fade. To keep it going, call channel.sendTyping() again after each 5second 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);