v1.0.0: Add version display in footer

This commit is contained in:
Alexej Wolff
2026-05-04 18:56:56 +02:00
parent f73a218745
commit efd2332875
8 changed files with 39 additions and 9 deletions
+15 -5
View File
@@ -271,7 +271,10 @@ ${story.plot}`;
/**
* Builds dynamic context (state + summary + rule reminders)
*/
export function buildDynamicContext(session: GameSession, messageCount?: number): string {
export function buildDynamicContext(
session: GameSession,
messageCount?: number,
): string {
const state = session.currentState;
const summary = session.storySummary || "The story just began.";
const keyEvents = session.keyEvents?.length
@@ -279,13 +282,16 @@ export function buildDynamicContext(session: GameSession, messageCount?: number)
: "No significant events yet.";
// Add rule reminders after 10+ messages to prevent drift
const ruleReminder = (messageCount && messageCount >= 10) ? `
const ruleReminder =
messageCount && messageCount >= 10
? `
=== REMINDER ===
• Do NOT act for the player — only describe reactions and consequences
• Do NOT ask "What do you do?" — end with atmosphere, not questions
• Format dialogue: **"text"** (double asterisks = bold)
• React to player's words explicitly` : '';
• React to player's words explicitly`
: "";
return `
=== CURRENT STATE ===
@@ -327,7 +333,9 @@ export async function generateStoryResponse(
const worldContext = buildWorldContext(story);
// 3. Dynamic context (state + summary + rule reminders after 10+ messages)
const dynamicContext = session ? buildDynamicContext(session, chatHistory.length) : "";
const dynamicContext = session
? buildDynamicContext(session, chatHistory.length)
: "";
// 4. Last N messages (not the full history!)
const recentMessages = chatHistory.slice(-RECENT_MESSAGES_COUNT);
@@ -362,7 +370,9 @@ export async function generateStoryResponseStream(
): Promise<string> {
const styleRules = buildStyleRules(story, player);
const worldContext = buildWorldContext(story);
const dynamicContext = session ? buildDynamicContext(session, chatHistory.length) : "";
const dynamicContext = session
? buildDynamicContext(session, chatHistory.length)
: "";
const recentMessages = chatHistory.slice(-RECENT_MESSAGES_COUNT);
const systemPrompt = styleRules + "\n" + worldContext + "\n" + dynamicContext;