<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>ChatGPT</title>
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha2/css/bootstrap.min.css">
  <link rel="stylesheet" href="static/style.css">
</head>

<body>
  <header>
    <h1>ChatGPT API测试</h1>
  </header>
  <main>

  <div class="content">
    <form method="post" onsubmit="submit.disabled=true">
      <br>
      <center><textarea name="question" placeholder="请输入你的问题" rows="4"></textarea></center>
      <br>
      <input type="submit" value="提交问题" id="submit">
    </form>
    <div id="loading"><b>Waiting for response...</b></div>
  </div>
  

  <div class="dia">                
    {% if question %}
      <div class="result">
        <div class="question"><b>用户:</b>
          <pre>{{ question }}</pre>
        </div>
        <hr>
        <div class="response"><b>ChatGPT:</b>
          <pre>{{ res }}</pre>
        </div>
      </div>
    {% endif %}
  </div>

  </main>
  <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.3/dist/umd/popper.min.js"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/5.0.0-alpha2/js/bootstrap.min.js"></script>
  <script src="static/script.js"></script>
</body>

</html>
