Compare commits

...

2 Commits

Author SHA1 Message Date
9145b07da7 trim input data for better results 2025-06-30 21:09:37 -04:00
593aa09a18 add dependencies 2025-06-30 20:39:16 -04:00
3 changed files with 33 additions and 3 deletions

24
package-lock.json generated
View File

@ -13,7 +13,8 @@
"dotenv": "^17.0.0", "dotenv": "^17.0.0",
"striptags": "^3.2.0", "striptags": "^3.2.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.8.3" "typescript": "^5.8.3",
"ws": "^8.18.3"
}, },
"devDependencies": { "devDependencies": {
"prisma": "^6.10.1" "prisma": "^6.10.1"
@ -344,6 +345,27 @@
"integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/ws": {
"version": "8.18.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz",
"integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==",
"license": "MIT",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
"optional": true
},
"utf-8-validate": {
"optional": true
}
}
},
"node_modules/yn": { "node_modules/yn": {
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz",

View File

@ -16,7 +16,8 @@
"dotenv": "^17.0.0", "dotenv": "^17.0.0",
"striptags": "^3.2.0", "striptags": "^3.2.0",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "^5.8.3" "typescript": "^5.8.3",
"ws": "^8.18.3"
}, },
"devDependencies": { "devDependencies": {
"prisma": "^6.10.1" "prisma": "^6.10.1"

View File

@ -82,6 +82,13 @@ const storePromptData = async (
} }
}; };
const trimInputData = (input: string) => {
const strippedInput = striptags(input);
const split = strippedInput.split(" ");
const promptStringIndex = split.indexOf("!prompt");
return split.slice(promptStringIndex + 1).join(" "); // returns everything after the !prompt
};
const generateOllamaRequest = async ( const generateOllamaRequest = async (
notification: Notification notification: Notification
): Promise<OllamaResponse | undefined> => { ): Promise<OllamaResponse | undefined> => {
@ -105,7 +112,7 @@ const generateOllamaRequest = async (
const ollamaRequestBody: OllamaRequest = { const ollamaRequestBody: OllamaRequest = {
model: process.env.OLLAMA_MODEL as string, model: process.env.OLLAMA_MODEL as string,
system: process.env.OLLAMA_SYSTEM_PROMPT as string, system: process.env.OLLAMA_SYSTEM_PROMPT as string,
prompt: `@${notification.status.account.fqn} says: ${striptags( prompt: `@${notification.status.account.fqn} says: ${trimInputData(
notification.status.content notification.status.content
)}`, )}`,
stream: false, stream: false,