David Ko commited on
Commit
1fb1877
ยท
1 Parent(s): 9abf0c1

build(frontend): copy flattened CRA build to backend static (fix 404 for /static/js/*); translate UI to English

Browse files
Files changed (1) hide show
  1. static/openai-chat.html +14 -14
static/openai-chat.html CHANGED
@@ -1,5 +1,5 @@
1
  <!DOCTYPE html>
2
- <html lang="ko">
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
@@ -28,7 +28,7 @@
28
  <div class="header">
29
  <h1>OpenAI Chat</h1>
30
  <div>
31
- <a href="/index.html">ํ™ˆ</a>
32
  </div>
33
  </div>
34
 
@@ -39,22 +39,22 @@
39
  <input id="model" type="text" value="gpt-4o-mini" />
40
  </div>
41
  <div>
42
- <label for="apiKey">OpenAI API Key (์„ ํƒ)</label>
43
- <input id="apiKey" type="password" placeholder="sk-... (ํ™˜๊ฒฝ๋ณ€์ˆ˜ OPENAI_API_KEY ์„ค์ • ๊ฐ€๋Šฅ)" />
44
  </div>
45
  </div>
46
- <label for="system">System Prompt (์„ ํƒ)</label>
47
  <input id="system" type="text" placeholder="You are a helpful assistant." />
48
- <label for="prompt">์‚ฌ์šฉ์ž ์งˆ๋ฌธ</label>
49
- <textarea id="prompt" placeholder="์—ฌ๊ธฐ์— ์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”"></textarea>
50
  <div class="actions">
51
- <button id="sendBtn">์งˆ๋ฌธ ๋ณด๋‚ด๊ธฐ</button>
52
- <button class="secondary" id="clearBtn">์ง€์šฐ๊ธฐ</button>
53
  </div>
54
  </div>
55
 
56
  <div class="card">
57
- <div class="muted">์‘๋‹ต</div>
58
  <div id="response" class="log"></div>
59
  </div>
60
  </div>
@@ -65,7 +65,7 @@
65
 
66
  function setLoading(on) {
67
  $('sendBtn').disabled = on;
68
- $('sendBtn').textContent = on ? '์ „์†ก ์ค‘...' : '์งˆ๋ฌธ ๋ณด๋‚ด๊ธฐ';
69
  }
70
 
71
  $('clearBtn').addEventListener('click', () => {
@@ -80,7 +80,7 @@
80
  const system = $('system').value.trim();
81
 
82
  if (!prompt) {
83
- alert('์งˆ๋ฌธ์„ ์ž…๋ ฅํ•˜์„ธ์š”.');
84
  return;
85
  }
86
 
@@ -104,9 +104,9 @@
104
  const data = await res.json();
105
  const { response, model: usedModel, usage, latency_sec } = data;
106
  const meta = `Model: ${usedModel} | Latency: ${latency_sec}s` + (usage ? ` | Usage: ${JSON.stringify(usage)}` : '');
107
- responseEl.textContent = response ? (response + '\n\n---\n' + meta) : '(๋นˆ ์‘๋‹ต)\n' + meta;
108
  } catch (e) {
109
- responseEl.textContent = '์—๋Ÿฌ: ' + e.message;
110
  } finally {
111
  setLoading(false);
112
  }
 
1
  <!DOCTYPE html>
2
+ <html lang="en">
3
  <head>
4
  <meta charset="UTF-8" />
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 
28
  <div class="header">
29
  <h1>OpenAI Chat</h1>
30
  <div>
31
+ <a href="/index.html">Home</a>
32
  </div>
33
  </div>
34
 
 
39
  <input id="model" type="text" value="gpt-4o-mini" />
40
  </div>
41
  <div>
42
+ <label for="apiKey">OpenAI API Key (optional)</label>
43
+ <input id="apiKey" type="password" placeholder="sk-... (OPENAI_API_KEY env var supported)" />
44
  </div>
45
  </div>
46
+ <label for="system">System Prompt (optional)</label>
47
  <input id="system" type="text" placeholder="You are a helpful assistant." />
48
+ <label for="prompt">User Question</label>
49
+ <textarea id="prompt" placeholder="Type your question here"></textarea>
50
  <div class="actions">
51
+ <button id="sendBtn">Send Question</button>
52
+ <button class="secondary" id="clearBtn">Clear</button>
53
  </div>
54
  </div>
55
 
56
  <div class="card">
57
+ <div class="muted">Response</div>
58
  <div id="response" class="log"></div>
59
  </div>
60
  </div>
 
65
 
66
  function setLoading(on) {
67
  $('sendBtn').disabled = on;
68
+ $('sendBtn').textContent = on ? 'Sending...' : 'Send Question';
69
  }
70
 
71
  $('clearBtn').addEventListener('click', () => {
 
80
  const system = $('system').value.trim();
81
 
82
  if (!prompt) {
83
+ alert('Please enter a question.');
84
  return;
85
  }
86
 
 
104
  const data = await res.json();
105
  const { response, model: usedModel, usage, latency_sec } = data;
106
  const meta = `Model: ${usedModel} | Latency: ${latency_sec}s` + (usage ? ` | Usage: ${JSON.stringify(usage)}` : '');
107
+ responseEl.textContent = response ? (response + '\n\n---\n' + meta) : '(Empty response)\n' + meta;
108
  } catch (e) {
109
+ responseEl.textContent = 'Error: ' + e.message;
110
  } finally {
111
  setLoading(false);
112
  }