LorekeeperAiService

Service for generating AI-powered lore summaries and interview reactions.

Supports multiple AI providers with fallback capability. Generates weekly news summaries, historical narratives, and in-character interview responses.

Types

Link copied to clipboard
data class InterviewTopicFollowUpRequest(val playerName: String, val topicTitle: String, val previousQuestion: String, val answer: String, val triggerHint: String?, val memoryPackets: List<LorekeeperAiService.LoreTalkMemoryPacket>)

Request payload for AI-generated per-topic interview follow-up prompts.

Link copied to clipboard
data class InterviewTopicOpenersRequest(val playerName: String, val previousInterviewEntries: List<LoreStorage.LoreEntry>, val fallbackQuestions: List<String>, val topicCount: Int, val triggerHint: String?, val memoryPackets: List<LorekeeperAiService.LoreTalkMemoryPacket>)

Request payload for AI-generated interview topic opener questions.

Link copied to clipboard
data class LoreTalkMemoryPacket(val source: String, val timestamp: Long, val evidence: String, val tags: List<String> = emptyList(), val names: List<String> = emptyList())

Canonical interpreted memory packet injected into the Lorekeeper talk prompt.

Link copied to clipboard
data class LoreTalkPromptContext(val topic: String, val recentTranscriptLines: List<String>, val playerMessage: String, val recentLoreEntries: List<LoreStorage.LoreEntry> = emptyList(), val recentInterviewEntries: List<LoreStorage.LoreEntry> = emptyList(), val historySummary: String? = null, val reputationContextLines: List<String> = emptyList(), val memoryPackets: List<LorekeeperAiService.LoreTalkMemoryPacket> = emptyList())

Context bundle used to generate a Lorekeeper talk reply prompt.

Link copied to clipboard
data class LoreTalkReviewAssessment(val usefulnessScore: Int, val civilityScore: Int, val summary: String)

Structured score payload for post-talk contribution review.

Properties

Link copied to clipboard

Circuit breaker for the Lorekeeper HTTP AI client.

Link copied to clipboard

Rate limiter for the Lorekeeper HTTP AI client.

Functions

Link copied to clipboard
fun canAutoRequestWeeklySummaryNow(weekNumber: Long, hasEntries: Boolean): Boolean

Returns true when auto-generation can issue a fresh weekly AI attempt right now.

Link copied to clipboard

Generates a player biography summary grounded in archived evidence.

Link copied to clipboard
fun generateInterviewFollowUpQuestions(playerName: String, previousInterviewEntries: List<LoreStorage.LoreEntry>, fallbackQuestions: List<String>, questionCount: Int): List<String>?

Generates follow-up interview questions using prior player interview history.

Link copied to clipboard
fun generateInterviewReaction(playerName: String, question: String, answer: String): String?

Generates an AI-powered interview reaction to a player's answer.

Link copied to clipboard

Generates one targeted follow-up question for the current interview topic.

Link copied to clipboard

Generates opening prompts for a multi-topic interview session.

Link copied to clipboard
fun generateInvestigationQuestions(targetPlayerName: String, reporterName: String, reportedQuestion: String, reportedAnswer: String): List<String>?

Generates up to two investigation questions for a mentioned player.

Link copied to clipboard
fun generateLoreTalkAssessment(playerName: String, topic: String, transcriptLines: List<String>, archivedSummary: String): LorekeeperAiService.LoreTalkReviewAssessment?

Reviews a completed talk and returns structured usefulness/civility scoring.

Link copied to clipboard

Generates a conversational Lorekeeper reply during a free-form talk session.

Link copied to clipboard
fun generateLoreTalkSummary(playerName: String, topic: String, transcriptLines: List<String>): String?

Generates a concise archival gist for a completed free-form talk session.

Link copied to clipboard
fun generateQualityAssessment(title: String, author: String, content: String): String?

Generates a JSON quality assessment for a submitted lore book.

Link copied to clipboard
fun generateRumor(playerName: String, interviewEntries: List<LoreStorage.LoreEntry>, submittedBooks: List<LoreStorage.SubmittedBook>): String?

Generates a short in-world rumor line from recent interview and submitted-book sources.

Link copied to clipboard
fun getOrCreateHistorySummary(server: MinecraftServer, entries: List<LoreStorage.LoreEntry>): String?

Gets or creates an AI-generated history summary from all lore entries.

Link copied to clipboard
fun getOrCreateWeeklySummary(server: MinecraftServer, weekNumber: Long, entries: List<LoreStorage.LoreEntry>, bypassRetryCooldown: Boolean = false): String?

Gets or creates an AI-generated weekly summary for the given week.

Link copied to clipboard

Returns true when weekly generation has exhausted automatic retries for the week.

Link copied to clipboard

Returns true when weekly generation is currently cooling down before another retry.

Link copied to clipboard

Returns true when a weekly summary request is actively in-flight.

Link copied to clipboard
fun polishSubmittedBook(title: String, author: String, content: String): String?

Rewrites a submitted book for resale by correcting grammar and adding a foreword.