Files
controls-web/ai_agents/db_agent/ui/frontend/index.html
2026-02-17 09:29:34 -06:00

124 lines
4.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>SugarScale SQL Agent</title>
<link rel="stylesheet" href="/static/styles.css" />
</head>
<body>
<header>
<h1>SugarScale SQL Agent</h1>
<p>Ask natural-language questions and execute the generated SQL.</p>
</header>
<main>
<div class="form-columns">
<section class="panel form-panel">
<form id="query-form">
<label for="question">Question</label>
<textarea id="question" name="question" rows="3" placeholder="e.g., How many loads were completed yesterday?" required></textarea>
<label for="tables">Table hints (comma-separated)</label>
<input id="tables" name="tables" type="text" placeholder="dbo.SugarLoadData" value="dbo.SugarLoadData" />
<div class="options">
<label>
<input type="checkbox" id="execute" name="execute" checked /> Execute SQL
</label>
<label for="max-rows">Max rows</label>
<input id="max-rows" name="max_rows" type="number" min="1" value="500" />
</div>
<div class="actions">
<button type="submit">Run</button>
<button type="button" id="reset-form" class="secondary">Reset</button>
</div>
</form>
</section>
<section class="panel helper-panel">
<label>Quick Reference</label>
<p class="helper-intro">Use these static values to include detailed data in your questions.</p>
<div class="helper-grid">
<div>
<label>Companies</label>
<ul>
<li>BigDawg</li>
<li>CSC</li>
<li>LACA</li>
<li>LASUCA</li>
<li>Ralph Callier</li>
</ul>
</div>
<div>
<label>Destinations</label>
<ul>
<li>LSR</li>
<li>CSC</li>
<li>Barge</li>
<li>Other</li>
</ul>
</div>
</div>
<p class="helper-intro">Dates can be represented as 10-12-25, 10/12/25, ect. Time can be exact or as simple as 6am, 4pm, ect.</p>
<div>
<label>Sample Questions</label>
<ul>
<li>List all loads from yesterday.</li>
<li>Show all loads hauled by LACA last week.</li>
<li>Show all loads hauled to barge this week.</li>
<li>Total tons hauled on 10/14/25.</li>
</ul>
</div>
</section>
</div>
<section class="panel results-panel" id="results" hidden>
<h2>Results</h2>
<div class="warning" id="warning" hidden></div>
<div id="summary"></div>
<details>
<summary>Generated SQL</summary>
<pre><code id="generated-sql"></code></pre>
</details>
<details id="sanitized-block" hidden>
<summary>Clean SQL (executed)</summary>
<pre><code id="sanitized-sql"></code></pre>
</details>
<div id="row-count"></div>
<div class="table-wrapper" id="table-wrapper" hidden>
<table id="result-table">
<thead id="result-thead"></thead>
<tbody id="result-tbody"></tbody>
</table>
</div>
<div class="export" id="export-wrapper" hidden>
<button type="button" id="export-results" class="secondary">Export CSV</button>
<button type="button" id="export-report" class="secondary">Download Report</button>
</div>
<div id="feedback-panel" hidden>
<h3>Was this answer helpful?</h3>
<div class="feedback-actions">
<button type="button" id="feedback-correct">Mark Correct</button>
<button type="button" id="feedback-incorrect" class="secondary">Needs Work</button>
</div>
<p id="feedback-status" hidden></p>
</div>
</section>
<section class="panel error" id="error" hidden>
<h2>Error</h2>
<pre id="error-message"></pre>
</section>
</main>
<footer>
<small>Powered by the SugarScale SQL agent.</small>
</footer>
<script src="/static/app.js" type="module"></script>
</body>
</html>