first commit

This commit is contained in:
2025-11-24 23:10:55 -06:00
commit 8315fa51c9
279 changed files with 74600 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
{# DM response after job completes #}
<div class="dm-response-content">
{{ dm_response | safe }}
</div>
{# Debug info #}
<div class="debug-panel" style="margin-top: 1rem; padding: 0.5rem; font-size: 0.7rem;">
<div class="debug-toggle" onclick="this.nextElementSibling.style.display = this.nextElementSibling.style.display === 'none' ? 'block' : 'none'">
[+] Raw API Response
</div>
<div style="display: none; margin-top: 0.5rem; white-space: pre; color: #a3e635; max-height: 150px; overflow: auto;">
{{ raw_result | tojson(indent=2) }}
</div>
</div>
{# Trigger state and history refresh #}
<div hx-get="{{ url_for('dev.get_state', session_id=session_id) }}"
hx-trigger="load"
hx-target="#state-content"
hx-swap="innerHTML"
style="display: none;"></div>
<div hx-get="{{ url_for('dev.get_history', session_id=session_id) }}"
hx-trigger="load"
hx-target="#history-content"
hx-swap="innerHTML"
style="display: none;"></div>

View File

@@ -0,0 +1,21 @@
{# History entries partial #}
{% if history %}
{% for entry in history|reverse %}
<div class="history-entry">
<div class="history-turn">Turn {{ entry.turn }}</div>
<div class="history-action">{{ entry.action }}</div>
<div class="history-response">{{ entry.dm_response[:150] }}{% if entry.dm_response|length > 150 %}...{% endif %}</div>
</div>
{% endfor %}
{% if pagination and pagination.has_more %}
<button hx-get="{{ url_for('dev.get_history', session_id=session_id) }}?offset={{ pagination.offset + pagination.limit }}"
hx-target="#history-content"
hx-swap="innerHTML"
style="width: 100%; padding: 0.5rem; background: #3b82f6; color: white; border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem;">
Load More
</button>
{% endif %}
{% else %}
<p style="color: #9ca3af; text-align: center; font-size: 0.85rem;">No history yet.</p>
{% endif %}

View File

@@ -0,0 +1,29 @@
{# Job status polling partial - polls every 2 seconds until complete #}
<div class="loading"
hx-get="{{ url_for('dev.job_status', job_id=job_id) }}?session_id={{ session_id }}"
hx-trigger="load delay:2s"
hx-swap="outerHTML">
<div style="margin-bottom: 0.5rem;">
<span class="spinner"></span>
Processing your action...
</div>
<div style="font-size: 0.75rem; color: #9ca3af;">
Job: {{ job_id[:8] }}... | Status: {{ status }}
</div>
</div>
<style>
.spinner {
display: inline-block;
width: 16px;
height: 16px;
border: 2px solid #4a4a5a;
border-top-color: #60a5fa;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
</style>

View File

@@ -0,0 +1,129 @@
{#
NPC Dialogue partial - displays conversation history with current exchange.
Expected context:
- npc_name: Name of the NPC
- character_name: Name of the player character
- conversation_history: List of previous exchanges [{player_line, npc_response}, ...]
- player_line: What the player just said
- dialogue: NPC's current response
- session_id: For any follow-up actions
#}
<div class="npc-conversation">
<div class="npc-conversation-header">
<span class="npc-conversation-title">Conversation with {{ npc_name }}</span>
</div>
<div class="npc-conversation-history">
{# Show previous exchanges #}
{% if conversation_history %}
{% for exchange in conversation_history %}
<div class="dialogue-exchange dialogue-exchange-past">
<div class="dialogue-player">
<span class="dialogue-speaker">{{ character_name }}:</span>
<span class="dialogue-text">{{ exchange.player_line }}</span>
</div>
<div class="dialogue-npc">
<span class="dialogue-speaker">{{ npc_name }}:</span>
<span class="dialogue-text">{{ exchange.npc_response }}</span>
</div>
</div>
{% endfor %}
{% endif %}
{# Show current exchange (highlighted) #}
<div class="dialogue-exchange dialogue-exchange-current">
<div class="dialogue-player">
<span class="dialogue-speaker">{{ character_name }}:</span>
<span class="dialogue-text">{{ player_line }}</span>
</div>
<div class="dialogue-npc">
<span class="dialogue-speaker">{{ npc_name }}:</span>
<span class="dialogue-text">{{ dialogue }}</span>
</div>
</div>
</div>
</div>
<style>
.npc-conversation {
background: #1a1a2a;
border-radius: 6px;
overflow: hidden;
}
.npc-conversation-header {
background: #2a2a3a;
padding: 0.75rem 1rem;
border-bottom: 1px solid #4a4a5a;
}
.npc-conversation-title {
color: #f59e0b;
font-weight: 600;
font-size: 0.95rem;
}
.npc-conversation-history {
padding: 1rem;
max-height: 400px;
overflow-y: auto;
}
.dialogue-exchange {
margin-bottom: 1rem;
padding-bottom: 1rem;
border-bottom: 1px solid #3a3a4a;
}
.dialogue-exchange:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.dialogue-exchange-past {
opacity: 0.7;
}
.dialogue-exchange-current {
background: #2a2a3a;
margin: 0 -1rem;
padding: 1rem;
border-radius: 0;
opacity: 1;
}
.dialogue-player {
margin-bottom: 0.5rem;
}
.dialogue-npc {
padding-left: 0.5rem;
border-left: 2px solid #f59e0b;
}
.dialogue-speaker {
font-weight: 600;
margin-right: 0.5rem;
}
.dialogue-player .dialogue-speaker {
color: #60a5fa;
}
.dialogue-npc .dialogue-speaker {
color: #f59e0b;
}
.dialogue-text {
color: #e5e7eb;
line-height: 1.5;
white-space: pre-wrap;
}
.dialogue-exchange-past .dialogue-text {
color: #9ca3af;
}
</style>

View File

@@ -0,0 +1,32 @@
{# Session state partial #}
<div class="state-item">
<div class="state-label">Session ID</div>
<div class="state-value">{{ session_id[:12] }}...</div>
</div>
<div class="state-item">
<div class="state-label">Turn</div>
<div class="state-value">{{ session.turn_number }}</div>
</div>
<div class="state-item">
<div class="state-label">Location</div>
<div class="state-value">{{ session.game_state.current_location }}</div>
</div>
<div class="state-item">
<div class="state-label">Type</div>
<div class="state-value">{{ session.game_state.location_type }}</div>
</div>
<div class="state-item">
<div class="state-label">Active Quests</div>
<div class="state-value">{{ session.game_state.active_quests|length }}</div>
</div>
{% if session.game_state.active_quests %}
<div class="state-item" style="margin-top: 0.5rem;">
<div class="state-label">Quest IDs</div>
<div class="state-value" style="font-size: 0.75rem;">
{% for quest_id in session.game_state.active_quests %}
{{ quest_id[:10] }}...{% if not loop.last %}, {% endif %}
{% endfor %}
</div>
</div>
{% endif %}

View File

@@ -0,0 +1,31 @@
{# Travel Modal Partial - displays available travel destinations #}
<div class="modal-overlay" onclick="this.remove()">
<div class="modal-content" onclick="event.stopPropagation()">
<h3>Travel to...</h3>
{% if locations %}
{% for location in locations %}
<button class="location-btn"
hx-post="{{ url_for('dev.do_travel', session_id=session_id) }}"
hx-vals='{"location_id": "{{ location.location_id }}"}'
hx-target="#dm-response"
hx-swap="innerHTML">
<div class="location-name">{{ location.name }}</div>
<div class="location-type">{{ location.location_type | default('Unknown') }}</div>
{% if location.description %}
<div class="location-desc" style="font-size: 0.75rem; color: #6b7280; margin-top: 0.25rem;">
{{ location.description[:80] }}{% if location.description|length > 80 %}...{% endif %}
</div>
{% endif %}
</button>
{% endfor %}
{% else %}
<p style="color: #9ca3af; text-align: center;">No locations available to travel to.</p>
<p style="color: #6b7280; font-size: 0.85rem; text-align: center;">
Discover new locations by exploring and talking to NPCs.
</p>
{% endif %}
<button class="modal-close" onclick="this.closest('.modal-overlay').remove()">Cancel</button>
</div>
</div>