trim input data for better results
This commit is contained in:
@ -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,
|
||||||
|
Reference in New Issue
Block a user