Skip to content

Commit 212f813

Browse files
committed
refactor: Remove unused job creation and gemini API code, update spam detection to use new AI generation method
1 parent eb5fdd2 commit 212f813

File tree

4 files changed

+10
-156
lines changed

4 files changed

+10
-156
lines changed

src/events/job-create.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/gemini.ts

Lines changed: 0 additions & 117 deletions
This file was deleted.

src/lib/constants.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,3 @@ export const LEVEL_MESSAGES = {
186186
"echo '${user} (${role})' >> /etc/tech-leaders.conf",
187187
],
188188
};
189-
190-
export const DEV_BOARD_CHANNEL = "1300427846342283436";
191-
export const JOB_BOARD_CHANNEL = "1300427561704226867";

src/lib/spam/spam-detection.service.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import { google } from "@ai-sdk/google";
2+
import { generateText } from "ai";
13
import dayjs from "dayjs";
24
import { Message, ThreadChannel } from "discord.js";
3-
import { GOOGLE_GEN_AI } from "../../gemini";
45
import { prisma } from "../../prisma";
56
import { ConfigValidator } from "../config-validator";
67
import { deleteUserMessages } from "../messages/delete-user-messages";
@@ -106,21 +107,19 @@ Respond with only "yes" if spam, "no" if legitimate.`;
106107
107108
Message: "${message.content}"`;
108109

109-
const response = await GOOGLE_GEN_AI?.models.generateContent({
110-
model: "gemini-2.5-flash-lite-preview-06-17",
111-
contents: [context],
112-
config: {
113-
systemInstruction: this.SYSTEM_PROMPT,
114-
temperature: 0.1,
115-
maxOutputTokens: 10,
116-
},
110+
const { text } = await generateText({
111+
model: google("gemini-2.5-flash"),
112+
system: this.SYSTEM_PROMPT,
113+
prompt: context,
114+
temperature: 0.1,
115+
maxOutputTokens: 10,
117116
});
118117

119118
console.log(
120-
`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] Spam detection - User: ${message.author.username} (${message.author.globalName || ""}) - Response: ${response?.text?.trim()}`
119+
`[${dayjs().format("YYYY-MM-DD HH:mm:ss")}] Spam detection - User: ${message.author.username} (${message.author.globalName || ""}) - Response: ${text.trim()}`
121120
);
122121

123-
return response?.text?.trim().toLowerCase() === "yes";
122+
return text.trim().toLowerCase() === "yes";
124123
} catch (error) {
125124
console.error("Spam detection error:", error);
126125
return false;

0 commit comments

Comments
 (0)