File size: 2,507 Bytes
9506587
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
110
111
112
113
114
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <title>DeepSeek Web Builder</title>
  <style>
    body {
      margin: 0;
      font-family: 'Segoe UI', sans-serif;
      display: flex;
      flex-direction: column;
      height: 100vh;
      background: #f9f9f9;
    }

    .container {
      display: flex;
      flex: 1;
      overflow: hidden;
    }

    .code-panel {
      width: 50%;
      background-color: #1e1e1e;
      color: #fff;
      padding: 10px;
      box-sizing: border-box;
      overflow-y: auto;
    }

    .code-panel pre {
      white-space: pre-wrap;
      word-wrap: break-word;
    }

    .preview-panel {
      width: 50%;
      background: #fff;
      border-left: 2px solid #ddd;
    }

    iframe {
      width: 100%;
      height: 100%;
      border: none;
    }

    .input-bar {
      display: flex;
      padding: 10px;
      border-top: 1px solid #ccc;
      background: #fff;
    }

    .input-bar input {
      flex: 1;
      padding: 10px;
      font-size: 16px;
      border: 1px solid #ccc;
      border-radius: 6px;
    }

    .input-bar button {
      padding: 10px 20px;
      margin-left: 10px;
      background-color: #ff2b82;
      color: white;
      border: none;
      border-radius: 6px;
      cursor: pointer;
    }

    h2 {
      margin-top: 10px;
      color: #999;
      font-weight: 400;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="code-panel">
      <h2>Generated Code</h2>
      <pre id="codeDisplay">Waiting for your prompt...</pre>
    </div>
    <div class="preview-panel">
      <iframe id="previewFrame"></iframe>
    </div>
  </div>
  <div class="input-bar">
    <input type="text" id="userInput" placeholder="✨ Ask me to create a modern, animated website or app..." />
    <button onclick="sendPrompt()">➀</button>
  </div>

  <script>
    function sendPrompt() {
      const prompt = document.getElementById("userInput").value;
      fetch("/generate", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ prompt: prompt })
      })
      .then(res => res.json())
      .then(data => {
        document.getElementById("codeDisplay").textContent = data.code;
        const blob = new Blob([data.code], { type: "text/html" });
        document.getElementById("previewFrame").src = URL.createObjectURL(blob);
      });
    }
  </script>
</body>
</html>