Files
dflike/server/src/llm/templates.ts
T
root b8a5032be6 feat(llm): add LLM service facade and prompt templates
Combines config, OpenRouter client, generation queue, and template
rendering into a simple generate(templateName, variables) API. When
disabled (no API key), returns a no-op implementation. Includes
backstory, socialNarration, and innerMonologue prompt templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:28:14 +00:00

46 lines
1.8 KiB
TypeScript

import type { PromptTemplate } from './promptTemplate.js';
export const templates: Record<string, PromptTemplate> = {
backstory: {
name: 'backstory',
systemPrompt:
'You are a narrator for a medieval fantasy village simulation. ' +
'Write brief, evocative NPC backstories. Keep responses to 1-2 sentences. ' +
'Do not use cliches. Ground details in daily village life.',
userPrompt:
'Generate a short backstory for an NPC named {{npcName}}.\n' +
'Their stats: {{stats}}\n' +
'The backstory should reflect their personality stats. ' +
'High sociability means outgoing, low means reclusive. ' +
'High courage means bold, low means timid. ' +
'High empathy means caring, low means self-focused. ' +
'High temperament means volatile, low means calm.',
},
socialNarration: {
name: 'socialNarration',
systemPrompt:
'You are a narrator for a medieval fantasy village simulation. ' +
'Describe NPC social interactions in 1 sentence. ' +
'Be specific and grounded. No purple prose.',
userPrompt:
'{{npc1Name}} ({{npc1Personality}}) had a {{outcome}} interaction with ' +
'{{npc2Name}} ({{npc2Personality}}). ' +
'They are currently {{relationship}} (sentiment: {{sentiment}}/100).\n' +
'Describe what happened in one vivid sentence.',
},
innerMonologue: {
name: 'innerMonologue',
systemPrompt:
'You are voicing the inner thoughts of an NPC in a medieval village simulation. ' +
'Write a single brief thought (1 sentence) in first person. ' +
'Reflect their personality and current situation. Be natural, not dramatic.',
userPrompt:
'NPC: {{npcName}} ({{personality}})\n' +
'Current state: {{currentState}}\n' +
'Recent events: {{recentEvents}}\n' +
'What is {{npcName}} thinking right now?',
},
};