File size: 3,994 Bytes
d6bfc8b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>SQLForge — Text-to-SQL</title>
  <link rel="stylesheet" href="/style.css" />
</head>
<body>
  <div class="aurora" aria-hidden="true"></div>

  <header class="topbar">
    <div class="brand">
      <div class="logo" aria-hidden="true">
        <svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
          <ellipse cx="12" cy="5" rx="8" ry="3"/><path d="M4 5v6c0 1.7 3.6 3 8 3s8-1.3 8-3V5"/><path d="M4 11v6c0 1.7 3.6 3 8 3s8-1.3 8-3v-6"/>
        </svg>
      </div>
      <div class="brand-text">
        <span class="brand-name">SQL<span class="accent">Forge</span></span>
        <span class="brand-sub">fine-tuned text-to-SQL</span>
      </div>
    </div>

    <div class="status" id="status" data-state="loading" title="Model status">
      <span class="dot"></span>
      <span class="status-label" id="statusLabel">connecting…</span>
    </div>
  </header>

  <main class="layout">
    <!-- INPUT -->
    <section class="panel input-panel">
      <div class="panel-head">
        <h2>Ask in plain English</h2>
        <p class="muted">Pick a database, type a question, and watch the model write &amp; run the SQL.</p>
      </div>

      <label class="field-label" for="dbSelect">Database</label>
      <div class="select-wrap">
        <select id="dbSelect"></select>
      </div>

      <label class="field-label" for="question">Question</label>
      <textarea id="question" rows="3" placeholder="e.g. How many singers do we have?"></textarea>

      <div class="examples" id="examples"></div>

      <details class="schema-box">
        <summary>Schema being used <span class="chev"></span></summary>
        <pre id="schemaView" class="code mono"></pre>
      </details>

      <button id="runBtn" class="run-btn">
        <span class="btn-label">Generate SQL</span>
        <span class="spinner" aria-hidden="true"></span>
      </button>
    </section>

    <!-- OUTPUT -->
    <section class="panel output-panel">
      <div class="panel-head row">
        <h2>Result</h2>
        <div class="badges" id="badges"></div>
      </div>

      <div id="placeholder" class="placeholder">
        <svg viewBox="0 0 24 24" width="40" height="40" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
          <path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="m14.5 4-5 16"/>
        </svg>
        <p>Your generated query and live results will appear here.</p>
      </div>

      <div id="result" class="result hidden">
        <div class="block">
          <div class="block-head"><span>Generated SQL</span><button class="copy" id="copyBtn">copy</button></div>
          <pre id="sqlOut" class="code sql mono"></pre>
        </div>

        <div id="traceBlock" class="block trace hidden">
          <div class="block-head"><span>🛠️ Self-correction trace</span></div>
          <div id="traceList"></div>
        </div>

        <div id="resultsBlock" class="block hidden">
          <div class="block-head"><span id="resultsHead">Query results</span></div>
          <div class="table-scroll"><table id="resultsTable"></table></div>
        </div>

        <div id="errorBlock" class="block error hidden">
          <div class="block-head"><span>Execution error</span></div>
          <pre id="errorOut" class="code mono"></pre>
        </div>
      </div>
    </section>
  </main>

  <footer class="footer">
    <span>Qwen2.5-Coder-1.5B · QLoRA · Spider</span>
    <span class="sep"></span>
    <span><b class="accent">65.6%</b> execution accuracy <span class="muted">(vs 57.4% base)</span></span>
    <span class="sep"></span>
    <span class="muted">runs SQL against real SQLite DBs</span>
  </footer>

  <script src="/app.js"></script>
</body>
</html>