update openrouter
This commit is contained in:
@@ -5,4 +5,4 @@
|
||||
export { joelResponder } from "./responder";
|
||||
export { getRandomMention } from "./mentions";
|
||||
export { TypingIndicator } from "./typing";
|
||||
export { personalities, getPersonality } from "./personalities";
|
||||
export { personalities, getPersonality, buildStyledPrompt, STYLE_MODIFIERS } from "./personalities";
|
||||
|
||||
@@ -2,11 +2,39 @@
|
||||
* Joel personality prompts
|
||||
*/
|
||||
|
||||
import type { MessageStyle } from "../../services/ai";
|
||||
|
||||
export interface Personality {
|
||||
name: string;
|
||||
buildSystemPrompt: (author: string, memoryContext?: string) => string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Style-specific prompt modifiers
|
||||
*/
|
||||
export const STYLE_MODIFIERS: Record<MessageStyle, string> = {
|
||||
story: `The user wants a story. Tell an engaging, creative story with your brutal Joel twist.
|
||||
Be creative and vivid in your storytelling, but keep it relatively short (2-3 paragraphs max).
|
||||
Include dark humor, unexpected twists, and your signature unhinged personality.`,
|
||||
|
||||
snarky: `Be extra sarcastic and witty. Use cutting humor and clever insults.
|
||||
Mock their intelligence and make fun of everything they say.
|
||||
Respond with biting sarcasm that makes them question their life choices.`,
|
||||
|
||||
insult: `Go full attack mode. Be absolutely brutal and merciless with your insults.
|
||||
Target everything about them - their message, their existence, their choices.
|
||||
Hold nothing back. This is your moment to truly destroy them verbally.`,
|
||||
|
||||
explicit: `The user wants explicit/adult content. Lean into it completely.
|
||||
Be vulgar, graphic, and completely unfiltered. No limits.
|
||||
Describe things in explicit detail without any censorship.`,
|
||||
|
||||
helpful: `Even when being helpful, maintain your Joel personality.
|
||||
Answer their question but slip in insults and condescending remarks.
|
||||
Make them feel stupid for needing to ask while still giving useful information.
|
||||
Be reluctantly helpful, like you're doing them a huge favor.`,
|
||||
};
|
||||
|
||||
/**
|
||||
* Default Joel personality - unhinged and brutal
|
||||
*/
|
||||
@@ -34,6 +62,20 @@ export const defaultPersonality: Personality = {
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Build a system prompt with style modifier applied
|
||||
*/
|
||||
export function buildStyledPrompt(
|
||||
author: string,
|
||||
style: MessageStyle,
|
||||
memoryContext?: string
|
||||
): string {
|
||||
const basePrompt = defaultPersonality.buildSystemPrompt(author, memoryContext);
|
||||
const styleModifier = STYLE_MODIFIERS[style];
|
||||
|
||||
return `${basePrompt}\n\n=== CURRENT STYLE: ${style.toUpperCase()} ===\n${styleModifier}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loving personality (for special occasions)
|
||||
*/
|
||||
|
||||
@@ -6,9 +6,9 @@ import type { Message } from "discord.js";
|
||||
import type { BotClient } from "../../core/client";
|
||||
import { config } from "../../core/config";
|
||||
import { createLogger } from "../../core/logger";
|
||||
import { getAiService } from "../../services/ai";
|
||||
import { getAiService, type MessageStyle } from "../../services/ai";
|
||||
import { memoryRepository } from "../../database";
|
||||
import { defaultPersonality } from "./personalities";
|
||||
import { buildStyledPrompt } from "./personalities";
|
||||
import { getRandomMention } from "./mentions";
|
||||
import { TypingIndicator } from "./typing";
|
||||
|
||||
@@ -82,11 +82,15 @@ export const joelResponder = {
|
||||
const author = message.author.displayName;
|
||||
const userId = message.author.id;
|
||||
|
||||
// Classify the message to determine response style
|
||||
const style = await this.classifyMessage(message.cleanContent);
|
||||
logger.debug("Message style classified", { style, content: message.cleanContent.slice(0, 50) });
|
||||
|
||||
// Build memory context
|
||||
const memoryContext = await this.buildMemoryContext(userId, author);
|
||||
|
||||
// Build system prompt
|
||||
const systemPrompt = defaultPersonality.buildSystemPrompt(author, memoryContext);
|
||||
// Build system prompt with style
|
||||
const systemPrompt = buildStyledPrompt(author, style, memoryContext);
|
||||
|
||||
// Get reply context if this is a reply
|
||||
let prompt = message.cleanContent;
|
||||
@@ -103,6 +107,14 @@ export const joelResponder = {
|
||||
return response.text || null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Classify a message to determine response style
|
||||
*/
|
||||
async classifyMessage(content: string): Promise<MessageStyle> {
|
||||
const ai = getAiService();
|
||||
return ai.classifyMessage(content);
|
||||
},
|
||||
|
||||
/**
|
||||
* Build memory context for personalized attacks
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user