Skip to content

Commit

Permalink
Answer to private messages
Browse files Browse the repository at this point in the history
  • Loading branch information
kk committed May 10, 2023
1 parent a8fa021 commit 9f9a351
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion llama.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const config = {
useMmap: true,
};

const prompt = (question) => `Answer as an assistant.
const prompt = (question) => `Answer as an AI sassy assistant.
USER: (asks a question) ${question}
ASSISTANT: `;

Expand Down
16 changes: 12 additions & 4 deletions zulipBot.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,23 @@ async function main() {
events.forEach(async (event) => {
last_event_id = Math.max(last_event_id, Number(event.id));
const isMentioned = event.flags?.includes("mentioned");
console.log(event.message);
if (isMentioned && event.type === "message") {
const content = await askllama({ question: event.message.content });
console.log(event);
if (
event.type === "message" &&
event.message.type === "private" &&
event.message.sender_full_name !== "gptBot"
) {
console.log(event.message);
const content = await askllama({
question: `My name is ${event.message.sender_full_name}. Answer this question: ${event.message.content}`,
});
console.log(content);
await client.messages.send({
to: event.message.sender_email,
type: "private",
//type: 'stream',
subject: "Testing gptBot",
content,
content: content.replace("(answers the question)", ""),
});
}
});
Expand Down

0 comments on commit 9f9a351

Please sign in to comment.